Skip to content
This repository has been archived by the owner on Jun 22, 2018. It is now read-only.

Cleanup of remaining Anime Cards that rely on 419 Token #434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
282 changes: 143 additions & 139 deletions script/c511000538.lua
Original file line number Diff line number Diff line change
@@ -1,139 +1,143 @@
--氷炎の卵
function c511000538.initial_effect(c)
--Synchro monster, 1 tuner + n or more monsters
function aux.AddSynchroProcedure(c,f1,f2,ct)
local code=c:GetOriginalCode()
local mt=_G["c" .. code]
if f1 then
mt.tuner_filter=function(mc) return mc and f1(mc) end
else
mt.tuner_filter=function(mc) return true end
end
if f2 then
mt.nontuner_filter=function(mc) return mc and f2(mc) end
else
mt.nontuner_filter=function(mc) return true end
end
mt.minntct=ct
mt.maxntct=99
mt.sync=true
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(Auxiliary.SynCondition(f1,f2,ct,99))
e1:SetTarget(Auxiliary.SynTarget(f1,f2,ct,99))
e1:SetOperation(Auxiliary.SynOperation(f1,f2,ct,99))
e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1)
end
--Synchro monster, 1 tuner + 1 monster
function Auxiliary.AddSynchroProcedure2(c,f1,f2)
local code=c:GetOriginalCode()
local mt=_G["c" .. code]
if f1 then
mt.tuner_filter=function(mc) return mc and f1(mc) end
else
mt.tuner_filter=function(mc) return true end
end
if f2 then
mt.nontuner_filter=function(mc) return mc and f2(mc) end
else
mt.nontuner_filter=function(mc) return true end
end
mt.minntct=1
mt.maxntct=1
mt.sync=true
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(Auxiliary.SynCondition(f1,f2,1,1))
e1:SetTarget(Auxiliary.SynTarget(f1,f2,1,1))
e1:SetOperation(Auxiliary.SynOperation(f1,f2,1,1))
e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1)
end


--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(511000538,0))
e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_LEAVE_FIELD)
e1:SetCondition(c511000538.spcon)
e1:SetTarget(c511000538.sptg)
e1:SetOperation(c511000538.spop)
c:RegisterEffect(e1)
if not c511000538.global_check then
c511000538.global_check=true
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_ADJUST)
ge2:SetCountLimit(1)
ge2:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
ge2:SetOperation(c511000538.synchk)
Duel.RegisterEffect(ge2,0)
end
end
function c511000538.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():IsPreviousLocation(LOCATION_SZONE)
end
function c511000538.filter(c,e,tp)
return c:IsAttribute(ATTRIBUTE_WATER) and c:IsType(TYPE_XYZ) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c511000538.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and c511000538.filter(chkc,e,tp) and chkc:IsControler(tp) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c511000538.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c511000538.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_ATTACK) then
local rk=tc:GetRank()+1
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_DEFENSE)
tc:RegisterEffect(e2)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetCode(EFFECT_CHANGE_RANK)
e4:SetValue(rk)
e4:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e4)
local e7=Effect.CreateEffect(e:GetHandler())
e7:SetType(EFFECT_TYPE_SINGLE)
e7:SetCode(EFFECT_XYZ_LEVEL)
e7:SetValue(c511000538.xyzlv)
e7:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e7)
--double xyz material
local e8=Effect.CreateEffect(c)
e8:SetType(EFFECT_TYPE_SINGLE)
e8:SetCode(511000538)
e8:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e8)
Duel.SpecialSummonComplete()
end
end
function c511000538.synchk(e,tp,eg,ep,ev,re,r,rp)
Duel.CreateToken(tp,419)
Duel.CreateToken(1-tp,419)
end
function c511000538.xyzlv(e,c,rc)
return c:GetRank()
end
--氷炎の卵
function c511000538.initial_effect(c)
--Synchro monster, 1 tuner + n or more monsters
function aux.AddSynchroProcedure(c,f1,f2,ct)
local code=c:GetOriginalCode()
local mt=_G["c" .. code]
if f1 then
mt.tuner_filter=function(mc) return mc and f1(mc) end
else
mt.tuner_filter=function(mc) return true end
end
if f2 then
mt.nontuner_filter=function(mc) return mc and f2(mc) end
else
mt.nontuner_filter=function(mc) return true end
end
mt.minntct=ct
mt.maxntct=99
mt.sync=true
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(Auxiliary.SynCondition(f1,f2,ct,99))
e1:SetTarget(Auxiliary.SynTarget(f1,f2,ct,99))
e1:SetOperation(Auxiliary.SynOperation(f1,f2,ct,99))
e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1)
end
--Synchro monster, 1 tuner + 1 monster
function Auxiliary.AddSynchroProcedure2(c,f1,f2)
local code=c:GetOriginalCode()
local mt=_G["c" .. code]
if f1 then
mt.tuner_filter=function(mc) return mc and f1(mc) end
else
mt.tuner_filter=function(mc) return true end
end
if f2 then
mt.nontuner_filter=function(mc) return mc and f2(mc) end
else
mt.nontuner_filter=function(mc) return true end
end
mt.minntct=1
mt.maxntct=1
mt.sync=true
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(Auxiliary.SynCondition(f1,f2,1,1))
e1:SetTarget(Auxiliary.SynTarget(f1,f2,1,1))
e1:SetOperation(Auxiliary.SynOperation(f1,f2,1,1))
e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1)
end


--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(511000538,0))
e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_LEAVE_FIELD)
e1:SetCondition(c511000538.spcon)
e1:SetTarget(c511000538.sptg)
e1:SetOperation(c511000538.spop)
c:RegisterEffect(e1)
if not c511000538.global_check then
c511000538.global_check=true
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_ADJUST)
ge2:SetCountLimit(1)
ge2:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
ge2:SetOperation(c511000538.synchk)
Duel.RegisterEffect(ge2,0)
end
end
function c511000538.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():IsPreviousLocation(LOCATION_SZONE)
end
function c511000538.filter(c,e,tp)
return c:IsAttribute(ATTRIBUTE_WATER) and c:IsType(TYPE_XYZ) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c511000538.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and c511000538.filter(chkc,e,tp) and chkc:IsControler(tp) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c511000538.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c511000538.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_ATTACK) then
local rk=tc:GetRank()+1
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_DEFENSE)
tc:RegisterEffect(e2)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetCode(EFFECT_CHANGE_RANK)
e4:SetValue(rk)
e4:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e4)
local e7=Effect.CreateEffect(e:GetHandler())
e7:SetType(EFFECT_TYPE_SINGLE)
e7:SetCode(EFFECT_XYZ_LEVEL)
e7:SetValue(c511000538.xyzlv)
e7:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e7)
--double xyz material
local e8=Effect.CreateEffect(c)
e8:SetType(EFFECT_TYPE_SINGLE)
e8:SetCode(511000538)
e8:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e8)
Duel.SpecialSummonComplete()
end
end
function c511000538.synchk(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFlagEffect(tp,419)==0 and Duel.GetFlagEffect(1-tp,419)==0 then
Duel.CreateToken(tp,419)
Duel.CreateToken(1-tp,419)
Duel.RegisterFlagEffect(tp,419,nil,0,1)
Duel.RegisterFlagEffect(1-tp,419,nil,0,1)
end
end
function c511000538.xyzlv(e,c,rc)
return c:GetRank()
end
Loading