Commit cf96f8fc authored by TanakaKotoha's avatar TanakaKotoha

lua fix

parent 661bdf75
......@@ -29,11 +29,7 @@ function cm.rccfilter(c)
return c:IsFaceup() and c:IsCode(17030001)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsExistingMatchingCard(cm.rccfilter,tp,LOCATION_ONFIELD,0,1,nil) then
return Duel.GetTurnPlayer()==tp
else
return true
end
return Duel.GetTurnPlayer()==tp or Duel.IsExistingMatchingCard(cm.rccfilter,tp,LOCATION_ONFIELD,0,1,nil)
end
function cm.filter(c)
return c:IsFaceup()
......@@ -72,7 +68,7 @@ function cm.cttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsCanAddCounter(0x1119,1) end
if chk==0 then return Duel.IsExistingTarget(Card.IsCanAddCounter,tp,LOCATION_MZONE,0,1,nil,0x1119,2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsCanAddCounter,tp,LOCATION_MZONE,0,2,2,nil,0x1119,2)
Duel.SelectTarget(tp,Card.IsCanAddCounter,tp,LOCATION_MZONE,0,1,1,nil,0x1119,2)
end
function cm.ctop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
......
......@@ -2,36 +2,76 @@
local m=17061158
local cm=_G["c"..m]
cm.dfc_front_side=m
cm.dfc_back_side1=m+1
cm.dfc_back_side2=m+2
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH)
e1:SetCountLimit(1,17061158+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
local b1=Duel.IsPlayerCanSpecialSummonMonster(tp,17061159,0,0x21,800,800,3,RACE_FAIRY,ATTRIBUTE_LIGHT)
local b2=Duel.IsPlayerCanSpecialSummonMonster(tp,17061160,0,0x21,1200,400,3,RACE_FAIRY,ATTRIBUTE_DARK)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and (b1 or b2)end
local off=1
local ops={}
local opval={}
if b1 then
ops[off]=aux.Stringid(17061158,1)
opval[off-1]=1
off=off+1
end
if b2 then
ops[off]=aux.Stringid(17061158,2)
opval[off-1]=2
off=off+1
end
local op=Duel.SelectOption(tp,table.unpack(ops))
e:SetLabel(op)
e:SetCategory(CATEGORY_TOHAND)
Duel.Hint(HINT_CARD,0,17061159+op)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
local op=Duel.SelectOption(tp,aux.Stringid(m,1),aux.Stringid(m,2))
e:SetLabel(op)
if op==0 then
local tcode=e:GetHandler().dfc_back_side1
local sel=e:GetLabel()
local tcode=17061159+sel
local b1=nil
if tcode==17061159 then b1=Duel.IsPlayerCanSpecialSummonMonster(tp,17061159,0,0x21,800,800,3,RACE_FAIRY,ATTRIBUTE_LIGHT)
else b1=Duel.IsPlayerCanSpecialSummonMonster(tp,17061160,0,0x21,1200,400,3,RACE_FAIRY,ATTRIBUTE_DARK) end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not b1 then return end
if not e:GetHandler():IsRelateToEffect(e) then return end
e:GetHandler():CancelToGrave()
--back
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_ADJUST)
e1:SetRange(LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED+LOCATION_HAND+LOCATION_EXTRA)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE)
e1:SetCountLimit(1)
e1:SetLabel(e:GetHandler():GetOriginalCode())
e1:SetCondition(cm.backon)
e1:SetOperation(cm.backop)
e:GetHandler():RegisterEffect(e1)
e:GetHandler():SetEntityCode(tcode,true)
e:GetHandler():ReplaceEffect(tcode,0,0)
Duel.ConfirmCards(1-tp,e:GetHandler())
e:GetHandler():RegisterFlagEffect(17061158,0,0,0)
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
else
local tcode1=e:GetHandler().dfc_back_side2
e:GetHandler():SetEntityCode(tcode1,true)
e:GetHandler():ReplaceEffect(tcode1,0,0)
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
end
end
function cm.backon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return e:GetHandler():GetFlagEffect(17061158)>0
end
function cm.backop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tcode=e:GetLabel()
c:SetEntityCode(tcode)
Duel.ConfirmCards(tp,Group.FromCards(c))
Duel.ConfirmCards(1-tp,Group.FromCards(c))
c:ReplaceEffect(tcode,0,0)
e:GetHandler():ResetFlagEffect(17061158)
end
\ No newline at end of file
......@@ -37,15 +37,6 @@ function cm.initial_effect(c)
e5:SetCode(EVENT_ATTACK_ANNOUNCE)
e5:SetOperation(cm.atksuc)
c:RegisterEffect(e5)
--back
local e8=Effect.CreateEffect(c)
e8:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e8:SetCode(EVENT_ADJUST)
e8:SetRange(LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED+LOCATION_HAND+LOCATION_EXTRA)
e8:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE)
e8:SetCondition(cm.backon)
e8:SetOperation(cm.backop)
c:RegisterEffect(e8)
end
function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......@@ -77,18 +68,6 @@ function cm.recop(e,tp,eg,ep,ev,re,r,rp)
Duel.Recover(p,d,REASON_EFFECT)
Duel.Hint(HINT_SOUND,0,aux.Stringid(m,5))
end
function cm.backon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c.dfc_front_side and c:GetOriginalCode()==c.dfc_back_side1
end
function cm.backop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tcode=c.dfc_front_side
c:SetEntityCode(tcode)
Duel.ConfirmCards(tp,Group.FromCards(c))
Duel.ConfirmCards(1-tp,Group.FromCards(c))
c:ReplaceEffect(tcode,0,0)
end
function cm.descon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE+LOCATION_SZONE) and c:IsFaceup()
......
......@@ -45,15 +45,6 @@ function cm.initial_effect(c)
e5:SetCode(EVENT_ATTACK_ANNOUNCE)
e5:SetOperation(cm.atksuc)
c:RegisterEffect(e5)
--back
local e8=Effect.CreateEffect(c)
e8:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e8:SetCode(EVENT_ADJUST)
e8:SetRange(LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED+LOCATION_HAND+LOCATION_EXTRA)
e8:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE)
e8:SetCondition(cm.backon)
e8:SetOperation(cm.backop)
c:RegisterEffect(e8)
end
function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......@@ -83,18 +74,6 @@ function cm.damop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
function cm.backon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c.dfc_front_side and c:GetOriginalCode()==c.dfc_back_side2
end
function cm.backop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tcode=c.dfc_front_side
c:SetEntityCode(tcode)
Duel.ConfirmCards(tp,Group.FromCards(c))
Duel.ConfirmCards(1-tp,Group.FromCards(c))
c:ReplaceEffect(tcode,0,0)
end
function cm.descon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE+LOCATION_SZONE) and c:IsFaceup()
......
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