Commit e5ab1dcc authored by Grajade's avatar Grajade

Update c74563002.lua

parent b3dbb8b5
--蛙符「操纵蛤蟆」
function c74563002.initial_effect(c)
--act in set turn
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e2:SetCondition(c74563002.actcon)
c:RegisterEffect(e2)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c74563002.negcost)
e1:SetTarget(c74563002.target)
e1:SetOperation(c74563002.activate)
c:RegisterEffect(e1)
--destroy
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_LEAVE_FIELD)
e4:SetTarget(c74563002.destg)
e4:SetOperation(c74563002.desop)
c:RegisterEffect(e4)
end
function c74563002.actcon(e)
return Duel.IsExistingMatchingCard(Card.IsSetCard,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,0x497)
end
function c74563002.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsCanRemoveCounter(tp,1,1,0x128a,1,REASON_COST) end
Duel.RemoveCounter(tp,1,1,0x128a,1,REASON_COST)
end
function c74563002.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,0,0)
end
function c74563002.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or Duel.GetLocationCount(1-tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,74563020,0,TYPES_TOKEN_MONSTER,0,0,1,RACE_MACHINE,ATTRIBUTE_DARK,POS_FACEUP_DEFENSE)
or not Duel.IsPlayerCanSpecialSummonMonster(tp,74563020,0,TYPES_TOKEN_MONSTER,0,0,1,RACE_AQUA,ATTRIBUTE_WATER,POS_FACEUP_DEFENSE,1-tp)
or Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
local token1=Duel.CreateToken(tp,74563020)
local token2=Duel.CreateToken(tp,74563020)
Duel.SpecialSummonStep(token1,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
Duel.SpecialSummonStep(token2,0,tp,1-tp,false,false,POS_FACEUP_DEFENSE)
Duel.SpecialSummonComplete()
end
function c74563002.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
end
function c74563002.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local sg=Duel.GetMatchingGroup(Card.IsCode,tp,0,LOCATION_MZONE,nil,74563020)
local tc=sg:GetFirst()
local ag=Group.CreateGroup()
while tc do
local seq=tc:GetSequence()
local acg=Duel.GetMatchingGroup(c74563002.seqfilter,tp,0,LOCATION_ONFIELD,tc,tp,seq)
ag:Merge(acg)
tc=sg:GetNext()
end
ag:Merge(sg)
if ag:GetCount()~=0 then Duel.Destroy(ag,REASON_EFFECT) end
end
function c74563002.seqfilter(c,tp,seq)
local loc=LOCATION_MZONE
if seq>8 then
loc=LOCATION_SZONE
seq=seq-8
end
local cseq=c:GetSequence()
-- if tp==c:GetControler() then cseq=cseq>>16 end
if tp==c:GetControler() and (cseq==5 and seq==3 or cseq==6 and seq==1) then return true end
local cloc=c:GetLocation()
if cloc==LOCATION_SZONE and cseq>=5 then return false end
if cloc==LOCATION_MZONE and cseq>=5 and loc==LOCATION_MZONE and tp~=c:GetControler()
and (seq==1 and cseq==5 or seq==3 and cseq==6) then return true end
return cseq==seq or cloc==loc and math.abs(cseq-seq)==1 and tp~=c:GetControler()
--蛙符「操纵蛤蟆」
function c74563002.initial_effect(c)
--act in set turn
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e2:SetCondition(c74563002.actcon)
c:RegisterEffect(e2)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c74563002.negcost)
e1:SetTarget(c74563002.target)
e1:SetOperation(c74563002.activate)
c:RegisterEffect(e1)
--destroy
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_LEAVE_FIELD)
e4:SetTarget(c74563002.destg)
e4:SetOperation(c74563002.desop)
c:RegisterEffect(e4)
end
function c74563002.tfilter(c)
return c:IsSetCard(0x497) and c:IsFaceup()
end
function c74563002.actcon(e)
return Duel.IsExistingMatchingCard(c74563002.tfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil)
end
function c74563002.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsCanRemoveCounter(tp,1,1,0x128a,1,REASON_COST) end
Duel.RemoveCounter(tp,1,1,0x128a,1,REASON_COST)
end
function c74563002.target(e,tp,eg,ep,ev,re,r,rp,chk)
local ft1=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ft2=Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)
if chk==0 then return ft1>0 and ft2>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,74563020,nil,TYPES_TOKEN_MONSTER,0,0,1,RACE_AQUA,ATTRIBUTE_WATER,POS_FACEUP_DEFENSE)
and Duel.IsPlayerCanSpecialSummonMonster(tp,74563020,nil,TYPES_TOKEN_MONSTER,0,0,1,RACE_AQUA,ATTRIBUTE_WATER,POS_FACEUP_DEFENSE,1-tp)
and not Duel.IsPlayerAffectedByEffect(tp,59822133) end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,0,0)
end
function c74563002.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or Duel.GetLocationCount(1-tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,74563020,nil,TYPES_TOKEN_MONSTER,0,0,1,RACE_AQUA,ATTRIBUTE_WATER,POS_FACEUP_DEFENSE)
or not Duel.IsPlayerCanSpecialSummonMonster(tp,74563020,nil,TYPES_TOKEN_MONSTER,0,0,1,RACE_AQUA,ATTRIBUTE_WATER,POS_FACEUP_DEFENSE,1-tp)
or Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
local token1=Duel.CreateToken(tp,74563020)
local token2=Duel.CreateToken(tp,74563020)
Duel.SpecialSummonStep(token1,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
Duel.SpecialSummonStep(token2,0,tp,1-tp,false,false,POS_FACEUP_DEFENSE)
Duel.SpecialSummonComplete()
end
function c74563002.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
end
function c74563002.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local sg=Duel.GetMatchingGroup(Card.IsCode,tp,0,LOCATION_MZONE,nil,74563020)
local tc=sg:GetFirst()
local ag=Group.CreateGroup()
while tc do
local seq=tc:GetSequence()
local acg=Duel.GetMatchingGroup(c74563002.seqfilter,tp,0,LOCATION_ONFIELD,tc,tp,seq)
ag:Merge(acg)
tc=sg:GetNext()
end
ag:Merge(sg)
if ag:GetCount()~=0 then Duel.Destroy(ag,REASON_EFFECT) end
end
function c74563002.seqfilter(c,tp,seq)
local loc=LOCATION_MZONE
if seq>8 then
loc=LOCATION_SZONE
seq=seq-8
end
local cseq=c:GetSequence()
-- if tp==c:GetControler() then cseq=cseq>>16 end
if tp==c:GetControler() and (cseq==5 and seq==3 or cseq==6 and seq==1) then return true end
local cloc=c:GetLocation()
if cloc==LOCATION_SZONE and cseq>=5 then return false end
if cloc==LOCATION_MZONE and cseq>=5 and loc==LOCATION_MZONE and tp~=c:GetControler()
and (seq==1 and cseq==5 or seq==3 and cseq==6) then return true end
return cseq==seq or cloc==loc and math.abs(cseq-seq)==1 and tp~=c:GetControler()
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment