Commit a715903e authored by DailyShana's avatar DailyShana

fix (80/80)

parent b2e885b7
......@@ -2,7 +2,7 @@
function c31472884.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_FREE_CHAIN)
......@@ -31,41 +31,38 @@ function c31472884.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end
function c31472884.cfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsDiscardable()
return c:IsType(TYPE_MONSTER) and c:IsDiscardable() and c:GetAttack()>=0 and c:GetDefence()>=0
and Duel.IsExistingTarget(c31472884.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,c)
end
function c31472884.tgfilter(c,dc)
return c:IsFaceup() and (c:GetAttack()~=dc:GetAttack() or c:GetDefence()~=dc:GetDefence())
end
function c31472884.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if Duel.IsExistingMatchingCard(c31472884.cfilter,tp,LOCATION_HAND,0,1,nil)
and Duel.GetFlagEffect(tp,31472884)==0 then
e:SetLabel(1)
return true
else
return false
end
end
function c31472884.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() and c31472884.tgfilter(chkc,e:GetLabelObject()) end
if chk==0 then
if e:GetLabel()~=1 then return false end
e:SetLabel(0)
return Duel.GetFlagEffect(tp,31472884)==0
and Duel.IsExistingMatchingCard(c31472884.cfilter,tp,LOCATION_HAND,0,1,nil)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local g=Duel.SelectMatchingCard(tp,c31472884.cfilter,tp,LOCATION_HAND,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST+REASON_DISCARD)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c31472884.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,g:GetFirst())
e:SetLabelObject(g:GetFirst())
g:GetFirst():CreateEffectRelation(e)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetTargetRange(1,0)
e1:SetProperty(EFFECT_FLAG_OATH+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c31472884.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then
if e:GetLabel()~=1 then return false end
e:SetLabel(0)
return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
end
function c31472884.activate(e,tp,eg,ep,ev,re,r,rp)
local cc=e:GetLabelObject()
local atk=cc:GetAttack()
......
......@@ -25,7 +25,6 @@ function c32104431.costfilter(c)
return c:IsSetCard(0xd6) and c:IsDiscardable()
end
function c32104431.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
if chk==0 then return Duel.IsExistingMatchingCard(c32104431.costfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,c32104431.costfilter,1,1,REASON_COST+REASON_DISCARD)
end
......@@ -33,12 +32,8 @@ function c32104431.spfilter(c,e,tp)
return c:IsSetCard(0xd7) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c32104431.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if e:GetLabel()==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
e:SetLabel(0)
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c32104431.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp)
end
e:SetLabel(0)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c32104431.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c32104431.operation(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -49,7 +49,7 @@ function c33327029.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST)
end
function c33327029.thfilter(c)
return c:IsSetCard(0xe1) and c:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsAbleToHand()
return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsSetCard(0xe1) and c:IsAbleToHand()
end
function c33327029.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c33327029.thfilter,tp,LOCATION_EXTRA,0,1,nil) end
......
......@@ -10,31 +10,39 @@ function c34449261.initial_effect(c)
e1:SetOperation(c34449261.activate)
c:RegisterEffect(e1)
end
function c34449261.filter1(c,tp,chk)
return c:IsFaceup() and c:IsType(TYPE_FUSION) and c:IsSetCard(0xad) and ((not chk)
or Duel.IsExistingTarget(c34449261.filter2,tp,0,LOCATION_MZONE,1,nil))
function c34449261.filter1(c,tp)
return c:IsFaceup() and c:IsType(TYPE_FUSION) and c:IsSetCard(0xad)
and Duel.IsExistingTarget(c34449261.filter2,tp,0,LOCATION_MZONE,1,nil,tp,c)
end
function c34449261.filter2(c,tp,ex2)
function c34449261.filter2(c,tp,tc)
local tg=Group.FromCards(c,tc)
return c:IsFaceup() and c:IsType(TYPE_FUSION)
and Duel.IsExistingMatchingCard(c34449261.filter3,tp,LOCATION_MZONE,LOCATION_MZONE,1,c,ex2)
and Duel.IsExistingMatchingCard(c34449261.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tg)
end
function c34449261.filter3(c,ex2)
return c~=ex2 and bit.band(c:GetSummonType(),SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL and c:IsDestructable()
function c34449261.desfilter(c,tg)
return not tg:IsContains(c) and bit.band(c:GetSummonType(),SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL and c:IsDestructable()
end
function c34449261.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingTarget(c34449261.filter1,tp,LOCATION_MZONE,0,1,nil,tp,true) end
local g1=Duel.SelectTarget(tp,c34449261.filter1,tp,LOCATION_MZONE,0,1,1,nil,tp,false)
function c34449261.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c34449261.filter1,tp,LOCATION_MZONE,0,1,nil,tp) end
local g1=Duel.SelectTarget(tp,c34449261.filter1,tp,LOCATION_MZONE,0,1,1,nil,tp)
local g2=Duel.SelectTarget(tp,c34449261.filter2,tp,0,LOCATION_MZONE,1,1,nil,tp,g1:GetFirst())
local g3=Duel.GetMatchingGroup(c34449261.filter3,tp,LOCATION_MZONE,LOCATION_MZONE,g1:GetFirst(),g2:GetFirst())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g3,g3:GetCount(),0,0)
local dam=g3:GetSum(Card.GetAttack)
if g3:FilterCount(Card.IsControler,nil,tp)>0 then Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,tp,dam) end
if g3:FilterCount(Card.IsControler,nil,1-tp)>0 then Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end
g1:Merge(g2)
local g=Duel.GetMatchingGroup(c34449261.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,g1)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
local dam=g1:GetSum(Card.GetAttack)
if g:FilterCount(Card.IsControler,nil,1-tp)==0 then
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,tp,dam)
elseif g:FilterCount(Card.IsControler,nil,tp)==0 then
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam)
else
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,dam)
end
end
function c34449261.activate(e,tp,eg,ep,ev,re,r,rp)
local tc1,tc2=Duel.GetFirstTarget()
local dam=tc1:GetAttack()+tc2:GetAttack()
local g=Duel.GetMatchingGroup(c34449261.filter3,tp,LOCATION_MZONE,LOCATION_MZONE,tc1,tc2)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
local dam=tg:Filter(Card.IsFaceup,nil):GetSum(Card.GetAttack)
local g=Duel.GetMatchingGroup(c34449261.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tg)
if g:GetCount()>0 and Duel.Destroy(g,REASON_EFFECT)~=0 then
local dg=Duel.GetOperatedGroup()
if dg:IsExists(aux.FilterEqualFunction(Card.GetPreviousControler,tp),1,nil) then Duel.Damage(tp,dam,REASON_EFFECT) end
......
......@@ -69,7 +69,7 @@ function c45383307.thfilter(c)
end
function c45383307.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_ONFIELD) and c:GetPreviousSequence()==5 and c:IsPreviousPosition(POS_FACEUP)
return c:IsPreviousLocation(LOCATION_SZONE) and c:GetPreviousSequence()==5 and c:IsPreviousPosition(POS_FACEUP)
end
function c45383307.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(c45383307.thfilter,tp,LOCATION_DECK,0,1,nil) end
......
......@@ -23,16 +23,17 @@ end
function c60433216.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttacker()
if tc:IsControler(1-tp) then tc=Duel.GetAttackTarget() end
local e1=Effect.CreateEffect(e:GetHandler())
if not tc or not tc:IsRelateToBattle() then return end
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetValue(1)
e1:SetReset(RESET_PHASE+PHASE_DAMAGE)
tc:RegisterEffect(e1)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,60433216,0,0x11,0,0,1,RACE_FIEND,ATTRIBUTE_FIRE) then return end
or not Duel.IsPlayerCanSpecialSummonMonster(tp,60433216,0,0x1011,0,0,1,RACE_FIEND,ATTRIBUTE_FIRE) then return end
c:AddTrapMonsterAttribute(TYPE_NORMAL+TYPE_TUNER,ATTRIBUTE_FIRE,RACE_FIEND,1,0,0)
Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP)
c:TrapMonsterBlock()
......
......@@ -16,17 +16,15 @@ function c69599136.initial_effect(c)
c:RegisterEffect(e3)
end
function c69599136.filter(c,tp)
return c:IsFaceup() and c:GetSummonPlayer()~=tp
return c:IsFaceup() and c:GetSummonPlayer()~=tp and c:IsCanTurnSet()
end
function c69599136.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(c69599136.filter,1,nil,tp) end
Duel.SetTargetCard(eg)
end
function c69599136.filter2(c,e,tp)
return c:IsFaceup() and c:GetSummonPlayer()~=tp and c:IsRelateToEffect(e)
local g=eg:Filter(c69599136.filter,1,nil,tp)
Duel.SetTargetCard(g)
end
function c69599136.activate(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(c69599136.filter2,nil,e,tp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if Duel.ChangePosition(g,POS_FACEDOWN_DEFENCE)~=0 then
local og=Duel.GetOperatedGroup()
local tc=og:GetFirst()
......
......@@ -47,8 +47,7 @@ function c69711728.cost(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c69711728.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c69711728.filter(chkc,eg:GetFirst():GetLevel(),e,tp) end
if chk==0 then return e:GetHandler():IsLocation(LOCATION_SZONE)
and eg:IsExists(c69711728.cfilter,1,nil,e,tp)
if chk==0 then return eg:IsExists(c69711728.cfilter,1,nil,e,tp)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c69711728.filter,tp,LOCATION_GRAVE,0,1,1,nil,eg:GetFirst():GetLevel(),e,tp)
......
......@@ -15,7 +15,7 @@ function c7044562.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK)
end
function c7044562.filter(c,lp)
return c:GetAttack()+c:GetDefence()==lp and c:IsAbleToHand()
return c:GetAttack()>0 and c:GetDefence()>0 and c:GetAttack()+c:GetDefence()==lp and c:IsAbleToHand()
end
function c7044562.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,LOCATION_DECK,0)
......
......@@ -35,7 +35,7 @@ function c71650854.initial_effect(c)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e6:SetRange(LOCATION_FZONE)
e6:SetTargetRange(1,0)
e6:SetTarget(c71650854.efilter1)
e6:SetTarget(c71650854.setlimit)
c:RegisterEffect(e6)
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_FIELD)
......@@ -43,7 +43,7 @@ function c71650854.initial_effect(c)
e7:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e7:SetRange(LOCATION_FZONE)
e7:SetTargetRange(1,0)
e7:SetValue(c71650854.efilter2)
e7:SetValue(c71650854.actlimit)
c:RegisterEffect(e7)
end
function c71650854.condition(e,tp,eg,ep,ev,re,r,rp)
......@@ -62,9 +62,9 @@ end
function c71650854.tgovalue(e,re,rp)
return rp~=1-e:GetHandlerPlayer()
end
function c71650854.efilter1(e,re,tp)
return re:IsType(TYPE_FIELD)
function c71650854.setlimit(e,c,tp)
return c:IsType(TYPE_FIELD)
end
function c71650854.efilter2(e,re,tp)
return re:GetHandler():IsType(TYPE_FIELD) and re:IsHasType(EFFECT_TYPE_ACTIVATE)
function c71650854.actlimit(e,re,tp)
return re:IsActiveType(TYPE_FIELD) and re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
......@@ -40,7 +40,7 @@ function c72772445.actfilter(c,tp)
return c and c:IsFaceup() and c:IsSetCard(0xe2) and c:IsType(TYPE_MONSTER) and c:IsControler(tp)
end
function c72772445.aclimit(e,re,tp)
return (re:IsHasType(EFFECT_TYPE_ACTIVATE) or re:IsActiveType(TYPE_MONSTER)) and not re:GetHandler():IsImmuneToEffect(e)
return not re:GetHandler():IsImmuneToEffect(e)
end
function c72772445.actcon(e)
local tp=e:GetHandlerPlayer()
......@@ -48,7 +48,7 @@ function c72772445.actcon(e)
end
function c72772445.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_ONFIELD) and c:GetPreviousSequence()==5 and c:IsPreviousPosition(POS_FACEUP)
return c:IsPreviousLocation(LOCATION_SZONE) and c:GetPreviousSequence()==5 and c:IsPreviousPosition(POS_FACEUP)
end
function c72772445.spfilter(c,e,tp)
return c:IsSetCard(0xe2) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......
......@@ -37,27 +37,19 @@ function c7922915.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND+LOCATION_DECK)
end
function c7922915.activate(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=0 then return end
if ft==1 then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c7922915.filter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp)
local g=Duel.SelectMatchingCard(tp,c7922915.filter,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
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g1=Duel.SelectMatchingCard(tp,c7922915.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g1:GetCount()>0 then
Duel.SpecialSummon(g1,0,tp,tp,false,false,POS_FACEUP)
end
Duel.BreakEffect()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g2=Duel.SelectMatchingCard(tp,c7922915.filter2,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g2:GetCount()>0 then
Duel.BreakEffect()
Duel.SpecialSummon(g2,0,tp,tp,false,false,POS_FACEUP)
end
end
end
function c7922915.cfilter(c,e,tp)
return c:IsCode(46986414) and c:IsFaceup()
......
--涅槃の超魔導剣士
function c80896904.initial_effect(c)
function c80896940.initial_effect(c)
c:EnableReviveLimit()
--pendulum summon
aux.EnablePendulumAttribute(c,false)
--synchro summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(80896904,0))
e1:SetDescription(aux.Stringid(80896940,0))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
......@@ -16,10 +16,10 @@ function c80896904.initial_effect(c)
e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetDescription(aux.Stringid(80896904,1))
e2:SetCondition(c80896904.syncon)
e2:SetTarget(c80896904.syntg)
e2:SetOperation(c80896904.synop)
e2:SetDescription(aux.Stringid(80896940,1))
e2:SetCondition(c80896940.syncon)
e2:SetTarget(c80896940.syntg)
e2:SetOperation(c80896940.synop)
e2:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e2)
--indes
......@@ -27,68 +27,68 @@ function c80896904.initial_effect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_ATTACK_ANNOUNCE)
e3:SetRange(LOCATION_PZONE)
e3:SetCondition(c80896904.indcon)
e3:SetOperation(c80896904.indop)
e3:SetCondition(c80896940.indcon)
e3:SetOperation(c80896940.indop)
c:RegisterEffect(e3)
--atkdown
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(80896904,2))
e4:SetDescription(aux.Stringid(80896940,2))
e4:SetCategory(CATEGORY_ATKCHANGE)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_DAMAGE_STEP_END)
e4:SetRange(LOCATION_PZONE)
e4:SetCondition(c80896904.atkcon)
e4:SetOperation(c80896904.atkop)
e4:SetCondition(c80896940.atkcon)
e4:SetOperation(c80896940.atkop)
c:RegisterEffect(e4)
--salvage
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(80896904,3))
e5:SetDescription(aux.Stringid(80896940,3))
e5:SetCategory(CATEGORY_TOHAND)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_SPSUMMON_SUCCESS)
e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
e5:SetCondition(c80896904.thcon)
e5:SetTarget(c80896904.thtg)
e5:SetOperation(c80896904.thop)
e5:SetCondition(c80896940.thcon)
e5:SetTarget(c80896940.thtg)
e5:SetOperation(c80896940.thop)
c:RegisterEffect(e5)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_MATERIAL_CHECK)
e0:SetValue(c80896904.valcheck)
e0:SetValue(c80896940.valcheck)
e0:SetLabelObject(e5)
c:RegisterEffect(e0)
--lp
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(80896904,4))
e6:SetDescription(aux.Stringid(80896940,4))
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e6:SetCode(EVENT_BATTLE_DESTROYING)
e6:SetCondition(aux.bdocon)
e6:SetOperation(c80896904.lpop)
e6:SetOperation(c80896940.lpop)
c:RegisterEffect(e6)
--pendulum
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(80896904,5))
e7:SetDescription(aux.Stringid(80896940,5))
e7:SetCategory(CATEGORY_DESTROY)
e7:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e7:SetCode(EVENT_DESTROYED)
e7:SetProperty(EFFECT_FLAG_DELAY)
e7:SetCondition(c80896904.pencon)
e7:SetTarget(c80896904.pentg)
e7:SetOperation(c80896904.penop)
e7:SetCondition(c80896940.pencon)
e7:SetTarget(c80896940.pentg)
e7:SetOperation(c80896940.penop)
c:RegisterEffect(e7)
end
function c80896904.matfilter1(c,syncard)
function c80896940.matfilter1(c,syncard)
return c:IsType(TYPE_PENDULUM) and c:GetSummonType()==SUMMON_TYPE_PENDULUM and c:IsNotTuner() and c:IsFaceup() and c:IsCanBeSynchroMaterial(syncard)
end
function c80896904.matfilter2(c,syncard)
function c80896940.matfilter2(c,syncard)
return c:IsNotTuner() and c:IsFaceup() and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSynchroMaterial(syncard)
end
function c80896904.synfilter(c,syncard,lv,g2)
function c80896940.synfilter(c,syncard,lv,g2)
local tlv=c:GetSynchroLevel(syncard)
if lv-tlv<=0 then return false end
return g2:CheckWithSumEqual(Card.GetSynchroLevel,lv-tlv,1,63,syncard)
end
function c80896904.syncon(e,c,tuner,mg)
function c80896940.syncon(e,c,tuner,mg)
if c==nil then return true end
if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
local tp=c:GetControler()
......@@ -96,11 +96,11 @@ function c80896904.syncon(e,c,tuner,mg)
local g1=nil
local g2=nil
if mg then
g1=mg:Filter(c80896904.matfilter1,nil,c)
g2=mg:Filter(c80896904.matfilter2,nil,c)
g1=mg:Filter(c80896940.matfilter1,nil,c)
g2=mg:Filter(c80896940.matfilter2,nil,c)
else
g1=Duel.GetMatchingGroup(c80896904.matfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
g2=Duel.GetMatchingGroup(c80896904.matfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
g1=Duel.GetMatchingGroup(c80896940.matfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
g2=Duel.GetMatchingGroup(c80896940.matfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
end
local pe=Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_SMATERIAL)
local lv=c:GetLevel()
......@@ -110,21 +110,21 @@ function c80896904.syncon(e,c,tuner,mg)
return g2:CheckWithSumEqual(Card.GetSynchroLevel,lv-tlv,1,63,c)
end
if not pe then
return g1:IsExists(c80896904.synfilter,1,nil,c,lv,g2)
return g1:IsExists(c80896940.synfilter,1,nil,c,lv,g2)
else
return c80896904.synfilter(pe:GetOwner(),c,lv,g2)
return c80896940.synfilter(pe:GetOwner(),c,lv,g2)
end
end
function c80896904.syntg(e,tp,eg,ep,ev,re,r,rp,chk,c,tuner,mg)
function c80896940.syntg(e,tp,eg,ep,ev,re,r,rp,chk,c,tuner,mg)
local g=Group.CreateGroup()
local g1=nil
local g2=nil
if mg then
g1=mg:Filter(c80896904.matfilter1,nil,c)
g2=mg:Filter(c80896904.matfilter2,nil,c)
g1=mg:Filter(c80896940.matfilter1,nil,c)
g2=mg:Filter(c80896940.matfilter2,nil,c)
else
g1=Duel.GetMatchingGroup(c80896904.matfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
g2=Duel.GetMatchingGroup(c80896904.matfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
g1=Duel.GetMatchingGroup(c80896940.matfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
g2=Duel.GetMatchingGroup(c80896940.matfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
end
local pe=Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_SMATERIAL)
local lv=c:GetLevel()
......@@ -138,13 +138,13 @@ function c80896904.syntg(e,tp,eg,ep,ev,re,r,rp,chk,c,tuner,mg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local tuner=nil
if not pe then
local t1=g1:FilterSelect(tp,c80896904.synfilter,1,1,nil,c,lv,g2)
local t1=g1:FilterSelect(tp,c80896940.synfilter,1,1,nil,c,lv,g2)
tuner=t1:GetFirst()
else
tuner=pe:GetOwner()
Group.FromCards(tuner):Select(tp,1,1,nil)
end
tuner:RegisterFlagEffect(80896904,RESET_EVENT+0x1fe0000,0,1)
tuner:RegisterFlagEffect(80896940,RESET_EVENT+0x1fe0000,0,1)
g:AddCard(tuner)
local lv1=tuner:GetSynchroLevel(c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
......@@ -157,17 +157,17 @@ function c80896904.syntg(e,tp,eg,ep,ev,re,r,rp,chk,c,tuner,mg)
return true
else return false end
end
function c80896904.synop(e,tp,eg,ep,ev,re,r,rp,c,tuner,mg)
function c80896940.synop(e,tp,eg,ep,ev,re,r,rp,c,tuner,mg)
local g=e:GetLabelObject()
c:SetMaterial(g)
Duel.SendtoGrave(g,REASON_MATERIAL+REASON_SYNCHRO)
g:DeleteGroup()
end
function c80896904.indcon(e,tp,eg,ep,ev,re,r,rp)
function c80896940.indcon(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
return a:IsType(TYPE_PENDULUM) and a:IsControler(tp)
end
function c80896904.indop(e,tp,eg,ep,ev,re,r,rp)
function c80896940.indop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttacker()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
......@@ -182,11 +182,11 @@ function c80896904.indop(e,tp,eg,ep,ev,re,r,rp)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_DAMAGE)
tc:RegisterEffect(e2)
end
function c80896904.atkcon(e,tp,eg,ep,ev,re,r,rp)
function c80896940.atkcon(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
return a and a:IsRelateToBattle() and a:IsType(TYPE_PENDULUM) and a:IsControler(tp)
end
function c80896904.atkop(e,tp,eg,ep,ev,re,r,rp)
function c80896940.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tg=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
local tc=tg:GetFirst()
......@@ -201,45 +201,45 @@ function c80896904.atkop(e,tp,eg,ep,ev,re,r,rp)
tc=tg:GetNext()
end
end
function c80896904.thcon(e,tp,eg,ep,ev,re,r,rp)
function c80896940.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO and e:GetLabel()==1
end
function c80896904.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
function c80896940.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and chkc:IsAbleToHand() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c80896904.thop(e,tp,eg,ep,ev,re,r,rp)
function c80896940.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
function c80896904.mfilter(c)
function c80896940.mfilter(c)
return c:IsType(TYPE_PENDULUM) and c:GetSummonType()==SUMMON_TYPE_PENDULUM
and (c:IsType(TYPE_TUNER) or c:GetFlagEffect(80896904)~=0)
and (c:IsType(TYPE_TUNER) or c:GetFlagEffect(80896940)~=0)
end
function c80896904.valcheck(e,c)
function c80896940.valcheck(e,c)
local g=c:GetMaterial()
if g:IsExists(c80896904.mfilter,1,nil) then
if g:IsExists(c80896940.mfilter,1,nil) then
e:GetLabelObject():SetLabel(1)
else
e:GetLabelObject():SetLabel(0)
end
end
function c80896904.lpop(e,tp,eg,ep,ev,re,r,rp)
function c80896940.lpop(e,tp,eg,ep,ev,re,r,rp)
Duel.SetLP(1-tp,math.ceil(Duel.GetLP(1-tp)/2))
end
function c80896904.pencon(e,tp,eg,ep,ev,re,r,rp)
function c80896940.pencon(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_EFFECT+REASON_BATTLE)~=0 and e:GetHandler():IsPreviousLocation(LOCATION_MZONE)
end
function c80896904.pentg(e,tp,eg,ep,ev,re,r,rp,chk)
function c80896940.pentg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLocation(tp,LOCATION_SZONE,6) or Duel.CheckLocation(tp,LOCATION_SZONE,7) end
end
function c80896904.penop(e,tp,eg,ep,ev,re,r,rp)
function c80896940.penop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.CheckLocation(tp,LOCATION_SZONE,6) and not Duel.CheckLocation(tp,LOCATION_SZONE,7) then return false end
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
......
......@@ -2,126 +2,154 @@
function c96100333.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(96100333,0))
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,0x1e0)
e1:SetTarget(c96100333.target1)
e1:SetOperation(c96100333.operation)
e1:SetTarget(c96100333.target)
c:RegisterEffect(e1)
--instant(chain)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(96100333,0))
e2:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON+CATEGORY_TODECK+CATEGORY_DRAW)
e2:SetDescription(aux.Stringid(96100333,1))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetHintTiming(0,0x1e0)
e2:SetCost(c96100333.cost)
e2:SetTarget(c96100333.target2)
e2:SetOperation(c96100333.operation)
e2:SetTarget(c96100333.destg)
e2:SetOperation(c96100333.desop)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(96100333,2))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_SZONE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetHintTiming(0,0x1e0)
e3:SetTarget(c96100333.sptg)
e3:SetOperation(c96100333.spop)
c:RegisterEffect(e3)
--to deck
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(96100333,3))
e4:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_SZONE)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetHintTiming(0,0x1e0)
e4:SetTarget(c96100333.tdtg)
e4:SetOperation(c96100333.tdop)
c:RegisterEffect(e4)
end
function c96100333.cfilter(c)
return (c:IsRace(RACE_ROCK) or c:IsType(TYPE_FIELD)) and c:IsAbleToRemoveAsCost()
end
function c96100333.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(96100333)==0
and Duel.IsExistingMatchingCard(c96100333.cfilter,tp,LOCATION_GRAVE,0,2,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c96100333.cfilter,tp,LOCATION_GRAVE,0,2,2,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
e:GetHandler():RegisterFlagEffect(96100333,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
end
function c96100333.desfilter(c)
return c:IsFaceup() and c:IsDestructable()
end
function c96100333.spfilter(c,e,tp)
return c:IsRace(RACE_ROCK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
function c96100333.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and c96100333.desfilter(chkc) and chkc~=e:GetHandler() end
if chk==0 then return Duel.IsExistingTarget(c96100333.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c96100333.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c96100333.tdfilter(c)
return c:IsType(TYPE_FIELD) and c:IsAbleToDeck()
function c96100333.desop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function c96100333.spcfilter1(c,cg,sg)
local g=sg:Clone()
g:RemoveCard(c)
return cg:IsExists(c96100333.spcfilter2,1,c,g)
end
function c96100333.tspfilter(c,e,tp)
function c96100333.spcfilter2(c,sg)
return sg:IsExists(aux.TRUE,1,c)
end
function c96100333.spfilter(c,e,tp)
return c:IsRace(RACE_ROCK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
and Duel.IsExistingMatchingCard(c96100333.cfilter,tp,LOCATION_GRAVE,0,2,c)
end
function c96100333.target1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then
if e:GetLabel()==1 then return chkc:IsOnField() and c96100333.desfilter(chkc) and chkc~=e:GetHandler()
elseif e:GetLabel()==2 then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c96100333.spfilter(chkc,e,tp)
else return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c96100333.tdfilter(chkc) end
end
if chk==0 then return true end
local b1=Duel.IsExistingTarget(c96100333.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler())
local b2=Duel.IsExistingTarget(c96100333.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp)
function c96100333.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c96100333.spfilter(chkc,e,tp) end
local cg=Duel.GetMatchingGroup(c96100333.cfilter,tp,LOCATION_GRAVE,0,nil)
local sg=Duel.GetMatchingGroup(c96100333.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp)
if chk==0 then return e:GetHandler():GetFlagEffect(96100333)==0
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
local b3=Duel.IsExistingTarget(c96100333.tdfilter,tp,LOCATION_GRAVE,0,1,nil)
and Duel.IsPlayerCanDraw(tp,1)
if b2 and not (b1 and b3) then
b2=Duel.IsExistingTarget(c96100333.tspfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp)
end
if Duel.IsExistingMatchingCard(c96100333.cfilter,tp,LOCATION_GRAVE,0,2,nil)
and (b1 or b2 or b3) and Duel.SelectYesNo(tp,94) then
and cg:IsExists(c96100333.spcfilter1,1,nil,cg,sg) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c96100333.cfilter,tp,LOCATION_GRAVE,0,2,2,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
b2=Duel.IsExistingTarget(c96100333.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
local ops={}
local opval={}
local off=1
if b1 then
ops[off]=aux.Stringid(96100333,1)
opval[off-1]=1
off=off+1
end
if b2 then
ops[off]=aux.Stringid(96100333,2)
opval[off-1]=2
off=off+1
end
if b3 then
ops[off]=aux.Stringid(96100333,3)
opval[off-1]=3
off=off+1
end
local op=Duel.SelectOption(tp,table.unpack(ops))
local sel=opval[op]
e:SetLabel(sel)
if sel==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c96100333.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
e:SetCategory(CATEGORY_DESTROY)
elseif sel==2 then
local g1=cg:FilterSelect(tp,c96100333.spcfilter1,1,1,nil,cg,sg)
sg:RemoveCard(g1:GetFirst())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g2=cg:FilterSelect(tp,c96100333.spcfilter2,1,1,g1:GetFirst(),sg)
sg:RemoveCard(g2:GetFirst())
g1:Merge(g2)
Duel.Remove(g1,POS_FACEUP,REASON_COST)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c96100333.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
local g=sg:Select(tp,1,1,nil)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c96100333.tdfilter,tp,LOCATION_GRAVE,0,1,3,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
e:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
end
e:GetHandler():RegisterFlagEffect(96100333,RESET_PHASE+PHASE_END,0,1)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
else
e:SetCategory(0)
e:SetProperty(0)
end
e:GetHandler():RegisterFlagEffect(96100333,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
end
function c96100333.operation(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():GetFlagEffect(96100333)==0 or not e:GetHandler():IsRelateToEffect(e) then return end
local sel=e:GetLabel()
if sel==1 then
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
elseif sel==2 then
function c96100333.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENCE)
end
else
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if not tg or tg:FilterCount(Card.IsRelateToEffect,nil,e)<1 then return end
end
function c96100333.tdcfilter1(c,cg,sg)
local g=sg:Clone()
g:RemoveCard(c)
return cg:IsExists(c96100333.spcfilter2,1,c,g)
end
function c96100333.tdcfilter2(c,sg)
return sg:IsExists(aux.TRUE,1,c)
end
function c96100333.tdfilter(c)
return c:IsType(TYPE_FIELD) and c:IsAbleToDeck()
end
function c96100333.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c96100333.tdfilter(chkc) end
local cg=Duel.GetMatchingGroup(c96100333.cfilter,tp,LOCATION_GRAVE,0,nil)
local sg=Duel.GetMatchingGroup(c96100333.tdfilter,tp,LOCATION_GRAVE,0,nil)
if chk==0 then return e:GetHandler():GetFlagEffect(96100333)==0
and Duel.IsPlayerCanDraw(tp,1)
and cg:IsExists(c96100333.tdcfilter1,1,nil,cg,sg) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=cg:FilterSelect(tp,c96100333.tdcfilter1,1,1,nil,cg,sg)
sg:RemoveCard(g1:GetFirst())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g2=cg:FilterSelect(tp,c96100333.tdcfilter2,1,1,g1:GetFirst(),sg)
sg:RemoveCard(g2:GetFirst())
g1:Merge(g2)
Duel.Remove(g1,POS_FACEUP,REASON_COST)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=sg:Select(tp,1,3,nil)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
e:GetHandler():RegisterFlagEffect(96100333,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
end
function c96100333.tdop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if tg:GetCount()==0 then return end
Duel.SendtoDeck(tg,nil,0,REASON_EFFECT)
local g=Duel.GetOperatedGroup()
if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end
......@@ -130,32 +158,19 @@ function c96100333.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
end
function c96100333.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c96100333.cfilter,tp,LOCATION_GRAVE,0,2,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c96100333.cfilter,tp,LOCATION_GRAVE,0,2,2,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c96100333.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
function c96100333.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then
if e:GetLabel()==1 then return chkc:IsOnField() and c96100333.desfilter(chkc) and chkc~=e:GetHandler()
elseif e:GetLabel()==2 then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c96100333.spfilter(chkc,e,tp)
else return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c96100333.tdfilter(chkc) end
if e:GetLabel()==1 then return c96100333.destg(e,tp,eg,ep,ev,re,r,rp,0,chkc)
elseif e:GetLabel()==2 then return c96100333.sptg(e,tp,eg,ep,ev,re,r,rp,0,chkc)
else return c96100333.tdtg(e,tp,eg,ep,ev,re,r,rp,0,chkc) end
end
local b1=Duel.IsExistingTarget(c96100333.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler())
local b2=Duel.IsExistingTarget(c96100333.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
local b3=Duel.IsExistingTarget(c96100333.tdfilter,tp,LOCATION_GRAVE,0,1,nil)
and Duel.IsPlayerCanDraw(tp,1)
if b2 and not (b1 and b3) then
b2=Duel.IsExistingTarget(c96100333.tspfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp)
end
if chk==0 then return e:GetHandler():GetFlagEffect(96100333)==0
and (b1 or b2 or b3) end
b2=Duel.IsExistingTarget(c96100333.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
if chk==0 then return true end
local b1=c96100333.cost(e,tp,eg,ep,ev,re,r,rp,0)
and c96100333.destg(e,tp,eg,ep,ev,re,r,rp,0)
local b2=c96100333.sptg(e,tp,eg,ep,ev,re,r,rp,0)
local b3=c96100333.tdtg(e,tp,eg,ep,ev,re,r,rp,0)
if (b1 or b2 or b3) and Duel.SelectYesNo(tp,94) then
local ops={}
local opval={}
local off=1
......@@ -178,18 +193,23 @@ function c96100333.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local sel=opval[op]
e:SetLabel(sel)
if sel==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c96100333.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
c96100333.cost(e,tp,eg,ep,ev,re,r,rp,1)
c96100333.destg(e,tp,eg,ep,ev,re,r,rp,1)
e:SetCategory(CATEGORY_DESTROY)
e:SetOperation(c96100333.desop)
elseif sel==2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c96100333.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
c96100333.sptg(e,tp,eg,ep,ev,re,r,rp,1)
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
e:SetOperation(c96100333.spop)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c96100333.tdfilter,tp,LOCATION_GRAVE,0,1,3,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
c96100333.tdtg(e,tp,eg,ep,ev,re,r,rp,1)
e:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
e:SetOperation(c96100333.tdop)
end
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
else
e:SetCategory(0)
e:SetProperty(0)
e:SetOperation(nil)
end
e:GetHandler():RegisterFlagEffect(96100333,RESET_PHASE+PHASE_END,0,1)
end
......@@ -38,7 +38,7 @@ function c9989792.initial_effect(c)
end
function c9989792.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_ONFIELD) and c:GetPreviousSequence()==5 and c:IsPreviousPosition(POS_FACEUP)
return c:IsPreviousLocation(LOCATION_SZONE) and c:GetPreviousSequence()==5 and c:IsPreviousPosition(POS_FACEUP)
end
function c9989792.thfilter(c)
return c:IsSetCard(0xe2) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
......
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