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)
e3:SetTargetRange(1, 0)
e3:SetValue(scard.efilter)
c:RegisterEffect(e3)
--cannot set
--Special Summon token
local e4 = Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_CANNOT_SSET)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_FZONE)
e4:SetTargetRange(1, 0)
e4:SetTarget(scard.setfilter)
e4:SetProperty(EFFECT_FLAG_BOTH_SIDE)
e4:SetTarget(scard.tktg)
e4:SetOperation(scard.tkop)
c:RegisterEffect(e4)
--Special Summon token
--cannot special summon
local e5 = Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
e5:SetType(EFFECT_TYPE_IGNITION)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetRange(LOCATION_FZONE)
e5:SetProperty(EFFECT_FLAG_BOTH_SIDE)
e5:SetTarget(scard.tktg)
e5:SetOperation(scard.tkop)
e5:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetTargetRange(1, 0)
e5:SetTarget(scard.splimit)
c:RegisterEffect(e5)
--cannot special summon
--cannot link material
local e6 = Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetRange(LOCATION_FZONE)
e6:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e6:SetTargetRange(1, 0)
e6:SetTarget(scard.splimit)
e6:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e6:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
e6:SetTarget(aux.TargetBoolFunction(Card.IsCode, id + 1))
e6:SetValue(1)
c:RegisterEffect(e6)
--cannot link material
--release all
local e7 = Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_FIELD)
e7:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e7:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
e7:SetTarget(aux.TargetBoolFunction(Card.IsCode, id + 1))
e7:SetValue(1)
e7:SetCategory(CATEGORY_RECOVER)
e7:SetType(EFFECT_TYPE_TRIGGER_F + EFFECT_TYPE_SINGLE)
e7:SetCode(EVENT_LEAVE_FIELD)
e7:SetTarget(scard.reltg)
e7:SetOperation(scard.relop)
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
scard.global_check = true
scard[0] = 0
......@@ -97,9 +76,6 @@ end
function scard.efilter(e, re, tp)
return re:GetHandler():IsType(TYPE_FIELD) and re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function scard.setfilter(e, c)
return c:IsType(TYPE_FIELD)
end
function scard.regtg(e, tp, eg, ep, ev, re, r, rp, chk)
if chk == 0 then
return true
......@@ -271,9 +247,8 @@ function scard.relfilter(c)
end
function scard.reltg(e, tp, eg, ep, ev, re, r, rp, chk)
scard.release_check = true
local c = e:GetHandler()
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
local g = Duel.GetMatchingGroup(scard.relfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
Duel.SetOperationInfo(0, CATEGORY_RELEASE, g, #g, 0, 0)
......@@ -292,9 +267,3 @@ function scard.relop(e, tp, eg, ep, ev, re, r, rp)
end
scard.release_check = false
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]
if not RSVeVal then
RSVeVal=RSVeVal or {}
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)
if chk then return g:GetCount()>0 end
if g:GetCount()<=0 then return end
......@@ -87,7 +87,7 @@ function rsve.ctcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker()==e:GetHandler() and Duel.GetAttackTarget()==nil
end
function rsve.ctop(e,tp,eg,ep,ev,re,r,rp)
rsve.addcounter(tp,4)
rsve.addcounter(4)
end
function rsve.NormalSummonFunction(c,ct)
local e1=Effect.CreateEffect(c)
......@@ -126,7 +126,7 @@ function rsve.ToGraveFunction(c,ct,con,cost)
c:RegisterEffect(e1)
end
function rsve.ctop2(e,tp,eg,ep,ev,re,r,rp)
rsve.addcounter(tp,e:GetLabel())
rsve.addcounter(e:GetLabel())
end
function rsve.AttackUpFunction(c,ct)
--
......@@ -185,7 +185,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e2)
end
function cm.ctop(e,tp,eg,ep,ev,re,r,rp)
rsve.addcounter(tp,4)
rsve.addcounter(4)
end
function cm.spcon(e,c)
if c==nil then return true end
......
......@@ -66,7 +66,7 @@ function cm.efop(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.ctop(e,tp,eg,ep,ev,re,r,rp)
rsve.addcounter(tp,4)
rsve.addcounter(4)
end
function cm.rdcon(e,tp,eg,ep,ev,re,r,rp)
local ct=math.floor(ev/100)
......
......@@ -19,5 +19,5 @@ function cm.initial_effect(c)
c:RegisterEffect(e3)
end
function cm.ctop(e,tp,eg,ep,ev,re,r,rp)
rsve.addcounter(tp,5)
rsve.addcounter(5)
end
......@@ -36,6 +36,6 @@ function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
if not tc:IsRelateToEffect(e) then return end
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
rsve.addcounter(tp,ct)
rsve.addcounter(ct)
end
end
\ No newline at end of file
......@@ -26,10 +26,10 @@ function cm.initial_effect(c)
c:RegisterEffect(e3)
end
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
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
function cm.damop(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetCounter(tp,1,1,0x144b)
......@@ -39,7 +39,7 @@ function cm.damop(e,tp,eg,ep,ev,re,r,rp)
end
end
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
Duel.Hint(HINT_CARD,0,m)
Duel.Damage(1-tp,ct*100,REASON_EFFECT)
......
......@@ -17,7 +17,7 @@ function cm.thfilter(c)
return c:IsSetCard(0x144b) and c:IsAbleToHand()
end
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
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
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)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
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
rsve.addcounter(tp,g:GetFirst():GetLevel()*2,nil,e:GetHandler())
rsve.addcounter(g:GetFirst():GetLevel()*2,nil,e:GetHandler())
end
end
end
......@@ -15,7 +15,7 @@ function cm.tgfilter(c)
return c:IsFaceup() and c:IsSetCard(0x144b) and c:GetCounter(0x144b)>0
end
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
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
......@@ -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 b3=Duel.IsExistingMatchingCard(cm.desfilter,tp,LOCATION_MZONE,0,1,nil)
if chk==0 then return b1 or b2 or b3 end
local sel={}
for i=1,ct do
local sel={}
local ops={}
local opval={}
local off=1
......@@ -73,7 +73,7 @@ function cm.damop(sel)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
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
rsve.addcounter(tp,tc:GetLevel(),nil)
rsve.addcounter(tc:GetLevel(),nil)
end
end
end
......
......@@ -95,5 +95,5 @@ function cm.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(p,ct*50,REASON_EFFECT)
end
function cm.damcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
return Duel.GetTurnPlayer()==tp
end
\ No newline at end of file
......@@ -1926,7 +1926,7 @@ function cm.RemoveEffectCost_3L(ct,...)
local omit_list={...}
return function(e,tp,eg,ep,ev,re,r,rp,chk)
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))
end
cm.RemoveEffect_3L(tp,e:GetHandler(),ct,ct,false,table.unpack(omit_list))
......@@ -1996,7 +1996,20 @@ function cm.ContinuousEffectReplaceCondition_3L(f,con,cd)
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))
else
cm.RemoveCertainEffect_3L(e:GetHandler(),cd)
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
cm.RemoveCertainEffect_3L(e:GetHandler(),cd)
end
return false
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