Skip to content

Commit

Permalink
"Despised Reality" fix
Browse files Browse the repository at this point in the history
General script update and simplifications.
  • Loading branch information
pyrQ authored Feb 4, 2025
1 parent 02cddec commit 7fddbd6
Showing 1 changed file with 27 additions and 110 deletions.
137 changes: 27 additions & 110 deletions unofficial/c511001214.lua
Original file line number Diff line number Diff line change
@@ -1,123 +1,40 @@
--見下した条約
--Despised Reality
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DRAW+CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.condition)
e1:SetOperation(s.operation)
e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
e1:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) end)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetLabel(1)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetCondition(s.spcon)
e2:SetOperation(s.spop)
e2:SetLabelObject(e1)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,1-tp)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetCondition(s.spcon2)
Duel.RegisterEffect(e3,1-tp)
local e4=e2:Clone()
e4:SetCode(EVENT_CHAIN_END)
Duel.RegisterEffect(e4,1-tp)
local e5=e2:Clone()
e5:SetCode(EVENT_ATTACK_ANNOUNCE)
Duel.RegisterEffect(e5,1-tp)
local e6=e2:Clone()
e6:SetCode(EVENT_DAMAGE_STEP_END)
Duel.RegisterEffect(e6,1-tp)
local e7=e2:Clone()
e7:SetCode(EVENT_PHASE+PHASE_END)
Duel.RegisterEffect(e7,1-tp)
local e8=Effect.CreateEffect(e:GetHandler())
e8:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e8:SetCode(EVENT_ADJUST)
e8:SetLabelObject(e1)
e8:SetCondition(s.spcon)
e8:SetOperation(s.regop)
e8:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e8,1-tp)
local e10=Effect.CreateEffect(e:GetHandler())
e10:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e10:SetCode(511001213)
e10:SetCountLimit(1)
e10:SetProperty(EFFECT_FLAG_DELAY)
e10:SetCondition(s.accon)
e10:SetOperation(s.damop)
e10:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e10,tp)
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,1-tp,LOCATION_DECK)
Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
Duel.SetPossibleOperationInfo(0,CATEGORY_DAMAGE,nil,0,tp,1000)
end
function s.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsLevelBelow(4)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetLabelObject():GetLabel()==1
end
function s.spcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetLabelObject():GetLabel()==1 and Duel.GetCurrentChain()==0
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabelObject():GetLabel()~=1 then return end
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp)
and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
e:GetLabelObject():SetLabel(0)
Duel.Hint(HINT_CARD,0,id)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
Duel.Hint(HINT_CARD,0,id)
Duel.Draw(1-tp,2,REASON_EFFECT)
elseif Duel.GetCurrentPhase()==PHASE_END then
Duel.RaiseEvent(e:GetHandler(),511001213,e,0,tp,0,0)
return c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local p=1-tp
if Duel.GetLocationCount(p,LOCATION_MZONE,p)>0
and Duel.IsExistingMatchingCard(s.spfilter,p,LOCATION_DECK,0,1,nil,e,p)
and Duel.IsPlayerCanDraw(tp,2)
and Duel.SelectYesNo(p,aux.Stringid(id,1)) then
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(p,s.spfilter,p,LOCATION_DECK,0,1,1,nil,e,p)
if #g>0 and Duel.SpecialSummon(g,0,p,p,false,false,POS_FACEUP)>0 then
Duel.Draw(tp,2,REASON_EFFECT)
end
else
Duel.Damage(tp,1000,REASON_EFFECT)
end
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabelObject():GetLabel()~=1 then return end
local tc=Duel.GetDecktopGroup(tp,1):GetFirst()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC_G)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_DECK)
e1:SetCountLimit(1)
e1:SetLabelObject(e:GetLabelObject())
e1:SetCondition(s.spcon3)
e1:SetOperation(s.spop3)
e1:SetReset(RESET_EVENT+EVENT_ADJUST)
tc:RegisterEffect(e1)
end
function s.spcon3(e,c,og)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(e:GetHandlerPlayer(),LOCATION_MZONE)>0 and e:GetLabelObject():GetLabel()==1
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp)
end
function s.spop3(e,tp,eg,ep,ev,re,r,rp,c,og)
Duel.Hint(HINT_CARD,0,id)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
og:Merge(g)
e:GetLabelObject():SetLabel(0)
Duel.Hint(HINT_CARD,0,id)
Duel.Draw(1-tp,2,REASON_EFFECT)
end
function s.accon(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp
end
function s.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,id)
Duel.Damage(tp,1000,REASON_EFFECT)
end

0 comments on commit 7fddbd6

Please sign in to comment.