Commit bd7224a7 authored by Nemo Ma's avatar Nemo Ma

Bugfix Addition and Sync

parent a11ed57b
...@@ -31,61 +31,40 @@ function scard.initial_effect(c) ...@@ -31,61 +31,40 @@ function scard.initial_effect(c)
e3:SetTargetRange(1, 0) e3:SetTargetRange(1, 0)
e3:SetValue(scard.efilter) e3:SetValue(scard.efilter)
c:RegisterEffect(e3) c:RegisterEffect(e3)
--cannot set --Special Summon token
local e4 = Effect.CreateEffect(c) local e4 = Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD) e4:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
e4:SetCode(EFFECT_CANNOT_SSET) e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetRange(LOCATION_FZONE) e4:SetRange(LOCATION_FZONE)
e4:SetTargetRange(1, 0) e4:SetProperty(EFFECT_FLAG_BOTH_SIDE)
e4:SetTarget(scard.setfilter) e4:SetTarget(scard.tktg)
e4:SetOperation(scard.tkop)
c:RegisterEffect(e4) c:RegisterEffect(e4)
--Special Summon token --cannot special summon
local e5 = Effect.CreateEffect(c) local e5 = Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN) e5:SetType(EFFECT_TYPE_FIELD)
e5:SetType(EFFECT_TYPE_IGNITION)
e5:SetRange(LOCATION_FZONE) e5:SetRange(LOCATION_FZONE)
e5:SetProperty(EFFECT_FLAG_BOTH_SIDE) e5:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e5:SetTarget(scard.tktg) e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetOperation(scard.tkop) e5:SetTargetRange(1, 0)
e5:SetTarget(scard.splimit)
c:RegisterEffect(e5) c:RegisterEffect(e5)
--cannot special summon --cannot link material
local e6 = Effect.CreateEffect(c) local e6 = Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD) e6:SetType(EFFECT_TYPE_FIELD)
e6:SetRange(LOCATION_FZONE) e6:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e6:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e6:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e6:SetTarget(aux.TargetBoolFunction(Card.IsCode, id + 1))
e6:SetTargetRange(1, 0) e6:SetValue(1)
e6:SetTarget(scard.splimit)
c:RegisterEffect(e6) c:RegisterEffect(e6)
--cannot link material --release all
local e7 = Effect.CreateEffect(c) local e7 = Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_FIELD) e7:SetCategory(CATEGORY_RECOVER)
e7:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e7:SetType(EFFECT_TYPE_TRIGGER_F + EFFECT_TYPE_SINGLE)
e7:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE) e7:SetCode(EVENT_LEAVE_FIELD)
e7:SetTarget(aux.TargetBoolFunction(Card.IsCode, id + 1)) e7:SetTarget(scard.reltg)
e7:SetValue(1) e7:SetOperation(scard.relop)
c:RegisterEffect(e7) c:RegisterEffect(e7)
--release all
local e8 = Effect.CreateEffect(c)
e8:SetCategory(CATEGORY_RECOVER)
e8:SetType(EFFECT_TYPE_TRIGGER_F + EFFECT_TYPE_SINGLE)
e8:SetCode(EVENT_LEAVE_FIELD)
e8:SetTarget(scard.reltg)
e8:SetOperation(scard.relop)
c:RegisterEffect(e8)
--oops tcg didn't ban cannon soldier
local e9 = Effect.CreateEffect(c)
e9:SetType(EFFECT_TYPE_FIELD)
e9:SetCode(EFFECT_CHANGE_DAMAGE)
e9:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e9:SetRange(LOCATION_FZONE)
e9:SetTargetRange(1, 1)
e9:SetValue(scard.damval)
c:RegisterEffect(e9)
local ea = e9:Clone()
ea:SetCode(EFFECT_NO_EFFECT_DAMAGE)
c:RegisterEffect(ea)
if not scard.global_check then if not scard.global_check then
scard.global_check = true scard.global_check = true
scard[0] = 0 scard[0] = 0
...@@ -97,9 +76,6 @@ end ...@@ -97,9 +76,6 @@ end
function scard.efilter(e, re, tp) function scard.efilter(e, re, tp)
return re:GetHandler():IsType(TYPE_FIELD) and re:IsHasType(EFFECT_TYPE_ACTIVATE) return re:GetHandler():IsType(TYPE_FIELD) and re:IsHasType(EFFECT_TYPE_ACTIVATE)
end end
function scard.setfilter(e, c)
return c:IsType(TYPE_FIELD)
end
function scard.regtg(e, tp, eg, ep, ev, re, r, rp, chk) function scard.regtg(e, tp, eg, ep, ev, re, r, rp, chk)
if chk == 0 then if chk == 0 then
return true return true
...@@ -271,9 +247,8 @@ function scard.relfilter(c) ...@@ -271,9 +247,8 @@ function scard.relfilter(c)
end end
function scard.reltg(e, tp, eg, ep, ev, re, r, rp, chk) function scard.reltg(e, tp, eg, ep, ev, re, r, rp, chk)
scard.release_check = true scard.release_check = true
local c = e:GetHandler()
if chk == 0 then if chk == 0 then
return not c:IsLocation(LOCATION_DECK) and not (c:IsLocation(LOCATION_REMOVED) and c:IsFacedown()) return not e:GetHandler():IsLocation(LOCATION_DECK) and not (c:IsLocation(LOCATION_REMOVED) and c:IsFacedown())
end end
local g = Duel.GetMatchingGroup(scard.relfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil) local g = Duel.GetMatchingGroup(scard.relfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
Duel.SetOperationInfo(0, CATEGORY_RELEASE, g, #g, 0, 0) Duel.SetOperationInfo(0, CATEGORY_RELEASE, g, #g, 0, 0)
...@@ -292,9 +267,3 @@ function scard.relop(e, tp, eg, ep, ev, re, r, rp) ...@@ -292,9 +267,3 @@ function scard.relop(e, tp, eg, ep, ev, re, r, rp)
end end
scard.release_check = false scard.release_check = false
end end
function scard.damval(e, re, val, r, rp, rc)
if r & REASON_EFFECT ~= 0 then
return 0
end
return val
end
...@@ -4,7 +4,7 @@ local cm=_G["c"..m] ...@@ -4,7 +4,7 @@ local cm=_G["c"..m]
if not RSVeVal then if not RSVeVal then
RSVeVal=RSVeVal or {} RSVeVal=RSVeVal or {}
rsve=RSVeVal rsve=RSVeVal
function rsve.addcounter(tp,ct,chk,rc) function rsve.addcounter(ct,chk,rc)
local g=Duel.GetMatchingGroup(rsve.ctfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,rc) local g=Duel.GetMatchingGroup(rsve.ctfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,rc)
if chk then return g:GetCount()>0 end if chk then return g:GetCount()>0 end
if g:GetCount()<=0 then return end if g:GetCount()<=0 then return end
...@@ -87,7 +87,7 @@ function rsve.ctcon(e,tp,eg,ep,ev,re,r,rp) ...@@ -87,7 +87,7 @@ function rsve.ctcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker()==e:GetHandler() and Duel.GetAttackTarget()==nil return Duel.GetAttacker()==e:GetHandler() and Duel.GetAttackTarget()==nil
end end
function rsve.ctop(e,tp,eg,ep,ev,re,r,rp) function rsve.ctop(e,tp,eg,ep,ev,re,r,rp)
rsve.addcounter(tp,4) rsve.addcounter(4)
end end
function rsve.NormalSummonFunction(c,ct) function rsve.NormalSummonFunction(c,ct)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
...@@ -126,7 +126,7 @@ function rsve.ToGraveFunction(c,ct,con,cost) ...@@ -126,7 +126,7 @@ function rsve.ToGraveFunction(c,ct,con,cost)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function rsve.ctop2(e,tp,eg,ep,ev,re,r,rp) function rsve.ctop2(e,tp,eg,ep,ev,re,r,rp)
rsve.addcounter(tp,e:GetLabel()) rsve.addcounter(e:GetLabel())
end end
function rsve.AttackUpFunction(c,ct) function rsve.AttackUpFunction(c,ct)
-- --
...@@ -185,7 +185,7 @@ function cm.initial_effect(c) ...@@ -185,7 +185,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function cm.ctop(e,tp,eg,ep,ev,re,r,rp) function cm.ctop(e,tp,eg,ep,ev,re,r,rp)
rsve.addcounter(tp,4) rsve.addcounter(4)
end end
function cm.spcon(e,c) function cm.spcon(e,c)
if c==nil then return true end if c==nil then return true end
......
...@@ -66,7 +66,7 @@ function cm.efop(e,tp,eg,ep,ev,re,r,rp) ...@@ -66,7 +66,7 @@ function cm.efop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function cm.ctop(e,tp,eg,ep,ev,re,r,rp) function cm.ctop(e,tp,eg,ep,ev,re,r,rp)
rsve.addcounter(tp,4) rsve.addcounter(4)
end end
function cm.rdcon(e,tp,eg,ep,ev,re,r,rp) function cm.rdcon(e,tp,eg,ep,ev,re,r,rp)
local ct=math.floor(ev/100) local ct=math.floor(ev/100)
......
...@@ -19,5 +19,5 @@ function cm.initial_effect(c) ...@@ -19,5 +19,5 @@ function cm.initial_effect(c)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function cm.ctop(e,tp,eg,ep,ev,re,r,rp) function cm.ctop(e,tp,eg,ep,ev,re,r,rp)
rsve.addcounter(tp,5) rsve.addcounter(5)
end end
...@@ -36,6 +36,6 @@ function cm.tgop(e,tp,eg,ep,ev,re,r,rp) ...@@ -36,6 +36,6 @@ function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
if not tc:IsRelateToEffect(e) then return end if not tc:IsRelateToEffect(e) then return end
local ct=tc:GetCounter(0x144b) local ct=tc:GetCounter(0x144b)
if ct>0 and tc:IsCanRemoveCounter(tp,0x144b,ct,REASON_EFFECT) and tc:RemoveCounter(tp,0x144b,ct,REASON_EFFECT) and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 then if ct>0 and tc:IsCanRemoveCounter(tp,0x144b,ct,REASON_EFFECT) and tc:RemoveCounter(tp,0x144b,ct,REASON_EFFECT) and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 then
rsve.addcounter(tp,ct) rsve.addcounter(ct)
end end
end end
\ No newline at end of file
...@@ -26,10 +26,10 @@ function cm.initial_effect(c) ...@@ -26,10 +26,10 @@ function cm.initial_effect(c)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function cm.damcon1(e,tp,eg,ep,ev,re,r,rp) function cm.damcon1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp and Duel.GetCounter(tp,1,1,0x144b)>0 return Duel.GetTurnPlayer()==tp
end end
function cm.damcon2(e,tp,eg,ep,ev,re,r,rp) function cm.damcon2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp and Duel.GetCounter(tp,0,1,0x144b)>0 return Duel.GetTurnPlayer()~=tp
end end
function cm.damop(e,tp,eg,ep,ev,re,r,rp) function cm.damop(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetCounter(tp,1,1,0x144b) local ct=Duel.GetCounter(tp,1,1,0x144b)
...@@ -39,7 +39,7 @@ function cm.damop(e,tp,eg,ep,ev,re,r,rp) ...@@ -39,7 +39,7 @@ function cm.damop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function cm.damop2(e,tp,eg,ep,ev,re,r,rp) function cm.damop2(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetCounter(tp,0,1,0x144b) local ct=Duel.GetCounter(tp,1,1,0x144b)
if ct>0 and Duel.GetTurnPlayer()~=tp then if ct>0 and Duel.GetTurnPlayer()~=tp then
Duel.Hint(HINT_CARD,0,m) Duel.Hint(HINT_CARD,0,m)
Duel.Damage(1-tp,ct*100,REASON_EFFECT) Duel.Damage(1-tp,ct*100,REASON_EFFECT)
......
...@@ -17,7 +17,7 @@ function cm.thfilter(c) ...@@ -17,7 +17,7 @@ function cm.thfilter(c)
return c:IsSetCard(0x144b) and c:IsAbleToHand() return c:IsSetCard(0x144b) and c:IsAbleToHand()
end end
function cm.filter(c) function cm.filter(c)
return c:IsLevelAbove(1) and c:IsSetCard(0x144b) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave() and rsve.addcounter(tp,c:GetLevel()*2,0) return c:IsLevelAbove(1) and c:IsSetCard(0x144b) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave() and rsve.addcounter(c:GetLevel()*2,0)
end end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local b1=Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) local b1=Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil)
...@@ -50,7 +50,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -50,7 +50,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_HAND+LOCATION_EXTRA,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_HAND+LOCATION_EXTRA,0,1,1,nil)
if g:GetCount()>0 and Duel.SendtoGrave(g,REASON_EFFECT)~=0 then if g:GetCount()>0 and Duel.SendtoGrave(g,REASON_EFFECT)~=0 then
rsve.addcounter(tp,g:GetFirst():GetLevel()*2,nil,e:GetHandler()) rsve.addcounter(g:GetFirst():GetLevel()*2,nil,e:GetHandler())
end end
end end
end end
...@@ -15,7 +15,7 @@ function cm.tgfilter(c) ...@@ -15,7 +15,7 @@ function cm.tgfilter(c)
return c:IsFaceup() and c:IsSetCard(0x144b) and c:GetCounter(0x144b)>0 return c:IsFaceup() and c:IsSetCard(0x144b) and c:GetCounter(0x144b)>0
end end
function cm.desfilter(c) function cm.desfilter(c)
return c:IsFaceup() and c:IsLevelAbove(1) and c:IsAttackAbove(1) and rsve.addcounter(tp,c:GetLevel(),0,c) return c:IsFaceup() and c:IsLevelAbove(1) and c:IsAttackAbove(1) and rsve.addcounter(c:GetLevel(),0,c)
end end
function cm.damtg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
local ct=Duel.GetMatchingGroupCount(Card.IsCode,tp,LOCATION_GRAVE,0,nil,m)+1 local ct=Duel.GetMatchingGroupCount(Card.IsCode,tp,LOCATION_GRAVE,0,nil,m)+1
...@@ -23,8 +23,8 @@ function cm.damtg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -23,8 +23,8 @@ function cm.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
local b2=Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_ONFIELD,0,1,nil) local b2=Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_ONFIELD,0,1,nil)
local b3=Duel.IsExistingMatchingCard(cm.desfilter,tp,LOCATION_MZONE,0,1,nil) local b3=Duel.IsExistingMatchingCard(cm.desfilter,tp,LOCATION_MZONE,0,1,nil)
if chk==0 then return b1 or b2 or b3 end if chk==0 then return b1 or b2 or b3 end
local sel={}
for i=1,ct do for i=1,ct do
local sel={}
local ops={} local ops={}
local opval={} local opval={}
local off=1 local off=1
...@@ -73,7 +73,7 @@ function cm.damop(sel) ...@@ -73,7 +73,7 @@ function cm.damop(sel)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local tc=Duel.SelectMatchingCard(tp,cm.desfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst() local tc=Duel.SelectMatchingCard(tp,cm.desfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc and Duel.Destroy(tc,REASON_EFFECT)~=0 and Duel.Damage(1-tp,tc:GetAttack(),REASON_EFFECT)~=0 then if tc and Duel.Destroy(tc,REASON_EFFECT)~=0 and Duel.Damage(1-tp,tc:GetAttack(),REASON_EFFECT)~=0 then
rsve.addcounter(tp,tc:GetLevel(),nil) rsve.addcounter(tc:GetLevel(),nil)
end end
end end
end end
......
...@@ -95,5 +95,5 @@ function cm.damop(e,tp,eg,ep,ev,re,r,rp) ...@@ -95,5 +95,5 @@ function cm.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(p,ct*50,REASON_EFFECT) Duel.Damage(p,ct*50,REASON_EFFECT)
end end
function cm.damcon(e,tp,eg,ep,ev,re,r,rp) function cm.damcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp return Duel.GetTurnPlayer()==tp
end end
\ No newline at end of file
...@@ -1926,7 +1926,7 @@ function cm.RemoveEffectCost_3L(ct,...) ...@@ -1926,7 +1926,7 @@ function cm.RemoveEffectCost_3L(ct,...)
local omit_list={...} local omit_list={...}
return function(e,tp,eg,ep,ev,re,r,rp,chk) return function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
if e:GetHandler():IsHasEffect(37564827) then return false end --if e:GetHandler():IsHasEffect(37564827) then return false end
return cm.RemoveEffect_3L(tp,e:GetHandler(),ct,ct,true,table.unpack(omit_list)) return cm.RemoveEffect_3L(tp,e:GetHandler(),ct,ct,true,table.unpack(omit_list))
end end
cm.RemoveEffect_3L(tp,e:GetHandler(),ct,ct,false,table.unpack(omit_list)) cm.RemoveEffect_3L(tp,e:GetHandler(),ct,ct,false,table.unpack(omit_list))
...@@ -1995,8 +1995,21 @@ function cm.ContinuousEffectReplaceCondition_3L(f,con,cd) ...@@ -1995,8 +1995,21 @@ function cm.ContinuousEffectReplaceCondition_3L(f,con,cd)
local c=e:GetHandler() local c=e:GetHandler()
if (f(c):IsExists(aux.FilterEqualFunction(Card.GetOriginalCode,cd),1,nil) and c:IsHasEffect(37564827)) then if (f(c):IsExists(aux.FilterEqualFunction(Card.GetOriginalCode,cd),1,nil) and c:IsHasEffect(37564827)) then
return (not con or con(e,tp,eg,ep,ev,re,r,rp)) return (not con or con(e,tp,eg,ep,ev,re,r,rp))
else
if Duel.GetCurrentChain()>0 then --Delay the effect removing to prevent stack overflow crash
local ex=Effect.CreateEffect(e:GetHandler())
ex:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ex:SetCode(EVENT_ADJUST)
ex:SetOperation(function(e)
cm.RemoveCertainEffect_3L(e:GetOwner(),e:GetLabel())
e:Reset()
end)
ex:SetLabel(cd)
ex:SetReset(RESET_CHAIN)
Duel.RegisterEffect(ex,tp)
else else
cm.RemoveCertainEffect_3L(e:GetHandler(),cd) cm.RemoveCertainEffect_3L(e:GetHandler(),cd)
end
return false return false
end end
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