Commit f2eab225 authored by POLYMER's avatar POLYMER

update 240902 wd

parent aab1c4cc
......@@ -6138,6 +6138,26 @@
88881087 0
88881921 0
88881923 0
12847555 0
12847556 0
28399984 0
82800063 0
82800066 0
82800069 0
82800072 0
82800075 0
82800078 0
82800081 0
82800084 0
82800087 0
82800090 0
82800093 0
82800096 0
82800099 0
82800102 0
82800105 0
82800108 0
82800111 0
#limit
33403513 1
82204250 0
......@@ -6909,6 +6929,7 @@
31400050 0 --归亡死恶魔,无任何限制的单卡抛瓦
90700001 0 --霜火要塞,系列剑指west环境,ban此卡即可
70002043 0
12847555 0
#limit
9950000 1
9950002 1
......
No preview for this file type
--古木寻斋
local m=12847555
local cm=_G["c"..m]
function cm.initial_effect(c)
--special summon rule
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_FIELD)
e0:SetCode(EFFECT_SPSUMMON_PROC)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetRange(LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE)
e0:SetCondition(cm.sprcon)
e0:SetTarget(cm.sprtg)
e0:SetOperation(cm.sprop)
c:RegisterEffect(e0)
--
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetCode(EVENT_PREDRAW)
e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_DUEL)
e1:SetRange(0xff)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
--act limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_CANNOT_ACTIVATE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(0,1)
e2:SetValue(cm.aclimit)
c:RegisterEffect(e2)
--disable
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_DISABLE)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(0,LOCATION_ONFIELD)
e3:SetTarget(cm.distarget)
c:RegisterEffect(e3)
--disable effect
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_CHAIN_SOLVING)
e4:SetRange(LOCATION_MZONE)
e4:SetOperation(cm.disoperation)
c:RegisterEffect(e4)
end
function cm.sprfilter(c,tp)
return (c:IsFaceup() or c:IsControler(tp)) and c:IsCode(m+1) and c:IsReleasable(REASON_SPSUMMON)
end
function cm.fselect(g,tp,sc)
return Duel.GetMZoneCount(tp,g,tp)>0
end
function cm.sprcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(cm.sprfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,tp)
return g:CheckSubGroup(cm.fselect,1,#g,tp,c)
end
function cm.sprtg(e,tp,eg,ep,ev,re,r,rp,chk,c)
local g=Duel.GetMatchingGroup(cm.sprfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=g:SelectSubGroup(tp,cm.fselect,true,1,#g,tp,c)
if sg then
sg:KeepAlive()
e:SetLabelObject(sg)
return true
else return false end
end
function cm.sprop(e,tp,eg,ep,ev,re,r,rp,c)
local g=e:GetLabelObject()
Duel.Release(g,REASON_SPSUMMON)
g:DeleteGroup()
end
function cm.check(c)
return not c:IsCode(m+1) and c:IsType(TYPE_MONSTER)
end
function cm.op(e,tp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(cm.check,tp,0,0xff,nil)
for tc in aux.Next(g) do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetValue(m+1)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
tc:RegisterEffect(e1)
end
end
function cm.aclimit(e,re,tp)
return re:GetHandler():IsCode(m+1)
end
function cm.distarget(e,c)
return c~=e:GetHandler() and c:IsCode(m+1)
end
function cm.disoperation(e,tp,eg,ep,ev,re,r,rp)
if re:GetHandler():IsCode(m+1) and re:GetHandler():IsFaceup() then
Duel.NegateEffect(ev)
end
end
\ No newline at end of file
--星雨
function c28399984.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c28399984.cost)
e1:SetTarget(c28399984.target)
e1:SetOperation(c28399984.activate)
c:RegisterEffect(e1)
--
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetTarget(c28399984.sptg)
e2:SetOperation(c28399984.spop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_REMOVE)
c:RegisterEffect(e3)
local e4=e2:Clone()
e4:SetType(EFFECT_TYPE_QUICK_F)
e4:SetCode(EVENT_BECOME_TARGET)
e4:SetRange(LOCATION_GRAVE+LOCATION_REMOVED)
e4:SetCondition(c28399984.spcon)
c:RegisterEffect(e4)
end
function c28399984.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_HAND,0,1,1,e:GetHandler())
e:SetLabelObject(g:GetFirst())
Duel.SendtoGrave(g,REASON_COST+REASON_DISCARD)
end
function c28399984.tgfilter(c)
return c:IsSetCard(0x284) and c:IsAbleToGrave()
end
function c28399984.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c28399984.tgfilter,tp,LOCATION_DECK,0,4,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,4,tp,LOCATION_DECK)
if e:GetLabelObject():IsSetCard(0x284) then
e:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CAN_FORBIDDEN)
end
end
function c28399984.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c28399984.tgfilter,tp,LOCATION_DECK,0,nil)
if g:GetCount()>=4 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=g:Select(tp,4,4,nil)
Duel.SendtoGrave(sg,REASON_EFFECT)
end
end
function c28399984.cfilter(c,e,tp)
return c:IsSetCard(0x284) and c:IsType(TYPE_MONSTER) and (c:IsAbleToHand() or (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)))
end
function c28399984.spcon(e,tp,eg,ep,ev,re,r,rp)
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
return eg:IsContains(e:GetHandler()) and re:GetHandler():IsType(TYPE_MONSTER) and re:GetHandler():IsSetCard(0x284)
end
function c28399984.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c28399984.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local sc=Duel.SelectMatchingCard(tp,c28399984.cfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp):GetFirst()
if sc then
local b1=sc:IsAbleToHand()
local b2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and sc:IsCanBeSpecialSummoned(e,0,tp,false,false)
local op=0
if b1 and b2 then op=Duel.SelectOption(tp,1190,1152)
elseif b1 then op=0
else op=1 end
if op==0 then
Duel.SendtoHand(sc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sc)
else
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,1)
e1:SetValue(c28399984.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c28399984.aclimit(e,re,tp)
return re:IsActiveType(TYPE_MONSTER) and not re:GetHandler():IsRace(RACE_FAIRY)
end
......@@ -18,7 +18,6 @@ function s.initial_effect(c)
s.Control_Mode=false
s.Wild_Mode=false
s.Random_Mode=false
s.Theworld_Mode=false
s.cheaktable={}
s.controltable={}
......@@ -43,8 +42,9 @@ function s.initial_effect(c)
local ge0=Effect.GlobalEffect()
ge0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge0:SetCode(EVENT_ADJUST)
ge0:SetCode(EVENT_DRAW)
ge0:SetCountLimit(1,id+EFFECT_COUNT_CODE_DUEL)
ge0:SetCondition(s.startcon)
ge0:SetOperation(s.startop)
Duel.RegisterEffect(ge0,0)
local ge1=Effect.GlobalEffect()
......@@ -53,6 +53,7 @@ function s.initial_effect(c)
ge1:SetCondition(s.adjustcon)
ge1:SetOperation(s.adjustop)
Duel.RegisterEffect(ge1,0)
--save
local ge2=Effect.GlobalEffect()
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_PREDRAW)
......@@ -106,6 +107,9 @@ if io then IO_CHECK=true end
function s.cfilter(c)
return c:GetOriginalCode()==id
end
function s.startcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount()==0
end
function s.startop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(0,0x7f,0x7f)
local xg=Duel.GetFieldGroup(0,0x4d,0x4d)
......@@ -121,8 +125,9 @@ function s.startop(e,tp,eg,ep,ev,re,r,rp)
e1:SetValue(0)
tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(tc)
e2:SetType(EFFECT_TYPE_IGNITION+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_EXTRA)
e2:SetCondition(s.menucon)
e2:SetOperation(s.menuop)
......@@ -167,7 +172,6 @@ function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
g:Merge(xc:GetOverlayGroup())
end
g=g:Filter(s.cfilter2,nil)
for tc in aux.Next(g) do
local bool1=tc:IsHasEffect(EFFECT_CANNOT_SPECIAL_SUMMON)
local bool2=tc:IsHasEffect(EFFECT_SPSUMMON_COST)
......@@ -269,7 +273,9 @@ function s.resetop(e,tp,eg,ep,ev,re,r,rp)
e:Reset()
end
function s.menucon(e,tp,eg,ep,ev,re,r,rp)
return tp==e:GetHandler():GetOwner()
local ph=Duel.GetCurrentPhase()
local bool=ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE and ph~=PHASE_BATTLE_STEP or ph==PHASE_MAIN1 or ph==PHASE_MAIN2
return tp==e:GetHandler():GetOwner() and (s.Wild_Mode or Duel.GetTurnPlayer()==tp and Duel.GetCurrentChain()==0 and Duel.GetTurnPlayer()==tp and bool)
end
function s.menuop(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
local page=1
......@@ -303,7 +309,7 @@ function s.menuop(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
s.hintcard()
page=0
elseif ot==2 then
s.loadmenu(tp)
s.loadmenu(e,tp)
page=0
elseif ot==3 then
s.mindcontrol(e,tp)
......@@ -343,11 +349,6 @@ function s.movecard(e,tp)
e1:SetCode(EVENT_CUSTOM+id)
e1:SetCountLimit(1)
e1:SetOperation(s.movespop)
if Duel.GetCurrentPhase()<=PHASE_STANDBY then
e1:SetReset(RESET_PHASE+PHASE_STANDBY,2)
else
e1:SetReset(RESET_PHASE+PHASE_STANDBY)
end
Duel.RegisterEffect(e1,tp)
Duel.RaiseEvent(c,EVENT_CUSTOM+id,e,0,tp,tp,0)
elseif ot==1 then
......@@ -458,13 +459,13 @@ function s.printcard(e,tp)
table.insert(codetable,ac)
if KOISHI_CHECK and IO_CHECK then
local luatable=s.get_lua_numbers("script")
for _,i in ipairs(luatable) do
for _,i in ipairs(luatable) do
if ac==Duel.ReadCard(i,2) and ac~=i then
table.insert(codetable,tonumber(i))
end
end
local luatable2=s.get_lua_numbers("expansions/script")
for _,i in ipairs(luatable2) do
for _,i in ipairs(luatable2) do
if ac==Duel.ReadCard(i,2) and ac~=i then
table.insert(codetable,tonumber(i))
end
......@@ -574,7 +575,7 @@ function s.setcard(e,tp)
if not mc:IsType(TYPE_LINK) then pos=Duel.SelectPosition(tp,mc,0xd) end
Duel.MoveToField(mc,tp,p,LOCATION_MZONE,pos,true,flag)
if tp~=p then
local e1=Effect.CreateEffect(mc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_CONTROL)
e1:SetValue(p)
......@@ -605,7 +606,7 @@ function s.setcard(e,tp)
local pos=Duel.SelectPosition(tp,mc,0xd)
Duel.MoveToField(mc,tp,p,LOCATION_MZONE,pos,true,flag)
if tp~=p then
local e1=Effect.CreateEffect(mc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_CONTROL)
e1:SetValue(p)
......@@ -872,18 +873,18 @@ function s.saveop(e,tp,eg,ep,ev,re,r,rp)
local turn=s.autodata.turn
Debug.Message("第"..turn.."回合 自动存档完成")
end
function s.loadmenu(tp)
local decs=6
if s.manualdata.turn==0 then decs=7 end
function s.loadmenu(e,tp)
local c=e:GetHandler()
local decs=s.manualdata.turn==0 and 7 or 6
local ot=s.SelectOption(tp,aux.Stringid(id+1,8),aux.Stringid(id+1,5),aux.Stringid(id+1,decs),1212)
if ot==0 then
s.loadcard(s.autodata)
s.loadcard(c,s.autodata)
elseif ot==1 then
s.manualdata=s.save()
local turn=s.manualdata.turn
Debug.Message("第"..turn.."回合 手动存档完成")
elseif ot==2 then
s.loadcard(s.manualdata)
s.loadcard(c,s.manualdata)
elseif ot==3 then
return
end
......@@ -942,7 +943,7 @@ function s.save()
end
return data
end
function s.loadcard(data)
function s.loadcard(c,data)
Debug.Message("正在读档")
Duel.Hint(HINT_CARD,0,id)
local cg=Duel.GetFieldGroup(0,0x4d,0x4d)
......@@ -969,7 +970,7 @@ function s.loadcard(data)
if cdata.sequence>=5 then Duel.SendtoExtraP(tc,p,REASON_RULE) end
if not Duel.MoveToField(tc,p,p,cdata.location,cdata.position,true,2^cdata.sequence) then Duel.SendtoGrave(tc,REASON_RULE) end
if tc:GetOwner()~=p then
local e1=Effect.CreateEffect(tc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_CONTROL)
e1:SetValue(p)
......@@ -1452,16 +1453,12 @@ function s.change_effect(effect,c,mp)
end
end
function s.wildop()
if not KOISHI_CHECK then
Debug.Message("该功能需要koishi函数!")
return
end
s.Wild_Mode=not s.Wild_Mode
local g=Duel.GetFieldGroup(0,0x7f,0x7f)
local xg=Duel.GetFieldGroup(0,0x4d,0x4d)
for xc in aux.Next(xg) do
g:Merge(xc:GetOverlayGroup())
end
s.Wild_Mode=not s.Wild_Mode
if s.Wild_Mode then
Debug.Message("歼灭模式 开")
s.SetCountLimit=Effect.SetCountLimit
......@@ -1527,7 +1524,7 @@ function s.randomop(tp)
end
end
function s.toolop(tp)
local op=s.SelectOption(tp,aux.Stringid(id+1,11),aux.Stringid(id+1,12),aux.Stringid(id+1,13),aux.Stringid(id+1,14),1212)
local op=s.SelectOption(tp,aux.Stringid(id+1,11),aux.Stringid(id+1,12),aux.Stringid(id+1,13),aux.Stringid(id+1,14),aux.Stringid(id+1,15))
if op==0 then
local p=s.SelectOption(tp,aux.Stringid(id+1,1),aux.Stringid(id+1,2))==0 and tp or 1-tp
local lp=s.AnnounceNumber(tp,80000,16000,8000,4000,2000,1000,500,100,1)
......@@ -1583,13 +1580,54 @@ function s.toolop(tp)
end
if sg:GetCount()>1 then Duel.SortDecktop(tp,p,sg:GetCount()) end
elseif op==3 then
if Duel.GetCurrentPhase()==PHASE_MAIN1 then
if Duel.GetTurnCount()==1 then
if KOISHI_CHECK then
Duel.MoveTurnCount()
else
Duel.SkipPhase(tp,PHASE_MAIN1,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(tp,PHASE_BATTLE,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(tp,PHASE_MAIN2,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(tp,PHASE_END,RESET_PHASE+PHASE_END,1)
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_SKIP_TURN)
e1:SetTargetRange(0,1)
e1:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
Duel.RegisterEffect(e1,tp)
Duel.SkipPhase(tp,PHASE_DRAW,RESET_PHASE+PHASE_END,2)
Duel.SkipPhase(tp,PHASE_STANDBY,RESET_PHASE+PHASE_END,2)
end
end
Duel.SkipPhase(tp,PHASE_MAIN1,RESET_PHASE+PHASE_BATTLE_START+RESET_SELF_TURN,1)
else
Duel.SkipPhase(tp,PHASE_MAIN2,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(tp,PHASE_END,RESET_PHASE+PHASE_END,1)
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_SKIP_TURN)
e1:SetTargetRange(0,1)
e1:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
Duel.RegisterEffect(e1,tp)
Duel.SkipPhase(tp,PHASE_DRAW,RESET_PHASE+PHASE_END,2)
Duel.SkipPhase(tp,PHASE_STANDBY,RESET_PHASE+PHASE_END,2)
Duel.SkipPhase(tp,PHASE_MAIN1,RESET_PHASE+PHASE_END,2)
end
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetTargetRange(1,0)
e2:SetReset(RESET_PHASE+PHASE_BATTLE_START+RESET_SELF_TURN)
Duel.RegisterEffect(e2,tp)
elseif op==4 then
if not KOISHI_CHECK then
Debug.Message("该功能需要koishi函数!")
return
end
Duel.ResetTimeLimit(0,999)
Duel.ResetTimeLimit(1,999)
elseif op==4 then
return
end
end
\ No newline at end of file
......@@ -30,17 +30,10 @@ function s.initial_effect(c)
e2:SetTarget(s.distg)
e2:SetOperation(s.disop)
c:RegisterEffect(e2)
--win
--local e5=Effect.CreateEffect(c)
--e5:SetCode(EVENT_BATTLE_DAMAGE)
--e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
--e5:SetCondition(s.wincon)
--e5:SetOperation(s.winop)
--c:RegisterEffect(e5)
end
function s.efilter(e,te)
return te:IsActiveType(TYPE_MONSTER) and te:GetOwner()~=e:GetOwner()
and (bit.band(te:GetCode(),EFFECT_DISABLE)~=0 or bit.band(te:GetCategory(),CATEGORY_DISABLE)~=0)
and (te:GetCode()==EFFECT_DISABLE or te:IsHasCategory(CATEGORY_DISABLE))
end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......@@ -79,6 +72,18 @@ end
function s.rmlimit(e,c,tp,r,re)
return c:IsOriginalCodeRule(e:GetLabel()) and re and re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsCode(id) and r==REASON_EFFECT
end
function s.wineff(c)
--win
local e5=Effect.CreateEffect(c)
e5:SetCode(EVENT_BATTLE_DAMAGE)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e5:SetCondition(s.wincon)
e5:SetOperation(s.winop)
c:RegisterEffect(e5)
end
function s.wincon(e,tp,eg,ep,ev,re,r,rp)
return ep==1-tp
end
......
--幻想乡 八意永琳
local s,id,o=GetID()
function s.initial_effect(c)
c:SetUniqueOnField(1,1,id)
--local e0=Effect.CreateEffect(c)
--e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
--e0:SetType(EFFECT_TYPE_SINGLE)
--e0:SetCode(EFFECT_ADD_RACE)
--e0:SetValue(RACE_WARRIOR)
--c:RegisterEffect(e0)
--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+LOCATION_DECK)
e1:SetCountLimit(1,id)
e1:SetCondition(s.spcon)
c:RegisterEffect(e1)
--s.deckdes(c)
if not s.global_flag then
s.global_flag=true
--remove
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD)
ge1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_IMMUNE)
ge1:SetCode(EFFECT_TO_GRAVE_REDIRECT)
ge1:SetTargetRange(LOCATION_OVERLAY,LOCATION_OVERLAY)
ge1:SetTarget(s.target)
ge1:SetValue(s.val)
Duel.RegisterEffect(ge1,0)
end
end
function s.deckdes(c)
--to hand
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_DECKDES+CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_IGNITION)
e5:SetRange(LOCATION_MZONE)
e5:SetCountLimit(1,id+1)
e5:SetTarget(s.ddtg)
e5:SetOperation(s.ddop)
c:RegisterEffect(e5)
end
s.overlay_redirect_todeck=true
function s.target(e,c)
return c.overlay_redirect_todeck==true
end
function s.val(e,c)
if c:IsReason(REASON_RULE) then return false end
return LOCATION_DECKSHF
end
function s.filter(c)
return c:IsFaceup() and c:IsSetCard(0x861) and c:IsType(TYPE_MONSTER)
end
function s.spcon(e,c)
if c==nil then return true end
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and
Duel.IsExistingMatchingCard(s.filter,c:GetControler(),LOCATION_MZONE,0,1,nil)
end
function s.ddtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,5) end
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,5)
end
function s.spfilter(c,e,tp)
return c:IsSetCard(0x863) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.ddop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.DiscardDeck(tp,5,REASON_EFFECT)
local og=Duel.GetOperatedGroup()
local sg=og:Filter(aux.NecroValleyFilter(s.spfilter),nil,e,tp)
if #sg>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.SelectYesNo(tp,aux.Stringid(1621413,2)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=sg:Select(tp,1,1,nil):GetFirst()
if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
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)
tc:RegisterEffect(e2)
end
Duel.SpecialSummonComplete()
end
end
\ No newline at end of file
--幻想乡 不死蓬莱人
local s,id,o=GetID()
s.karuya_name_list=true
function s.initial_effect(c)
c:SetSPSummonOnce(id)
--xyz summon
c:EnableReviveLimit()
aux.AddXyzProcedureLevelFree(c,s.mfilter,s.xyzcheck,2,2)
--attach
local e2=Effect.CreateEffect(c)
e2:SetDescription(1102)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(s.rmcon)
--e2:SetCost(s.rmcost)
e2:SetTarget(s.rmtg)
e2:SetOperation(s.rmop)
c:RegisterEffect(e2)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(2)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_DESTROYED)
e3:SetCondition(s.spcon)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
end
function s.mfilter(c,xyzc)
return c:IsXyzType(TYPE_MONSTER) and c:IsXyzLevel(xyzc,7)
end
function s.xyzcheck(g)
return g:IsExists(Card.IsCode,1,nil,82800072)
end
function s.rmcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
end
function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local og=c:GetOverlayGroup()
if chk==0 then return og and #og>0 and c:CheckRemoveOverlayCard(tp,#og,REASON_COST) end
Duel.SendtoGrave(og,REASON_COST)
end
function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:CheckRemoveOverlayCard(tp,1,REASON_EFFECT) end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),0,0)
end
function s.rmop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local og=c:GetOverlayGroup()
if og and #og>0 and c:CheckRemoveOverlayCard(tp,#og,REASON_EFFECT)
and Duel.SendtoGrave(og,REASON_EFFECT+REASON_EFFECT)~=0 then
Duel.RaiseEvent(c,EVENT_DETACH_MATERIAL,e,0,tp,tp,Duel.GetCurrentChain())
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler())
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_EFFECT+REASON_BATTLE)
end
function s.spfilter(c,e,tp)
return c:IsCode(82800072,82800069) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp)
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,59822133)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and g:GetClassCount(Card.GetCode)>=2 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_GRAVE)
end
function s.fselect(g,tp)
return g:GetClassCount(Card.GetCode)==#g
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsPlayerCanSpecialSummonCount(tp,2) and not Duel.IsPlayerAffectedByEffect(tp,59822133) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 then
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE,0,nil,e,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:SelectSubGroup(tp,s.fselect,false,2,2,tp)
if sg and #sg==2 then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
end
end
\ No newline at end of file
--幻想乡 蓬莱山辉夜
local s,id,o=GetID()
function s.initial_effect(c)
--add race
--local e0=Effect.CreateEffect(c)
--e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
--e0:SetType(EFFECT_TYPE_SINGLE)
--e0:SetCode(EFFECT_ADD_RACE)
--e0:SetValue(RACE_SPELLCASTER)
--c:RegisterEffect(e0)
--Special Summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(2)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCountLimit(1,id)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--material
local e3=Effect.CreateEffect(c)
e3:SetDescription(1165)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,id+1)
e3:SetTarget(s.target)
e3:SetOperation(s.operation)
c:RegisterEffect(e3)
end
function s.filter(c,e,tp)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x863) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function s.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,s.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)
end
end
function s.mfilter(c)
return c:IsCanOverlay()
end
function s.spfilter(c,e,tp,mc)
return c:IsSetCard(0x863) and mc:IsCanBeXyzMaterial(c) and c:IsType(TYPE_XYZ) and c:IsRank(7)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false)
and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.mfilter(chkc) and chkc~=c end
if chk==0 then return aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_XMATERIAL)
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c)
and Duel.IsExistingTarget(s.mfilter,tp,LOCATION_MZONE,0,1,c) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
Duel.SelectTarget(tp,s.mfilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler())
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local mg=Group.FromCards(c)
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and aux.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,c):GetFirst()
if sc then
Duel.BreakEffect()
sc:SetMaterial(mg)
local og1=c:GetOverlayGroup()
if og1:GetCount()>0 then
Duel.SendtoGrave(og1,REASON_RULE)
end
Duel.Overlay(sc,mg)
if Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)~=0 then
sc:CompleteProcedure()
if 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(sc,Group.FromCards(tc))
end
end
end
end
end
\ No newline at end of file
--幻想乡 藤原妹红
local s,id,o=GetID()
function s.initial_effect(c)
--add race
--local e0=Effect.CreateEffect(c)
--e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
--e0:SetType(EFFECT_TYPE_SINGLE)
--e0:SetCode(EFFECT_ADD_RACE)
--e0:SetValue(RACE_WARRIOR)
--c:RegisterEffect(e0)
--Special Summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(2)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
--e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCountLimit(1,id)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(2)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_HAND)
e3:SetCountLimit(1,id+2)
e3:SetCondition(s.hspcon)
e3:SetTarget(s.hsptg)
e3:SetOperation(s.hspop)
c:RegisterEffect(e3)
--to hand
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_REMOVE)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCountLimit(1,id+1)
e4:SetTarget(s.thtg)
e4:SetOperation(s.thop)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(s.thcon)
c:RegisterEffect(e5)
end
s.karuya_name_list=true
function s.filter(c,e,tp)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x861) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.cfilter(c,e,tp)
return c:IsFaceup() and c:IsSetCard(0x861) and c:IsType(TYPE_MONSTER)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_DECK,0,1,nil,e,tp)
and not Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_DECK)
end
function s.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,aux.NecroValleyFilter(s.filter),tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetTarget(s.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.splimit(e,c)
return not c:IsRace(RACE_ILLUSION)
end
function s.hcfilter(c)
return c:IsFaceup() and c:IsRace(RACE_ILLUSION)
end
function s.hspcon(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)
return ct==0 or ct==Duel.GetMatchingGroupCount(s.hcfilter,tp,LOCATION_MZONE,0,nil)
end
function s.hsptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function s.hspop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL)
e1:SetValue(3)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
end
Duel.SpecialSummonComplete()
end
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_DECK)
end
function s.thfilter(c)
return c.karuya_name_list==true and c:IsType(TYPE_SPELL) and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
\ No newline at end of file
--幻想乡 永远亭
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
--level
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:SetTarget(s.target)
e2:SetValue(500)
c:RegisterEffect(e2)
--destroy or to hand
local e5=Effect.CreateEffect(c)
e5:SetDescription(1102)
e5:SetCategory(CATEGORY_REMOVE)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_DETACH_MATERIAL)
e5:SetRange(LOCATION_FZONE)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCountLimit(1,id+1)
e5:SetCondition(s.rmcon)
e5:SetTarget(s.rmtg)
e5:SetOperation(s.rmop)
c:RegisterEffect(e5)
local e4=e5:Clone()
e4:SetCode(EVENT_TO_DECK)
e4:SetCondition(s.rmmcon)
c:RegisterEffect(e4)
local e3=e4:Clone()
e3:SetCode(EVENT_TO_GRAVE)
c:RegisterEffect(e3)
local e6=e4:Clone()
e6:SetCode(EVENT_TO_HAND)
c:RegisterEffect(e6)
local e7=e4:Clone()
e7:SetCode(EVENT_REMOVE)
c:RegisterEffect(e7)
end
s.karuya_name_list=true
function s.rmlimit(e,c,tp,r,re)
return c==e:GetHandler() and r&REASON_EFFECT>0
end
function s.thfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x861,0x863) and c:IsAbleToHand()
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:Select(tp,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
end
function s.target(e,c)
return c:IsType(TYPE_XYZ) or c:IsSetCard(0x863)
end
function s.cfilter(c)
return c:IsLocation(LOCATION_MZONE) and c:IsSetCard(0x863) and c:IsType(TYPE_XYZ)
end
function s.rmcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.cfilter,1,nil)
end
function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
end
function s.rmop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 then
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
end
function s.mcfilter(c)
return c:IsPreviousLocation(LOCATION_OVERLAY) and c:IsSetCard(0x863) and not c:IsReason(REASON_RULE)
end
function s.rmmcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.mcfilter,1,nil)
end
\ No newline at end of file
--蓬莱山辉夜的宿敌
local s,id,o=GetID()
s.karuya_name_list=true
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
--maintain
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetOperation(s.mtop)
c:RegisterEffect(e2)
--lv
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_GRAVE)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e3:SetCountLimit(1,id)
e3:SetCost(aux.bfgcost)
e3:SetTarget(s.thtg)
e3:SetOperation(s.thop)
c:RegisterEffect(e3)
end
function s.rmfilter(c)
return c:IsAbleToRemove() and c:IsSetCard(0x863) and c:IsType(TYPE_MONSTER)
end
function s.mtop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,id)
local sg=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_DECK,0,nil)
if #sg>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local rg=sg:Select(tp,1,1,nil)
Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)
else
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
end
function s.posfilter1(c)
return c:IsFaceup()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(s.posfilter1,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingTarget(s.posfilter1,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELF)
local g1=Duel.SelectTarget(tp,s.posfilter1,tp,LOCATION_MZONE,0,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,530)
local g2=Duel.SelectTarget(tp,s.posfilter1,tp,0,LOCATION_MZONE,1,1,nil)
end
function s.atcon(e)
local c=e:GetLabelObject()
return c:GetFlagEffectLabel(id)==e:GetLabel()
end
function s.attg(e,c)
return c:GetFlagEffect(id)>0
end
function s.atlimit(e,c)
return c~=e:GetHandler() and c:GetFlagEffect(id)==0
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local fid=c:GetFieldID()
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tg=g:Filter(Card.IsRelateToEffect,nil,e)
if #tg<2 then
c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(id,0))
for tc in aux.Next(tg) do
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,0,1,0)
--at limit
local e1=Effect.CreateEffect(c)
--e1:SetDescription(aux.Stringid(id,1))
--e1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(0,LOCATION_MZONE)
e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
e1:SetLabelObject(c)
e1:SetLabel(fid)
e1:SetCondition(s.atcon)
e1:SetTarget(s.attg)
e1:SetValue(s.atlimit)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e5=Effect.CreateEffect(c)
--e5:SetDescription(aux.Stringid(id,2))
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e5:SetCode(EFFECT_UNRELEASABLE_SUM)
e5:SetRange(LOCATION_MZONE)
e5:SetLabelObject(c)
e5:SetLabel(fid)
e5:SetCondition(s.atcon)
e5:SetReset(RESET_EVENT+RESETS_STANDARD)
e5:SetValue(1)
tc:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e6:SetCode(EFFECT_UNRELEASABLE_NONSUM)
tc:RegisterEffect(e6)
local e7=e5:Clone()
--e7:SetDescription(aux.Stringid(id,4))
e7:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e7:SetValue(s.fuslimit)
tc:RegisterEffect(e7)
local e8=e5:Clone()
--e8:SetDescription(aux.Stringid(id,5))
e8:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
tc:RegisterEffect(e8)
local e10=e5:Clone()
--e10:SetDescription(aux.Stringid(id,6))
e10:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
tc:RegisterEffect(e10)
--cannot target
local e11=Effect.CreateEffect(c)
--e11:SetDescription(aux.Stringid(id,7))
e11:SetType(EFFECT_TYPE_SINGLE)
e11:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e11:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e11:SetRange(LOCATION_MZONE)
e11:SetLabelObject(c)
e11:SetLabel(fid)
e11:SetCondition(s.atcon)
e11:SetValue(s.tgoval)
e11:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e11)
end
local loc=LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED
--indes
local e2=Effect.CreateEffect(c)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_MZONE+LOCATION_SZONE)
e2:SetTargetRange(loc,loc)
e2:SetLabelObject(c)
e2:SetLabel(fid)
e2:SetTarget(s.evtg)
e2:SetValue(s.evalue)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetRange(LOCATION_MZONE+LOCATION_SZONE)
e3:SetTargetRange(1,1)
e3:SetValue(s.aclimit)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e3)
--adjust
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e4:SetCode(EVENT_ADJUST)
e4:SetRange(LOCATION_MZONE+LOCATION_SZONE)
e4:SetOperation(s.adjustop)
e4:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e4)
end
end
function s.fuslimit(e,c,st)
return st==SUMMON_TYPE_FUSION
end
function s.adjcfilter(c)
return c:IsFaceup() and c:GetFlagEffect(id)>0
end
function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetMatchingGroupCount(s.adjcfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if ct~=2 then
Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT)
Duel.Readjust()
end
end
function s.aclimit(e,re,tp)
local rc=re:GetHandler()
return rc:GetFlagEffect(id)>0 and not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET)
end
function s.evtg(e,c)
return c:GetFlagEffect(id)==0 or c:GetFlagEffectLabel(id)==e:GetLabel()
end
function s.evalue(e,re,rp)
local rc=re:GetHandler()
return rc:GetFlagEffect(id)>0
end
function s.tgoval(e,re,rp)
return e:GetHandler()==re:GetHandler()
end
function s.gthfilter(c)
return c.karuya_name_list==true and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.gthfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.gthfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
--蓬莱山辉夜的索取
local s,id,o=GetID()
s.karuya_name_list=true
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,id)
e1:SetCost(s.cost2)
e1:SetTarget(s.target2)
e1:SetOperation(s.activate2)
c:RegisterEffect(e1)
--lv
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_GRAVE)
e3:SetCountLimit(1,id)
e3:SetCost(aux.bfgcost)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
end
function s.cfilter2(c)
return c:IsFaceup() and (c.karuya_name_list==true or c:IsSetCard(0x863)) and c:IsAbleToDeckAsCost()
end
function s.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
local res=Duel.IsExistingMatchingCard(s.cfilter2,tp,LOCATION_REMOVED,0,2,nil)
if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then res=true end
if chk==0 then return res end
if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,s.cfilter2,tp,LOCATION_REMOVED,0,2,2,nil)
Duel.HintSelection(g)
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST)
end
function s.spfilter(c,e,tp)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x861) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function s.activate2(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,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_DECK+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 s.hspfilter(c,e,tp)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x861,0x863) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.hspfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function s.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,s.hspfilter,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 s.Select(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,id)
--e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
function s.cfilter(c)
return c:IsLevelBelow(3) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local res=Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil)
if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then res=true end
if chk==0 then return res end
if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function s.filter(c)
return c:IsSetCard(0x861) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
local b1=Duel.GetFlagEffect(tp,id)==0 and s.cost(e,tp,eg,ep,ev,re,r,rp,0)
and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil)
local b2=Duel.GetFlagEffect(tp,id+1)==0 and s.cost2(e,tp,eg,ep,ev,re,r,rp,0)
and s.target2(e,tp,eg,ep,ev,re,r,rp,0)
if chk==0 then return b1 or b2 end
local off=1
local ops={}
local opval={}
if b1 then
ops[off]=1109
opval[off-1]=1
off=off+1
end
if b2 then
ops[off]=2
opval[off-1]=2
off=off+1
end
local op=Duel.SelectOption(tp,table.unpack(ops))
local sel=opval[op]
e:SetLabel(sel)
if sel==1 then
s.cost(e,tp,eg,ep,ev,re,r,rp,1)
Duel.RegisterFlagEffect(tp,id,RESET_PHASE+PHASE_END,0,1)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
elseif sel==2 then
s.cost2(e,tp,eg,ep,ev,re,r,rp,1)
Duel.RegisterFlagEffect(tp,id+1,RESET_PHASE+PHASE_END,0,1)
s.target2(e,tp,eg,ep,ev,re,r,rp,1)
end
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local sel=e:GetLabel()
if sel==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
elseif sel==2 then
s.activate2(e,tp,eg,ep,ev,re,r,rp)
end
end
\ No newline at end of file
--蓬莱山辉夜的五种神宝
local s,id,o=GetID()
s.karuya_name_list=true
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetDescription(1124)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
function s.rccfilter(c)
return c:IsFaceup() and c:IsSetCard(0x861) and c:IsType(TYPE_MONSTER)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.rccfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
local b1=Duel.GetFlagEffect(tp,id)==0
local b2=Duel.GetFlagEffect(tp,id+100)==0 and s.damtg(e,tp,eg,ep,ev,re,r,rp,0,chkc)
local b3=Duel.GetFlagEffect(tp,id+200)==0 and s.target2(e,tp,eg,ep,ev,re,r,rp,0)
local b4=Duel.GetFlagEffect(tp,id+300)==0 and s.postg(e,tp,eg,ep,ev,re,r,rp,0,chkc)
local b5=Duel.GetFlagEffect(tp,id+400)==0 and s.drtg(e,tp,eg,ep,ev,re,r,rp,0)
if chk==0 then return b1 or b2 or b3 or b4 or b5 end
local off=1
local ops={}
local opval={}
if b1 then
ops[off]=1124
opval[off-1]=1
off=off+1
end
if b2 then
ops[off]=1122
opval[off-1]=2
off=off+1
end
if b3 then
ops[off]=1106
opval[off-1]=3
off=off+1
end
if b4 then
ops[off]=1131
opval[off-1]=4
off=off+1
end
if b5 then
ops[off]=1108
opval[off-1]=5
off=off+1
end
local op=Duel.SelectOption(tp,table.unpack(ops))
local sel=opval[op]
e:SetLabel(sel)
if sel==1 then
Duel.RegisterFlagEffect(tp,id,RESET_PHASE+PHASE_END,0,1)
elseif sel==2 then
Duel.RegisterFlagEffect(tp,id+100,RESET_PHASE+PHASE_END,0,1)
s.damtg(e,tp,eg,ep,ev,re,r,rp,1,chkc)
elseif sel==3 then
Duel.RegisterFlagEffect(tp,id+200,RESET_PHASE+PHASE_END,0,1)
s.target2(e,tp,eg,ep,ev,re,r,rp,1)
elseif sel==4 then
Duel.RegisterFlagEffect(tp,id+300,RESET_PHASE+PHASE_END,0,1)
s.postg(e,tp,eg,ep,ev,re,r,rp,1,chkc)
elseif sel==5 then
Duel.RegisterFlagEffect(tp,id+400,RESET_PHASE+PHASE_END,0,1)
s.drtg(e,tp,eg,ep,ev,re,r,rp,1)
end
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local sel=e:GetLabel()
if sel==1 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetValue(1)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
Duel.RegisterEffect(e2,tp)
elseif sel==2 then
s.damop(e,tp,eg,ep,ev,re,r,rp)
elseif sel==3 then
s.activate2(e,tp,eg,ep,ev,re,r,rp)
elseif sel==4 then
s.posop(e,tp,eg,ep,ev,re,r,rp)
elseif sel==5 then
s.drop(e,tp,eg,ep,ev,re,r,rp)
end
end
function s.danfilter(c)
return c:IsFaceup() and c:GetBaseAttack()>0
end
function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.danfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.danfilter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,s.danfilter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,g:GetFirst():GetAttack())
end
function s.damop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local atk=tc:GetBaseAttack()/2
if tc:IsRelateToEffect(e) and tc:IsFaceup() and atk>0 then
Duel.Damage(1-tp,atk,REASON_EFFECT)
end
end
function s.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 end
end
function s.activate2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local hg=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
if #hg>0 then
Duel.ConfirmCards(tp,hg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rc=hg:Select(tp,1,1,nil):GetFirst()
if Duel.Remove(rc,POS_FACEUP,REASON_EFFECT+REASON_TEMPORARY)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetLabelObject(rc)
e1:SetCountLimit(1)
e1:SetOperation(s.retop)
Duel.RegisterEffect(e1,tp)
end
end
end
function s.retop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoHand(e:GetLabelObject(),nil,REASON_EFFECT)
end
function s.posfilter(c)
return c:IsFaceup() and c:IsCanTurnSet() and aux.NegateMonsterFilter(c)
end
function s.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.posfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.posfilter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,s.posfilter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function s.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsCanBeDisabledByEffect(e) then
Duel.NegateRelatedChain(tc,RESETS_STANDARD-RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
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)
tc:RegisterEffect(e2)
end
if tc:IsRelateToEffect(e) and tc:IsLocation(LOCATION_MZONE) and tc:IsFaceup() then
Duel.ChangePosition(tc,POS_FACEDOWN_DEFENSE)
end
end
function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(2)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
end
function s.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
--永远亭 铃仙·优昙华院因幡
local s,id,o=GetID()
s.karuya_name_list=true
function s.initial_effect(c)
--add race
--local e0=Effect.CreateEffect(c)
--e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
--e0:SetType(EFFECT_TYPE_SINGLE)
--e0:SetCode(EFFECT_ADD_RACE)
--e0:SetValue(RACE_BEAST+RACE_BEASTWARRIOR)
--c:RegisterEffect(e0)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(2)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,id)
e1:SetCost(s.spcost)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,id+1)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
c:RegisterEffect(e2)
end
function s.cfilter(c)
return c:IsSetCard(0x863) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost() and not c:IsCode(id)
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_DECK,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and 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
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
function s.thfilter(c)
return (c:IsSetCard(0x863) or c.karuya_name_list==true) and c:IsType(TYPE_SPELL) and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
\ No newline at end of file
--永远亭 兔妖
local s,id,o=GetID()
s.karuya_name_list=true
function s.initial_effect(c)
c:EnableReviveLimit()
--material
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x863),1,1)
--copy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(70369116,1))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,id)
e2:SetCost(s.cpcost)
e2:SetTarget(s.cptg)
e2:SetOperation(s.cpop)
c:RegisterEffect(e2)
--draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(1109)
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCountLimit(1,id)
e2:SetCondition(s.thcon)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
c:RegisterEffect(e2)
end
function s.cpfilter(c)
return c.karuya_name_list==true and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToRemoveAsCost()
and c:CheckActivateEffect(true,true,false)~=nil
end
function s.cpcost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
if chk==0 then return true end
end
function s.cptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if e:GetLabel()==0 then return false end
e:SetLabel(0)
return Duel.CheckLPCost(tp,1000) and Duel.IsExistingMatchingCard(s.cpfilter,tp,LOCATION_DECK,0,1,nil)
end
e:SetLabel(0)
Duel.PayLPCost(tp,1000)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,s.cpfilter,tp,LOCATION_DECK,0,1,1,nil)
local te,ceg,cep,cev,cre,cr,crp=g:GetFirst():CheckActivateEffect(true,true,true)
Duel.Remove(g,POS_FACEUP,REASON_COST)
e:SetProperty(te:GetProperty())
local tg=te:GetTarget()
if tg then tg(e,tp,ceg,cep,cev,cre,cr,crp,1) end
te:SetLabelObject(e:GetLabelObject())
e:SetLabelObject(te)
Duel.ClearOperationInfo(0)
end
function s.cpop(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
if te then
e:SetLabelObject(te:GetLabelObject())
local op=te:GetOperation()
if op then op(e,tp,eg,ep,ev,re,r,rp) end
end
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetReset(RESET_PHASE+PHASE_END)
e2:SetTarget(s.splimit)
Duel.RegisterEffect(e2,tp)
end
function s.splimit(e,c)
return not c:IsType(TYPE_XYZ) and c:IsLocation(LOCATION_EXTRA)
end
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_EFFECT)
end
function s.filter(c)
return ((c:IsType(TYPE_MONSTER) and c:IsSetCard(0x863)) or c:IsSetCard(0x863)) and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
--永远亭 兔妖出击
local s,id,o=GetID()
s.karuya_name_list=true
function s.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,nil,3,2)
c:EnableReviveLimit()
--add race
--local e0=Effect.CreateEffect(c)
--e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
--e0:SetType(EFFECT_TYPE_SINGLE)
--e0:SetCode(EFFECT_ADD_RACE)
--e0:SetValue(RACE_BEAST+RACE_BEASTWARRIOR)
--c:RegisterEffect(e0)
--Search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCost(s.thcost)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
c:RegisterEffect(e2)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_DESTROY+CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCountLimit(1,id)
e3:SetTarget(s.destg)
e3:SetOperation(s.desop)
c:RegisterEffect(e3)
end
function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function s.thfilter(c)
return (c:IsSetCard(0x863) or c.karuya_name_list==true) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function s.dthfilter(c)
return c:IsSetCard(0x95) and c:IsAbleToHand()
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and s.desfilter(chkc) and chkc~=e:GetHandler() end
if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_ONFIELD,0,1,e:GetHandler())
and Duel.IsExistingMatchingCard(s.dthfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_ONFIELD,0,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.dthfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetTarget(s.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.splimit(e,c)
return not c:IsSetCard(0x863)
end
--永远亭 兔妖准备
local s,id,o=GetID()
s.karuya_name_list=true
function s.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x863),3,2,nil,nil,99)
c:EnableReviveLimit()
--add race
--local e0=Effect.CreateEffect(c)
--e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
--e0:SetType(EFFECT_TYPE_SINGLE)
--e0:SetCode(EFFECT_ADD_RACE)
--e0:SetValue(RACE_BEAST+RACE_BEASTWARRIOR)
--c:RegisterEffect(e0)
--tograve
local e1=Effect.CreateEffect(c)
e1:SetDescription(1110)
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,id)
e1:SetCondition(s.tdcon)
e1:SetTarget(s.tdtg)
e1:SetOperation(s.tdop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(31123642,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,id+1)
e2:SetCost(s.spcost)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
end
function s.tdcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
end
function s.tdfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToDeck()
end
function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.tdfilter,tp,LOCATION_REMOVED,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_REMOVED)
end
function s.atkfilter(c)
return c:IsFaceup() and c:IsSetCard(0x863)
end
function s.tdop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,s.tdfilter,tp,LOCATION_REMOVED,0,1,1,nil)
local sg=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_MZONE,0,nil)
if g:GetCount()>0 and Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 then
Duel.BreakEffect()
for tc in aux.Next(sg) do
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
e3:SetValue(500)
tc:RegisterEffect(e3)
local e2=e3:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
tc:RegisterEffect(e2)
end
end
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100)
if chk==0 then return true end
end
function s.spfilter(c,e,tp)
return c:IsRace(RACE_ILLUSION) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local sg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_DECK,0,nil,e,tp)
local ct=math.min(Duel.GetLocationCount(tp,LOCATION_MZONE),c:GetOverlayCount(),#sg)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ct=1 end
if chk==0 then
if e:GetLabel()~=100 then return false end
e:SetLabel(0)
return c:CheckRemoveOverlayCard(tp,1,REASON_COST) and ct>0 end
local at=c:RemoveOverlayCard(tp,1,ct,REASON_COST)
e:SetLabel(at)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,at,tp,LOCATION_DECK)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local ct=e:GetLabel()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<ct then return end
if ct>1 and Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,ct,ct,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
\ No newline at end of file
--永远亭 因幡帝
local s,id,o=GetID()
function s.race(c)
--add race
local e0=Effect.CreateEffect(c)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_ADD_RACE)
e0:SetValue(RACE_BEAST)
c:RegisterEffect(e0)
end
function s.initial_effect(c)
--return
local e1=Effect.CreateEffect(c)
e1:SetDescription(2)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_REMOVED)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,id)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
--draw
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetDescription(1108)
e4:SetCategory(CATEGORY_DRAW)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetCountLimit(1,id+1)
e4:SetCondition(s.drcon)
e4:SetTarget(s.drtg)
e4:SetOperation(s.drop)
c:RegisterEffect(e4)
end
function s.filter(c)
return c:IsRace(RACE_ILLUSION+RACE_BEAST+RACE_BEASTWARRIOR+RACE_WARRIOR) and c:IsFaceup()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end
local c=e:GetHandler()
if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsFaceup()
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetTargetRange(1,0)
e1:SetTarget(s.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.splimit(e,c)
return not (c:IsRace(RACE_ILLUSION) and c:IsSetCard(0x863))
end
function s.drcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_OVERLAY)
end
function s.drtg(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 s.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
--永远亭 月之公主蓬莱山辉夜
local s,id,o=GetID()
s.karuya_name_list=true
function s.race(c)
--add race
local e0=Effect.CreateEffect(c)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_ADD_RACE)
e0:SetValue(RACE_SPELLCASTER)
c:RegisterEffect(e0)
end
function s.initial_effect(c)
--c:SetSPSummonOnce(id)
--xyz summon
c:EnableReviveLimit()
aux.AddXyzProcedureLevelFree(c,s.mfilter,s.xyzcheck,2,2)
--set
local e2=Effect.CreateEffect(c)
e2:SetDescription(1153)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,id)
e2:SetHintTiming(0,TIMING_END_PHASE)
e2:SetCost(s.setcost)
e2:SetTarget(s.settg)
e2:SetOperation(s.setop)
c:RegisterEffect(e2)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,id+1)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e3:SetTarget(s.target)
e3:SetOperation(s.operation)
c:RegisterEffect(e3)
end
function s.mfilter(c,xyzc)
return c:IsXyzType(TYPE_MONSTER) and c:IsXyzLevel(xyzc,7)
end
function s.xyzcheck(g)
return g:IsExists(Card.IsSetCard,1,nil,0x861)
end
function s.setfilter(c,tp)
return c:IsFaceupEx() and c:IsType(TYPE_SPELL) and c:IsSSetable(true) and c:IsSetCard(0x861,0x863)
and (c:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0)
end
function s.setcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function s.settg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and s.setfilter(chkc,tp) end
if chk==0 then return Duel.IsExistingTarget(s.setfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil,tp) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectTarget(tp,s.setfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil,tp)
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0)
end
function s.setop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SSet(tp,tc)~=0 then
if tc:IsType(TYPE_QUICKPLAY) then
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e2:SetCode(EFFECT_QP_ACT_IN_SET_TURN)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2)
else
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e2:SetRange(LOCATION_SZONE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e2:SetTarget(s.destg)
e2:SetOperation(s.desop)
tc:RegisterEffect(e2)
end
end
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local te,eg,ep,ev,re,r,rp=c:CheckActivateEffect(true,true,true)
local cost=nil
if te and te:GetCost() then cost=te:GetCost() end
local condition=nil
if te and te:GetCondition() then condition=te:GetCondition() end
local tg=nil
if te and te:GetTarget() then tg=te:GetTarget() end
local res=c:CheckActivateEffect(true,true,false)~=nil
and (not cost or cost(e,tp,eg,ep,ev,re,r,rp,0)) and te:CheckCountLimit(tp)==true
and (not condition or condition(e,tp,eg,ep,ev,re,r,rp)) and (not tg or tg(e,tp,eg,ep,ev,re,r,rp,0))
if chk==0 then return c:GetFlagEffect(id)==0 and res end
Duel.ChangePosition(c,POS_FACEUP)
if cost then cost(e,tp,eg,ep,ev,re,r,rp,1) end
e:SetProperty(te:GetProperty())
if tg then tg(e,tp,eg,ep,ev,re,r,rp,1) end
te:SetLabelObject(c)
e:SetLabelObject(te)
Duel.ClearOperationInfo(0)
c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te=e:GetLabelObject()
if te then
e:SetLabelObject(te:GetLabelObject())
local op=te:GetOperation()
if op then op(e,tp,eg,ep,ev,re,r,rp) end
end
if not c:IsType(TYPE_CONTINUOUS+TYPE_FIELD) then
Duel.SendtoGrave(c,REASON_RULE)
end
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return e:GetHandler():IsType(TYPE_XYZ)
and Duel.IsExistingMatchingCard(Card.IsCanOverlay,tp,0,LOCATION_ONFIELD,1,e:GetHandler()) end
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local tg=Duel.SelectMatchingCard(tp,Card.IsCanOverlay,tp,0,LOCATION_ONFIELD,1,1,nil)
local tc=tg:GetFirst()
if tc then
local og=tc:GetOverlayGroup()
if og:GetCount()>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
Duel.Overlay(c,tg)
end
end
\ No newline at end of file
--永远亭 月之贤者八意永琳
local s,id,o=GetID()
function s.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_ILLUSION),7,3,s.ovfilter,aux.Stringid(id,0),3)
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(1,0)
e1:SetTarget(s.splimit)
c:RegisterEffect(e1)
--material
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,id)
e2:SetCost(s.rmcost)
e2:SetTarget(s.target)
e2:SetOperation(s.operation)
c:RegisterEffect(e2)
end
function s.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsSetCard(0x862)
end
function s.ovfilter(c)
return c:IsFaceup() and c:IsCode(82800063)
end
function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local og=c:GetOverlayGroup()
if chk==0 then return og and #og>0 and c:CheckRemoveOverlayCard(tp,#og,REASON_COST) end
Duel.SendtoGrave(og,REASON_COST)
Duel.RaiseEvent(c,EVENT_DETACH_MATERIAL,e,0,tp,tp,Duel.GetCurrentChain())
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac=Duel.AnnounceCard(tp)
Duel.SetTargetParam(ac)
Duel.SetOperationInfo(0,CATEGORY_ANNOUNCE,nil,0,tp,0)
end
function s.rmfilter(c,d)
return c:IsFaceup() and c:IsCode(d)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ac=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE)
e1:SetTargetRange(LOCATION_ONFIELD,LOCATION_ONFIELD)
e1:SetTarget(s.distg)
e1:SetLabel(ac)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetCondition(s.discon)
e2:SetOperation(s.disop)
e2:SetLabel(ac)
Duel.RegisterEffect(e2,tp)
local sg=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,ac)
if #sg>0 then
Duel.Remove(sg,POS_FACEUP,REASON_EFFECT)
end
end
function s.distg(e,c)
local ac=e:GetLabel()
return c:IsCode(ac) and (c:IsType(TYPE_EFFECT+TYPE_SPELL+TYPE_TRAP) or c:GetOriginalType()&TYPE_EFFECT~=0)
end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
local ac=e:GetLabel()
return re:GetHandler():IsCode(ac)
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev)
end
--永远亭集结 永夜抄异变
local s,id,o=GetID()
function s.initial_effect(c)
--xyz summon
c:EnableReviveLimit()
aux.AddXyzProcedureLevelFree(c,s.mfilter,s.xyzcheck,5,5)
--atk gain
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(s.value)
c:RegisterEffect(e1)
--cannot target
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetValue(aux.tgoval)
c:RegisterEffect(e2)
--negate
local e3=Effect.CreateEffect(c)
e3:SetDescription(1131)
e3:SetCategory(CATEGORY_NEGATE)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_CHAINING)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,id)
e3:SetCondition(s.discon)
e3:SetCost(s.discost)
e3:SetTarget(s.distg)
e3:SetOperation(s.disop)
c:RegisterEffect(e3)
--material
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetTarget(s.target)
e4:SetOperation(s.operation)
c:RegisterEffect(e4)
--maintain
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_DAMAGE)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e5:SetCode(EVENT_PHASE+PHASE_END)
e5:SetRange(LOCATION_MZONE)
e5:SetCountLimit(1)
e5:SetCondition(s.mtcon)
e5:SetTarget(s.mttg)
e5:SetOperation(s.mtop)
c:RegisterEffect(e5)
end
function s.mfilter(c,xyzc)
return c:IsXyzType(TYPE_MONSTER) and c:IsXyzLevel(xyzc,9)
end
function s.xyzcheck(g)
return g:IsExists(Card.IsRace,1,nil,RACE_ILLUSION)
end
function s.value(e,c)
return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_REMOVED,LOCATION_REMOVED)*300
end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainDisablable(ev)
end
function s.discost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function s.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)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
end
end
function s.vfilter(c)
return c:IsCanOverlay() and c:IsFaceup() and c:IsType(TYPE_MONSTER)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return e:GetHandler():IsType(TYPE_XYZ)
and Duel.IsExistingMatchingCard(s.vfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,e:GetHandler()) end
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local tg=Duel.SelectMatchingCard(tp,s.vfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,1,nil)
local tc=tg:GetFirst()
if tc then
local og=tc:GetOverlayGroup()
if og:GetCount()>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
Duel.Overlay(c,tg)
end
end
function s.mtcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local og=c:GetOverlayGroup()
return Duel.GetTurnPlayer()==tp and og:GetClassCount(Card.GetRace)>=5
end
function s.mttg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local og=c:GetOverlayGroup()
if chk==0 then return og:GetClassCount(Card.GetRace)>=5 end
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,#og*800)
end
function s.mtop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local og=c:GetOverlayGroup()
if og:GetClassCount(Card.GetRace)>=5 then
local ct=Duel.SendtoGrave(og,REASON_EFFECT)
Duel.Damage(1-tp,ct*800,REASON_EFFECT)
end
end
\ No newline at end of file
--永远亭启动 永恒假面之月
local s,id,o=GetID()
function s.initial_effect(c)
c:SetUniqueOnField(1,0,id)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.condition)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(2)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetTarget(s.target)
e2:SetOperation(s.activate)
c:RegisterEffect(e2)
--summon with no tribute
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_HAND,0)
e3:SetCode(EFFECT_SUMMON_PROC)
e3:SetCountLimit(1)
e3:SetCondition(s.ntcon)
e3:SetTarget(s.nttg)
c:RegisterEffect(e3)
--draw
local e4=Effect.CreateEffect(c)
e4:SetDescription(1108)
e4:SetCategory(CATEGORY_DRAW)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCountLimit(1)
e4:SetRange(LOCATION_SZONE)
e4:SetCondition(s.drcon)
e4:SetTarget(s.drtg)
e4:SetOperation(s.drop)
c:RegisterEffect(e4)
if not s.global_flag then
s.global_flag=true
s[0]={}
for i=1,65535 do
table.insert(s[0],i)
end
--self destroy
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_DRAW)
ge2:SetOperation(s.regop)
Duel.RegisterEffect(ge2,0)
end
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
for tc in aux.Next(eg) do
if re and re:GetHandler():IsSetCard(0x863) then return end
if tc:IsCode(id) and tc:IsLocation(LOCATION_HAND+LOCATION_SZONE) then
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD+RESET_PHASE+PHASE_END,0,1)
end
end
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetFlagEffect(id)==0
end
function s.ntcon(e,c,minc)
if c==nil then return true end
return minc==0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function s.nttg(e,c)
return c:IsLevelAbove(7)
end
function s.drfilter(c,tp)
return c:IsSetCard(0x863) and c:IsSummonPlayer(tp) and c:IsSummonType(SUMMON_TYPE_XYZ)
end
function s.drcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.drfilter,1,e:GetHandler(),tp)
end
function s.drtg(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 s.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
function s.rmfilter(c,d)
return c:IsAbleToRemove() and c:IsSetCard(d)
end
function s.filter1(c,e,tp)
if not c:IsType(TYPE_XYZ) then return end
local dg=Group.CreateGroup()
local g=nil
for i,setcard in ipairs(s[0]) do
if c:IsSetCard(setcard) then
g=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE,0,nil,setcard)
dg:Merge(g)
end
end
local rk=c:GetRank()
return #dg>0 and rk>0 and c:IsFaceup() and aux.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL)
and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,#dg)
end
function s.filter2(c,e,tp,mc,rk)
if c:GetOriginalCode()==6165656 and not mc:IsCode(48995978) then return false end
local rank=mc:GetRank()
local kk=rank+rk
return c:IsRankBelow(kk) and c:GetRank()>rank and mc:IsCanBeXyzMaterial(c)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,true,true) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter1(chkc,e,tp) end
if chk==0 then return Duel.IsExistingTarget(s.filter1,tp,LOCATION_MZONE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,s.filter1,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.fselect(g,e,tp,mc)
return Duel.IsExistingMatchingCard(s.filter3,tp,LOCATION_EXTRA,0,1,nil,e,tp,mc,#g)
end
function s.filter3(c,e,tp,mc,rk)
if c:GetOriginalCode()==6165656 and not mc:IsCode(48995978) then return false end
local rank=mc:GetRank()
local kk=rank+rk
return c:IsRank(kk) and mc:IsCanBeXyzMaterial(c)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,true,true) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if not aux.MustMaterialCheck(tc,tp,EFFECT_MUST_BE_XMATERIAL) then return end
if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) then return end
local d=Group.CreateGroup()
local g=nil
for i,setcard in ipairs(s[0]) do
if tc:IsSetCard(setcard) then
g=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE,0,nil,setcard)
end
end
local sg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_EXTRA,0,nil,TYPE_XYZ)
local tg,rk=sg:GetMaxGroup(Card.GetRank)
--Debug.Message(rk)
local ct=math.min(#g,rk-tc:GetRank())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=g:SelectSubGroup(tp,s.fselect,false,1,ct,e,tp,tc)
local ct=Duel.Remove(sg,POS_FACEUP,REASON_EFFECT)
if ct>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local egg=Duel.SelectMatchingCard(tp,s.filter3,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,ct)
local sc=egg:GetFirst()
if sc then
local mg=tc:GetOverlayGroup()
if mg:GetCount()~=0 then
Duel.Overlay(sc,mg)
end
sc:SetMaterial(Group.FromCards(tc))
Duel.Overlay(sc,Group.FromCards(tc))
Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,true,true,POS_FACEUP)
sc:CompleteProcedure()
end
end
end
\ No newline at end of file
......@@ -25,7 +25,7 @@ function s.initial_effect(c)
c:RegisterEffect(e2)
end
function s.rmfilter(c,tp)
return c:IsRace(RACE_ZOMBIE) and c:IsAbleToRemove() and c:IsFaceupEx()
return c:IsRace(RACE_ZOMBIE) and c:IsAbleToRemove() and c:IsFaceupEx() and c:IsAttackBelow(1000)
and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,c)
end
function s.filter(c)
......
......@@ -96,6 +96,7 @@ function s.rsfilter(c)
end
function s.ttcon(e,c,minc)
if c==nil then return true end
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(s.rsfilter,tp,LOCATION_MZONE,0,nil)
return minc<=4 and g:GetClassCount(Card.GetOriginalCode)>3 and Duel.CheckTribute(c,4,4,g)
end
......
......@@ -71,7 +71,7 @@ function s.ttcon(e,c,minc)
local mg=Duel.GetMatchingGroup(Card.IsAbleToRemoveAsCost,tp,LOCATION_MZONE,0,nil)
local mg2=Duel.GetMatchingGroup(Card.IsAbleToRemoveAsCost,tp,0,LOCATION_ONFIELD,nil)
if Duel.IsPlayerAffectedByEffect(tp,82800126) then mg:Merge(mg2) end
return minc<=ct and Duel.CheckTribute(c,ct,ct,mg) and mg:CheckSubGroup(s.fselect,2,2,tp)
return minc<=ct and mg:CheckSubGroup(s.fselect,2,2,tp)
end
function s.ttop(e,tp,eg,ep,ev,re,r,rp,c)
local mg=Duel.GetMatchingGroup(Card.IsAbleToRemoveAsCost,tp,LOCATION_MZONE,0,nil)
......
......@@ -55,6 +55,8 @@ function s.initial_effect(c)
c:RegisterEffect(e7)
if not s.global_flag then
s.global_flag=true
s[0]={}
s[1]={}
--Negate
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
......@@ -65,16 +67,28 @@ function s.initial_effect(c)
end
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return re:GetActivateLocation()==LOCATION_REMOVED and re:IsActiveType(TYPE_MONSTER)
return re:IsActiveType(TYPE_MONSTER)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if re:GetActivateLocation()==LOCATION_REMOVED and re:IsActiveType(TYPE_MONSTER) then
rc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,3))
if Duel.GetTurnCount()~=s[2] then
s[0]={}
s[1]={}
s[2]=Duel.GetTurnCount()
end
if re:IsActiveType(TYPE_MONSTER) then
table.insert(s[rp],rc:GetCode())
end
end
function s.cthfilter(c)
return c:IsAbleToHand() and c:GetFlagEffect(id)==0 and c:IsRace(RACE_ZOMBIE)
local p=c:GetControler()
local ct=0
for _,fcode in ipairs(s[p]) do
if fcode==c:GetCode() then
ct=1
end
end
return c:IsAbleToHand() and c:IsRace(RACE_ZOMBIE) and ct==0
end
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(82800114)~=0
......@@ -89,6 +103,22 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
if Duel.IsExistingMatchingCard(s.summmfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil)
and Duel.SelectYesNo(tp,1) then
Duel.BreakEffect()
s.summmop(e,tp,eg,ep,ev,re,r,rp)
end
end
end
function s.summmfilter(c)
return c:IsRace(RACE_ZOMBIE) and c:IsSummonable(true,nil)
end
function s.summmop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,s.summmfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.Summon(tp,tc,true,nil)
end
end
function s.lfcon(e)
......
......@@ -40,6 +40,7 @@ function s.initial_effect(c)
e4:SetCountLimit(1)
e4:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e4:SetCondition(s.poscon)
e4:SetCost(s.poscost)
e4:SetTarget(s.postg)
e4:SetOperation(s.posop)
c:RegisterEffect(e4)
......@@ -53,7 +54,26 @@ function s.initial_effect(c)
e5:SetTarget(s.target)
e5:SetOperation(s.operation)
c:RegisterEffect(e5)
--code
s.EnableChangeCode(c,82800144,LOCATION_HAND+LOCATION_DECK+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)
end
function s.EnableChangeCode(c,code,location,condition)
Auxiliary.AddCodeList(c,code)
local loc=c:GetOriginalType()&TYPE_MONSTER~=0 and LOCATION_MZONE or LOCATION_SZONE
loc=location or loc
if condition==nil then condition=Auxiliary.TRUE end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_SET_AVAILABLE)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetRange(loc)
e1:SetCondition(condition)
e1:SetValue(code)
c:RegisterEffect(e1)
return e1
end
function s.fselect(g,tp)
return g:FilterCount(Card.IsControler,nil,1-tp)<=1
end
......@@ -66,7 +86,7 @@ function s.ttcon(e,c,minc)
local mg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_MZONE,0,nil)
local mg2=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
if Duel.IsPlayerAffectedByEffect(tp,82800126) then mg:Merge(mg2) end
return minc<=ct and Duel.CheckTribute(c,ct,ct,mg) and mg:CheckSubGroup(s.fselect,2,2,tp)
return minc<=ct and mg:CheckSubGroup(s.fselect,2,2,tp)
end
function s.ttop(e,tp,eg,ep,ev,re,r,rp,c)
local mg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_MZONE,0,nil)
......@@ -74,7 +94,7 @@ function s.ttop(e,tp,eg,ep,ev,re,r,rp,c)
if Duel.IsPlayerAffectedByEffect(tp,82800126) then mg:Merge(mg2) end
local ct=2
if c:IsLevelBelow(6) then ct=1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=mg:SelectSubGroup(tp,s.fselect,false,ct,ct,tp)
c:SetMaterial(sg)
Duel.Release(sg,REASON_SUMMON+REASON_MATERIAL)
......@@ -100,6 +120,14 @@ end
function s.poscon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
end
function s.poscost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost,tp,LOCATION_HAND,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemoveAsCost,tp,LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 then
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
end
function s.posfilter(c)
return c:IsFaceup() and c:IsCanTurnSet() and c:IsRace(RACE_ZOMBIE)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment