Commit 59fc3626 authored by salix5's avatar salix5 Committed by GitHub

fix EFFECT_DISABLE_FIELD (#1520)

* fix EFFECT_DISABLE_FIELD

EFFECT_DISABLE_FIELD has 3 types:
1. The player chooses the location
The script has an operation function but no value function.
The temp value will be set in operation, and it will be reset in card::reset().

2. Certain location related to the card
The script has a value function.
It will not be reset in card::reset().

3. Fixed location
The script sets the value as a constant.
The temp value will be reset in card::reset().

* fix EFFECT_DISABLE_FIELD

* edit comment

* typos

* fix 氷結界に住む魔酔虫
parent 3a7c8906
......@@ -81,15 +81,14 @@ function c10584050.activate(e,tp,eg,ep,ev,re,r,rp)
sc=sg:GetNext()
end
if dis~=0 then
if tp==1 then
dis=((dis&0xffff)<<16)|((dis>>16)&0xffff)
end
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_DISABLE_FIELD)
e3:SetOperation(c10584050.disop)
e3:SetValue(dis)
e3:SetReset(RESET_PHASE+PHASE_END)
e3:SetLabel(dis)
Duel.RegisterEffect(e3,tp)
end
end
function c10584050.disop(e,tp)
return e:GetLabel()
end
......@@ -39,17 +39,15 @@ function c13629812.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
local seq=tc:GetSequence()
if tc:IsControler(1-tp) then seq=seq+16 end
local val=aux.SequenceToGlobal(tc:GetControler(),LOCATION_MZONE,tc:GetSequence())
if tc:IsRelateToEffect(e) and Duel.Remove(tc,0,REASON_EFFECT+REASON_TEMPORARY)~=0 and tc:IsLocation(LOCATION_REMOVED) then
c:SetCardTarget(tc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetRange(LOCATION_SZONE)
e1:SetLabel(seq)
e1:SetCondition(c13629812.discon)
e1:SetOperation(c13629812.disop)
e1:SetValue(val)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
end
......@@ -57,9 +55,6 @@ end
function c13629812.discon(e)
return e:GetHandler():GetCardTargetCount()>0
end
function c13629812.disop(e,tp)
return bit.lshift(0x1,e:GetLabel())
end
function c13629812.retcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=c:GetFirstCardTarget()
......@@ -73,7 +68,7 @@ function c13629812.retop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=e:GetLabelObject()
if tc:IsRelateToEffect(e) then
local zone=bit.lshift(0x1,tc:GetPreviousSequence())
local zone=0x1<<tc:GetPreviousSequence()
Duel.ReturnToField(tc,tc:GetPreviousPosition(),zone)
end
end
......@@ -22,8 +22,7 @@ function c22959079.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c22959079.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local seq=tc:GetSequence()
if tc:IsControler(1-tp) then seq=seq+16 end
local val=aux.SequenceToGlobal(tc:GetControler(),LOCATION_MZONE,tc:GetSequence())
if tc:IsRelateToEffect(e) and Duel.Remove(tc,0,REASON_EFFECT+REASON_TEMPORARY)~=0 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
......@@ -37,10 +36,9 @@ function c22959079.operation(e,tp,eg,ep,ev,re,r,rp)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_DISABLE_FIELD)
e2:SetLabel(seq)
e2:SetLabelObject(tc)
e2:SetCondition(c22959079.discon)
e2:SetOperation(c22959079.disop)
e2:SetValue(val)
Duel.RegisterEffect(e2,tp)
end
end
......@@ -53,9 +51,8 @@ end
function c22959079.discon(e,c)
if e:GetLabelObject():IsLocation(LOCATION_REMOVED) then
return true
else e:Reset() return false end
end
function c22959079.disop(e,tp)
local dis1=bit.lshift(0x1,e:GetLabel())
return dis1
else
e:Reset()
return false
end
end
......@@ -46,16 +46,13 @@ function c32224143.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c32224143.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local seq=tc:GetSequence()
if tc:IsControler(1-tp) then seq=seq+16 end
local val=aux.SequenceToGlobal(tc:GetControler(),LOCATION_MZONE,tc:GetSequence())
if tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.Destroy(tc,REASON_EFFECT)~=0 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetLabel(seq)
e1:SetCondition(c32224143.discon)
e1:SetOperation(c32224143.disop)
e1:SetReset(0)
e1:SetValue(val)
Duel.RegisterEffect(e1,tp)
end
end
......@@ -66,9 +63,6 @@ function c32224143.discon(e)
e:Reset()
return false
end
function c32224143.disop(e,tp)
return bit.lshift(0x1,e:GetLabel())
end
function c32224143.atkcon(e)
return Duel.IsExistingMatchingCard(c32224143.cfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,e:GetHandler())
end
......@@ -43,18 +43,19 @@ function c40669071.lztg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Hint(HINT_ZONE,tp,dis)
end
function c40669071.lzop(e,tp,eg,ep,ev,re,r,rp)
local zone=e:GetLabel()
if tp==1 then
zone=((zone&0xffff)<<16)|((zone>>16)&0xffff)
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetOperation(c40669071.disop)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
e1:SetLabel(e:GetLabel())
e1:SetValue(zone)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e:GetHandler():RegisterEffect(e1)
end
function c40669071.disop(e,tp)
return e:GetLabel()
end
function c40669071.tgtg(e,c)
return e:GetHandler():GetLinkedGroup():IsContains(c)
end
......@@ -33,8 +33,7 @@ function c46247282.initial_effect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetRange(LOCATION_MZONE)
e4:SetCode(EFFECT_DISABLE_FIELD)
e4:SetProperty(EFFECT_FLAG_REPEAT)
e4:SetOperation(c46247282.disop)
e4:SetValue(c46247282.disval)
c:RegisterEffect(e4)
end
function c46247282.cfilter(c)
......@@ -73,7 +72,7 @@ function c46247282.desop(e,tp,eg,ep,ev,re,r,rp)
end
end
end
function c46247282.disop(e,tp)
function c46247282.disval(e)
local c=e:GetHandler()
return c:GetColumnZone(LOCATION_ONFIELD)
return c:GetColumnZone(LOCATION_ONFIELD,0)
end
......@@ -40,16 +40,13 @@ function c47810543.operation(e,tp,eg,ep,ev,re,r,rp)
if g:GetCount()>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 then
local seq=4-g:GetFirst():GetSequence()
if Duel.CheckLocation(1-tp,LOCATION_MZONE,seq) then
local val=aux.SequenceToGlobal(1-tp,LOCATION_MZONE,seq)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetValue(val)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetLabel(16+seq)
e1:SetOperation(c47810543.disop)
Duel.RegisterEffect(e1,tp)
end
end
end
function c47810543.disop(e,tp)
return 0x1<<e:GetLabel()
end
......@@ -59,15 +59,16 @@ function c53244294.ztg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Hint(HINT_ZONE,tp,dis)
end
function c53244294.zop(e,tp,eg,ep,ev,re,r,rp)
local zone=e:GetLabel()
if tp==1 then
zone=((zone&0xffff)<<16)|((zone>>16)&0xffff)
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetOperation(c53244294.disop)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(zone)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
e1:SetLabel(e:GetLabel())
e:GetHandler():RegisterEffect(e1)
end
function c53244294.disop(e,tp)
return e:GetLabel()
end
......@@ -19,9 +19,8 @@ function c739444.initial_effect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_DISABLE_FIELD)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_REPEAT)
e2:SetCondition(c739444.discon)
e2:SetOperation(c739444.disop)
e2:SetValue(c739444.disval)
c:RegisterEffect(e2)
end
function c739444.matfilter(c)
......@@ -41,9 +40,7 @@ end
function c739444.discon(e)
return e:GetHandler():GetFlagEffect(739444)~=0
end
function c739444.disop(e,tp)
function c739444.disval(e)
local c=e:GetHandler()
local flag1=bit.band(c:GetLinkedZone(tp),0xffffff00)
local flag2=bit.band(c:GetLinkedZone(tp),0xff00ffff)
return flag1+flag2
return c:GetLinkedZone(0)
end
......@@ -15,7 +15,7 @@ function c75713017.atcon(e,tp,eg,ep,ev,re,r,rp)
local bc=c:GetBattleTarget()
if not bc then return false end
local seq=bc:GetPreviousSequence()
e:SetLabel(seq+16)
e:SetLabel(seq)
return Duel.GetAttacker()==c and aux.bdocon(e,tp,eg,ep,ev,re,r,rp) and seq<5 and c:IsChainAttackable(0)
end
function c75713017.atcost(e,tp,eg,ep,ev,re,r,rp,chk)
......@@ -24,14 +24,12 @@ function c75713017.atcost(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c75713017.atop(e,tp,eg,ep,ev,re,r,rp)
Duel.ChainAttack()
local seq=e:GetLabel()
local val=aux.SequenceToGlobal(1-tp,LOCATION_MZONE,seq)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetLabel(e:GetLabel())
e1:SetOperation(c75713017.disop)
e1:SetValue(val)
e1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e1,tp)
end
function c75713017.disop(e,tp)
return bit.lshift(0x1,e:GetLabel())
end
......@@ -46,13 +46,16 @@ function c79569173.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c79569173.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(1-tp,LOCATION_SZONE,PLAYER_NONE,0)<3 then return end
local zone=e:GetLabel()
if tp==1 then
zone=((zone&0xffff)<<16)|((zone>>16)&0xffff)
end
--disable field
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_SZONE)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetOperation(c79569173.disop)
e1:SetLabel(e:GetLabel())
e1:SetValue(zone)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e:GetHandler():RegisterEffect(e1)
end
......
......@@ -31,21 +31,17 @@ function c82685480.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if g:GetCount()==0 then return end
if Duel.Destroy(g,REASON_EFFECT)==0 then return end
local seq=0
local val=0
local og=Duel.GetOperatedGroup()
local tc=og:GetFirst()
while tc do
seq=bit.replace(seq,0x1,tc:GetPreviousSequence())
val=val|aux.SequenceToGlobal(tc:GetPreviousControler(),LOCATION_MZONE,tc:GetPreviousSequence())
tc=og:GetNext()
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetLabel(seq*0x10000)
e1:SetOperation(c82685480.disop)
e1:SetValue(val)
e1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e1,tp)
end
function c82685480.disop(e,tp)
return e:GetLabel()
end
......@@ -4,16 +4,10 @@ function c90502999.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CONTINUOUS_TARGET)
e1:SetTarget(c90502999.target)
e1:SetOperation(c90502999.operation)
c:RegisterEffect(e1)
--disable field
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EFFECT_DISABLE_FIELD)
e2:SetOperation(c90502999.disop)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
end
function c90502999.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE,PLAYER_NONE,0)
......@@ -22,6 +16,18 @@ function c90502999.target(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(dis)
Duel.Hint(HINT_ZONE,tp,dis)
end
function c90502999.disop(e,tp)
return e:GetLabelObject():GetLabel()
function c90502999.operation(e,tp,eg,ep,ev,re,r,rp)
local zone=e:GetLabel()
if tp==1 then
zone=((zone&0xffff)<<16)|((zone>>16)&0xffff)
end
local c=e:GetHandler()
--disable field
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EFFECT_DISABLE_FIELD)
e2:SetValue(zone)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e2)
end
......@@ -5,22 +5,30 @@ function c92065772.initial_effect(c)
e1:SetDescription(aux.Stringid(92065772,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(c92065772.target)
e1:SetOperation(c92065772.operation)
c:RegisterEffect(e1)
end
function c92065772.operation(e,tp,eg,ep,ev,re,r,rp)
function c92065772.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:SetLabel(0)
if Duel.GetLocationCount(tp,LOCATION_MZONE,PLAYER_NONE,0)<=0
and Duel.GetLocationCount(1-tp,LOCATION_MZONE,PLAYER_NONE,0)<=0 then return end
--disable field
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetOperation(c92065772.disop)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
e:GetHandler():RegisterEffect(e1)
end
function c92065772.disop(e,tp)
local dis1=Duel.SelectDisableField(tp,1,LOCATION_MZONE,LOCATION_MZONE,0xe000e0)
return dis1
e:SetLabel(dis1)
end
function c92065772.operation(e,tp,eg,ep,ev,re,r,rp)
local zone=e:GetLabel()
if tp==1 then
zone=((zone&0xffff)<<16)|((zone>>16)&0xffff)
end
local c=e:GetHandler()
--disable field
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_DISABLE_FIELD)
e2:SetValue(zone)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e2)
end
......@@ -10,7 +10,7 @@ function c97466438.initial_effect(c)
e1:SetRange(LOCATION_HAND)
e1:SetCost(c97466438.reg)
c:RegisterEffect(e1)
--
--disable zone(monster effect)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(97466438,0))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
......@@ -22,7 +22,7 @@ function c97466438.initial_effect(c)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
--disable zone
--disable zone(pendulum effect)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(97466438,1))
e4:SetType(EFFECT_TYPE_IGNITION)
......@@ -50,28 +50,31 @@ function c97466438.ztg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Hint(HINT_ZONE,tp,dis)
end
function c97466438.zop(e,tp,eg,ep,ev,re,r,rp)
local zone=e:GetLabel()
if tp==1 then
zone=((zone&0xffff)<<16)|((zone>>16)&0xffff)
end
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_PZONE)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetOperation(c97466438.disop)
e1:SetValue(zone)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetLabel(e:GetLabel())
c:RegisterEffect(e1)
end
function c97466438.zop2(e,tp,eg,ep,ev,re,r,rp)
local zone=e:GetLabel()
if tp==1 then
zone=((zone&0xffff)<<16)|((zone>>16)&0xffff)
end
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetOperation(c97466438.disop)
e1:SetValue(zone)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetLabel(e:GetLabel())
c:RegisterEffect(e1)
end
function c97466438.disop(e,tp)
return e:GetLabel()
end
......@@ -2501,3 +2501,24 @@ function Auxiliary.tdcfop(c)
Duel.SendtoDeck(g,nil,2,REASON_COST)
end
end
--return the global index of the zone in (p,loc,seq)
function Auxiliary.SequenceToGlobal(p,loc,seq)
if p~=0 and p~=1 then
return 0
end
if loc==LOCATION_MZONE then
if seq<=6 then
return 0x1<<(16*p+seq)
else
return 0
end
elseif loc == LOCATION_SZONE then
if seq<=4 then
return 0x10<<(16*p+seq)
else
return 0
end
else
return 0
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment