Commit 28c0e6d1 authored by mercury233's avatar mercury233

add cards CHIM-EN

parent c987d36b
--Dream Mirror Hypnagogia
function c25964547.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCountLimit(1,25964547+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c25964547.target)
e1:SetOperation(c25964547.activate)
c:RegisterEffect(e1)
end
function c25964547.cfilter1(c,tp)
return c:IsCode(74665651) and not c:IsForbidden() and ((c:CheckUniqueOnField(tp)
and Duel.IsExistingMatchingCard(c25964547.cfilter2,tp,LOCATION_HAND+LOCATION_DECK,0,1,c,1-tp))
or (c:CheckUniqueOnField(1-tp)
and Duel.IsExistingMatchingCard(c25964547.cfilter2,tp,LOCATION_HAND+LOCATION_DECK,0,1,c,tp)))
end
function c25964547.cfilter2(c,p)
return c:IsCode(1050355) and c:CheckUniqueOnField(p) and not c:IsForbidden()
end
function c25964547.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c25964547.cfilter1,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,tp) end
end
function c25964547.activate(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetMatchingGroup(c25964547.cfilter1,tp,LOCATION_HAND+LOCATION_DECK,0,nil,tp)
local b1=g1:IsExists(Card.CheckUniqueOnField,1,nil,tp)
local b2=g1:IsExists(Card.CheckUniqueOnField,1,nil,1-tp)
if not b1 and not b2 then return end
local g2=Duel.GetMatchingGroup(c25964547.cfilter2,tp,LOCATION_HAND+LOCATION_DECK,0,nil,tp)
local g3=Duel.GetMatchingGroup(c25964547.cfilter2,tp,LOCATION_HAND+LOCATION_DECK,0,nil,1-tp)
local tg1=nil
local tg2=nil
if b1 and not b2 then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(25964547,0))
tg1=g1:Select(tp,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(25964547,1))
tg2=g3:Select(tp,1,1,nil)
end
if not b1 and b2 then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(25964547,0))
tg1=g2:Select(tp,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(25964547,1))
tg2=g1:Select(tp,1,1,nil)
end
if b1 and b2 then
local g=g1:Clone()
g:Merge(g2)
g:Merge(g3)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(25964547,0))
tg1=g:Select(tp,1,1,nil)
g:Remove(Card.IsCode,nil,tg1:GetFirst():GetCode())
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(25964547,1))
tg2=g:Select(tp,1,1,nil)
end
Duel.MoveToField(tg1:GetFirst(),tp,tp,LOCATION_SZONE,POS_FACEUP,true)
Duel.MoveToField(tg2:GetFirst(),tp,1-tp,LOCATION_SZONE,POS_FACEUP,true)
end
--Oneiros, the Dream Mirror Erlking
function c35187185.initial_effect(c)
c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,c35187185.ffilter,2,true)
--attribute
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_ADD_ATTRIBUTE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(ATTRIBUTE_DARK)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(35187185,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_RELEASE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,35187185)
e2:SetCondition(c35187185.descon)
e2:SetTarget(c35187185.destg)
e2:SetOperation(c35187185.desop)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(35187185,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCountLimit(1,35187186)
e3:SetCondition(c35187185.spcon)
e3:SetTarget(c35187185.sptg)
e3:SetOperation(c35187185.spop)
c:RegisterEffect(e3)
end
function c35187185.ffilter(c,fc,sub,mg,sg)
return c:IsFusionSetCard(0x131) and (not sg or not sg:IsExists(Card.IsFusionAttribute,1,c,c:GetFusionAttribute()))
end
function c35187185.cfilter(c,tp)
return c:IsPreviousLocation(LOCATION_MZONE) and c:GetPreviousControler()==tp
end
function c35187185.descon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c35187185.cfilter,1,e:GetHandler(),tp)
end
function c35187185.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_ONFIELD) end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c35187185.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function c35187185.spfilter(c,e,tp)
return c:IsSetCard(0x131) and not c:IsCode(35187185) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c35187185.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetPreviousControler()==tp and rp==1-tp
end
function c35187185.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c35187185.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end
function c35187185.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,aux.NecroValleyFilter(c35187185.spfilter),tp,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
--Brutal Beast Battle
function c36809777.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,36809777+EFFECT_COUNT_CODE_OATH)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetTarget(c36809777.target)
e1:SetOperation(c36809777.activate)
c:RegisterEffect(e1)
end
function c36809777.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
for i,p in ipairs({tp,1-tp}) do
local g=Duel.GetMatchingGroup(Card.IsFaceup,p,LOCATION_MZONE,0,nil)
for i,type in ipairs({TYPE_RITUAL,TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK}) do
local rg=g:Filter(Card.IsType,nil,type)
local rc=rg:GetCount()
if rc>1 then
return true
end
end
end
return false
end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,0,0)
end
function c36809777.activate(e,tp,eg,ep,ev,re,r,rp)
tp=Duel.GetTurnPlayer()
local res={}
for i,p in ipairs({tp,1-tp}) do
local sg=Group.CreateGroup()
local g=Duel.GetMatchingGroup(Card.IsFaceup,p,LOCATION_MZONE,0,nil)
for i,type in ipairs({TYPE_RITUAL,TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK}) do
local rg=g:Filter(Card.IsType,nil,type)
local rc=rg:GetCount()
if rc>1 then
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TOGRAVE)
local dg=rg:Select(p,rc-1,rc-1,nil)
sg:Merge(dg)
end
end
if sg:GetCount()>0 then
res[p]=true
Duel.SendtoGrave(sg,REASON_RULE)
end
end
if res[0] or res[1] then
Duel.BreakEffect()
end
for i,p in ipairs({tp,1-tp}) do
if res[p] then
local ct=0
local g=Duel.GetMatchingGroup(Card.IsFaceup,p,LOCATION_MZONE,0,nil)
for i,type in ipairs({TYPE_RITUAL,TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK}) do
if g:IsExists(Card.IsType,1,nil,type) then ct=ct+1 end
end
Duel.Draw(p,ct,REASON_EFFECT)
end
end
end
--Primineral Mandstrong
function c37021315.initial_effect(c)
--set
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MONSTER_SSET)
e1:SetValue(TYPE_SPELL)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c37021315.regcon)
e2:SetOperation(c37021315.regop)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(37021315,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetRange(LOCATION_GRAVE)
e3:SetCountLimit(1,37021315)
e3:SetCondition(c37021315.spcon)
e3:SetTarget(c37021315.sptg)
e3:SetOperation(c37021315.spop)
c:RegisterEffect(e3)
end
function c37021315.regcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEDOWN)
and c:IsReason(REASON_DESTROY) and c:IsReason(REASON_EFFECT) and c:GetPreviousControler()==tp and rp==1-tp
end
function c37021315.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
c:RegisterFlagEffect(37021315,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
function c37021315.cfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToHand() and not c:IsCode(37021315)
end
function c37021315.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(37021315)>0
end
function c37021315.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,0,tp,LOCATION_GRAVE)
end
function c37021315.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0
and Duel.IsExistingMatchingCard(aux.NecroValleyFilter(c37021315.cfilter),tp,LOCATION_GRAVE,0,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(37021315,0)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c37021315.cfilter),tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
--Dream Mirror Oneiromancy
function c61459246.initial_effect(c)
--activate(effect)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCountLimit(1,61459246+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c61459246.condition1)
e1:SetTarget(c61459246.target1)
e1:SetOperation(c61459246.activate1)
c:RegisterEffect(e1)
--activate(spsummon)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_ACTIVATE)
e2:SetCode(EVENT_SPSUMMON)
e2:SetCountLimit(1,61459246+EFFECT_COUNT_CODE_OATH)
e2:SetCondition(c61459246.condition2)
e2:SetTarget(c61459246.target2)
e2:SetOperation(c61459246.activate2)
c:RegisterEffect(e2)
end
function c61459246.cfilter1(c)
return c:IsFaceup() and c:IsCode(74665651)
end
function c61459246.condition1(e,tp,eg,ep,ev,re,r,rp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) and rp==1-tp and Duel.IsExistingMatchingCard(c61459246.cfilter1,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil)
end
function c61459246.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function c61459246.activate1(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
end
function c61459246.cfilter2(c)
return c:IsFaceup() and c:IsCode(1050355)
end
function c61459246.condition2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and rp==1-tp and Duel.IsExistingMatchingCard(c61459246.cfilter2,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil)
end
function c61459246.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,eg:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,eg:GetCount(),0,0)
end
function c61459246.activate2(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateSummon(eg)
Duel.Destroy(eg,REASON_EFFECT)
end
--Dream Mirror Phantasms
function c62171834.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,62171834+EFFECT_COUNT_CODE_OATH)
e1:SetOperation(c62171834.activate)
c:RegisterEffect(e1)
--atk/def up
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetValue(500)
e2:SetCondition(c62171834.upcon)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e3)
--atk/def down
local e4=e2:Clone()
e4:SetTargetRange(0,LOCATION_MZONE)
e4:SetValue(-500)
e4:SetCondition(c62171834.downcon)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e5)
end
function c62171834.thfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x131) and c:IsAbleToHand()
end
function c62171834.activate(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local g=Duel.GetMatchingGroup(c62171834.thfilter,tp,LOCATION_DECK,0,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(62171834,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 c62171834.ufilter(c)
return c:IsFaceup() and c:IsCode(74665651)
end
function c62171834.upcon(e,tp)
return Duel.IsExistingMatchingCard(c62171834.ufilter,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil)
end
function c62171834.dfilter(c)
return c:IsFaceup() and c:IsCode(1050355)
end
function c62171834.downcon(e,tp)
return Duel.IsExistingMatchingCard(c62171834.dfilter,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil)
end
--Phantasos, the Dream Mirror Friend
function c62393472.initial_effect(c)
--spsummon1
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(62393472,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,62393472)
e1:SetCondition(c62393472.spcon1)
e1:SetTarget(c62393472.sptg1)
e1:SetOperation(c62393472.spop1)
c:RegisterEffect(e1)
--spsummon2
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(62393472,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END+TIMING_BATTLE_END)
e2:SetCountLimit(1,62393473)
e2:SetCondition(c62393472.spcon2)
e2:SetCost(c62393472.spcost2)
e2:SetTarget(c62393472.sptg2)
e2:SetOperation(c62393472.spop2)
c:RegisterEffect(e2)
end
function c62393472.spfilter1(c,e,tp)
return c:IsSetCard(0x131) and c:IsLevelBelow(8) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) and not c:IsCode(62393472)
end
function c62393472.spcon1(e,tp,eg,ep,ev,re,r,rp)
return re:GetHandler():IsSetCard(0x131) and re:IsActiveType(TYPE_MONSTER)
end
function c62393472.sptg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c62393472.spfilter1(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c62393472.spfilter1,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c62393472.spfilter1,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c62393472.spop1(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
end
function c62393472.cfilter(c)
return c:IsFaceup() and c:IsCode(1050355)
end
function c62393472.spfilter2(c,e,tp)
return c:IsCode(99792080) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c62393472.spcon2(e,tp,eg,ep,ev,re,r,rp)
return ((Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE) or Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and Duel.IsExistingMatchingCard(c62393472.cfilter,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil)
end
function c62393472.spcost2(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsReleasable() and Duel.GetMZoneCount(tp,c)>0 end
Duel.Release(c,REASON_COST)
end
function c62393472.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c62393472.spfilter2,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c62393472.spop2(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,c62393472.spfilter2,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
--Desert Locusts
function c63410069.initial_effect(c)
c:EnableReviveLimit()
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
--discard
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(63410069,0))
e1:SetCategory(CATEGORY_HANDES)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCountLimit(1,63410069)
e1:SetCondition(c63410069.diccon)
e1:SetTarget(c63410069.dictg)
e1:SetOperation(c63410069.dicop)
c:RegisterEffect(e1)
--synchro summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(63410069,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END)
e2:SetCondition(c63410069.sscon)
e2:SetTarget(c63410069.sstg)
e2:SetOperation(c63410069.ssop)
c:RegisterEffect(e2)
end
function c63410069.diccon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
end
function c63410069.dictg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(0)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,0,1)
end
function c63410069.dicop(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetTurnPlayer()
local d=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
local g=Duel.GetFieldGroup(p,LOCATION_HAND,0)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_DISCARD)
sg=g:Select(p,1,1,nil)
Duel.SendtoGrave(sg,REASON_EFFECT+REASON_DISCARD)
end
end
function c63410069.sscon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2)
end
function c63410069.sstg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(63410069)==0 and Duel.IsExistingMatchingCard(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,1,nil,c) end
c:RegisterFlagEffect(63410069,RESET_CHAIN,0,1)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c63410069.ssop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetControler()~=tp or not c:IsRelateToEffect(e) then return end
local g=Duel.GetMatchingGroup(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,nil,c)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
Duel.SynchroSummon(tp,sg:GetFirst(),c)
end
end
--Monster Express
function c637216.initial_effect(c)
--to grave
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(637216,0))
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,637216)
e1:SetTarget(c637216.tgtg)
e1:SetOperation(c637216.tgop)
c:RegisterEffect(e1)
end
function c637216.cfilter(c,tp)
return c:IsFaceup() and Duel.IsExistingMatchingCard(c637216.tgfilter,tp,LOCATION_EXTRA,0,1,nil,c:GetOriginalRace())
end
function c637216.tgfilter(c,race)
return c:IsAbleToGrave() and c:GetOriginalRace()==race
end
function c637216.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c637216.cfilter(chkc,tp) end
if chk==0 then return Duel.IsExistingTarget(c637216.cfilter,tp,LOCATION_MZONE,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c637216.cfilter,tp,LOCATION_MZONE,0,1,1,nil,tp)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_EXTRA)
end
function c637216.tgop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local race=tc:GetOriginalRace()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c637216.tgfilter,tp,LOCATION_EXTRA,0,1,1,nil,race)
if g:GetCount()>0 and Duel.SendtoGrave(g,REASON_EFFECT)~=0 and g:GetFirst():IsLocation(LOCATION_GRAVE) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetLabel(g:GetFirst():GetOriginalRace())
e1:SetTargetRange(1,0)
e1:SetTarget(c637216.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
end
end
function c637216.splimit(e,c)
return not c:IsRace(e:GetLabel())
end
--Tyrant Farm
function c90814668.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,90814668+EFFECT_COUNT_CODE_OATH)
e1:SetCost(c90814668.cost)
e1:SetTarget(c90814668.target)
e1:SetOperation(c90814668.activate)
c:RegisterEffect(e1)
end
function c90814668.cfilter(c,e,tp)
return c:IsType(TYPE_EFFECT) and Duel.IsExistingMatchingCard(c90814668.spfilter,tp,LOCATION_GRAVE,0,1,c,e,tp,c:GetOriginalRace(),c:GetOriginalAttribute()) and Duel.GetMZoneCount(tp,c)>0
end
function c90814668.spfilter(c,e,tp,race,att)
return c:IsType(TYPE_MONSTER) and not c:IsType(TYPE_EFFECT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:GetOriginalRace()==race and c:GetOriginalAttribute()==att
end
function c90814668.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100)
return true
end
function c90814668.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if e:GetLabel()~=100 then return false end
e:SetLabel(0)
return Duel.CheckReleaseGroup(tp,c90814668.cfilter,1,nil,e,tp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectReleaseGroup(tp,c90814668.cfilter,1,1,nil,e,tp)
Duel.Release(g,REASON_COST)
g:KeepAlive()
e:SetLabelObject(g:GetFirst())
e:SetLabel(0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end
function c90814668.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
local tc=e:GetLabelObject()
local race=tc:GetOriginalRace()
local att=tc:GetOriginalAttribute()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c90814668.spfilter),tp,LOCATION_GRAVE,0,1,1,nil,e,tp,race,att)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
--Dream Mirror of Chaos
function c98570539.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON+CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCountLimit(1,98570539+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c98570539.target)
e1:SetOperation(c98570539.activate)
c:RegisterEffect(e1)
end
function c98570539.filter0(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToRemove()
end
function c98570539.filter1(c,e)
return not c:IsImmuneToEffect(e)
end
function c98570539.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0x131) and (not f or f(c)) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c98570539.cfilter1(c)
return c:IsFaceup() and c:IsCode(74665651)
end
function c98570539.cfilter2(c)
return c:IsFaceup() and c:IsCode(1050355)
end
function c98570539.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(Card.IsOnField,nil)
local mg2=nil
if Duel.IsExistingMatchingCard(c98570539.cfilter1,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil) then
mg2=Duel.GetFusionMaterial(tp):Filter(Card.IsLocation,nil,LOCATION_HAND)
mg1:Merge(mg2)
end
if Duel.IsExistingMatchingCard(c98570539.cfilter2,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil) then
mg2=Duel.GetMatchingGroup(c98570539.filter0,tp,LOCATION_GRAVE,0,nil)
mg1:Merge(mg2)
end
local res=Duel.IsExistingMatchingCard(c98570539.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c98570539.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg3,mf,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_GRAVE)
end
function c98570539.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(Card.IsOnField,nil):Filter(c98570539.filter1,nil,e)
local mg2=nil
if Duel.IsExistingMatchingCard(c98570539.cfilter1,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil) then
mg2=Duel.GetFusionMaterial(tp):Filter(Card.IsLocation,nil,LOCATION_HAND)
mg1:Merge(mg2)
end
if Duel.IsExistingMatchingCard(c98570539.cfilter2,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil) then
mg2=Duel.GetMatchingGroup(c98570539.filter0,tp,LOCATION_GRAVE,0,nil)
mg1:Merge(mg2)
end
local sg1=Duel.GetMatchingGroup(c98570539.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c98570539.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
local mat2=mat1:Filter(Card.IsLocation,nil,LOCATION_GRAVE)
mat1:Sub(mat2)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.Remove(mat2,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
--Phantasos, the Dream Mirror Foe
function c99792080.initial_effect(c)
--direct attack
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(99792080,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,99792080)
e1:SetCondition(c99792080.dircon)
e1:SetOperation(c99792080.dirop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(99792080,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END+TIMING_BATTLE_END)
e2:SetCountLimit(1,99792081)
e2:SetCondition(c99792080.spcon)
e2:SetCost(c99792080.spcost)
e2:SetTarget(c99792080.sptg)
e2:SetOperation(c99792080.spop)
c:RegisterEffect(e2)
end
function c99792080.dircon(e,tp,eg,ep,ev,re,r,rp)
return re:GetHandler():IsSetCard(0x131) and re:IsActiveType(TYPE_MONSTER)
end
function c99792080.dirop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DIRECT_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
end
function c99792080.cfilter(c)
return c:IsFaceup() and c:IsCode(74665651)
end
function c99792080.spfilter(c,e,tp)
return c:IsCode(62393472) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c99792080.spcon(e,tp,eg,ep,ev,re,r,rp)
return ((Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE) or Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and Duel.IsExistingMatchingCard(c99792080.cfilter,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil)
end
function c99792080.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsReleasable() and Duel.GetMZoneCount(tp,c)>0 end
Duel.Release(c,REASON_COST)
end
function c99792080.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c99792080.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c99792080.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,c99792080.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
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