Commit 4a4406ae authored by TanakaKotoha's avatar TanakaKotoha

fix lua

parent f1babad2
...@@ -9,12 +9,25 @@ function cm.initial_effect(c) ...@@ -9,12 +9,25 @@ function cm.initial_effect(c)
aux.AddXyzProcedureLevelFree(c,cm.mfilter,cm.xyzcheck,2,99) aux.AddXyzProcedureLevelFree(c,cm.mfilter,cm.xyzcheck,2,99)
c:EnableReviveLimit() c:EnableReviveLimit()
--effect gian --effect gian
local e1=Effect.CreateEffect(c) local ef_1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ef_1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EVENT_ADJUST) ef_1:SetCode(m)
e1:SetRange(LOCATION_MZONE) ef_1:SetRange(LOCATION_MZONE)
e1:SetOperation(cm.efop) ef_1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SINGLE_RANGE)
c:RegisterEffect(e1) c:RegisterEffect(ef_1)
local ef_2=Effect.CreateEffect(c)
ef_2:SetType(EFFECT_TYPE_SINGLE)
ef_2:SetCode(m+1000)
ef_2:SetRange(LOCATION_MZONE)
ef_2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
c:RegisterEffect(ef_2)
local ef_3=Effect.CreateEffect(c)
ef_3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ef_3:SetCode(EVENT_ADJUST)
ef_3:SetRange(LOCATION_MZONE)
ef_3:SetOperation(cm.op)
c:RegisterEffect(ef_3)
cm[ef_3]={}
end end
function cm.mfilter(c) function cm.mfilter(c)
return chrb.CHRB(c) return chrb.CHRB(c)
...@@ -22,20 +35,54 @@ end ...@@ -22,20 +35,54 @@ end
function cm.xyzcheck(g) function cm.xyzcheck(g)
return g:GetClassCount(Card.GetCode)==#g return g:GetClassCount(Card.GetCode)==#g
end end
function cm.effilter(c) function cm.copyfilter(c,ec)
return c:IsType(TYPE_MONSTER) and chrb.CHRB(c) return c:IsType(TYPE_MONSTER) and chrb.CHRB(c) and c:IsType(TYPE_EFFECT) and not c:IsType(TYPE_TRAPMONSTER) and not c:IsHasEffect(m) and ec:GetOverlayCount()>0
end end
function cm.efop(e,tp,eg,ep,ev,re,r,rp) function cm.gfilter(c,g)
local c=e:GetHandler() if not g then return true end
local ct=c:GetOverlayGroup(tp,1,0) return not g:IsContains(c)
local wg=ct:Filter(cm.effilter,nil,tp) end
local wbc=wg:GetFirst() function cm.gfilter1(c,g)
while wbc do if not g then return true end
local code=wbc:GetOriginalCode() return not g:IsExists(cm.gfilter2,1,nil,c:GetOriginalCode())
if c:IsFaceup() and c:GetFlagEffect(code)==0 then end
c:CopyEffect(code, RESET_EVENT+0x1fe0000+EVENT_CHAINING, 1) function cm.gfilter2(c,code)
c:RegisterFlagEffect(code,RESET_EVENT+0x1fe0000+EVENT_CHAINING,0,1) return c:GetOriginalCode()==code
end end
wbc=wg:GetNext() function cm.op(e,tp,eg,ep,ev,re,r,rp)
end local c=e:GetHandler()
local copyt=cm[e]
local exg=Group.CreateGroup()
for tc,cid in pairs(copyt) do
if tc and cid then exg:AddCard(tc) end
end
local g=c:GetOverlayGroup():Filter(cm.copyfilter,nil,c)
local dg=exg:Filter(cm.gfilter,nil,g)
for tc in aux.Next(dg) do
c:ResetEffect(copyt[tc],RESET_COPY)
exg:RemoveCard(tc)
copyt[tc]=nil
end
local cg=g:Filter(cm.gfilter1,nil,exg)
local f=Card.RegisterEffect
Card.RegisterEffect=function(tc,e,forced)
e:SetCondition(cm.rcon(e:GetCondition(),tc,copyt))
f(tc,e,forced)
end
for tc in aux.Next(cg) do
copyt[tc]=c:CopyEffect(tc:GetOriginalCode(),RESET_EVENT+0x1fe0000,1)
end
Card.RegisterEffect=f
end
function cm.rcon(con,tc,copyt)
return function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsHasEffect(m+1000) then
c:ResetEffect(c,copyt[tc],RESET_COPY)
copyt[tc]=nil
return false
end
if not con or con(e,tp,eg,ep,ev,re,r,rp) then return true end
return e:IsHasType(0x7e0) and c:GetFlagEffect(m)>0
end
end end
\ No newline at end of file
...@@ -64,13 +64,10 @@ function c14801019.efop(e,tp,eg,ep,ev,re,r,rp) ...@@ -64,13 +64,10 @@ function c14801019.efop(e,tp,eg,ep,ev,re,r,rp)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetRange(LOCATION_MZONE) e1:SetRange(LOCATION_MZONE)
e1:SetLabel(ep) e1:SetLabel(ep)
e1:SetValue(c14801019.tgval) e1:SetValue(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetReset(RESET_EVENT+RESETS_STANDARD)
rc:RegisterEffect(e1,true) rc:RegisterEffect(e1,true)
end end
function c14801019.tgval(e,re,rp)
return rp==1-e:GetLabel()
end
function c14801019.thcon(e,tp,eg,ep,ev,re,r,rp) function c14801019.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_EFFECT) return e:GetHandler():IsReason(REASON_EFFECT)
end end
......
...@@ -96,9 +96,10 @@ end ...@@ -96,9 +96,10 @@ end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g1=Duel.GetMatchingGroup(cm.filter1,tp,LOCATION_MZONE,0,nil) local g1=Duel.GetMatchingGroup(cm.filter1,tp,LOCATION_MZONE,0,nil)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and cm.filter2(chkc,tp) end if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and cm.filter2(chkc,tp) end
if chk==0 then return iCount(0,tp,m,1) and Duel.IsExistingTarget(cm.filter2,tp,LOCATION_MZONE,0,1,nil,tp) and g1:GetClassCount(Card.GetLevel)>1 end if chk==0 then return Duel.GetFlagEffect(tp,17060818)==0 and Duel.IsExistingTarget(cm.filter2,tp,LOCATION_MZONE,0,1,nil,tp) and g1:GetClassCount(Card.GetLevel)>1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,cm.filter2,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SelectTarget(tp,cm.filter2,tp,LOCATION_MZONE,0,1,1,nil,tp)
Duel.RegisterFlagEffect(tp,17060818,RESET_PHASE+PHASE_END,0,1)
end end
function cm.activate(e,tp,eg,ep,ev,re,r,rp) function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
...@@ -110,9 +111,9 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -110,9 +111,9 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CHANGE_LEVEL_FINAL) e1:SetCode(EFFECT_CHANGE_LEVEL)
e1:SetValue(lv) e1:SetValue(lv)
e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetReset(RESET_EVENT+RESETS_STANDARD)
lc:RegisterEffect(e1) lc:RegisterEffect(e1)
lc=g:GetNext() lc=g:GetNext()
end end
......
...@@ -22,16 +22,15 @@ function cm.initial_effect(c) ...@@ -22,16 +22,15 @@ function cm.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetRange(LOCATION_HAND+LOCATION_GRAVE) e2:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e2:SetCountLimit(1,17060820)
e2:SetCondition(cm.hspcon) e2:SetCondition(cm.hspcon)
e2:SetOperation(cm.hspop) e2:SetOperation(cm.hspop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--special summon --fusion summon
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(17060820,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION) e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetCondition(cm.fpcon) e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,17060820)
e3:SetTarget(cm.fptg) e3:SetTarget(cm.fptg)
e3:SetOperation(cm.fpop) e3:SetOperation(cm.fpop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
...@@ -51,13 +50,6 @@ function cm.IsDark_Degenerate(c) ...@@ -51,13 +50,6 @@ function cm.IsDark_Degenerate(c)
local m=_G["c"..c:GetCode()] local m=_G["c"..c:GetCode()]
return m and m.is_named_with_Dark_Degenerate return m and m.is_named_with_Dark_Degenerate
end end
function iCount(name,tp,m,id)
return ((name=="get" or name=="set")
and {(name=="get"
and {tonumber(((Duel.GetFlagEffect(tp,m)==nil) and {0} or {Duel.GetFlagEffect(tp,m)})[1])}
or { Debug.Message("","请使用Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1)") })[1]}
or {(bit.band(iCount("get",tp,m,id),math.pow(2,id-1))==0 and {true} or {false})[1]})[1]
end
function cm.epcon(e,tp,eg,ep,ev,re,r,rp) function cm.epcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp return Duel.GetTurnPlayer()==tp
end end
...@@ -79,21 +71,18 @@ function cm.hspcon(e,c) ...@@ -79,21 +71,18 @@ function cm.hspcon(e,c)
if c==nil then return true end if c==nil then return true end
local tp=c:GetControler() local tp=c:GetControler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return ft>-1 and Duel.CheckReleaseGroup(tp,cm.hspfilter,1,nil,ft,tp) return ft>-1 and Duel.GetFlagEffect(tp,17060820)==0 and Duel.CheckReleaseGroup(tp,cm.hspfilter,1,nil,ft,tp)
end end
function cm.hspop(e,tp,eg,ep,ev,re,r,rp,c) function cm.hspop(e,tp,eg,ep,ev,re,r,rp,c)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local g=Duel.SelectReleaseGroup(tp,cm.hspfilter,1,1,nil,ft,tp) local g=Duel.SelectReleaseGroup(tp,cm.hspfilter,1,1,nil,ft,tp)
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
Duel.RegisterFlagEffect(tp,17060820,RESET_PHASE+PHASE_END,0,1)
end end
function cm.fpcon(e,tp,eg,ep,ev,re,r,rp) function cm.filter1(c,e)
local ph=Duel.GetCurrentPhase()
return ph~=PHASE_DAMAGE and ph~=PHASE_DAMAGE_CAL
end
function cm.spfilter1(c,e)
return not c:IsImmuneToEffect(e) return not c:IsImmuneToEffect(e)
end end
function cm.spfilter2(c,e,tp,m,f,gc,chkf) function cm.filter2(c,e,tp,m,f,gc,chkf)
return c:IsType(TYPE_FUSION) and c:IsRace(RACE_WARRIOR) and (not f or f(c)) return c:IsType(TYPE_FUSION) and c:IsRace(RACE_WARRIOR) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,gc,chkf) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,gc,chkf)
end end
...@@ -101,18 +90,18 @@ function cm.fptg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -101,18 +90,18 @@ function cm.fptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
if chk==0 then if chk==0 then
local chkf=tp local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(cm.spfilter1,nil,e) local mg1=Duel.GetFusionMaterial(tp)
local res=Duel.IsExistingMatchingCard(cm.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,c,chkf) local res=Duel.IsExistingMatchingCard(cm.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,c,chkf)
if not res then if not res then
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
if ce~=nil then if ce~=nil then
local fgroup=ce:GetTarget() local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp) local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue() local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(cm.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,c,chkf) res=Duel.IsExistingMatchingCard(cm.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,c,chkf)
end end
end end
return res and iCount(0,tp,m,1) return res
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end end
...@@ -120,8 +109,8 @@ function cm.fpop(e,tp,eg,ep,ev,re,r,rp) ...@@ -120,8 +109,8 @@ function cm.fpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local chkf=tp local chkf=tp
if c:IsFacedown() or not c:IsRelateToEffect(e) or c:IsImmuneToEffect(e) then return end if c:IsFacedown() or not c:IsRelateToEffect(e) or c:IsImmuneToEffect(e) then return end
local mg1=Duel.GetFusionMaterial(tp):Filter(cm.spfilter1,nil,e) local mg1=Duel.GetFusionMaterial(tp):Filter(cm.filter1,nil,e)
local sg1=Duel.GetMatchingGroup(cm.spfilter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,c,chkf) local sg1=Duel.GetMatchingGroup(cm.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,c,chkf)
local mg2=nil local mg2=nil
local sg2=nil local sg2=nil
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
...@@ -129,7 +118,7 @@ function cm.fpop(e,tp,eg,ep,ev,re,r,rp) ...@@ -129,7 +118,7 @@ function cm.fpop(e,tp,eg,ep,ev,re,r,rp)
local fgroup=ce:GetTarget() local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp) mg2=fgroup(ce,e,tp)
local mf=ce:GetValue() local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(cm.spfilter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,c,chkf) sg2=Duel.GetMatchingGroup(cm.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,c,chkf)
end end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone() local sg=sg1:Clone()
......
...@@ -6,18 +6,18 @@ function cm.initial_effect(c) ...@@ -6,18 +6,18 @@ function cm.initial_effect(c)
aux.EnablePendulumAttribute(c) aux.EnablePendulumAttribute(c)
--spsummon --spsummon
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0)) e1:SetDescription(aux.Stringid(17060914,0))
e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION) e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_PZONE) e1:SetRange(LOCATION_PZONE)
e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_DUEL) e1:SetCountLimit(1,17060914)
e1:SetCondition(cm.spcon) e1:SetCondition(cm.spcon)
e1:SetTarget(cm.sptg) e1:SetTarget(cm.sptg)
e1:SetOperation(cm.spop) e1:SetOperation(cm.spop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--search --search
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1)) e2:SetDescription(aux.Stringid(17060914,1))
e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SEARCH+CATEGORY_TOHAND) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SEARCH+CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetCode(EVENT_SUMMON_SUCCESS)
...@@ -33,18 +33,7 @@ end ...@@ -33,18 +33,7 @@ end
cm.is_named_with_Ma_Elf=1 cm.is_named_with_Ma_Elf=1
function cm.IsMa_Elf(c) function cm.IsMa_Elf(c)
local m=_G["c"..c:GetCode()] local m=_G["c"..c:GetCode()]
return m and m.is_named_with_Ma_Elf return m and m.is_named_with_Ma_Elf
end
function cm.IsMillion_Arthur(c)
local m=_G["c"..c:GetCode()]
return m and m.is_named_with_Million_Arthur
end
function iCount(name,tp,m,id)
return ((name=="get" or name=="set")
and {(name=="get"
and {tonumber(((Duel.GetFlagEffect(tp,m)==nil) and {0} or {Duel.GetFlagEffect(tp,m)})[1])}
or { Debug.Message("","请使用Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1)") })[1]}
or {(bit.band(iCount("get",tp,m,id),math.pow(2,id-1))==0 and {true} or {false})[1]})[1]
end end
function cm.cfilter(c) function cm.cfilter(c)
return c:IsFacedown() or not c:IsType(TYPE_PENDULUM) return c:IsFacedown() or not c:IsType(TYPE_PENDULUM)
...@@ -52,41 +41,38 @@ end ...@@ -52,41 +41,38 @@ end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp) function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_MZONE,0,1,nil) return not Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_MZONE,0,1,nil)
end end
function cm.filter(c) function cm.tgfilter(c)
return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsAbleToGrave() return c:IsSetCard(0x7f0) and (c:IsFaceup() or not c:IsLocation(LOCATION_EXTRA)) and c:IsAbleToHand()
end end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false)
and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil)end and Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_EXTRA,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_EXTRA)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end end
function cm.spop(e,tp,eg,ep,ev,re,r,rp) function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_EXTRA,0,1,1,nil) local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.tgfilter),tp,LOCATION_EXTRA,0,1,1,nil)
local tc=g:GetFirst() local tc=tg:GetFirst()
if Duel.SendtoGrave(tc,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_GRAVE) and c:IsRelateToEffect(e) then if tc and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_GRAVE) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end end
end end
function cm.tgfilter(c)
return (c:IsType(TYPE_PENDULUM) and cm.IsMillion_Arthur or not c:IsLocation(LOCATION_DECK)) and c:IsAbleToGrave()
and (c:IsFaceup() and c:IsType(TYPE_PENDULUM) or not c:IsLocation(LOCATION_EXTRA)) and c:IsAbleToGrave()
end
function cm.thfilter(c) function cm.thfilter(c)
return c:IsType(TYPE_PENDULUM) and cm.IsMa_Elf(c) and c:IsAbleToHand() and not c:IsCode(17060914) return c:IsType(TYPE_PENDULUM) and cm.IsMa_Elf(c) and c:IsAbleToHand() and not c:IsCode(17060914)
end end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return iCount(0,tp,m,1) and Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil) if chk==0 then return Duel.GetFlagEffect(tp,17060914)==0 and Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_EXTRA+LOCATION_DECK,0,1,nil)
and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) end and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK+LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_EXTRA)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1) Duel.RegisterFlagEffect(tp,17060914,RESET_PHASE+PHASE_END,0,1)
end end
function cm.thop(e,tp,eg,ep,ev,re,r,rp) function cm.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.tgfilter),tp,LOCATION_DECK+LOCATION_EXTRA,0,1,1,nil) local tg=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_EXTRA+LOCATION_DECK,0,1,1,nil)
local tc=tg:GetFirst() local tc=tg:GetFirst()
if tc and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_GRAVE) then if tc and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_GRAVE) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
...@@ -96,4 +82,4 @@ function cm.thop(e,tp,eg,ep,ev,re,r,rp) ...@@ -96,4 +82,4 @@ function cm.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.ConfirmCards(1-tp,sg) Duel.ConfirmCards(1-tp,sg)
end end
end end
end end
\ No newline at end of file
...@@ -50,15 +50,17 @@ function cm.con(e,c) ...@@ -50,15 +50,17 @@ function cm.con(e,c)
if c==nil then return true end if c==nil then return true end
return Duel.GetMatchingGroupCount(aux.TRUE,c:GetControler(),LOCATION_MZONE,0,nil)==1 return Duel.GetMatchingGroupCount(aux.TRUE,c:GetControler(),LOCATION_MZONE,0,nil)==1
end end
function cm.spfilter(c,ft,tp)
return c:IsControler(tp)
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
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and local tp=c:GetControler()
Duel.GetMatchingGroupCount(aux.TRUE,c:GetControler(),LOCATION_MZONE,0,nil)==1 local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
and Duel.CheckReleaseGroup(tp,Card.IsReleasable,1,nil) return Duel.GetMatchingGroupCount(aux.TRUE,c:GetControler(),LOCATION_MZONE,0,nil)==1 and Duel.CheckReleaseGroup(tp,cm.spfilter,1,nil,ft,tp)
end end
function cm.spop(e,tp,eg,ep,ev,re,r,rp,c) function cm.spop(e,tp,eg,ep,ev,re,r,rp,c)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local g=Duel.GetFirstMatchingCard(Card.IsReleasable,tp,LOCATION_MZONE,0,nil)
local g=Duel.GetFirstMatchingCard(Card.IsReleasable,tp,LOCATION_MZONE,1,nil)
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
end end
function cm.atkfilter(c) function cm.atkfilter(c)
...@@ -77,7 +79,7 @@ function cm.sumsuc(e,tp,eg,ep,ev,re,r,rp) ...@@ -77,7 +79,7 @@ function cm.sumsuc(e,tp,eg,ep,ev,re,r,rp)
e1:SetCountLimit(1) e1:SetCountLimit(1)
e1:SetCondition(cm.epcon) e1:SetCondition(cm.epcon)
e1:SetOperation(cm.activate) e1:SetOperation(cm.activate)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,c:GetControler())
end end
end end
function cm.epcon(e,tp,eg,ep,ev,re,r,rp) function cm.epcon(e,tp,eg,ep,ev,re,r,rp)
...@@ -96,14 +98,14 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -96,14 +98,14 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local e2=e1:Clone() local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE) e2:SetCode(EFFECT_UPDATE_DEFENSE)
g:RegisterEffect(e2) g:RegisterEffect(e2)
end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local cg=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil)
local cg=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil) if cg:GetCount()<1 then
if cg:GetCount()<1 then Duel.Damage(1-tp,1000,REASON_EFFECT)
Duel.Damage(1-tp,1000,REASON_EFFECT)
else else
Duel.HintSelection(cg) Duel.HintSelection(cg)
Duel.Destroy(cg,REASON_EFFECT) Duel.Destroy(cg,REASON_EFFECT)
Duel.Damage(1-tp,1000,REASON_EFFECT) Duel.Damage(1-tp,1000,REASON_EFFECT)
end
end end
end end
...@@ -4,7 +4,7 @@ local cm=_G["c"..m] ...@@ -4,7 +4,7 @@ local cm=_G["c"..m]
function cm.initial_effect(c) function cm.initial_effect(c)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW) e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
...@@ -21,8 +21,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -21,8 +21,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,1,nil) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
end end
function cm.operation(e,tp,eg,ep,ev,re,r,rp,chk) function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then if tc:IsRelateToEffect(e) then
Duel.Remove(tc,POS_FACEDOWN,REASON_EFFECT) Duel.Remove(tc,POS_FACEDOWN,REASON_EFFECT)
......
...@@ -19,9 +19,9 @@ function c47570004.initial_effect(c) ...@@ -19,9 +19,9 @@ function c47570004.initial_effect(c)
e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,47570005) e2:SetCountLimit(1,47570005)
e2:SetCondition(c47570004.descon) e2:SetCondition(c47570004.ctmcon)
e2:SetTarget(c47570004.destg) e2:SetTarget(c47570004.ctmtg)
e2:SetOperation(c47570004.desop) e2:SetOperation(c47570004.ctmop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function c47570004.condition(e,tp,eg,ep,ev,re,r,rp) function c47570004.condition(e,tp,eg,ep,ev,re,r,rp)
...@@ -51,7 +51,7 @@ function c47570004.ctmtg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -51,7 +51,7 @@ function c47570004.ctmtg(e,tp,eg,ep,ev,re,r,rp,chk)
end end
function c47570004.ctmop(e,tp,eg,ep,ev,re,r,rp) function c47570004.ctmop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,0,aux.ExceptThisCard(e)) local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,aux.ExceptThisCard(e))
if g:GetCount()>0 and Duel.Destroy(g,REASON_EFFECT)~=0 then if g:GetCount()>0 and Duel.Destroy(g,REASON_EFFECT)~=0 then
Duel.BreakEffect() Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(47570004,0)) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(47570004,0))
......
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