Commit 982fdc74 authored by root's avatar root

Refresh on 2024-08-04 21:20:44

parent eb26f238
--マルチャミー・フワロス
local s,id,o=GetID()
function s.initial_effect(c)
--draw
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(s.drcon)
e1:SetCost(s.drcost)
e1:SetOperation(s.drop)
c:RegisterEffect(e1)
Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,s.chainfilter)
end
function s.drcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0)==0 and Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)<2
end
function s.drcost(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)
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetTargetRange(1,0)
e3:SetCondition(s.actcon)
e3:SetValue(s.aclimit)
e3:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e3,tp)
end
function s.chainfilter(re,tp,cid)
return not (re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsSetCard(0x1b2))
end
function s.actcon(e)
local tp=e:GetHandlerPlayer()
return Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)>1
end
function s.aclimit(e,re,tp)
return re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsSetCard(0x1b2)
end
function s.drop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(s.drcon1)
e1:SetOperation(s.drop1)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(s.regcon)
e2:SetOperation(s.regop)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetCode(EVENT_CHAIN_SOLVED)
e3:SetCondition(s.drcon2)
e3:SetOperation(s.drop2)
e3:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e3,tp)
local e4=Effect.CreateEffect(e:GetHandler())
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetCountLimit(1)
e4:SetCondition(s.tdcon)
e4:SetOperation(s.tdop)
e4:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e4,tp)
end
function s.filter(c,sp)
return c:IsSummonPlayer(sp) and not c:IsSummonLocation(LOCATION_HAND+LOCATION_DECK+LOCATION_EXTRA)
end
function s.drcon1(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.filter,1,nil,1-tp)
and not Duel.IsChainSolving()
end
function s.drop1(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw(tp,1,REASON_EFFECT)
end
function s.regcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.filter,1,nil,1-tp)
and Duel.IsChainSolving()
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(tp,id+o,RESET_CHAIN,0,1)
end
function s.drcon2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(tp,id+o)>0
end
function s.drop2(e,tp,eg,ep,ev,re,r,rp)
local n=Duel.GetFlagEffect(tp,id+o)
Duel.ResetFlagEffect(tp,id+o)
Duel.Draw(tp,n,REASON_EFFECT)
end
function s.tdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldGroupCount(e:GetOwnerPlayer(),LOCATION_HAND,0)>Duel.GetFieldGroupCount(e:GetOwnerPlayer(),0,LOCATION_ONFIELD)+6
end
function s.tdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(e:GetOwnerPlayer(),LOCATION_HAND,0)
local d=Duel.GetFieldGroupCount(e:GetOwnerPlayer(),LOCATION_HAND,0)-(Duel.GetFieldGroupCount(e:GetOwnerPlayer(),0,LOCATION_ONFIELD)+6)
local sg=g:RandomSelect(e:GetOwnerPlayer(),d)
Duel.SendtoDeck(sg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
end
\ No newline at end of file
--群雄割拠
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.condition)
e1:SetTarget(s.acttg)
c:RegisterEffect(e1)
--adjust
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetCode(EVENT_ADJUST)
e2:SetRange(LOCATION_SZONE)
e2:SetOperation(s.adjustop)
c:RegisterEffect(e2)
--cannot summon,spsummon,flipsummon
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetRange(LOCATION_SZONE)
e4:SetCode(EFFECT_LIMIT_SPECIAL_SUMMON_POSITION)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetTargetRange(1,1)
e4:SetTarget(s.sumlimit)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetRange(LOCATION_SZONE)
e5:SetCode(EFFECT_CANNOT_SUMMON)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetTargetRange(1,1)
e5:SetTarget(s.sumlimit)
c:RegisterEffect(e5)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetRange(LOCATION_SZONE)
e6:SetCode(EFFECT_CANNOT_FLIP_SUMMON)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e6:SetTargetRange(1,1)
e6:SetTarget(s.sumlimit)
c:RegisterEffect(e6)
end
s[0]=0
s[1]=0
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and not Duel.CheckPhaseActivity()
end
function s.acttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
s[0]=0
s[1]=0
end
function s.limfilter(c)
return c:IsFaceup() and c:IsStatus(STATUS_EFFECT_ENABLED)
end
function s.sumlimit(e,c,sump,sumtype,sumpos,targetp)
if sumpos and bit.band(sumpos,POS_FACEDOWN)>0 then return false end
local rc=s.getrace(Duel.GetMatchingGroup(s.limfilter,targetp or sump,LOCATION_MZONE,0,nil))
if rc==0 then return false end
return c:GetRace()~=rc
end
function s.getrace(g)
local arc=0
local tc=g:GetFirst()
while tc do
arc=bit.bor(arc,tc:GetRace())
tc=g:GetNext()
end
return arc
end
function s.rmfilter(c,rc)
return c:GetRace()==rc
end
function s.isonlyone(val)
return val&(val-1)==0
end
function s.tgselect(sg,g)
local rac=s.getrace(g-sg)
return rac>0 and s.isonlyone(rac) and not sg:IsExists(s.rmfilter,1,nil,rac)
end
function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL then return end
local g1=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
local g2=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
local c=e:GetHandler()
if g1:GetCount()==0 then s[tp]=0
else
local rac=s.getrace(g1)
if bit.band(rac,rac-1)~=0 then
if s[tp]==0 or bit.band(s[tp],rac)==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=g1:SelectSubGroup(tp,s.tgselect,false,1,#g1,g1)
if not sg then
rac=0
else
rac=s.getrace(g1-sg)
end
else rac=s[tp] end
end
g1:Remove(s.rmfilter,nil,rac)
s[tp]=rac
end
if g2:GetCount()==0 then s[1-tp]=0
else
local rac=s.getrace(g2)
if bit.band(rac,rac-1)~=0 then
if s[1-tp]==0 or bit.band(s[1-tp],rac)==0 then
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE)
local sg=g2:SelectSubGroup(1-tp,s.tgselect,false,1,#g2,g2)
if not sg then
rac=0
else
rac=s.getrace(g2-sg)
end
else rac=s[1-tp] end
end
g2:Remove(s.rmfilter,nil,rac)
s[1-tp]=rac
end
g1:Merge(g2)
if g1:GetCount()>0 then
Duel.SendtoGrave(g1,REASON_RULE)
Duel.Readjust()
end
end
--御前試合
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.condition)
e1:SetTarget(s.acttg)
c:RegisterEffect(e1)
--adjust
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetCode(EVENT_ADJUST)
e2:SetRange(LOCATION_SZONE)
e2:SetOperation(s.adjustop)
c:RegisterEffect(e2)
--cannot summon,spsummon,flipsummon
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetRange(LOCATION_SZONE)
e4:SetCode(EFFECT_LIMIT_SPECIAL_SUMMON_POSITION)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetTargetRange(1,1)
e4:SetTarget(s.sumlimit)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetRange(LOCATION_SZONE)
e5:SetCode(EFFECT_CANNOT_SUMMON)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetTargetRange(1,1)
e5:SetTarget(s.sumlimit)
c:RegisterEffect(e5)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetRange(LOCATION_SZONE)
e6:SetCode(EFFECT_CANNOT_FLIP_SUMMON)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e6:SetTargetRange(1,1)
e6:SetTarget(s.sumlimit)
c:RegisterEffect(e6)
end
s[0]=0
s[1]=0
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and not Duel.CheckPhaseActivity()
end
function s.acttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
s[0]=0
s[1]=0
end
function s.limfilter(c)
return c:IsFaceup() and c:IsStatus(STATUS_EFFECT_ENABLED)
end
function s.sumlimit(e,c,sump,sumtype,sumpos,targetp)
if sumpos and bit.band(sumpos,POS_FACEDOWN)>0 then return false end
local at=s.getattribute(Duel.GetMatchingGroup(s.limfilter,targetp or sump,LOCATION_MZONE,0,nil))
if at==0 then return false end
return c:GetAttribute()~=at
end
function s.getattribute(g)
local aat=0
local tc=g:GetFirst()
while tc do
aat=bit.bor(aat,tc:GetAttribute())
tc=g:GetNext()
end
return aat
end
function s.rmfilter(c,at)
return c:GetAttribute()==at
end
function s.isonlyone(val)
return val&(val-1)==0
end
function s.tgselect(sg,g)
local att=s.getattribute(g-sg)
return att>0 and s.isonlyone(att) and not sg:IsExists(s.rmfilter,1,nil,att)
end
function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL then return end
local g1=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
local g2=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
local c=e:GetHandler()
if g1:GetCount()==0 then s[tp]=0
else
local att=s.getattribute(g1)
if not s.isonlyone(att) then
if s[tp]==0 or bit.band(s[tp],att)==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=g1:SelectSubGroup(tp,s.tgselect,false,1,#g1,g1)
if not sg then
att=0
else
att=s.getattribute(g1-sg)
end
else att=s[tp] end
end
g1:Remove(s.rmfilter,nil,att)
s[tp]=att
end
if g2:GetCount()==0 then s[1-tp]=0
else
local att=s.getattribute(g2)
if not s.isonlyone(att) then
if s[1-tp]==0 or bit.band(s[1-tp],att)==0 then
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE)
local sg=g2:SelectSubGroup(1-tp,s.tgselect,false,1,#g2,g2)
if not sg then
att=0
else
att=s.getattribute(g2-sg)
end
else att=s[1-tp] end
end
g2:Remove(s.rmfilter,nil,att)
s[1-tp]=att
end
g1:Merge(g2)
if g1:GetCount()>0 then
Duel.SendtoGrave(g1,REASON_RULE)
Duel.Readjust()
end
end
--センサー万別
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.condition)
c:RegisterEffect(e1)
--only one
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(24207889)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1)
c:RegisterEffect(e2)
--cannot summon,spsummon,flipsummon
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetRange(LOCATION_SZONE)
e4:SetCode(EFFECT_LIMIT_SPECIAL_SUMMON_POSITION)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetTargetRange(1,1)
e4:SetTarget(s.sumlimit)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetCode(EFFECT_CANNOT_SUMMON)
c:RegisterEffect(e5)
local e6=e4:Clone()
e6:SetCode(EFFECT_CANNOT_FLIP_SUMMON)
c:RegisterEffect(e6)
if not s.global_check then
s.global_check=true
s.is_empty=true
s[0]={}
s[1]={}
local race=1
while race<RACE_ALL do
s[0][race]=Group.CreateGroup()
s[0][race]:KeepAlive()
s[1][race]=Group.CreateGroup()
s[1][race]:KeepAlive()
race=race<<1
end
--adjust
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
ge1:SetCode(EVENT_ADJUST)
ge1:SetOperation(s.adjustop)
Duel.RegisterEffect(ge1,0)
end
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and not Duel.CheckPhaseActivity()
end
function s.rmfilter(c,rc)
return c:IsFaceup() and c:IsRace(rc) and c:IsStatus(STATUS_EFFECT_ENABLED)
end
function s.sumlimit(e,c,sump,sumtype,sumpos,targetp)
if sumtype==SUMMON_TYPE_DUAL then return false end
if sumpos and bit.band(sumpos,POS_FACEDOWN)>0 then return false end
local tp=sump
if targetp then tp=targetp end
return Duel.IsExistingMatchingCard(s.rmfilter,tp,LOCATION_MZONE,0,1,nil,c:GetRace())
end
function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsPlayerAffectedByEffect(0,24207889) then
if not s.is_empty then
local race=1
while race<RACE_ALL do
s[0][race]:Clear()
s[1][race]:Clear()
race=race<<1
end
s.is_empty=true
end
return
end
s.is_empty=false
local phase=Duel.GetCurrentPhase()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL then return end
local sg=Group.CreateGroup()
for p=0,1 do
local g=Duel.GetMatchingGroup(Card.IsFaceup,p,LOCATION_MZONE,0,nil)
local race=1
while race<RACE_ALL do
local rg=g:Filter(Card.IsRace,nil,race)
local rc=rg:GetCount()
if rc>1 then
rg:Sub(s[p][race]:Filter(Card.IsRace,nil,race))
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TOGRAVE)
local dg=rg:Select(p,rc-1,rc-1,nil)
sg:Merge(dg)
end
race=race<<1
end
end
if sg:GetCount()>0 then
Duel.SendtoGrave(sg,REASON_RULE)
Duel.Readjust()
end
for p=0,1 do
local g=Duel.GetMatchingGroup(Card.IsFaceup,p,LOCATION_MZONE,0,nil)
local race=1
while race<RACE_ALL do
s[p][race]:Clear()
s[p][race]:Merge(g:Filter(Card.IsRace,nil,race))
race=race<<1
end
end
end
--サモンリミッター
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.condition)
c:RegisterEffect(e1)
--summon count limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EFFECT_CANNOT_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1)
e2:SetTarget(s.limittg)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EFFECT_CANNOT_FLIP_SUMMON)
c:RegisterEffect(e3)
local e4=e2:Clone()
e4:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
c:RegisterEffect(e4)
--counter
local et=Effect.CreateEffect(c)
et:SetType(EFFECT_TYPE_FIELD)
et:SetCode(EFFECT_LEFT_SPSUMMON_COUNT)
et:SetRange(LOCATION_SZONE)
et:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
et:SetTargetRange(1,1)
et:SetValue(s.countval)
c:RegisterEffect(et)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and not Duel.CheckPhaseActivity()
end
function s.limittg(e,c,tp)
local t1,t2,t3=Duel.GetActivityCount(tp,ACTIVITY_SUMMON,ACTIVITY_FLIPSUMMON,ACTIVITY_SPSUMMON)
return t1+t2+t3>=2
end
function s.countval(e,re,tp)
local t1,t2,t3=Duel.GetActivityCount(tp,ACTIVITY_SUMMON,ACTIVITY_FLIPSUMMON,ACTIVITY_SPSUMMON)
if t1+t2+t3>=2 then return 0 else return 2-t1-t2-t3 end
end
--虚無空間
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.condition)
c:RegisterEffect(e1)
--disable spsummon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTarget(s.limittg)
e2:SetTargetRange(1,1)
c:RegisterEffect(e2)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and not Duel.CheckPhaseActivity()
end
function s.filter(c,tp)
return c:IsFaceup() and c:GetOwner()==tp
end
function s.limittg(e,c,tp)
return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil,tp)
end
\ No newline at end of file
--増殖するG
local s,id,o=GetID()
function s.initial_effect(c)
--draw
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,id)
e1:SetCost(s.cost)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
function s.cfilter(c)
return c:IsRace(RACE_INSECT) and c:IsAbleToGraveAsCost() and (c:IsLocation(LOCATION_HAND) or c:IsFaceup())
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToGraveAsCost() and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND+LOCATION_MZONE,LOCATION_MZONE,1,c) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND+LOCATION_MZONE,LOCATION_MZONE,1,1,c)
g:AddCard(c)
Duel.SendtoGrave(g,REASON_COST)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(s.drcon1)
e1:SetOperation(s.drop1)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
--sp_summon effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(s.regcon)
e2:SetOperation(s.regop)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetCode(EVENT_CHAIN_SOLVED)
e3:SetCondition(s.drcon2)
e3:SetOperation(s.drop2)
e3:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e3,tp)
end
function s.filter(c,sp)
return c:IsSummonPlayer(sp)
end
function s.drcon1(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.filter,1,nil,1-tp)
and not Duel.IsChainSolving()
end
function s.drop1(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw(tp,1,REASON_EFFECT)
end
function s.regcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.filter,1,nil,1-tp)
and Duel.IsChainSolving()
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(tp,id,RESET_CHAIN,0,1)
end
function s.drcon2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(tp,id)>0
end
function s.drop2(e,tp,eg,ep,ev,re,r,rp)
local n=Duel.GetFlagEffect(tp,id)
Duel.ResetFlagEffect(tp,id)
Duel.Draw(tp,n,REASON_EFFECT)
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