Commit d615bbfe authored by Nemo Ma's avatar Nemo Ma

0324 wild

parent 8c5ec0d7
......@@ -67,9 +67,9 @@
4865039 0
4865040 0
7407235 0
9912001 0
9981625 0
9990119 0
9990228 0
9990233 0
10080420 0
10100000 0
......@@ -84,6 +84,7 @@
11450903 0
11450904 0
11450905 0
11450996 0
11450997 0
11450998 0
11450999 0
......@@ -95,6 +96,11 @@
11451015 0
11451016 0
11451017 0
11451021 0
11451022 0
11451023 0
11451024 0
11451025 0
11451767 0
11513043 0
11513044 0
......@@ -127,6 +133,8 @@
11560321 0
11560322 0
11560323 0
11591111 0
11591112 0
11662004 0
12070000 0
12070001 0
......@@ -157,6 +165,9 @@
14000790 0
14000971 0
14000973 0
14010146 0
14010147 0
14010148 0
14010283 0
14010313 0
14012021 0
......@@ -167,6 +178,7 @@
15000316 0
15000317 0
15000318 0
15003062 0
15004002 0
15004003 0
15090003 0
......@@ -179,6 +191,11 @@
16200006 0
16200007 0
16200008 0
16609025 0
16670007 0
16670012 0
16670035 0
16670045 0
18155001 0
18155011 0
18155021 0
......@@ -192,15 +209,10 @@
18678558 0
19198211 0
20220679 0
21099999 0
22021680 0
22348028 0
22348134 0
25000000 0
25000001 0
25000049 0
25000104 0
25000105 0
25000403 0
27847059 0
30000001 0
30000004 0
......@@ -360,6 +372,20 @@
34500360 0
34500370 0
34500380 0
35531500 0
35531501 0
35531502 0
35531503 0
35531504 0
35531505 0
35531508 0
35531509 0
35531510 0
35531511 0
35531512 0
35531513 0
35531514 0
35531515 0
35697557 0
37818797 0
40010436 0
......@@ -463,7 +489,6 @@
46250024 0
46250025 0
49678550 0
50005205 0
50587164 0
53587967 0
53752002 0
......@@ -480,6 +505,15 @@
53796161 0
53796162 0
53796163 0
53796187 0
53796188 0
53796189 0
53796190 0
53796193 0
53796194 0
53796195 0
53796196 0
53796197 0
58510970 0
60001009 0
60001158 0
......@@ -491,18 +525,6 @@
60001164 0
60001165 0
60001166 0
60002035 0
60002036 0
60002037 0
60002038 0
60002039 0
60002040 0
60002041 0
60002042 0
60002043 0
60002044 0
60002045 0
60002046 0
60002067 0
60002068 0
60002069 0
......@@ -529,7 +551,11 @@
60002407 0
60002408 0
60002409 0
60010034 0
60010035 0
60010037 0
60303246 0
60967917 0
60969917 0
61777317 0
63288533 0
......@@ -590,6 +616,8 @@
67200823 0
67200825 0
67200827 0
70002010 0
70002012 0
70007492 0
70007493 0
70007494 0
......@@ -707,6 +735,69 @@
72100536 0
72100537 0
72100538 0
74500013 0
74500501 0
74500602 0
74500702 0
74500721 0
74501015 0
74501303 0
74501502 0
74502003 0
74502602 0
74510203 0
74512926 0
74514435 0
74514436 0
74514534 0
74514738 0
74515141 0
74515545 0
74515546 0
74515550 0
74515847 0
74515848 0
74516045 0
74516050 0
74516146 0
74516153 0
74516251 0
74516252 0
74516355 0
74516549 0
74516555 0
74516653 0
74516856 0
74516857 0
74517054 0
74517055 0
74517057 0
74517172 0
74517256 0
74520829 0
74521513 0
74529401 0
74534626 0
74536108 0
74539103 0
74541229 0
74541665 0
74542246 0
74543232 0
74546765 0
74550504 0
74552991 0
74557525 0
74566699 0
74566924 0
74569179 0
74570403 0
74571833 0
74580816 0
74585399 0
74586611 0
74590055 0
74594972 0
75001001 0
75001002 0
75001003 0
......@@ -752,14 +843,6 @@
77032564 0
77032565 0
77693530 0
77723303 0
77723304 0
77723305 0
77723387 0
77724137 0
77770002 0
77770010 0
77770015 0
79029185 0
79200001 0
79200002 0
......@@ -783,6 +866,9 @@
79200023 0
79200024 0
79200025 0
79250000 0
79250001 0
79250009 0
79783881 0
80002333 0
80250315 0
......@@ -1114,6 +1200,11 @@
88881043 0
88881044 0
88881045 0
88881085 0
88881086 0
88990322 0
88990370 0
88990374 0
89386000 0
89386001 0
89386002 0
......@@ -1134,6 +1225,8 @@
89390006 0
89390007 0
89390008 0
89410001 0
89412001 0
90351999 0
90700001 0
90700002 0
......@@ -1218,6 +1311,7 @@
90700083 0
90700084 0
90700085 0
91000005 0
92781608 0
94380880 0
95703000 0
......@@ -1279,6 +1373,7 @@
96071073 0
96071074 0
96071075 0
96100000 0
98452220 0
98730001 0
98730004 0
......@@ -1305,9 +1400,11 @@
98730417 0
98730419 0
98731001 0
98920005 0
98920032 0
98920042 0
98920093 0
98920101 0
98920114 0
98920127 0
98920146 0
......@@ -1333,29 +1430,49 @@
98920308 0
98920310 0
98920313 0
98920316 0
98920319 0
98920320 0
98920321 0
98920339 0
98920348 0
98920349 0
98920350 0
98920358 0
98920377 0
98920384 0
98920389 0
98920401 0
98920404 0
98920415 0
98920429 0
98920441 0
98920449 0
98920473 0
98920485 0
98920488 0
98920489 0
98920490 0
98920516 0
98920549 0
98920567 0
98920594 0
98920605 0
98920607 0
98920609 0
98920613 0
98920618 0
98920620 0
98920645 0
98920659 0
98920671 0
98920672 0
98920673 0
98920711 0
98920718 0
98920721 0
98920730 0
98920731 0
98940000 0
98940001 0
98940004 0
......@@ -1373,8 +1490,9 @@
98940020 0
98940026 0
98940028 0
98940029 0
98940039 0
98940044 1
98940043 0
98940045 0
98940046 0
98941000 0
......@@ -1390,6 +1508,7 @@
98941043 0
98941044 0
98941045 0
98941046 0
98941047 0
98941048 0
99550610 0
......@@ -1552,6 +1671,7 @@
130006022 0
130006023 0
130006024 0
130006050 0
130006100 0
130006101 0
130006102 0
......@@ -1566,40 +1686,6 @@
130006111 0
151194046 0
192746535 0
60967917 0
70002010 0
70002012 0
98920005 0
98920607 0
98920609 0
98940029 0
88990322 0
88990370 0
88990374 0
98920349 0
98920350 0
98920449 0
98940043 0
98941046 0
9912001 0
15000211 0
15003062 0
98920316 0
98920441 0
98920605 0
98920613 0
98920618 0
98920671 0
98920730 0
14010146 0
14010147 0
14010148 0
16670007 0
16670012 0
16670035 0
16670045 0
60010034 0
60010035 0
#Semi-Wild 1003
31409200 0
31409201 0
......
No preview for this file type
expansions/pics/98941000.jpg

85.6 KB | W: | H:

expansions/pics/98941000.jpg

37.2 KB | W: | H:

expansions/pics/98941000.jpg
expansions/pics/98941000.jpg
expansions/pics/98941000.jpg
expansions/pics/98941000.jpg
  • 2-up
  • Swipe
  • Onion skin
......@@ -20,23 +20,27 @@ function cm.initial_effect(c)
e3:SetCode(EVENT_PHASE_START+PHASE_DRAW)
e3:SetRange(LOCATION_DECK)
e3:SetOperation(cm.op2)
c:RegisterEffect(e3)
--c:RegisterEffect(e3)
local e6=e3:Clone()
e6:SetCode(EVENT_PHASE_START+PHASE_STANDBY)
c:RegisterEffect(e6)
--c:RegisterEffect(e6)
local e7=e3:Clone()
e7:SetCode(EVENT_PHASE_START+PHASE_MAIN1)
c:RegisterEffect(e7)
--c:RegisterEffect(e7)
local e8=e3:Clone()
e8:SetCode(EVENT_PHASE+PHASE_BATTLE_START)
e8:SetCondition(cm.con2)
c:RegisterEffect(e8)
--c:RegisterEffect(e8)
local e9=e3:Clone()
e9:SetCode(EVENT_PHASE_START+PHASE_MAIN2)
c:RegisterEffect(e9)
--c:RegisterEffect(e9)
local e10=e3:Clone()
e10:SetCode(EVENT_PHASE_START+PHASE_END)
c:RegisterEffect(e10)
--c:RegisterEffect(e10)
local e11=e3:Clone()
e11:SetCode(EVENT_FREE_CHAIN)
e11:SetCondition(cm.condition)
c:RegisterEffect(e11)
local e2=e1:Clone()
e2:SetDescription(aux.Stringid(m,0))
e2:SetRange(LOCATION_DECK)
......@@ -57,12 +61,13 @@ function cm.initial_effect(c)
e5:SetCode(EFFECT_SPSUMMON_PROC_G)
e5:SetRange(LOCATION_DECK)
e5:SetCondition(cm.condition)
--c:RegisterEffect(e5)
c:RegisterEffect(e5)
if not cm.global_check then
cm.global_check=true
cm.activate_sequence={}
local _GetActivateLocation=Effect.GetActivateLocation
local _GetActivateSequence=Effect.GetActivateSequence
local _NegateActivation=Duel.NegateActivation
function Effect.GetActivateLocation(e)
if e:GetDescription()==aux.Stringid(m,0) then
return LOCATION_SZONE
......@@ -75,6 +80,17 @@ function cm.initial_effect(c)
end
return _GetActivateSequence(e)
end
function Duel.NegateActivation(ev)
local re=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_EFFECT)
local res=_NegateActivation(ev)
if res and aux.GetValueType(re)=="Effect" then
local rc=re:GetHandler()
if rc and rc:IsRelateToEffect(re) and not (rc:IsOnField() and rc:IsFacedown()) and re:GetDescription()==aux.Stringid(m,0) then
rc:SetStatus(STATUS_ACTIVATE_DISABLED,true)
end
end
return res
end
end
end
function cm.actarget(e,te,tp)
......@@ -111,7 +127,7 @@ function cm.rsop(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1 and not Duel.CheckPhaseActivity()
return Duel.GetCurrentPhase()==PHASE_MAIN1 and not Duel.CheckPhaseActivity() and Duel.GetCurrentChain()==0
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
......@@ -153,13 +169,14 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,LOCATION_HAND,0)
local cp=Duel.GetCurrentPhase()
local tab={[1]=1,[2]=2,[4]=3,[8]=4,[256]=5,[512]=6}
if #g>0 and g:FilterCount(Card.IsAbleToDeckAsCost,nil)==#g and Duel.GetFlagEffect(tp,m)==0 then
if #g>0 and g:FilterCount(Card.IsAbleToDeckAsCost,nil)==#g and c:IsAbleToRemove() and Duel.GetFlagEffect(tp,m)==0 then
Duel.RegisterFlagEffect(tp,m,RESET_PHASE+Duel.GetCurrentPhase(),0,1)
if Duel.SelectYesNo(tp,aux.Stringid(m,tab[cp])) then
Duel.SendtoDeck(g,nil,2,REASON_COST)
Duel.Remove(c,POS_FACEUP,REASON_RULE)
cm.op(e,tp,eg,ep,ev,re,r,rp)
end
--if Duel.SelectYesNo(tp,aux.Stringid(m,tab[cp])) then
Duel.SendtoDeck(g,nil,2,REASON_COST)
Duel.Remove(c,POS_FACEUP,REASON_RULE)
cm.op(e,tp,eg,ep,ev,re,r,rp)
Duel.AdjustAll()
--end
end
end
function cm.drop(e,tp,eg,ep,ev,re,r,rp)
......@@ -172,5 +189,5 @@ function cm.drop(e,tp,eg,ep,ev,re,r,rp)
Duel.Readjust()
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.SetLP(tp,Duel.GetLP(tp)-300*e:GetLabel())
Duel.SetLP(tp,Duel.GetLP(tp)-2000*e:GetLabel())
end
\ No newline at end of file
local m=16609025
local cm=_G["c"..m]
cm.name="特殊模式-模仿者"
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_SSET)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PHASE_START+PHASE_DRAW)
e2:SetRange(LOCATION_DECK+LOCATION_HAND)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetCountLimit(1,m+EFFECT_COUNT_CODE_DUEL)
e2:SetCondition(cm.lmcon)
e2:SetOperation(cm.lmop)
c:RegisterEffect(e2)
end
function cm.lmcon(e)
local c=e:GetHandler()
local tp=c:GetControler()
return Duel.GetFlagEffect(0,m)==0 and not c:IsPublic()
end
function cm.lmop(e)
if Duel.GetFlagEffect(0,m)>0 then return end
Duel.RegisterFlagEffect(0,m,0,0,1)
local c=e:GetHandler()
local tp=c:GetControler()
Duel.ConfirmCards(1-tp,c)
Duel.ConfirmCards(tp,c)
if Duel.SelectOption(1-tp,aux.Stringid(m,0),aux.Stringid(m,1))==0 then
local g=Duel.GetFieldGroup(tp,0xff,0xff)
local ec=g:GetFirst()
while ec do
Duel.Exile(ec,0)
ec=g:GetNext()
end
local x=0
local y=0
while x<10 do
local l=Duel.GetRandomNumber(1,2)
local num=15000211
if l==2 then
num=16670012
end
local token=Duel.CreateToken(tp,num)
Duel.SendtoDeck(token,nil,0,0)
x=x+1
end
while y<10 do
local l=Duel.GetRandomNumber(1,2)
local num=15000211
if l==2 then
num=16670012
end
local token=Duel.CreateToken(1-tp,num)
Duel.SendtoDeck(token,nil,0,0)
y=y+1
end
Duel.BreakEffect()
Duel.ShuffleDeck(tp)
Duel.ShuffleDeck(1-tp)
local ht1=Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)
if ht1<5 then
Duel.Draw(tp,5-ht1,0)
end
local ht2=Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)
if ht2<5 then
Duel.Draw(1-tp,5-ht2,0)
end
Duel.BreakEffect()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_DRAW_COUNT)
e1:SetTargetRange(1,1)
e1:SetValue(cm.c2)
Duel.RegisterEffect(e1,0)
--ReplaceDraw
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PREDRAW)
e2:SetCondition(cm.condition)
e2:SetOperation(cm.operation)
Duel.RegisterEffect(e2,0)
end
end
function cm.c2(e)
local p=Duel.GetTurnPlayer()
local num=5-Duel.GetFieldGroupCount(p,LOCATION_HAND,0)
return num
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetTurnPlayer()
local tt=Duel.GetTurnCount(p)
return true
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetTurnPlayer()
local x=0
local l=Duel.GetRandomNumber(1,2)
while x<4 do
local num=15000211
if l==2 then
num=16670012
end
local token=Duel.CreateToken(p,num)
Duel.SendtoDeck(token,nil,0,0)
x=x+1
end
end
--灰流丽·惊奇
function c35531500.initial_effect(c)
aux.AddCodeList(c,14558127)
--sp
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetRange(LOCATION_GRAVE)
e1:SetCountLimit(1,35531500)
e1:SetTarget(c35531500.sptg)
e1:SetOperation(c35531500.spop)
c:RegisterEffect(e1)
end
function c35531500.ctfil(c,e,tp)
return (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(c35531500.espfil,tp,LOCATION_EXTRA,0,1,nil,e,tp,c:GetLevel())
end
function c35531500.espfil(c,e,tp,lv)
return c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsLevel(lv+e:GetHandler():GetLevel())
end
function c35531500.espfil2(c,e,tp,lv1,lv2)
return c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsLevel(lv1+lv2+e:GetHandler():GetLevel())
end
function c35531500.pbfil(c,e,tp,lv)
return not c:IsPublic() and c:IsLevelAbove(1) and (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and Duel.IsExistingMatchingCard(c35531500.espfil2,tp,LOCATION_EXTRA,0,1,nil,e,tp,lv,c:GetLevel())
end
function c35531500.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(c35531500.ctfil,tp,LOCATION_GRAVE,0,1,e:GetHandler(),e,tp) end
local tc=Duel.SelectMatchingCard(tp,c35531500.ctfil,tp,LOCATION_GRAVE,0,1,1,e:GetHandler(),e,tp):GetFirst()
local lv=tc:GetLevel()
local g=Group.FromCards(tc,e:GetHandler())
if Duel.IsExistingMatchingCard(c35531500.pbfil,tp,LOCATION_HAND,0,1,nil,e,tp,lv) and Duel.SelectYesNo(tp,aux.Stringid(35531500,0)) then
local pc=Duel.SelectMatchingCard(tp,c35531500.pbfil,tp,LOCATION_HAND,0,1,1,nil,e,tp,lv):GetFirst()
Duel.ConfirmCards(1-tp,pc)
Duel.ShuffleHand(tp)
lv=lv+pc:GetLevel()
end
e:SetLabel(lv)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c35531500.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local lv=e:GetLabel()
if lv and Duel.IsExistingMatchingCard(c35531500.espfil,tp,LOCATION_EXTRA,0,1,nil,e,tp,lv) then
local sc=Duel.SelectMatchingCard(tp,c35531500.espfil,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,lv):GetFirst()
Duel.SpecialSummon(sc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)
sc:CompleteProcedure()
end
end
--灰流丽·惊叹
function c35531501.initial_effect(c)
aux.AddCodeList(c,14558127)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,35531501+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c35531501.spcon)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e2:SetCountLimit(1,15531501)
e2:SetTarget(c35531501.thtg1)
e2:SetOperation(c35531501.thop1)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
--to hand
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_HAND)
e3:SetCost(c35531501.thcost2)
e3:SetTarget(c35531501.thtg2)
e3:SetOperation(c35531501.thop2)
c:RegisterEffect(e3)
end
function c35531501.spcon(e,c)
if c==nil then return true end
return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0
and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c35531501.thfilter1(c,e,tp)
if not ((c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and c:IsType(TYPE_MONSTER)) then return false end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return c:IsAbleToHand() or (ft>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false))
end
function c35531501.thtg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c35531501.thfilter1,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp) end
end
function c35531501.thop1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local g=Duel.SelectMatchingCard(tp,c35531501.thfilter1,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local tc=g:GetFirst()
if tc then
if tc:IsAbleToHand() and (not tc:IsCanBeSpecialSummoned(e,0,tp,false,false) or ft<=0 or Duel.SelectOption(tp,1190,1152)==0) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
end
function c35531501.thcost2(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_GRAVE)
e1:SetCountLimit(1)
e1:SetOperation(function(e)
Duel.SendtoHand(e:GetHandler(),nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,e:GetHandler()) end)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1,true)
end
function c35531501.thfilter2(c,e,tp)
if not ((c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and not c:IsType(TYPE_TUNER) and c:IsType(TYPE_MONSTER)) then return false end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return c:IsAbleToHand() or (ft>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false))
end
function c35531501.thtg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c35531501.thfilter2,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
end
function c35531501.thop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local g=Duel.SelectMatchingCard(tp,c35531501.thfilter2,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local tc=g:GetFirst()
if tc then
if tc:IsAbleToHand() and (not tc:IsCanBeSpecialSummoned(e,0,tp,false,false) or ft<=0 or Duel.SelectOption(tp,1190,1152)==0) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
end
--灰流丽·可爱
function c35531502.initial_effect(c)
aux.AddCodeList(c,14558127)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,35531501+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c35531502.hspcon)
c:RegisterEffect(e1)
--to deck and sp
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,15531502)
e2:SetTarget(c35531502.tgsptg)
e2:SetOperation(c35531502.tgspop)
c:RegisterEffect(e2)
end
function c35531502.cfilter(c)
return c:IsFaceup() and (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and not c:IsCode(35531502)
end
function c35531502.hspcon(e,c)
if c==nil then return true end
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and
Duel.IsExistingMatchingCard(c35531502.cfilter,c:GetControler(),LOCATION_MZONE,0,1,nil)
end
function c35531502.espfil(c,e,tp)
return c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) and (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and c:IsType(TYPE_SYNCHRO)
end
function c35531502.tgsptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGrave() and Duel.IsExistingTarget(c35531502.tdfil,tp,LOCATION_GRAVE,0,1,nil) and Duel.IsExistingMatchingCard(c35531502.espfil,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
local g=Duel.SelectTarget(tp,c35531502.tdfil,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c35531502.tgspop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,2,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) and Duel.SendtoGrave(c,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(c35531502.espfil,tp,LOCATION_EXTRA,0,1,nil,e,tp) then
local sc=Duel.SelectMatchingCard(tp,c35531502.espfil,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
Duel.SpecialSummon(sc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)
sc:CompleteProcedure()
end
end
--灰流丽·疑问
function c35531503.initial_effect(c)
aux.AddCodeList(c,14558127)
--negate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_CHAINING)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,35531503)
e1:SetCondition(c35531503.discon)
e1:SetCost(c35531503.discost)
e1:SetTarget(c35531503.distg)
e1:SetOperation(c35531503.disop)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,35531503)
e2:SetCost(c35531503.thcost)
e2:SetTarget(c35531503.thtg)
e2:SetOperation(c35531503.thop)
c:RegisterEffect(e2)
end
function c35531503.discon(e,tp,eg,ep,ev,re,r,rp)
local ex2,g2,gc2,dp2,dv2=Duel.GetOperationInfo(ev,CATEGORY_SPECIAL_SUMMON)
local ex3,g3,gc3,dp3,dv3=Duel.GetOperationInfo(ev,CATEGORY_TOGRAVE)
local ex4=re:IsHasCategory(CATEGORY_DRAW)
local ex5=re:IsHasCategory(CATEGORY_SEARCH)
local ex6=re:IsHasCategory(CATEGORY_DECKDES)
return ((ex2 and bit.band(dv2,LOCATION_DECK)==LOCATION_DECK)
or (ex3 and bit.band(dv3,LOCATION_DECK)==LOCATION_DECK)
or ex4 or ex5 or ex6) and Duel.IsChainDisablable(ev)
end
function c35531503.discost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
end
function c35531503.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
end
function c35531503.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev)
end
function c35531503.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
end
function c35531503.thfilter(c)
return (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and not c:IsCode(35531503) and c:IsAbleToHand()
end
function c35531503.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(c35531503.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c35531503.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.SelectMatchingCard(tp,c35531503.thfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst()
if tc then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--灰流丽·委屈
function c35531504.initial_effect(c)
aux.AddCodeList(c,14558127)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,35531504)
e1:SetCondition(function(e)
return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_MZONE,0)==0 end)
e1:SetCost(c35531504.spcost)
e1:SetTarget(c35531504.sptg)
e1:SetOperation(c35531504.spop)
c:RegisterEffect(e1)
end
function c35531504.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsDiscardable() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD)
end
function c35531504.spfilter(c,e,tp)
return (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c35531504.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c35531504.spfilter,tp,LOCATION_HAND,0,1,e:GetHandler(),e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c35531504.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c35531504.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
--灰流丽·咬
function c35531505.initial_effect(c)
aux.AddCodeList(c,14558127)
--deckdes
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DECKDES)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,35531505)
e1:SetCondition(c35531505.dkcon)
e1:SetTarget(c35531505.dktg)
e1:SetOperation(c35531505.dkop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,15531505)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c35531505.sptg)
e2:SetOperation(c35531505.spop)
c:RegisterEffect(e2)
--Release
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_RELEASE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_DESTROYED)
e3:SetCountLimit(1,25531505)
e3:SetCondition(c35531505.rlcon)
e3:SetTarget(c35531505.rltg)
e3:SetOperation(c35531505.rlop)
c:RegisterEffect(e3)
end
function c35531505.dkcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_HAND+LOCATION_DECK)
end
function c35531505.dktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,3) and Duel.IsPlayerCanDiscardDeck(1-tp,3) end
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,PLAYER_ALL,3)
end
function c35531505.dkop(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetDecktopGroup(tp,3)
local g2=Duel.GetDecktopGroup(1-tp,3)
g1:Merge(g2)
Duel.DisableShuffleCheck()
Duel.SendtoGrave(g1,REASON_EFFECT)
end
function c35531505.spfilter(c,e,tp)
return (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and not c:IsCode(35531505) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c35531505.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c35531505.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c35531505.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c35531505.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c35531505.rlcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_EFFECT) and rp==1-tp and c:IsPreviousControler(tp)
end
function c35531505.rltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsReleasableByEffect,tp,0,LOCATION_MZONE,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_RELEASE,nil,1,1-tp,LOCATION_MZONE)
end
function c35531505.rlop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,Card.IsReleasableByEffect,tp,0,LOCATION_MZONE,1,1,nil)
if g:GetCount()>0 then
Duel.Release(g,REASON_EFFECT)
end
end
--灰流丽·欺负小蓝
function c35531508.initial_effect(c)
aux.AddCodeList(c,14558127)
--Synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--deckdes
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DECKDES+CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,35531508)
e1:SetCondition(function(e)
return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO) end)
e1:SetTarget(c35531508.ddtg)
e1:SetOperation(c35531508.ddop)
c:RegisterEffect(e1)
--to hand
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,15531508)
e1:SetCost(c35531508.srcost)
e1:SetTarget(c35531508.srtg)
e1:SetOperation(c35531508.srop)
c:RegisterEffect(e1)
end
function c35531508.ddtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,2) end
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,2)
end
function c35531508.thfil(c)
return (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and c:IsAbleToHand()
end
function c35531508.ddop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.DiscardDeck(tp,2,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(c35531508.thfil,tp,LOCATION_DECK,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(35531508,0)) then
Duel.BreakEffect()
local sc=Duel.SelectMatchingCard(tp,c35531508.thfil,tp,LOCATION_DECK,0,1,1,nil):GetFirst()
Duel.SendtoHand(sc,tp,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sc)
end
end
function c35531508.srcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c35531508.thgck(g)
return g:FilterCount(Card.IsLocation,nil,LOCATION_GRAVE)==1
and g:FilterCount(Card.IsLocation,nil,LOCATION_DECK)==1
end
function c35531508.srtg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c35531508.thfil,tp,LOCATION_DECK+LOCATION_GRAVE,0,nil)
if chk==0 then return g:CheckSubGroup(c35531508.thgck,2,2) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c35531508.srop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(c35531508.thfil,tp,LOCATION_DECK+LOCATION_GRAVE,0,nil)
if g:CheckSubGroup(c35531508.thgck,2,2) then
local sg=g:SelectSubGroup(tp,c35531508.thgck,false,2,2)
Duel.SendtoHand(sg,tp,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
end
--灰流丽·带上手铐
function c35531509.initial_effect(c)
aux.AddCodeList(c,14558127)
--Synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--lv
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(35531509,1))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,35531509)
e1:SetTarget(c35531509.lvtg)
e1:SetOperation(c35531509.lvop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(35531509,2))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,15531509)
e2:SetCost(c35531509.spcost)
e2:SetTarget(c35531509.sptg)
e2:SetOperation(c35531509.spop)
c:RegisterEffect(e2)
--des
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_BE_MATERIAL)
e3:SetCountLimit(1,25531509)
e3:SetCondition(c35531509.descon)
e3:SetTarget(c35531509.destg)
e3:SetOperation(c35531509.desop)
c:RegisterEffect(e3)
end
function c35531509.pbfil(c)
return not c:IsPublic() and c:IsAttribute(ATTRIBUTE_FIRE)
end
function c35531509.lvtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c35531509.pbfil,tp,LOCATION_HAND,0,1,nil) end
local tc=Duel.SelectMatchingCard(tp,c35531509.pbfil,tp,LOCATION_HAND,0,1,1,nil):GetFirst()
Duel.ConfirmCards(1-tp,tc)
e:SetLabel(tc:GetLevel())
Duel.ShuffleHand(tp)
end
function c35531509.lvop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local lv=e:GetLabel()
if lv and c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(-lv)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
end
end
function c35531509.ctfil(c)
return c:IsAbleToHandAsCost() and (c:IsCode(14558127) or aux.IsCodeListed(c,14558127))
end
function c35531509.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c35531509.ctfil,tp,LOCATION_DECK+LOCATION_GRAVE,0,2,nil) end
local g=Duel.SelectMatchingCard(tp,c35531509.ctfil,tp,LOCATION_DECK+LOCATION_GRAVE,0,2,2,nil)
Duel.SendtoHand(g,nil,REASON_COST)
end
function c35531509.spfilter(c,e,tp)
return c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function c35531509.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c35531509.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c35531509.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c35531509.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
end
function c35531509.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_GRAVE) and r==REASON_SYNCHRO
end
function c35531509.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c35531509.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
--灰流丽·选择困难症
function c35531510.initial_effect(c)
aux.AddCodeList(c,14558127)
--Synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--negate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,35531510)
e1:SetTarget(c35531510.negtg)
e1:SetOperation(c35531510.negop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,15531510)
e2:SetCost(c35531510.spcost)
e2:SetTarget(c35531510.sptg)
e2:SetOperation(c35531510.spop)
c:RegisterEffect(e2)
end
function c35531510.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0)
end
function c35531510.negop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_ATTACK)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e3)
end
end
function c35531510.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c35531510.spfilter(c,e,tp,mc)
return c:IsLevelBelow(9) and aux.IsCodeListed(c,14558127) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0
end
function c35531510.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c35531510.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,nil) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c35531510.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=Duel.SelectMatchingCard(tp,c35531510.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,nil):GetFirst()
if tc then
if Duel.SpecialSummonStep(tc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP) then
tc:CompleteProcedure()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_ADD_TYPE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(TYPE_TUNER)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
Duel.SpecialSummonComplete()
end
end
--灰流丽·为什么会有墓指这种东西
function c35531511.initial_effect(c)
aux.AddCodeList(c,14558127)
--Synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(function(c) return c:IsAttribute(ATTRIBUTE_FIRE) and c:IsRace(RACE_ZOMBIE) end),2)
c:EnableReviveLimit()
--remove
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,35531511)
e1:SetTarget(c35531511.rmtg)
e1:SetOperation(c35531511.rmop)
c:RegisterEffect(e1)
--damage
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c35531511.damcon)
e2:SetOperation(c35531511.damop)
c:RegisterEffect(e2)
--negate
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,15531511)
e2:SetCondition(c35531511.discon)
e2:SetTarget(c35531511.distg)
e2:SetOperation(c35531511.disop)
c:RegisterEffect(e2)
end
function c35531511.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
local x=Duel.GetMatchingGroupCount(function(c) return (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) end,tp,LOCATION_GRAVE,0,nil)
if chk==0 then return x>0 and Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,x,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),nil,LOCATION_ONFIELD)
end
function c35531511.rmop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if g:GetCount()>0 then
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
end
function c35531511.cfilter(c,tp)
return c:IsSummonPlayer(1-tp)
end
function c35531511.damcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return eg:IsExists(c35531511.cfilter,1,nil,tp)
end
function c35531511.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,35531511)
Duel.Damage(1-tp,500,REASON_EFFECT)
end
function c35531511.discon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev)
end
function c35531511.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function c35531511.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
end
--被欺负的灰流丽
function c35531512.initial_effect(c)
aux.AddCodeList(c,14558127)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,35531512+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c35531512.condition)
e1:SetTarget(c35531512.target)
e1:SetOperation(c35531512.activate)
c:RegisterEffect(e1)
end
function c35531512.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(function(c) return c:IsFaceup() and (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) end,tp,LOCATION_MZONE,0,1,nil)
end
function c35531512.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,35531513,0,TYPES_TOKEN_MONSTER,0,1800,3,RACE_ZOMBIE,ATTRIBUTE_FIRE,POS_FACEUP) end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
end
function c35531512.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,35531513,0,TYPES_TOKEN_MONSTER,0,1800,3,RACE_ZOMBIE,ATTRIBUTE_FIRE,POS_FACEUP) then return end
local token=Duel.CreateToken(tp,35531513)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP)
end
--查询着的灰流丽
function c35531514.initial_effect(c)
aux.AddCodeList(c,14558127)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,35531514+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c35531514.target)
e1:SetOperation(c35531514.activate)
c:RegisterEffect(e1)
end
function c35531514.filter(c)
return c:IsType(TYPE_MONSTER) and (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and c:IsAbleToGrave()
end
function c35531514.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c35531514.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end
function c35531514.thfilter(c)
return c:IsRace(RACE_ZOMBIE) and c:IsAttribute(ATTRIBUTE_FIRE) and c:IsAbleToHand()
end
function c35531514.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c35531514.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 and Duel.SendtoGrave(g,REASON_EFFECT)~=0 and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=3 and Duel.SelectYesNo(tp,aux.Stringid(35531514,0)) then
Duel.ConfirmDecktop(tp,3)
local g=Duel.GetDecktopGroup(tp,3)
if g:GetCount()>0 and g:IsExists(c35531514.thfilter,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(35531514,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:FilterSelect(tp,c35531514.thfilter,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
Duel.ShuffleHand(tp)
end
Duel.ShuffleDeck(tp)
end
end
--被破坏轮惩罚的灰流丽
function c35531515.initial_effect(c)
aux.AddCodeList(c,14558127)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c35531515.cost)
c:RegisterEffect(e1)
--to grave
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(35531515,1))
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_SZONE)
e1:SetCountLimit(1)
e1:SetLabel(1)
e1:SetCondition(c35531515.effcon)
e1:SetTarget(c35531515.tgtg)
e1:SetOperation(c35531515.tgop)
c:RegisterEffect(e1)
--SpecialSummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(35531515,2))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetLabel(3)
e2:SetCondition(c35531515.effcon)
e2:SetTarget(c35531515.sptg)
e2:SetOperation(c35531515.spop)
c:RegisterEffect(e2)
--SpecialSummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(35531515,3))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetLabel(5)
e2:SetCondition(c35531515.effcon)
e2:SetTarget(c35531515.esptg)
e2:SetOperation(c35531515.espop)
c:RegisterEffect(e2)
end
function c35531515.ctfil(c)
return c:IsAbleToRemoveAsCost() and (c:IsCode(14558127) or aux.IsCodeListed(c,14558127))
end
function c35531515.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c35531515.ctfil,tp,LOCATION_GRAVE,0,1,nil) end
local g=Duel.SelectMatchingCard(tp,c35531515.ctfil,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c35531515.effcon(e)
local tp=e:GetHandlerPlayer()
return Duel.GetMatchingGroupCount(function(c) return (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) end,tp,LOCATION_GRAVE,0,nil)>=e:GetLabel()
end
function c35531515.tgfil(c)
return (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave()
end
function c35531515.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c35531515.tgfil,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end
function c35531515.tgop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c35531515.tgfil,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
function c35531515.spfil(c,e,tp)
return (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c35531515.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c35531515.spfil,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function c35531515.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c35531515.spfil,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c35531515.tdfil(c)
return c:IsAbleToDeckOrExtraAsCost() and (c:IsCode(14558127) or aux.IsCodeListed(c,14558127)) and c:IsLevelAbove(1)
end
function c35531515.espfil(c,e,tp,g)
return c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) and c:IsLevel(g:GetSum(Card.GetLevel)) and aux.IsCodeListed(c,14558127) and c:IsType(TYPE_SYNCHRO)
end
function c35531515.tdgck(g,e,tp)
return g:FilterCount(function(c) return c:IsType(TYPE_TUNER) end,nil)==1
and g:FilterCount(function(c) return not c:IsType(TYPE_TUNER) end,nil)==1
and Duel.IsExistingMatchingCard(c35531515.espfil,tp,LOCATION_EXTRA,0,1,nil,e,tp,g)
end
function c35531515.esptg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c35531515.tdfil,tp,LOCATION_GRAVE,0,nil)
if chk==0 then return g:CheckSubGroup(c35531515.tdgck,2,2,e,tp) end
local sg=g:SelectSubGroup(tp,c35531515.tdgck,false,2,2,e,tp)
sg:KeepAlive()
e:SetLabelObject(sg)
Duel.SendtoDeck(sg,nil,2,REASON_COST)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c35531515.espop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=e:GetLabelObject()
if g:GetCount()>0 and Duel.IsExistingMatchingCard(c35531515.espfil,tp,LOCATION_EXTRA,0,1,nil,e,tp,g) then
local sc=Duel.SelectMatchingCard(tp,c35531515.espfil,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,g):GetFirst()
Duel.SpecialSummon(sc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)
sc:CompleteProcedure()
end
end
if not require and dofile then function require(str) return dofile(str..".lua") end end
if not pcall(function() require("expansions/script/c53702500") end) then require("script/c53702500") end
local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,53796195)
c:EnableReviveLimit()
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(function(e,se,sp,st)return se==e:GetLabelObject() and Duel.GetFlagEffect(e:GetHandlerPlayer(),id)==0 end)
c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,12))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_EXTRA)
e1:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e1:SetHintTiming(0,TIMING_DRAW_PHASE+TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCondition(s.spcon)
e1:SetCost(s.spcost)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
e0:SetLabelObject(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SUMMON_COST)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(0xff,0xff)
e2:SetLabel(0)
e2:SetCondition(s.costcon)
e2:SetOperation(s.costop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EFFECT_SPSUMMON_COST)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,13))
e4:SetCategory(CATEGORY_TODECK+CATEGORY_TOGRAVE)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_CUSTOM+id)
e4:SetRange(LOCATION_MZONE)
e4:SetLabel(0)
e4:SetCondition(s.tgcon)
e4:SetTarget(s.tgtg)
c:RegisterEffect(e4)
e2:SetLabelObject(e4)
e3:SetLabelObject(e4)
local g=Group.CreateGroup()
g:KeepAlive()
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e5:SetCode(EVENT_SUMMON_SUCCESS)
e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e5:SetRange(LOCATION_MZONE)
e5:SetOperation(s.MergedDelayEventCheck1(g,e2,e3,e4))
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e6)
local e7=e5:Clone()
e7:SetCode(EVENT_CHAIN_END)
e7:SetOperation(s.MergedDelayEventCheck2(g,e2,e3,e4))
c:RegisterEffect(e7)
local e8=Effect.CreateEffect(c)
e8:SetType(EFFECT_TYPE_FIELD)
e8:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
e8:SetCode(id)
e8:SetRange(LOCATION_MZONE)
e8:SetTargetRange(1,1)
c:RegisterEffect(e8)
if not s.global_check then
s.global_check=true
if c53796195 and not c53796195[0] then
c53796195[0]={}
c53796195[1]={}
end
local f1=aux.PendOperation
aux.PendOperation=function()
local func1=f1()
local func2=func1
func2=function(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
local res=func1(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
if Duel.IsPlayerAffectedByEffect(0,id) then s.pendcount=#sg end
return res
end
return func2
end
local f2=Duel.SpecialSummon
Duel.SpecialSummon=function(tg,...)
if Duel.IsPlayerAffectedByEffect(0,id) then if aux.GetValueType(tg)=="Card" then s.pendcount=1 else s.pendcount=#tg end end
local ct=f2(tg,...)
s.pendcount=0 s.pendcheck=0
return ct
end
end
end
s.pendcount=0
s.pendcheck=0
function s.MergedDelayEventCheck1(g,e2,e3,e4)
return function(e,tp,eg,ep,ev,re,r,rp)
g:Merge(eg)
if Duel.GetCurrentChain()==0 and not Duel.CheckEvent(EVENT_CHAIN_END) then
local _eg=g:Clone()
local t=SNNM.Remove(SNNM.Merged({e2:GetLabel()},{e3:GetLabel()}),0)
if #t>0 then e4:SetLabel(table.unpack(t)) Duel.RaiseEvent(Group.__add(_eg,e:GetHandler()),EVENT_CUSTOM+id,re,r,rp,ep,ev) end
e2:SetLabel(0) e3:SetLabel(0)
g:Clear()
end
end
end
function s.MergedDelayEventCheck2(g,e2,e3,e4)
return function(e,tp,eg,ep,ev,re,r,rp)
if #g>0 then
local _eg=g:Clone()
local t=SNNM.Remove(SNNM.Merged({e2:GetLabel()},{e3:GetLabel()}),0)
if #t>0 then e4:SetLabel(table.unpack(t)) Duel.RaiseEvent(Group.__add(_eg,e:GetHandler()),EVENT_CUSTOM+id,re,r,rp,ep,ev) end
e2:SetLabel(0) e3:SetLabel(0)
g:Clear()
end
end
end
function s.cfilter(c)
return c:IsCode(53796195) and c:IsFaceup()
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_EXTRA,0,1,nil)
end
function s.spcfilter(c,e,tp)
return c:IsFaceup() and c:IsAbleToExtraAsCost() and Duel.GetLocationCountFromEx(tp,tp,c,e:GetHandler()) and (aux.IsCodeListed(c,53796195) or c:IsType(0x40))
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.spcfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,s.spcfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
Duel.SendtoDeck(g,nil,REASON_COST)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 then return end
c:CompleteProcedure()
Duel.RegisterFlagEffect(tp,id,RESET_PHASE+SNNM.GetCurrentPhase(),0,1)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetTargetRange(LOCATION_ONFIELD,0)
e1:SetValue(s.efilter)
e1:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e1,tp)
end
function s.efilter(e,te,c)
if te:GetHandlerPlayer()==e:GetHandlerPlayer() or not te:IsActivated() then return false end
if not te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return true end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
return not g or not g:IsContains(c)
end
function s.costcon(e)
return Duel.IsExistingMatchingCard(Card.IsFacedown,e:GetHandlerPlayer(),LOCATION_REMOVED,0,1,nil)
end
function s.costop(e,tp,eg,ep,ev,re,r,rp)
local p=e:GetHandlerPlayer()
local e1=e:GetLabelObject()
local check=true
if e:GetHandler():IsHasEffect(EFFECT_CANNOT_TRIGGER) then check=false end
local p=e:GetHandlerPlayer()
local le1={Duel.IsPlayerAffectedByEffect(p,EFFECT_CANNOT_ACTIVATE)}
for _,v in pairs(le1) do
local val=v:GetValue()
if aux.GetValueType(val)=="number" or val(v,e1,p) then check=false end
end
local le2={Duel.IsPlayerAffectedByEffect(p,EFFECT_ACTIVATE_COST)}
for _,v in pairs(le2) do
local cost=v:GetCost()
if cost and not cost(v,e1,p) then
local tg=v:GetTarget()
if not tg or tg(v,e1,p) then check=false end
end
end
if tp==p or not check then s.pendcount=0 s.pendcheck=0 return end
if s.pendcheck==0 then s.pendcount=(s.pendcount>0 and s.pendcount) or 1 end
if s.pendcount>0 and s.pendcheck==0 then
s.pendcheck=s.pendcount-1
local g=Duel.GetMatchingGroup(aux.AND(Card.IsFacedown,Card.IsAbleToDeck),p,LOCATION_REMOVED,0,nil)
if g:GetClassCount(Card.GetCode)>=s.pendcount and Duel.SelectEffectYesNo(p,e:GetHandler(),aux.Stringid(id,s.pendcount-1)) then
local ag=Group.CreateGroup()
local codes={}
for c in aux.Next(g) do
local code=c:GetCode()
if not ag:IsExists(Card.IsCode,1,nil,code) then
ag:AddCard(c)
table.insert(codes,code)
end
end
table.sort(codes)
local ct=#codes
local nt={codes[1],OPCODE_ISCODE}
if ct>1 then
for i=2,ct do
table.insert(nt,codes[i])
table.insert(nt,OPCODE_ISCODE)
table.insert(nt,OPCODE_OR)
end
end
local t={}
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_CODE)
while s.pendcount>0 and ct>0 do
local ac=Duel.AnnounceCard(p,table.unpack(nt))
table.insert(t,ac)
table.insert(nt,ac)
table.insert(nt,OPCODE_ISCODE)
table.insert(nt,OPCODE_NOT)
table.insert(nt,OPCODE_AND)
ct=ct-1
s.pendcount=s.pendcount-1
end
if e:GetLabel()==0 then e:SetLabel(table.unpack(t)) else e:SetLabel(table.unpack(SNNM.Merged({e:GetLabel()},t))) end
end
s.pendcount=0
end
end
function s.tgcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) and eg:IsContains(e:GetHandler())
end
function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
local t={e:GetLabel()}
local table=t
if chk==0 then return true end
e:SetOperation(s.tgop(table))
local g=eg:Filter(Card.IsSummonPlayer,nil,1-tp)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_REMOVED)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,g:GetCount(),0,0)
end
function s.tdfilter(c,t,g)
return c:IsFacedown() and c:IsCode(table.unpack(t)) and g:IsExists(Card.IsCode,1,nil,c:GetCode()) and c:IsAbleToDeck()
end
function s.tgop(t)
return function(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetTargetsRelateToChain():Filter(Card.IsFaceup,nil)
local tdg=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_REMOVED,0,nil,t,g)
if #tdg>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local sg=tdg:SelectSubGroup(tp,aux.dncheck,false,1,#g)
if sg then
Duel.ConfirmCards(1-tp,sg)
local tg=g:Filter(function(c,sg)return sg:IsExists(Card.IsCode,1,nil,c:GetCode())end,nil,sg)
if Duel.SendtoDeck(sg,nil,2,REASON_EFFECT)~=0 and sg:IsExists(Card.IsLocation,1,nil,LOCATION_DECK+LOCATION_EXTRA) then Duel.SendtoGrave(tg,REASON_RULE) end
end
end
if c53796195 and not SNNM.AllExist(c53796195[tp],t) and Duel.SelectYesNo(tp,aux.Stringid(id,14)) then SNNM.Merge(c53796195[tp],t) end
e:SetOperation(nil)
end
end
if not require and dofile then function require(str) return dofile(str..".lua") end end
if not pcall(function() require("expansions/script/c53702500") end) then require("script/c53702500") end
local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,53796195)
c:EnableReviveLimit()
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(function(e,se,sp,st)return se==e:GetLabelObject() and Duel.GetFlagEffect(e:GetHandlerPlayer(),id)==0 end)
c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,12))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_EXTRA)
e1:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e1:SetHintTiming(0,TIMING_DRAW_PHASE+TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCondition(s.spcon)
e1:SetCost(s.spcost)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
e0:SetLabelObject(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EFFECT_SEND_REPLACE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetRange(LOCATION_MZONE)
e2:SetTarget(s.reptg)
e2:SetValue(s.repval)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,13))
e3:SetCategory(CATEGORY_TODECK+CATEGORY_REMOVE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_CUSTOM+id)
e3:SetRange(LOCATION_MZONE)
e3:SetLabel(0)
e3:SetCondition(s.rmcon)
e3:SetTarget(s.rmtg)
c:RegisterEffect(e3)
e2:SetLabelObject(e3)
local g=Group.CreateGroup()
g:KeepAlive()
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetRange(LOCATION_MZONE)
e4:SetOperation(s.MergedDelayEventCheck1(g,e2,e3))
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetCode(EVENT_CHAIN_END)
e5:SetOperation(s.MergedDelayEventCheck2(g,e2,e3))
c:RegisterEffect(e5)
if not s.global_check then
s.global_check=true
if c53796195 and not c53796195[0] then
c53796195[0]={}
c53796195[1]={}
end
end
end
function s.MergedDelayEventCheck1(g,e2,e3)
return function(e,tp,eg,ep,ev,re,r,rp)
g:Merge(eg)
if Duel.GetCurrentChain()==0 and not Duel.CheckEvent(EVENT_CHAIN_END) then
local _eg=g:Clone()
local t=SNNM.Remove({e2:GetLabel()},0)
if #t>0 then e3:SetLabel(table.unpack(t)) Duel.RaiseEvent(Group.__add(_eg,e:GetHandler()),EVENT_CUSTOM+id,re,r,rp,ep,ev) end
e2:SetLabel(0)
g:Clear()
end
end
end
function s.MergedDelayEventCheck2(g,e2,e3)
return function(e,tp,eg,ep,ev,re,r,rp)
if #g>0 then
local _eg=g:Clone()
local t=SNNM.Remove({e2:GetLabel()},0)
if #t>0 then e3:SetLabel(table.unpack(t)) Duel.RaiseEvent(Group.__add(_eg,e:GetHandler()),EVENT_CUSTOM+id,re,r,rp,ep,ev) end
e2:SetLabel(0) e3:SetLabel(0)
g:Clear()
end
end
end
function s.cfilter(c)
return c:IsCode(53796195) and c:IsFaceup()
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_EXTRA,0,1,nil)
end
function s.spcfilter(c,e,tp)
return c:IsFaceup() and c:IsAbleToExtraAsCost() and Duel.GetLocationCountFromEx(tp,tp,c,e:GetHandler()) and (aux.IsCodeListed(c,53796195) or c:IsType(TYPE_LINK))
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.spcfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,s.spcfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
Duel.SendtoDeck(g,nil,REASON_COST)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 then return end
c:CompleteProcedure()
Duel.RegisterFlagEffect(tp,id,RESET_PHASE+SNNM.GetCurrentPhase(),0,1)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetTargetRange(LOCATION_REMOVED,0)
e1:SetValue(s.efilter)
e1:SetReset(RESET_PHASE+SNNM.GetCurrentPhase())
Duel.RegisterEffect(e1,tp)
end
function s.efilter(e,te,c)
return te:GetHandlerPlayer()~=e:GetHandlerPlayer()
end
function s.repfilter(c,tp)
return c:IsControler(1-tp) and c:GetDestination()==LOCATION_GRAVE and c:IsAbleToRemove(tp,POS_FACEDOWN)
end
function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local repg=eg:Filter(s.repfilter,nil,tp)
local gct=#repg
local g=Duel.GetMatchingGroup(aux.AND(Card.IsFacedown,Card.IsAbleToDeck),e:GetHandlerPlayer(),LOCATION_REMOVED,0,nil)
local e1=e:GetLabelObject()
local check=true
if e:GetHandler():IsHasEffect(EFFECT_CANNOT_TRIGGER) then check=false end
local p=e:GetHandlerPlayer()
local le1={Duel.IsPlayerAffectedByEffect(p,EFFECT_CANNOT_ACTIVATE)}
for _,v in pairs(le1) do
local val=v:GetValue()
if aux.GetValueType(val)=="number" or val(v,e1,p) then check=false end
end
local le2={Duel.IsPlayerAffectedByEffect(p,EFFECT_ACTIVATE_COST)}
for _,v in pairs(le2) do
local cost=v:GetCost()
if cost and not cost(v,e1,p) then
local tg=v:GetTarget()
if not tg or tg(v,e1,p) then check=false end
end
end
if chk==0 then return gct>0 and g:GetClassCount(Card.GetCode)>=gct and check end
local sel=gct-1
if sel>10 then sel=10 end
if Duel.SelectEffectYesNo(tp,e:GetHandler(),aux.Stringid(id,sel)) then
local ag=Group.CreateGroup()
local codes={}
for c in aux.Next(g) do
local code=c:GetCode()
if not ag:IsExists(Card.IsCode,1,nil,code) then
ag:AddCard(c)
table.insert(codes,code)
end
end
table.sort(codes)
local ct=#codes
local nt={codes[1],OPCODE_ISCODE}
if ct>1 then
for i=2,ct do
table.insert(nt,codes[i])
table.insert(nt,OPCODE_ISCODE)
table.insert(nt,OPCODE_OR)
end
end
local t={}
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_CODE)
while gct>0 and ct>0 do
local ac=Duel.AnnounceCard(p,table.unpack(nt))
table.insert(t,ac)
table.insert(nt,ac)
table.insert(nt,OPCODE_ISCODE)
table.insert(nt,OPCODE_NOT)
table.insert(nt,OPCODE_AND)
ct=ct-1
gct=gct-1
end
if e:GetLabel()==0 then e:SetLabel(table.unpack(t)) else e:SetLabel(table.unpack(SNNM.Merged({e:GetLabel()},t))) end
end
return false
end
function s.repval(e,c)
return false
end
function s.rmcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsPreviousControler,1,nil,1-tp) and eg:IsContains(e:GetHandler())
end
function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local t={e:GetLabel()}
local table=t
if chk==0 then return true end
e:SetOperation(s.rmop(table))
local g=eg:Filter(Card.IsPreviousControler,nil,1-tp)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_REMOVED)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),0,0)
end
function s.tdfilter(c,t,g)
return c:IsFacedown() and c:IsCode(table.unpack(t)) and g:IsExists(Card.IsCode,1,nil,c:GetCode()) and c:IsAbleToDeck()
end
function s.rmop(t)
return function(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetTargetsRelateToChain():Filter(Card.IsAbleToRemove,nil,tp,POS_FACEDOWN)
local tdg=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_REMOVED,0,nil,t,g)
if #tdg>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local sg=tdg:SelectSubGroup(tp,aux.dncheck,false,1,#g)
if sg then
Duel.ConfirmCards(1-tp,sg)
local tg=g:Filter(function(c,sg)return sg:IsExists(Card.IsCode,1,nil,c:GetCode())end,nil,sg)
if Duel.SendtoDeck(sg,nil,2,REASON_EFFECT)~=0 and sg:IsExists(Card.IsLocation,1,nil,LOCATION_DECK+LOCATION_EXTRA) then Duel.Remove(tg,POS_FACEDOWN,REASON_EFFECT) end
end
end
if c53796195 and SNNM.Intersection(t,c53796195[tp]) and Duel.SelectYesNo(tp,aux.Stringid(id,14)) then SNNM.Merge(c53796195[tp],t) end
e:SetOperation(nil)
end
end
if not require and dofile then function require(str) return dofile(str..".lua") end end
if not pcall(function() require("expansions/script/c53702500") end) then require("script/c53702500") end
local s,id,o=GetID()
s.alc_taisa=true
function s.initial_effect(c)
aux.AddCodeList(c,53796195)
aux.EnablePendulumAttribute(c)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_FIELD)
e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
e0:SetCode(id)
e0:SetRange(LOCATION_HAND+LOCATION_DECK)
e0:SetTargetRange(1,0)
c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_DRAW_PHASE+TIMING_STANDBY_PHASE+TIMINGS_CHECK_MONSTER+TIMING_MAIN_END+TIMING_END_PHASE)
e1:SetRange(LOCATION_HAND+LOCATION_DECK)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)return #(s[tp])>0 end)
e1:SetCost(s.cost)
e1:SetTarget(s.tg)
e1:SetOperation(s.op)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_END)
e2:SetRange(LOCATION_EXTRA)
e2:SetOperation(s.regop)
c:RegisterEffect(e2)
if not s.global_check then
s.global_check=true
if not s[0] then
s[0]={}
s[1]={}
end
local ge1=Effect.GlobalEffect()
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAINING)
ge1:SetOperation(s.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_SOLVING)
ge2:SetOperation(s.count)
Duel.RegisterEffect(ge2,0)
local ge3=Effect.GlobalEffect()
ge3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge3:SetCode(EFFECT_SEND_REPLACE)
ge3:SetTarget(s.reptg)
ge3:SetValue(s.repval)
Duel.RegisterEffect(ge3,0)
local roll=Duel.GetFieldGroup(0,0x3,0x41):GetSum(Card.GetCode)
local A=1103515245
local B=12345
local M=32767
function s.roll(min,max)
min=tonumber(min)
max=tonumber(max)
roll=((roll*A+B)%M)/M
if min~=nil then
if max==nil then
return math.floor(roll*min)+1
else
max=max-min+1
return math.floor(roll*max+min)
end
end
return roll
end
local f1=Card.IsAbleToDeckAsCost
Card.IsAbleToDeckAsCost=function(sc)
local ct=sc:GetFlagEffectLabel(id) or 0
if ct&(TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ+TYPE_LINK)~=0 then return false else return f1(sc) end
end
local f2=Card.IsAbleToExtra
Card.IsAbleToExtra=function(sc)
local ct=sc:GetFlagEffectLabel(id)
if ct and ct&(TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ+TYPE_LINK+TYPE_PENDULUM)==0 then return false else return f2(sc) end
end
local f3=Card.IsAbleToExtraAsCost
Card.IsAbleToExtraAsCost=function(sc)
local ct=sc:GetFlagEffectLabel(id)
if ct and ct&(TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ+TYPE_LINK)==0 then return false else return f3(sc) end
end
local f4=Card.IsAbleToHandAsCost
Card.IsAbleToHandAsCost=function(sc)
local ct=sc:GetFlagEffectLabel(id) or 0
if ct&(TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ+TYPE_LINK)~=0 then return false else return f4(sc) end
end
local f5=Card.IsSSetable
Card.IsSSetable=function(sc,...)
local ct=sc:GetFlagEffectLabel(id)
if ct and ct&(TYPE_SPELL+TYPE_TRAP)==0 then return false else return f5(sc,...) end
end
local f6=Card.IsCanBeSpecialSummoned
Card.IsCanBeSpecialSummoned=function(sc,...)
local ct=sc:GetFlagEffectLabel(id)
if ct and ct&(TYPE_MONSTER)==0 then return false else return f6(sc,...) end
end
local f7=Card.CheckEquipTarget
Card.CheckEquipTarget=function(sc,...)
local ct=sc:GetFlagEffectLabel(id)
if ct then return false else return f7(sc,...) end
end
local f8=Duel.IsPlayerCanSummon
Duel.IsPlayerCanSummon=function(tp,type,sc)
local ct=sc:GetFlagEffectLabel(id)
if ct then return false else return f8(tp,type,sc) end
end
local f9=Duel.IsPlayerCanMSet
Duel.IsPlayerCanMSet=function(tp,type,sc)
local ct=sc:GetFlagEffectLabel(id)
if ct then return false else return f9(tp,type,sc) end
end
local f10=Duel.IsPlayerCanSSet
Duel.IsPlayerCanSSet=function(tp,sc)
local ct=sc:GetFlagEffectLabel(id)
if ct then return false else return f10(tp,sc) end
end
local f11=Duel.IsPlayerCanSpecialSummon
Duel.IsPlayerCanSpecialSummon=function(p,type,pos,tp,sc)
local ct=sc:GetFlagEffectLabel(id)
if ct then return false else return f11(p,type,pos,tp,sc) end
end
local funcs={}
local fnames={"SendtoGrave","Destroy","SendtoHand","SendtoExtraP","SendtoDeck","Overlay","SpecialSummon","SpecialSummonStep","MoveToField","ReturnToField","Summon","MSet","SSet","Equip"}
for k,v in ipairs(fnames) do
funcs[v]=Duel[v]
if k==1 then
Duel[v]=function(tg,reason)
if reason&REASON_RULE~=0 then
tg=Group.__add(tg,tg)
for tc in aux.Next(tg) do
local ct=tc:GetFlagEffectLabel(id+250) or 0
if ct>0 then tc:SetEntityCode(ct) tc:ReplaceEffect(ct,0,0) end
end
end
return funcs[v](tg,reason)
end
elseif k==2 then
Duel[v]=function(tg,reason,...)
if reason&REASON_RULE~=0 then
tg=Group.__add(tg,tg)
for tc in aux.Next(tg) do
local ct=tc:GetFlagEffectLabel(id+250) or 0
if ct>0 then tc:SetEntityCode(ct) tc:ReplaceEffect(ct,0,0) end
end
end
return funcs[v](tg,reason,...)
end
elseif k<5 then
Duel[v]=function(tg,tp,reason)
if reason&REASON_RULE~=0 then
tg=Group.__add(tg,tg)
for tc in aux.Next(tg) do
local ct=tc:GetFlagEffectLabel(id+250) or 0
if ct>0 then tc:SetEntityCode(ct) tc:ReplaceEffect(ct,0,0) end
end
end
return funcs[v](tg,tp,reason)
end
elseif k==5 then
Duel[v]=function(tg,tp,seq,reason)
if reason&REASON_RULE~=0 then
tg=Group.__add(tg,tg)
for tc in aux.Next(tg) do
local ct=tc:GetFlagEffectLabel(id+250) or 0
if ct>0 then tc:SetEntityCode(ct) tc:ReplaceEffect(ct,0,0) end
end
end
return funcs[v](tg,tp,seq,reason)
end
elseif k==6 then
Duel[v]=function(oc,tg)
tg=Group.__add(tg,tg)
for tc in aux.Next(tg) do
local ct=tc:GetFlagEffectLabel(id+250) or 0
if ct>0 then tc:SetEntityCode(ct) tc:ReplaceEffect(ct,0,0) end
end
return funcs[v](oc,tg)
end
elseif k<11 then
Duel[v]=function(tg,...)
local tg2=Group.__add(tg,tg)
for tc in aux.Next(tg2) do
local ct=tc:GetFlagEffectLabel(id+250) or 0
if ct>0 then tc:SetEntityCode(ct) tc:ReplaceEffect(ct,0,0) end
end
return funcs[v](tg,...)
end
else
Duel[v]=function(tp,tg,...)
local tg2=Group.__add(tg,tg)
for tc in aux.Next(tg2) do
local ct=tc:GetFlagEffectLabel(id+250) or 0
if ct>0 then tc:SetEntityCode(ct) tc:ReplaceEffect(ct,0,0) end
end
return funcs[v](tp,tg,...)
end
end
end
end
end
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
if re:IsHasType(EFFECT_TYPE_ACTIVATE) then re:GetHandler():RegisterFlagEffect(id+750,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1) end
local g=Group.__sub(Duel.GetFieldGroup(rp,0xff,0),re:GetHandler())
if #g<3 or not Duel.IsPlayerAffectedByEffect(1-rp,id) then return end
local roll1=s.roll(1,#g)
local roll2=roll1
while roll2==roll1 do roll2=s.roll(1,#g) end
local sg=Group.CreateGroup()
local sc=g:GetFirst()
local ct=1
while sc do
if ct==roll1 or ct==roll2 then sg:AddCard(sc) end
sc=g:GetNext()
ct=ct+1
end
sg:AddCard(re:GetHandler())
for tc in aux.Next(sg) do Duel.Hint(HINT_CODE,rp,tc:GetCode()) if not SNNM.IsInTable(tc:GetCode(),s[1-rp]) then table.insert(s[1-rp],tc:GetCode()) end end
end
function s.count(e,tp,eg,ep,ev,re,r,rp)
if not re:GetHandler():IsStatus(STATUS_LEAVE_CONFIRMED) then re:GetHandler():ResetFlagEffect(id+750) end
end
function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=eg:Filter(function(c)return c:GetFlagEffect(id+250)>0 end,nil)
if chk==0 then return #g>0 end
for tc in aux.Next(g) do
local ct=tc:GetFlagEffectLabel(id+250)
tc:SetEntityCode(ct) tc:ReplaceEffect(ct,0,0)
end
return false
end
function s.repval(e,c)
return false
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToExtra() end
Duel.SendtoExtraP(c,tp,REASON_COST)
end
function s.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,id)==0 and Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,0xff,0,#(s[tp]),e:GetHandler(),tp,POS_FACEDOWN) end
Duel.RegisterFlagEffect(tp,id,RESET_PHASE+SNNM.GetCurrentPhase(),0,1)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,0xff)
Duel.Hint(HINT_OPSELECTED,tp,e:GetDescription())
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsLocation(LOCATION_EXTRA) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0xff,0,#(s[tp]),#(s[tp]),c,tp,POS_FACEDOWN)
if #g==0 then return end
local acg=Group.CreateGroup()
for tc in aux.Next(g) do if tc:GetFlagEffect(id+750)>0 or tc:GetEquipTarget() or tc:IsHasEffect(EFFECT_REMAIN_FIELD) then acg:AddCard(tc) end end
Duel.Remove(g,POS_FACEDOWN,REASON_EFFECT)
local og=Duel.GetOperatedGroup():Filter(Card.IsLocation,nil,LOCATION_REMOVED)
if #og==0 then return end
og:Filter(Card.IsPreviousLocation,nil,LOCATION_ONFIELD):ForEach(Card.SetReason,REASON_EFFECT+REASON_TEMPORARY)
for tc in aux.Next(og) do
tc:CreateRelation(c,RESET_EVENT+RESETS_STANDARD)
local num=s.roll(1,#(s[tp]))
local code=(s[tp])[num]
table.remove(s[tp],num)
local name=tc:GetOriginalCode()
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,0,1,tc:GetOriginalType())
tc:RegisterFlagEffect(id+250,RESET_EVENT+RESETS_STANDARD,0,1,name)
if acg:IsContains(tc) then tc:RegisterFlagEffect(id+500,RESET_EVENT+RESETS_STANDARD,0,1) end
tc:SetEntityCode(code)
tc:ReplaceEffect(code,0,0)
end
Duel.ConfirmCards(tp,Duel.GetMatchingGroup(Card.IsFacedown,tp,LOCATION_REMOVED,0,nil))
og:KeepAlive()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_MOVE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetLabelObject(og)
e1:SetCondition(s.tdcon)
e1:SetOperation(s.tdop)
c:RegisterEffect(e1,true)
Duel.ConfirmCards(tp,og)
end
function s.tdcon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsLocation(LOCATION_REMOVED)
end
function s.tdop(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject():Filter(Card.IsRelateToCard,nil,e:GetHandler())
if #g==0 then return end
local sg=g:Filter(function(c)return c:GetFlagEffect(id+500)>0 end,nil)
Duel.SendtoGrave(sg,REASON_RULE)
g:Sub(sg)
sg=g:Filter(Card.IsReason,nil,REASON_TEMPORARY)
for tc in aux.Next(sg) do
local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0)
if fc and tc:IsPreviousLocation(LOCATION_FZONE) then Duel.SendtoGrave(fc,REASON_RULE) end
if tc:IsPreviousLocation(LOCATION_FZONE) then Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,true) else Duel.ReturnToField(tc) end
end
g:Sub(sg)
sg=g:Filter(Card.IsPreviousLocation,nil,LOCATION_HAND)
Duel.SendtoHand(sg,tp,REASON_EFFECT)
g:Sub(sg)
sg=g:Filter(Card.IsPreviousLocation,nil,LOCATION_DECK+LOCATION_EXTRA)
Duel.SendtoDeck(sg,tp,2,REASON_EFFECT)
g:Sub(sg)
sg=g:Filter(Card.IsPreviousLocation,nil,LOCATION_GRAVE)
Duel.SendtoGrave(sg,REASON_EFFECT)
end
function s.filter(c,code)
return c:IsFacedown() and c:GetOriginalCode()~=code
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
local b1=e:GetHandler():IsAbleToDeck()
local b2=Duel.IsExistingMatchingCard(Card.IsFacedown,tp,LOCATION_REMOVED,0,1,nil)
local sel=aux.SelectFromOptions(tp,{b1,aux.Stringid(id,1)},{b2,aux.Stringid(id,2)},{true,aux.Stringid(id,4)})
if sel~=3 then Duel.Hint(HINT_CARD,0,id) end
if sel==1 then Duel.SendtoDeck(e:GetHandler(),nil,2,REASON_EFFECT) elseif sel==2 then
local g=Duel.GetMatchingGroup(Card.IsFacedown,tp,LOCATION_REMOVED,0,nil)
local ac=0
if g:GetClassCount(Card.GetOriginalCode)==1 then ac=Duel.AnnounceCard(tp,g:GetFirst():GetOriginalCode(),OPCODE_ISCODE,OPCODE_NOT) else ac=Duel.AnnounceCard(tp) end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,3))
local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_REMOVED,0,1,1,nil,ac):GetFirst()
Duel.ConfirmCards(1-tp,tc)
local name=tc:GetOriginalCode()
if tc:GetFlagEffect(id)==0 then
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,0,1,tc:GetOriginalType())
tc:RegisterFlagEffect(id+250,RESET_EVENT+RESETS_STANDARD,0,1,name)
end
tc:SetEntityCode(ac)
tc:ReplaceEffect(ac,0,0)
Duel.ConfirmCards(tp,Duel.GetMatchingGroup(Card.IsFacedown,tp,LOCATION_REMOVED,0,nil))
end
end
if not require and dofile then function require(str) return dofile(str..".lua") end end
if not pcall(function() require("expansions/script/c53702500") end) then require("script/c53702500") end
local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,53796195)
c:EnableReviveLimit()
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(function(e,se,sp,st)return se==e:GetLabelObject() and Duel.GetFlagEffect(e:GetHandlerPlayer(),id)==0 end)
c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,12))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_EXTRA)
e1:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e1:SetHintTiming(0,TIMING_DRAW_PHASE+TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCondition(s.spcon)
e1:SetCost(s.spcost)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
e0:SetLabelObject(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_ACTIVATE_COST)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
e2:SetTargetRange(0,1)
e2:SetCondition(s.costcon)
e2:SetCost(s.costchk)
e2:SetOperation(s.costop)
c:RegisterEffect(e2)
if not s.global_check then
s.global_check=true
if c53796195 and not c53796195[0] then
c53796195[0]={}
c53796195[1]={}
end
end
end
function s.cfilter(c)
return c:IsCode(53796195) and c:IsFaceup()
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_EXTRA,0,1,nil)
end
function s.spcfilter(c,e,tp)
return c:IsFaceup() and c:IsAbleToExtraAsCost() and Duel.GetLocationCountFromEx(tp,tp,c,e:GetHandler()) and (aux.IsCodeListed(c,53796195) or c:IsType(TYPE_SYNCHRO))
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.spcfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,s.spcfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
Duel.SendtoDeck(g,nil,REASON_COST)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 then return end
c:CompleteProcedure()
Duel.RegisterFlagEffect(tp,id,RESET_PHASE+SNNM.GetCurrentPhase(),0,1)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetValue(s.efilter)
e1:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e1,tp)
end
function s.efilter(e,te,c)
return te:GetHandlerPlayer()~=e:GetHandlerPlayer()
end
function s.costcon(e)
return Duel.IsExistingMatchingCard(Card.IsFacedown,e:GetHandlerPlayer(),LOCATION_REMOVED,0,1,nil)
end
function s.costchk(e,te,tp)
e:SetLabelObject(te)
return true
end
function s.costop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(id,13))
e1:SetCategory(CATEGORY_TODECK+CATEGORY_NEGATE+CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_QUICK_F)
e1:SetCode(EVENT_CHAINING)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(s.negcon)
e1:SetTarget(s.negtg)
e1:SetOperation(s.negop)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_CHAIN)
e:GetHandler():RegisterEffect(e1)
local check=true
if e:GetHandler():IsHasEffect(EFFECT_CANNOT_TRIGGER) then check=false end
local p=e:GetHandlerPlayer()
local le1={Duel.IsPlayerAffectedByEffect(p,EFFECT_CANNOT_ACTIVATE)}
for _,v in pairs(le1) do
local val=v:GetValue()
if aux.GetValueType(val)=="number" or val(v,e1,p) then check=false end
end
local le2={Duel.IsPlayerAffectedByEffect(p,EFFECT_ACTIVATE_COST)}
for _,v in pairs(le2) do
local cost=v:GetCost()
if cost and not cost(v,e1,p) then
local tg=v:GetTarget()
if not tg or tg(v,e1,p) then check=false end
end
end
local g=Duel.GetMatchingGroup(aux.AND(Card.IsFacedown,Card.IsAbleToDeck),e:GetHandlerPlayer(),LOCATION_REMOVED,0,nil)
if check and #g>0 and Duel.SelectEffectYesNo(p,e:GetHandler(),aux.Stringid(id,0)) then
local ag=Group.CreateGroup()
local codes={}
for c in aux.Next(g) do
local code=c:GetCode()
if not ag:IsExists(Card.IsCode,1,nil,code) then
ag:AddCard(c)
table.insert(codes,code)
end
end
table.sort(codes)
local ct=#codes
local nt={codes[1],OPCODE_ISCODE}
if ct>1 then
for i=2,ct do
table.insert(nt,codes[i])
table.insert(nt,OPCODE_ISCODE)
table.insert(nt,OPCODE_OR)
end
end
local ac=Duel.AnnounceCard(p,table.unpack(nt))
e1:SetLabel(ac)
e1:SetLabelObject(e:GetLabelObject())
else e1:Reset() end
end
function s.negcon(e,tp,eg,ep,ev,re,r,rp)
return rp~=tp and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED)
end
function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return e:GetLabel()~=0 and e:GetLabelObject()==re end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_ONFIELD)
end
function s.tdfilter(c,code,code2)
return c:IsFacedown() and c:IsCode(code) and c:IsCode(code2) and c:IsAbleToDeck()
end
function s.negop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local sc=Duel.SelectMatchingCard(tp,s.tdfilter,tp,LOCATION_REMOVED,0,1,1,nil,e:GetLabel(),re:GetHandler():GetCode()):GetFirst()
if sc then
Duel.ConfirmCards(1-tp,sc)
if Duel.SendtoDeck(sc,nil,2,REASON_EFFECT)~=0 and sc:IsLocation(LOCATION_DECK+LOCATION_EXTRA) and Duel.NegateActivation(ev) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 then
Duel.HintSelection(g)
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
end
if c53796195 and not SNNM.IsInTable(e:GetLabel(),c53796195[tp]) and Duel.SelectYesNo(tp,aux.Stringid(id,14)) then table.insert(c53796195[tp],e:GetLabel()) end
end
if not require and dofile then function require(str) return dofile(str..".lua") end end
if not pcall(function() require("expansions/script/c53702500") end) then require("script/c53702500") end
local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,53796195)
c:EnableReviveLimit()
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(function(e,se,sp,st)return se==e:GetLabelObject() and Duel.GetFlagEffect(e:GetHandlerPlayer(),id)==0 end)
c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_EXTRA)
e1:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e1:SetHintTiming(0,TIMING_DRAW_PHASE+TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCondition(s.spcon)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
e0:SetLabelObject(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMING_DRAW_PHASE+TIMING_STANDBY_PHASE+TIMINGS_CHECK_MONSTER+TIMING_MSET+TIMING_SSET+TIMING_MAIN_END+TIMING_END_PHASE)
e2:SetTarget(s.tg)
e2:SetOperation(s.op)
c:RegisterEffect(e2)
local g=Group.CreateGroup()
g:KeepAlive()
e2:SetLabelObject(g)
if not s.global_check then
s.global_check=true
if c53796195 and not c53796195[0] then
c53796195[0]={}
c53796195[1]={}
end
end
end
function s.cfilter(c)
return c:IsCode(53796195) and c:IsFaceup()
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_EXTRA,0,1,nil)
end
function s.spfilter(c,e,tp,tc)
return c:IsFaceup() and (aux.IsCodeListed(c,53796195) or c:IsType(0x40)) and c:IsCanBeXyzMaterial(tc) and Duel.GetLocationCountFromEx(tp,tp,c,tc)>0 and tc:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.spfilter2(c,e,tp,tc)
return s.spfilter(c,e,tp,tc) and not c:IsImmuneToEffect(e)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_MZONE,0,1,nil,e,tp,e:GetHandler()) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local tc=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_MZONE,0,1,1,nil,e,tp,c):GetFirst()
if not tc then return end
local mg=tc:GetOverlayGroup()
if mg:GetCount()~=0 then Duel.Overlay(c,mg) end
Duel.Overlay(c,Group.FromCards(tc))
if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 then return end
c:CompleteProcedure()
Duel.RegisterFlagEffect(tp,id,RESET_PHASE+SNNM.GetCurrentPhase(),0,1)
end
function s.xyzfilter(c,tc)
return c:IsCanOverlay() and not c:IsRelateToCard(tc)
end
function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and s.xyzfilter(chkc,c) end
local g=Duel.GetMatchingGroup(aux.AND(Card.IsFacedown,Card.IsAbleToDeck),tp,LOCATION_REMOVED,0,nil)
if chk==0 then return Duel.IsExistingTarget(s.xyzfilter,tp,0,LOCATION_ONFIELD,1,nil,c) and Duel.IsExistingMatchingCard(Card.IsFacedown,tp,0,LOCATION_HAND+LOCATION_DECK+LOCATION_ONFIELD+LOCATION_EXTRA+LOCATION_REMOVED,5,nil) and Duel.GetOverlayGroup(tp,1,0):IsExists(Card.IsAbleToDeck,1,nil) and #g>0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local tg=Duel.SelectTarget(tp,s.xyzfilter,tp,0,LOCATION_ONFIELD,1,1,nil,c)
e:GetLabelObject():Merge(tg)
tg:GetFirst():CreateRelation(c,RESET_EVENT+0x1fc0000)
if Duel.GetFlagEffect(tp,id+500)==0 then
Duel.RegisterFlagEffect(tp,id+500,RESET_PHASE+SNNM.GetCurrentPhase(),0,1)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_ADJUST)
e1:SetLabelObject(e)
e1:SetOperation(s.reset)
Duel.RegisterEffect(e1,tp)
c:CreateEffectRelation(e1)
end
local ag=Group.CreateGroup()
local codes={}
for c in aux.Next(g) do
local code=c:GetCode()
if not ag:IsExists(Card.IsCode,1,nil,code) then
ag:AddCard(c)
table.insert(codes,code)
end
end
table.sort(codes)
local ct=#codes
local nt={codes[1],OPCODE_ISCODE}
if ct>1 then
for i=2,ct do
table.insert(nt,codes[i])
table.insert(nt,OPCODE_ISCODE)
table.insert(nt,OPCODE_OR)
end
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac=Duel.AnnounceCard(tp,table.unpack(nt))
Duel.SetTargetParam(ac)
Duel.SetOperationInfo(0,CATEGORY_ANNOUNCE,nil,0,tp,0)
end
function s.reset(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetOwner()
local g=e:GetLabelObject():GetLabelObject()
if not c:IsRelateToEffect(e) or Duel.GetFlagEffect(tp,id+500)==0 then
g:ForEach(Card.ReleaseRelation,c)
g:Clear()
e:Reset()
end
end
function s.tdfilter(c,ac,g)
return c:IsFacedown() and c:IsCode(ac) and g:IsExists(Card.IsCode,1,nil,c:GetCode()) and c:IsAbleToDeck()
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
local ac=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
local g=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_HAND+LOCATION_DECK+LOCATION_ONFIELD+LOCATION_EXTRA+LOCATION_REMOVED,nil)
if #g>4 then
local sg=g:RandomSelect(tp,5)
Duel.ConfirmCards(tp,sg)
local ovg=Duel.GetOverlayGroup(tp,1,0):Filter(Card.IsAbleToDeck,nil)
local tdg=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_REMOVED,0,nil,ac,sg)
if #tdg>0 and #ovg>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local tg1=tdg:Select(tp,1,1,nil)
local tg2=ovg:Select(tp,1,1,nil)
tg1:Merge(tg2)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if Duel.SendtoDeck(tg1,nil,2,REASON_EFFECT)~=0 and tg1:IsExists(Card.IsLocation,1,nil,LOCATION_DECK+LOCATION_EXTRA) and c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
local og=tc:GetOverlayGroup()
if og:GetCount()>0 then Duel.SendtoGrave(og,REASON_RULE) end
Duel.Overlay(c,Group.FromCards(tc))
end
end
if sg:IsExists(Card.IsLocation,1,nil,LOCATION_HAND) then Duel.ShuffleHand(1-tp) end
if sg:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(1-tp) end
end
if c53796195 and not SNNM.IsInTable(ac,c53796195[tp]) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then table.insert(c53796195[tp],ac) end
end
--两面宿傩
local m=91000005
local cm=c91000005
function c91000005.initial_effect(c)
c:EnableReviveLimit()
aux.AddFusionProcFunRep2(c,cm.fit0,1,99,false)
--aux.AddFusionProcFunFunRep()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetValue(SUMMON_TYPE_FUSION)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(cm.sumcon)
e1:SetOperation(cm.sucop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,2))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BATTLE_DESTROYING)
e2:SetCondition(cm.con2)
e2:SetTarget(cm.tg2)
e2:SetOperation(cm.op2)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,2))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e3:SetCondition(cm.con3)
e3:SetTarget(cm.tg3)
e3:SetOperation(cm.op3)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,0))
e4:SetCategory(CATEGORY_RECOVER)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1,m)
e4:SetTarget(cm.target)
e4:SetOperation(cm.operation)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,3))
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetRange(LOCATION_MZONE)
e5:SetCountLimit(1)
e5:SetHintTiming(0,TIMING_DRAW_PHASE)
e5:SetTarget(cm.attg)
e5:SetOperation(cm.atop)
c:RegisterEffect(e5)
end
function cm.fit0(c)
return c:IsType(TYPE_MONSTER)
end
function cm.fit1(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToDeckOrExtraAsCost()
end
function cm.sumcon(e,c)
if c==nil then return true end
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cm.fit1,tp,LOCATION_REMOVED+LOCATION_GRAVE,0,1,nil)
end
function cm.sucop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.SelectMatchingCard(tp,cm.fit1,tp,LOCATION_REMOVED+LOCATION_GRAVE,0,1,99,nil)
Duel.SendtoDeck(g,nil,2,REASON_COST)
end
--e2 1
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=c:GetBattleTarget()
e:SetLabelObject(tc)
return tc and tc:IsType(TYPE_MONSTER) and tc:IsReason(REASON_BATTLE) and tc:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
local tc=e:GetLabelObject()
Duel.SetTargetCard(tc)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tc,1,0,LOCATION_GRAVE)
end
function cm.op2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
--e2 2
function cm.fit2(c,e,tp)
return c:GetReason()&REASON_EFFECT~=0 and c:GetReasonEffect():GetHandler()==e:GetHandler() and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.con3(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(cm.fit2,1,nil,e,tp)
end
function cm.tg3(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,nil,0,LOCATION_GRAVE)
end
function cm.op3(e,tp,eg,ep,ev,re,r,rp)
local n=Duel.GetLocationCount(tp,LOCATION_MZONE)
local g=Duel.SelectMatchingCard(tp,cm.fit2,tp,0,LOCATION_GRAVE+LOCATION_REMOVED,1,n,nil,e,tp)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
-- e4
function cm.filter(c)
return c:IsFaceup() and c:GetAttack()>0
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,nil)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_MZONE,0,nil)
local c=e:GetHandler()
local tc=g:GetFirst()
while tc do
Duel.Recover(tp,tc:GetBaseAttack(),REASON_EFFECT)
tc=g:GetNext()
end
end
-- e5
function cm.attg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
end
function cm.atop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SELF_DESTROY)
e1:SetTargetRange(0,LOCATION_MZONE)
e1:SetValue(e:GetLabel())
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
......@@ -5,108 +5,650 @@ function c98941000.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--atk up
--山と雪解の春化精
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetRange(LOCATION_FZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetCondition(c98941000.condition)
e2:SetValue(1000)
c:RegisterEffect(e2)
--spsummon
e2:SetDescription(aux.Stringid(98941000,0))
e2:SetCategory(CATEGORY_DRAW+CATEGORY_SPECIAL_SUMMON+CATEGORY_GRAVE_SPSUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_HAND)
e2:SetCost(c98941000.drcost)
e2:SetTarget(c98941000.drtg1)
e2:SetOperation(c98941000.drop1)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(98941000,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_FZONE)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e3:SetCountLimit(1,98941000)
e3:SetCost(c98941000.spcost)
e3:SetTarget(c98941000.sptg)
e3:SetOperation(c98941000.spop)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e3:SetRange(LOCATION_DECK+LOCATION_GRAVE)
e3:SetTargetRange(LOCATION_HAND,0)
e3:SetTarget(c98941000.eftg1)
e3:SetLabelObject(e2)
c:RegisterEffect(e3)
--to hand
--丘と芽吹の春化精
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(98941000,1))
e4:SetCategory(CATEGORY_TOHAND)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e4:SetRange(LOCATION_FZONE)
e4:SetCountLimit(1,98942000)
e4:SetCondition(c98941000.thcon)
e4:SetDescription(aux.Stringid(98941000,0))
e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON+CATEGORY_GRAVE_SPSUMMON)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_HAND)
e4:SetCost(c98941000.drcost)
e4:SetTarget(c98941000.thtg)
e4:SetOperation(c98941000.thop)
c:RegisterEffect(e4)
--tofiled
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e5:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_DECK)
e5:SetCode(EVENT_SPSUMMON_SUCCESS)
e5:SetOperation(c98941000.damop)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e5:SetRange(LOCATION_DECK+LOCATION_GRAVE)
e5:SetTargetRange(LOCATION_HAND,0)
e5:SetTarget(c98941000.eftg2)
e5:SetLabelObject(e4)
c:RegisterEffect(e5)
--森と目覚の春化精
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(98941000,0))
e6:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON+CATEGORY_GRAVE_SPSUMMON)
e6:SetType(EFFECT_TYPE_QUICK_O)
e6:SetCode(EVENT_FREE_CHAIN)
e6:SetRange(LOCATION_HAND)
e6:SetCost(c98941000.drcost)
e6:SetTarget(c98941000.tgtg)
e6:SetOperation(c98941000.tgop)
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e7:SetRange(LOCATION_DECK+LOCATION_GRAVE)
e7:SetTargetRange(LOCATION_HAND,0)
e7:SetTarget(c98941000.eftg3)
e7:SetLabelObject(e6)
c:RegisterEffect(e7)
--花と野原の春化精
local e8=Effect.CreateEffect(c)
e8:SetDescription(aux.Stringid(98941000,0))
e8:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON+CATEGORY_GRAVE_SPSUMMON)
e8:SetType(EFFECT_TYPE_QUICK_O)
e8:SetCode(EVENT_FREE_CHAIN)
e8:SetRange(LOCATION_HAND)
e8:SetCost(c98941000.drcost)
e8:SetTarget(c98941000.thtg1)
e8:SetOperation(c98941000.thop1)
local e9=Effect.CreateEffect(c)
e9:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e9:SetRange(LOCATION_DECK+LOCATION_GRAVE)
e9:SetTargetRange(LOCATION_HAND,0)
e9:SetTarget(c98941000.eftg4)
e9:SetLabelObject(e8)
c:RegisterEffect(e9)
--苗と霞の春化精
local e10=Effect.CreateEffect(c)
e10:SetDescription(aux.Stringid(98941000,0))
e10:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON+CATEGORY_GRAVE_SPSUMMON)
e10:SetType(EFFECT_TYPE_QUICK_O)
e10:SetCode(EVENT_FREE_CHAIN)
e10:SetRange(LOCATION_HAND)
e10:SetCost(c98941000.drcost)
e10:SetTarget(c98941000.thtg2)
e10:SetOperation(c98941000.thop2)
local e11=Effect.CreateEffect(c)
e11:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e11:SetRange(LOCATION_DECK+LOCATION_GRAVE)
e11:SetTargetRange(LOCATION_HAND,0)
e11:SetTarget(c98941000.eftg5)
e11:SetLabelObject(e10)
c:RegisterEffect(e11)
--to hand
local e12=Effect.CreateEffect(c)
e12:SetDescription(aux.Stringid(98941000,1))
e12:SetCategory(CATEGORY_TOHAND)
e12:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e12:SetCode(EVENT_SPSUMMON_SUCCESS)
e12:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e12:SetRange(LOCATION_FZONE)
e12:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e12:SetCondition(c98941000.thcon)
e12:SetTarget(c98941000.thtg0)
e12:SetOperation(c98941000.thop0)
c:RegisterEffect(e12)
--adjust
local e13=Effect.CreateEffect(c)
e13:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e13:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e13:SetCode(EVENT_ADJUST)
e13:SetRange(0xff)
e13:SetOperation(c98941000.adjustop)
c:RegisterEffect(e13)
--change effect type
local e14=Effect.CreateEffect(c)
e14:SetType(EFFECT_TYPE_FIELD)
e14:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e14:SetCode(98941000)
e14:SetRange(LOCATION_FZONE)
e14:SetTargetRange(1,0)
c:RegisterEffect(e14)
--special summon
local e15=Effect.CreateEffect(c)
e15:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e15:SetCode(EVENT_SPSUMMON_SUCCESS)
e15:SetRange(LOCATION_FZONE)
e15:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e15:SetOperation(c98941000.regop)
c:RegisterEffect(e15)
local e16=Effect.CreateEffect(c)
e16:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e16:SetCode(EVENT_CHAIN_SOLVED)
e16:SetRange(LOCATION_FZONE)
e16:SetCondition(c98941000.recon)
e16:SetOperation(c98941000.reop)
c:RegisterEffect(e16)
--add setcode
local e17=Effect.CreateEffect(c)
e17:SetType(EFFECT_TYPE_FIELD)
e17:SetRange(LOCATION_SZONE)
e17:SetTargetRange(LOCATION_MZONE,0)
e17:SetTarget(aux.TargetBoolFunction(Card.IsAttribute,ATTRIBUTE_EARTH))
e17:SetCode(EFFECT_ADD_SETCODE)
e17:SetValue(0x182)
c:RegisterEffect(e17)
--atk up
local e18=Effect.CreateEffect(c)
e18:SetType(EFFECT_TYPE_FIELD)
e18:SetCode(EFFECT_UPDATE_ATTACK)
e18:SetRange(LOCATION_FZONE)
e18:SetTargetRange(LOCATION_MZONE,0)
e18:SetValue(1000)
e18:SetTarget(aux.TargetBoolFunction(Card.IsAttribute,ATTRIBUTE_EARTH))
c:RegisterEffect(e18)
if not c98941000.global_activate_check then
c98941000.global_activate_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAIN_SOLVED)
ge1:SetOperation(c98941000.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c98941000.atkfilter(c)
return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsFaceup()
end
function c98941000.condition(e)
local tp=e:GetHandlerPlayer()
return Duel.GetMatchingGroupCount(c98941000.atkfilter,tp,LOCATION_MZONE,0,nil)>=5
function c98941000.checkop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if re:GetValue()~=60969918 then return end
if rc:IsLocation(LOCATION_MZONE) and rc:GetFlagEffect(98941000)==0 then
rc:RegisterFlagEffect(98941000,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
end
function c98941000.costfilter(c)
return c:IsCode(98941008) and c:IsAbleToRemoveAsCost()
end
function c98941000.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c98941000.costfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c98941000.costfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c98941000.filter(c,e,tp)
return c:IsCode(98941006) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c98941000.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c98941000.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c98941000.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c98941000.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
return (c:IsType(TYPE_MONSTER) or c:IsSetCard(0x182)) and c:IsDiscardable()
end
function c98941000.stfilter(c,tp)
return c:IsCode(98941000) and c:IsType(TYPE_FIELD) and not c:IsForbidden() and c:CheckUniqueOnField(tp)
end
function c98941000.drcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local b2=Duel.IsExistingMatchingCard(c98941000.costfilter,tp,LOCATION_HAND,0,1,c)
local b1=Duel.IsExistingMatchingCard(c98941000.stfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,tp)
if chk==0 then return c:IsDiscardable() and b2 and b1 and Duel.GetFieldCard(tp,LOCATION_FZONE,0)==nil end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local g=Duel.SelectMatchingCard(tp,c98941000.costfilter,tp,LOCATION_HAND,0,1,1,c)
g:AddCard(c)
Duel.SendtoGrave(g,REASON_COST+REASON_DISCARD)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local tc=Duel.SelectMatchingCard(tp,c98941000.stfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,tp):GetFirst()
if tc then
local fc=Duel.GetFieldCard(tp,LOCATION_SZONE,5)
if fc then
Duel.SendtoGrave(fc,REASON_RULE)
Duel.BreakEffect()
end
Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,true)
end
end
function c98941000.drtg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c98941000.spfilter(c,e,tp)
return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c98941000.drop1(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
if Duel.Draw(p,d,REASON_EFFECT)>0 then
local sg=Duel.GetMatchingGroup(aux.NecroValleyFilter(c98941000.spfilter),tp,LOCATION_GRAVE,0,nil,e,tp)
if sg:GetCount()>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.SelectYesNo(tp,aux.Stringid(98941000,2)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sc=sg:Select(tp,1,1,nil)
Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)
end
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(c98941000.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c98941000.aclimit(e,re,tp)
return re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsNonAttribute(ATTRIBUTE_EARTH)
end
function c98941000.thfilter(c)
return c:IsSetCard(0x182) and not c:IsCode(9350312) and c:IsAbleToHand()
end
function c98941000.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c98941000.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c98941000.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c98941000.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 and g:GetFirst():IsLocation(LOCATION_HAND) then
Duel.ConfirmCards(1-tp,g)
local sg=Duel.GetMatchingGroup(aux.NecroValleyFilter(c98941000.spfilter),tp,LOCATION_GRAVE,0,nil,e,tp)
if sg:GetCount()>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.SelectYesNo(tp,aux.Stringid(98941000,2)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sc=sg:Select(tp,1,1,nil)
Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)
end
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(c98941000.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c98941000.tgfilter(c)
return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsSummonableCard() and c:IsAbleToGrave()
end
function c98941000.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c98941000.tgfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end
function c98941000.spfilter1(c,e,tp,code)
return c:IsAttribute(ATTRIBUTE_EARTH) and not c:IsCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c98941000.tgop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c98941000.tgfilter,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst()
if g:GetCount()>0 and Duel.SendtoGrave(g,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_GRAVE) then
local sg=Duel.GetMatchingGroup(aux.NecroValleyFilter(c98941000.spfilter1),tp,LOCATION_GRAVE,0,nil,e,tp,tc:GetCode())
if sg:GetCount()>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.SelectYesNo(tp,aux.Stringid(98941000,2)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sc=sg:Select(tp,1,1,nil)
Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)
end
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(c98941000.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c98941000.thfilter1(c)
return c:IsAttribute(ATTRIBUTE_EARTH) and not c:IsCode(62133026) and c:IsAbleToHand()
end
function c98941000.thtg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c98941000.thfilter1,tp,LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
end
function c98941000.thop1(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c98941000.thfilter1),tp,LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 and g:GetFirst():IsLocation(LOCATION_HAND) then
Duel.ConfirmCards(1-tp,g)
local sg=Duel.GetMatchingGroup(aux.NecroValleyFilter(c98941000.spfilter),tp,LOCATION_GRAVE,0,nil,e,tp)
if sg:GetCount()>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.SelectYesNo(tp,aux.Stringid(98941000,2)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sc=sg:Select(tp,1,1,nil)
Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)
end
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(c98941000.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c98941000.thfilter2(c)
return c:IsRace(RACE_FAIRY) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsAbleToHand() and not c:IsCode(81519836)
end
function c98941000.thtg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c98941000.thfilter2,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c98941000.thop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c98941000.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 and g:GetFirst():IsLocation(LOCATION_HAND) then
Duel.ConfirmCards(1-tp,g)
local sg=Duel.GetMatchingGroup(aux.NecroValleyFilter(c98941000.spfilter),tp,LOCATION_GRAVE,0,nil,e,tp)
if sg:GetCount()>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.SelectYesNo(tp,aux.Stringid(98941000,2)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sc=sg:Select(tp,1,1,nil)
Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)
end
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(c98941000.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c98941000.eftg1(e,c)
return c:IsOriginalCodeRule(9238125)
end
function c98941000.eftg2(e,c)
return c:IsOriginalCodeRule(9350312)
end
function c98941000.eftg3(e,c)
return c:IsOriginalCodeRule(36745317)
end
function c98941000.eftg4(e,c)
return c:IsOriginalCodeRule(62133026)
end
function c98941000.eftg5(e,c)
return c:IsOriginalCodeRule(81519836)
end
function c98941000.cfilter(c,tp)
return c:IsSetCard(0xa182) and c:IsPreviousLocation(LOCATION_GRAVE) and c:IsPreviousControler(tp)
return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsPreviousLocation(LOCATION_GRAVE) and c:IsPreviousControler(tp)
end
function c98941000.thcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c98941000.cfilter,1,nil,tp)
end
function c98941000.thfilter(c)
function c98941000.thfilter0(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c98941000.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_MZONE) and c98941000.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c98941000.thfilter,tp,LOCATION_GRAVE+LOCATION_MZONE,LOCATION_GRAVE+LOCATION_MZONE,1,nil) end
function c98941000.thtg0(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_MZONE) and c98941000.thfilter0(chkc) end
if chk==0 then return Duel.IsExistingTarget(c98941000.thfilter0,tp,LOCATION_GRAVE+LOCATION_MZONE,LOCATION_GRAVE+LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,c98941000.thfilter,tp,LOCATION_GRAVE+LOCATION_MZONE,LOCATION_GRAVE+LOCATION_MZONE,1,1,nil)
local g=Duel.SelectTarget(tp,c98941000.thfilter0,tp,LOCATION_GRAVE+LOCATION_MZONE,LOCATION_GRAVE+LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c98941000.thop(e,tp,eg,ep,ev,re,r,rp)
function c98941000.thop0(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
function c98941000.csfilter(c)
return c:IsSetCard(0xa182)
function c98941000.ufilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAttribute(ATTRIBUTE_EARTH)
end
function c98941000.actarget(e,te,tp)
--prevent activating
local tc=te:GetHandler()
return ((te:GetValue()==60965917 or te:GetValue()==60965919) and not Duel.IsPlayerAffectedByEffect(te:GetHandlerPlayer(),60965917))
--prevent normal activating beside S&T on field
or (te:GetValue()==60965918 and Duel.IsPlayerAffectedByEffect(te:GetHandlerPlayer(),60965917) and not (te:IsHasType(EFFECT_TYPE_ACTIVATE) and tc:IsLocation(LOCATION_SZONE)))
--prevent quick activating on field
or (te:GetValue()==60965919 and te:IsHasType(EFFECT_TYPE_QUICK_O) and tc:IsLocation(LOCATION_SZONE))
end
function c98941000.adjustop(e,tp,eg,ep,ev,re,r,rp)
if not c98941000.globle_check then
c98941000.globle_check=true
local ge0=Effect.CreateEffect(e:GetHandler())
ge0:SetType(EFFECT_TYPE_FIELD)
ge0:SetCode(EFFECT_ACTIVATE_COST)
ge0:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
ge0:SetCost(aux.FALSE)
ge0:SetTargetRange(1,1)
ge0:SetTarget(c98941000.actarget)
Duel.RegisterEffect(ge0,0)
--Activate to field
local ge1=Effect.CreateEffect(e:GetHandler())
ge1:SetType(EFFECT_TYPE_FIELD)
ge1:SetCode(EFFECT_ACTIVATE_COST)
ge1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
ge1:SetTargetRange(1,0)
ge1:SetTarget(c98941000.actarget2)
ge1:SetOperation(c98941000.costop)
Duel.RegisterEffect(ge1,0)
local ge2=ge1:Clone()
Duel.RegisterEffect(ge2,1)
local g=Duel.GetMatchingGroup(c98941000.ufilter,0,0xff,0xff,nil)
cregister=Card.RegisterEffect
esetcountLimit=Effect.SetCountLimit
table_effect={}
table_countlimit_flag=0
table_countlimit_count=0
Effect.SetCountLimit=function(effect,count,flag)
table_countlimit_flag=flag
table_countlimit_count=count
return esetcountLimit(effect,count,flag)
end
Card.RegisterEffect=function(card,effect,flag)
if effect then
local eff=effect:Clone()
if (table_countlimit_flag~=0 and table_countlimit_count==1) or (effect:IsHasType(EFFECT_TYPE_IGNITION) and not card:IsType(TYPE_SPELL)) or
(effect:IsHasType(EFFECT_TYPE_ACTIVATE) and not card:IsType(TYPE_TRAP) and not card:IsType(TYPE_QUICKPLAY)) and not card:IsType(TYPE_SPELL) then
eff:SetValue(60969918)
--effect edit
local eff2=effect:Clone()
--id remove
if table_countlimit_flag~=0 and table_countlimit_count==1 and not card:IsType(TYPE_SPELL) then
esetcountLimit(eff2,1,table_countlimit_flag)
end
--spell speed 2
if eff2:IsHasType(EFFECT_TYPE_IGNITION) then
eff2:SetDescription(aux.Stringid(98941000,4))
eff2:SetCondition(c98941000.condition)
eff2:SetType(EFFECT_TYPE_QUICK_O)
eff2:SetCode(EVENT_FREE_CHAIN)
eff2:SetHintTiming(TIMING_END_PHASE,TIMING_DRAW_PHASE+TIMING_END_PHASE+TIMINGS_CHECK_MONSTER)
end
eff2:SetValue(98941000)
--spell activate in hand
if eff2:IsHasType(EFFECT_TYPE_ACTIVATE) and not card:IsType(TYPE_TRAP) and not card:IsType(TYPE_SPELL) and not card:IsType(TYPE_MONSTER) then
eff2:SetDescription(aux.Stringid(98941000,6))
eff2:SetType(EFFECT_TYPE_QUICK_O)
eff2:SetCode(EVENT_FREE_CHAIN)
eff2:SetRange(LOCATION_HAND)
eff2:SetValue(60969919)
eff2:SetHintTiming(TIMING_END_PHASE,TIMING_DRAW_PHASE+TIMING_END_PHASE+TIMINGS_CHECK_MONSTER)
end
table.insert(table_effect,eff2)
end
table.insert(table_effect,eff)
end
table_countlimit_flag=0
table_countlimit_count=0
return
end
for tc in aux.Next(g) do
table_effect={}
tc:ReplaceEffect(98941000,0)
Duel.CreateToken(0,tc:GetOriginalCode())
for key,eff in ipairs(table_effect) do
cregister(tc,eff)
end
end
Card.RegisterEffect=cregister
Effect.SetCountLimit=esetcountLimit
end
e:Reset()
end
function c98941000.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsEnvironment(98941000,tp,LOCATION_FZONE) and (e:GetHandler():IsLocation(LOCATION_MZONE) or e:GetHandler():IsSetCard(0x182))
end
function c98941000.actarget2(e,te,tp)
local tc=te:GetHandler()
e:SetLabelObject(te)
return tc:IsSetCard(0x182) and te:IsHasType(EFFECT_TYPE_QUICK_O) and tc:IsLocation(LOCATION_HAND) and tc:IsType(TYPE_SPELL)
end
function c98941000.costop(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
local tc=te:GetHandler()
local tp=te:GetHandlerPlayer()
te:SetType(EFFECT_TYPE_ACTIVATE)
if tc:IsType(TYPE_FIELD) then
local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0)
if fc then
Duel.SendtoGrave(fc,REASON_RULE)
Duel.BreakEffect()
end
Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,false)
else
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,false)
end
local ge3=Effect.CreateEffect(tc)
ge3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
ge3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
ge3:SetCode(EVENT_CHAIN_SOLVED)
ge3:SetLabelObject(te)
ge3:SetReset(RESET_PHASE+PHASE_END)
ge3:SetOperation(c98941000.resetop)
Duel.RegisterEffect(ge3,tp)
local ge4=ge3:Clone()
ge4:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(ge4,tp)
end
function c98941000.resetop(e,tp,eg,ep,ev,re,r,rp)
if re==e:GetLabelObject() and re:IsHasType(EFFECT_TYPE_ACTIVATE) then
re:SetType(EFFECT_TYPE_QUICK_O)
e:Reset()
end
end
function c98941000.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_CHAIN_SOLVED)
e3:SetOperation(c98941000.sop)
e3:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e3,tp)
end
function c98941000.sop(e,tp,eg,ep,ev,re,r,rp)
if ep~=tp then e:GetHandler():RegisterFlagEffect(98941000,RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET+RESET_CHAIN,0,1) end
end
function c98941000.recon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==1
end
function c98941000.tg(e,tp,eg,ep,ev,re,r,rp,chk)
local mg=Duel.GetMatchingGroup(Card.IsSetCard,tp,LOCATION_MZONE,0,nil,0x11b)
if chk==0 then return Duel.IsExistingMatchingCard(c98941000.filter,tp,LOCATION_EXTRA,0,1,nil,mg) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c98941000.damop(e,tp,eg,ep,ev,re,r,rp)
if eg:FilterCount(c98941000.csfilter,nil,tp)>0 and Duel.GetFieldCard(tp,LOCATION_FZONE,0)==nil then
Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_FZONE,POS_FACEUP,true)
function c98941000.lkfilter(c)
return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsLinkSummonable(nil)
end
function c98941000.xyzfilter(c)
return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsXyzSummonable(nil)
end
function c98941000.syfilter(c)
return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsSynchroSummonable(nil)
end
function c98941000.sssfilter(c,e,tp)
return c:IsCode(55125728) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c98941000.sumfilter(c)
return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsSummonable(true,nil)
end
function c98941000.reop(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetMatchingGroup(c98941000.lkfilter,tp,LOCATION_EXTRA,0,1,nil)
local g2=Duel.GetMatchingGroup(c98941000.syfilter,tp,LOCATION_EXTRA,0,nil,nil)
local g3=Duel.GetMatchingGroup(c98941000.xyzfilter,tp,LOCATION_EXTRA,0,nil)
local g4=Duel.GetMatchingGroup(c98941000.sumfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,nil)
local g5=Duel.GetMatchingGroup(c98941000.sssfilter,tp,LOCATION_DECK,0,nil,e)
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c98941000.filter1,nil,e)
local sg1=Duel.GetMatchingGroup(c98941000.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg2=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c98941000.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end
local b1=g1:GetCount()>0
local b2=g2:GetCount()>0
local b3=g3:GetCount()>0
local b4=g4:GetCount()>0
local b5=g5:GetCount()>0
local b6=(sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0))
local b7=b1 or b2 or b3 or b4
if (b7 or b6 or b5) and Duel.SelectYesNo(tp,aux.Stringid(98941000,11)) then
local op1=aux.SelectFromOptions(tp,
{b7,aux.Stringid(98941000,8)},
{b6,aux.Stringid(98941000,9)},
{b5,aux.Stringid(98941000,10)},
{true,aux.Stringid(197042,2)})
if op1==1 then
local op2=aux.SelectFromOptions(tp,
{b1,aux.Stringid(98941000,5)},
{b2,aux.Stringid(98941000,6)},
{b3,aux.Stringid(98941000,7)},
{b4,aux.Stringid(98941000,3)},
{true,aux.Stringid(197042,2)})
if op2==3 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg1=g3:Select(tp,1,1,nil)
Duel.XyzSummon(tp,sg1:GetFirst(),nil)
elseif op2==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sgk2=g1:Select(tp,1,1,nil)
Duel.LinkSummon(tp,sgk2:GetFirst(),nil)
elseif op2==2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sgk=g2:Select(tp,1,1,nil)
Duel.SynchroSummon(tp,sgk:GetFirst(),nil)
elseif op2==4 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local gec=Duel.SelectMatchingCard(tp,c98941000.sumfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
local tc=gec:GetFirst()
if tc then
Duel.Summon(tp,tc,true,nil)
end
end
elseif op1==2 then
local msg=sg1:Clone()
if sg2 then msg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=msg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
elseif op1==3 then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c98941000.sssfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
end
end
function c98941000.filter1(c,e)
return not c:IsImmuneToEffect(e)
end
function c98941000.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsAttribute(ATTRIBUTE_EARTH) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
\ No newline at end of file
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