Commit 56c120fb authored by Nemo Ma's avatar Nemo Ma

fix

parent fd58e051
......@@ -25,7 +25,42 @@ function c111443942.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c111443942.filter,tp,LOCATION_DECK,0,1,nil) end
end
function c111443942.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.RegisterFlagEffect(tp,111443942,RESET_PHASE+PHASE_END,0,1)
if Duel.IsExistingMatchingCard(c111443942.filter,tp,LOCATION_DECK,0,2,nil) then
local sg=Duel.GetMatchingGroup(c111443942.filter,tp,LOCATION_DECK,0,nil)
Duel.ConfirmCards(tp,sg)
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCondition(c111443942.con)
e1:SetOperation(c111443942.op)
e1:SetLabelObject(e6)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
Duel.RegisterEffect(e2,tp)
local e3=e1:Clone()
e3:SetCode(EVENT_TO_HAND)
Duel.RegisterEffect(e3,tp)
local e4=e1:Clone()
e4:SetCode(EVENT_TO_DECK)
Duel.RegisterEffect(e4,tp)
local e5=e1:Clone()
e5:SetCode(EVENT_REMOVE)
Duel.RegisterEffect(e5,tp)
--
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e6:SetCode(EVENT_CHAIN_SOLVED)
e6:SetOperation(c111443942.disop)
e6:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e6,tp)
local e7=e6:Clone()
e7:SetCode(EVENT_CHAINING)
Duel.RegisterEffect(e7,tp)
end
function c111443942.cfilter(c,tp)
......
--サイクリボー
function c114064005.initial_effect(c)
aux.AddCodeList(c,40640057)
--change control
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetRange(LOCATION_HAND+LOCATION_DECK)
e1:SetCode(EFFECT_SEND_REPLACE)
e1:SetTarget(c114064005.reptg)
e1:SetValue(c114064005.value)
e1:SetOperation(c114064005.repop)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_BATTLE_PHASE)
e1:SetCondition(c114064005.adcon)
e1:SetCost(c114064005.cost)
e1:SetTarget(c114064005.adtg)
e1:SetOperation(c114064005.adop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetOperation(c114064005.thop)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetTarget(c114064005.eftg)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
--
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_CONTROL)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
e3:SetRange(LOCATION_MZONE)
e3:SetCondition(c114064005.condition2)
e3:SetTarget(c114064005.target2)
e3:SetOperation(c114064005.activate2)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(114064005)
e3:SetRange(LOCATION_GRAVE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetTargetRange(1,0)
c:RegisterEffect(e3)
--deck activate
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e4:SetRange(LOCATION_MZONE)
e4:SetTargetRange(LOCATION_MZONE,0)
e4:SetTarget(c114064005.eftg2)
e4:SetLabelObject(e3)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetOperation(c114064005.operation)
c:RegisterEffect(e4)
--replace
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(114064005,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(c114064005.thcon2)
e5:SetTarget(c114064005.thtg2)
e5:SetOperation(c114064005.thop2)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e5:SetRange(LOCATION_DECK+LOCATION_HAND)
e5:SetCode(EFFECT_SEND_REPLACE)
e5:SetTarget(c114064005.reptg)
e5:SetOperation(c114064005.repop)
e5:SetValue(c114064005.repval)
c:RegisterEffect(e5)
--plus effect
if not c114064005.global_check then
c114064005.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_ADJUST)
ge1:SetOperation(c114064005.sdop)
Duel.RegisterEffect(ge1,0)
end
end
function c114064005.adcon(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE)
and not e:GetHandler():IsStatus(STATUS_CHAINING)
end
function c114064005.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(114064005)==0 end
e:GetHandler():RegisterFlagEffect(114064005,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
end
function c114064005.adtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chkc then return false end
local c=e:GetHandler()
local bc=c:GetBattleTarget()
if chk==0 then return bc and bc:IsOnField() and c:IsAbleToChangeControler() and bc:IsAbleToChangeControler() end
Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(114064005,0))
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,2,0,0)
end
function c114064005.adop(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local at=Duel.GetAttackTarget()
if not (a:IsRelateToEffect(e) or at:IsRelateToEffect(e)) then return end
if Duel.SwapControl(a,at,RESET_PHASE+PHASE_BATTLE,1) then
Duel.CalculateDamage(a,at)
end
end
function c114064005.eftg(e,c)
return c:IsSetCard(0xa4) and c:IsType(TYPE_MONSTER)
end
function c114064005.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tp=c:GetControler()
if Duel.GetFlagEffect(tp,114064005)>0 then return end
Duel.RegisterFlagEffect(tp,114064005,RESET_PHASE+PHASE_END,0,1)
if c:GetPreviousLocation()==LOCATION_DECK then Duel.ShuffleDeck(tp) end
if Duel.IsExistingMatchingCard(c114064005.kufilter,tp,LOCATION_DECK,0,2,nil) then
local sg=Duel.GetMatchingGroup(c114064005.kufilter,tp,LOCATION_DECK,0,nil)
Duel.ConfirmCards(tp,sg)
end
--public
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCondition(c114064005.con)
e1:SetOperation(c114064005.op)
e1:SetLabelObject(e6)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
Duel.RegisterEffect(e2,tp)
local e3=e1:Clone()
e3:SetCode(EVENT_TO_HAND)
Duel.RegisterEffect(e3,tp)
local e4=e1:Clone()
e4:SetCode(EVENT_TO_DECK)
Duel.RegisterEffect(e4,tp)
local e5=e1:Clone()
e5:SetCode(EVENT_REMOVE)
Duel.RegisterEffect(e5,tp)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e6:SetRange(LOCATION_GRAVE)
e6:SetTargetRange(LOCATION_GRAVE+LOCATION_MZONE+LOCATION_HAND,0)
e6:SetTarget(c114064005.eftg2)
e6:SetLabelObject(e5)
c:RegisterEffect(e6)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e6:SetCode(EVENT_CHAIN_SOLVED)
e6:SetOperation(c114064005.pubop)
e6:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e6,tp)
end
--public
function c114064005.cfilter(c,tp)
return c:GetPreviousControler()==tp
and (c:IsPreviousLocation(LOCATION_DECK) or c:GetSummonLocation()==LOCATION_DECK
or (c:IsControler(tp) and c:IsPreviousLocation(LOCATION_DECK))
or c:IsLocation(LOCATION_DECK)) and not c:IsReason(REASON_DRAW)
end
function c114064005.con(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c114064005.cfilter,1,nil,tp)
end
function c114064005.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetFieldGroup(tp,LOCATION_DECK,0)
if g:GetCount()<=1 then return end
c:RegisterFlagEffect(114064005,RESET_EVENT+0x1fc0000+RESET_CHAIN,0,1)
end
function c114064005.pubop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetFieldGroup(tp,LOCATION_DECK,0)
if g:GetCount()<=1 then return end
if c:GetFlagEffect(114064005)~=0 and Duel.IsExistingMatchingCard(c114064005.kufilter,tp,LOCATION_DECK,0,2,nil) then
local sg=Duel.GetMatchingGroup(c114064005.kufilter,tp,LOCATION_DECK,0,nil)
Duel.ConfirmCards(tp,sg)
c:ResetFlagEffect(114064005)
end
end
function c114064005.prfilter(c)
return c:IsCode(114064005) and c:IsAbleToGrave()
end
function c114064005.repfilter(c,tp)
return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE+LOCATION_HAND) and c:GetDestination()==LOCATION_GRAVE and c:IsSetCard(0xa4) and not c:IsCode(114064005) and Duel.GetFlagEffect(tp,114064005)==0
return c:IsControler(tp) and c:IsType(TYPE_MONSTER) and c:IsSetCard(0xa4) and not c:IsCode(114064005)
and (c:IsLocation(LOCATION_HAND) or (c:IsLocation(LOCATION_ONFIELD) and c:IsFaceup())) and c:GetDestination()==LOCATION_GRAVE
end
function c114064005.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return eg:IsExists(c114064005.repfilter,1,nil,tp) and c:IsAbleToGrave() end
if Duel.SelectYesNo(tp,aux.Stringid(114064005,0)) then
local sg=eg:Filter(c114064005.repfilter,nil,tp):Filter(Card.IsLocation,nil,LOCATION_HAND)
if sg and sg:GetCount()>0 then
Duel.ConfirmCards(1-tp,sg)
if chk==0 then return eg:IsExists(c114064005.repfilter,1,nil,tp) end
if not Duel.IsExistingMatchingCard(c114064005.prfilter,tp,LOCATION_DECK+LOCATION_HAND,0,1,nil) then return end
if Duel.GetFlagEffect(tp,114064006)>0 then return end
if Duel.SelectYesNo(tp,aux.Stringid(114064005,2)) then
local g=eg:Filter(c114064005.repfilter2,nil,tp)
if g:GetCount()>0 then
Duel.ConfirmCards(1-tp,g)
Duel.ShuffleHand(tp)
end
return true
else return false end
end
function c114064005.repfilter2(c,tp)
return c:IsControler(tp) and c:IsType(TYPE_MONSTER) and c:IsSetCard(0xa4)
and c:IsLocation(LOCATION_HAND) and c:GetDestination()==LOCATION_GRAVE
end
function c114064005.repop(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local tp=c:GetControler()
Duel.RegisterFlagEffect(tp,114064006,RESET_PHASE+PHASE_END,0,1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tg=Duel.SelectMatchingCard(tp,c114064005.prfilter,tp,LOCATION_DECK+LOCATION_HAND,0,1,1,nil)
if tg:GetCount()>0 then
Duel.SendtoGrave(tg,REASON_EFFECT+REASON_REPLACE)
end
return false
end
function c114064005.value(e,c)
function c114064005.repval(e,c)
return c114064005.repfilter(c,e:GetHandlerPlayer())
end
function c114064005.repop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(tp,114064005,RESET_PHASE+PHASE_END,0,1)
Duel.SendtoGrave(e:GetHandler(),REASON_REPLACE+REASON_EFFECT)
function c114064005.kufilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and (c:IsCode(80831721,15471265,20065322,25573054,40703222,89086566) or c:IsSetCard(0xa4))
end
function c114064005.actfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and aux.IsCodeListed(c,40640057)
function c114064005.kmfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xa4)
end
function c114064005.thop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFlagEffect(tp,114064006)>0 then return end
Duel.RegisterFlagEffect(tp,114064006,RESET_PHASE+PHASE_END,0,1)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(c114064005.actfilter,tp,0xff,0xff,nil)
for tc in aux.Next(g) do
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_FIELD)
e0:SetCode(EFFECT_SPSUMMON_PROC_G)
e0:SetRange(LOCATION_DECK)
e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
e0:SetReset(RESET_PHASE+PHASE_END)
tc:RegisterEffect(e0,true)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_ACTIVATE_COST)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,0)
e1:SetTarget(c114064005.actarget)
e1:SetOperation(c114064005.costop)
Duel.RegisterEffect(e1,tp)
local ae=tc:GetActivateEffect():Clone()
local con=ae:GetCondition()
ae:SetType(EFFECT_TYPE_QUICK_O+EFFECT_TYPE_ACTIVATE)
ae:SetCondition(c114064005.actcon(con))
ae:SetRange(LOCATION_DECK)
ae:SetReset(RESET_PHASE+PHASE_END)
tc:RegisterEffect(ae,true)
function c114064005.sdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetOwner()
local g=Duel.GetMatchingGroup(c114064005.kufilter,c,LOCATION_DECK,LOCATION_DECK,nil)
local tc=g:GetFirst()
while tc do
if tc:GetFlagEffect(114064005)==0 then
local code=tc:GetOriginalCode()
local ae=tc:GetActivateEffect()
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(ae:GetCode())
e1:SetCategory(ae:GetCategory())
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+ae:GetProperty())
e1:SetRange(LOCATION_DECK)
e1:SetCountLimit(1,code)
e1:SetCondition(c114064005.sfcon)
e1:SetTarget(c114064005.sftg)
e1:SetOperation(c114064005.sfop)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
--activate cost
local e2=Effect.CreateEffect(tc)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_ACTIVATE_COST)
e2:SetRange(LOCATION_DECK)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_UNCOPYABLE)
e2:SetTargetRange(LOCATION_DECK,0)
e2:SetCost(c114064005.costchk)
e2:SetTarget(c114064005.costtg)
e2:SetOperation(c114064005.costop)
e2:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e2)
tc:RegisterFlagEffect(114064005,RESET_EVENT+0x1fe0000,0,1)
end
tc=g:GetNext()
end
end
function c114064005.actcon(con)
return function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return (not con or con(e,tp,eg,ep,ev,re,r,rp)) and aux.IsCodeListed(c,40640057) and ((c:IsType(TYPE_TRAP) or (c:IsType(TYPE_SPELL) and c:IsType(TYPE_QUICKPLAY))) or (Duel.GetTurnPlayer()==tp and Duel.GetCurrentChain()==0 and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2))) and c:IsLocation(LOCATION_DECK)
local kg=Duel.GetMatchingGroup(c114064005.kmfilter,c,LOCATION_DECK+LOCATION_ONFIELD+LOCATION_EXTRA+LOCATION_HAND,LOCATION_DECK+LOCATION_ONFIELD+LOCATION_EXTRA+LOCATION_HAND,nil)
local tck=kg:GetFirst()
while tck do
if tck:GetFlagEffect(114064006)==0 then
--spsummon
local e1=Effect.CreateEffect(tck)
e1:SetDescription(aux.Stringid(114064005,1))
e1:SetCategory(CATEGORY_SPSUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCondition(c114064005.spcon)
e1:SetCost(c114064005.cost)
e1:SetTarget(c114064005.sptg)
e1:SetOperation(c114064005.spop)
tck:RegisterEffect(e1)
tck:RegisterFlagEffect(114064006,0,0,1)
end
tck=kg:GetNext()
end
end
function c114064005.actarget(e,te,tp)
local tc=te:GetHandler()
e:SetLabelObject(tc)
return c114064005.actfilter(tc) and tc:IsLocation(LOCATION_DECK)
--deck activate
function c114064005.sfcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(tp,114064005)>0
end
function c114064005.costop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(c114064005.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
function c114064005.sftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local ae=e:GetHandler():GetActivateEffect()
local fcon=ae:GetCondition()
local fcos=ae:GetCost()
local ftg=ae:GetTarget()
if chk==0 then
return (not fcon or fcon(e,tp,eg,ep,ev,re,r,rp))
and (not fcos or fcos(e,tp,eg,ep,ev,re,r,rp,0))
and (not ftg or ftg(e,tp,eg,ep,ev,re,r,rp,0))
end
if fcos then
fcos(e,tp,eg,ep,ev,re,r,rp,1)
end
if ftg then
ftg(e,tp,eg,ep,ev,re,r,rp,1)
end
end
function c114064005.sfop(e,tp,eg,ep,ev,re,r,rp)
local ae=e:GetHandler():GetActivateEffect()
local fop=ae:GetOperation()
if fop then
fop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c114064005.aclimit(e,re,tp)
return re:GetHandler():IsLocation(LOCATION_DECK) and re:GetHandler():IsCode(e:GetHandler():GetCode())
--activate field
function c114064005.costchk(e,te_or_c,tp)
local tp=e:GetHandler():GetControler()
return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
end
function c114064005.condition2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c==Duel.GetAttacker() or c==Duel.GetAttackTarget()
function c114064005.costtg(e,te,tp)
e:SetLabelObject(te)
return te:GetHandler():IsLocation(LOCATION_DECK) and te:GetHandler()==e:GetHandler()
end
function c114064005.target2(e,tp,eg,ep,ev,re,r,rp,chk)
function c114064005.costop(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
local c=e:GetHandler()
local a=Duel.GetAttacker()
local at=Duel.GetAttackTarget()
if chk==0 then return a and a:IsOnField() and a:IsAbleToChangeControler() and at and at:IsOnField() and at:IsAbleToChangeControler() and c:GetFlagEffect(114064007)==0 end
c:RegisterFlagEffect(114064007,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_DAMAGE_CAL,0,1)
local g=Group.FromCards(a,at)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,2,0,0)
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false)
c:CreateEffectRelation(te)
local ev0=Duel.GetCurrentChain()+1
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetCountLimit(1)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ev==ev0 end)
e1:SetOperation(c114064005.rsop)
e1:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(e2,tp)
end
function c114064005.activate2(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local at=Duel.GetAttackTarget()
if a:IsRelateToEffect(e) and a:IsAttackable() and at:IsRelateToEffect(e) then
if Duel.SwapControl(a,at,RESET_PHASE+PHASE_BATTLE,1) then
Duel.CalculateDamage(a,at)
end
function c114064005.rsop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if e:GetCode()==EVENT_CHAIN_SOLVED and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_EFFECT_ENABLED,true)
end
if e:GetCode()==EVENT_CHAIN_NEGATED and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_ACTIVATE_DISABLED,true)
end
end
function c114064005.eftg2(e,c)
return c:IsSetCard(0xa4) and c:IsType(TYPE_MONSTER)
end
function c114064005.thcon2(e,tp,eg,ep,ev,re,r,rp)
function c114064005.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_HAND+LOCATION_ONFIELD) and not c:IsReason(REASON_LINK)
return not c:IsReason(REASON_LINK) and (c:IsPreviousLocation(LOCATION_HAND) or c:IsPreviousLocation(LOCATION_ONFIELD))
end
function c114064005.thfilter(c,e,tp,tc)
return c:IsSetCard(0xa4) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(tc:GetCode())
function c114064005.spfilter(c,e,tp,code)
return c:IsSetCard(0xa4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(code)
end
function c114064005.thtg2(e,tp,eg,ep,ev,re,r,rp,chk)
function c114064005.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 Duel.IsExistingMatchingCard(c114064005.thfilter,tp,LOCATION_DECK,0,1,nil,e,tp,c) and c:GetFlagEffect(114064005)==0 end
local code=c:GetOriginalCode()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c114064005.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp,code)
and Duel.IsPlayerAffectedByEffect(tp,114064005) end
Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(114064005,1))
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
c:RegisterFlagEffect(114064005,RESET_CHAIN,0,1)
end
function c114064005.thop2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
function c114064005.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local code=c:GetOriginalCode()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c114064005.thfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,c)
local g=Duel.SelectMatchingCard(tp,c114064005.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,code)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
local e1=Effect.CreateEffect(c)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetTarget(aux.TargetBoolFunction(Card.IsCode,g:GetFirst():GetCode()))
e1:SetTarget(c114064005.sumlimit)
e1:SetLabel(g:GetFirst():GetCode())
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
end
\ No newline at end of file
end
function c114064005.sumlimit(e,c)
return c:IsCode(e:GetLabel())
end
......@@ -48,7 +48,7 @@ function cm.initial_effect(c)
function Duel.SelectTarget(sp,f,p,s,o,min,max,nc,...)
if Duel.GetFlagEffect(0,m)>0 and min==1 and max==1 then
local e=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT)
local tgf=function(c,...) return f(c,...) and c:IsCanBeEffectTarget(e) end
local tgf=function(c,...) return (not f or f(c,...)) and c:IsCanBeEffectTarget(e) end
local g=Duel.GetMatchingGroup(tgf,p,s,o,nc,...)
local tg=g:Select(sp,min,max,nc)
Duel.SetTargetCard(tg)
......
......@@ -149,11 +149,13 @@ function cm.pspop(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingTarget(cm.desfil,tp,LOCATION_PZONE,0,1,e:GetHandler()) and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
local c=e:GetHandler()
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_PZONE) and chkc~=c end
if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_PZONE,0,1,c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local tc=Duel.SelectTarget(tp,cm.desfil,tp,LOCATION_PZONE,0,1,1,e:GetHandler())
local tc=Duel.SelectTarget(tp,nil,tp,LOCATION_PZONE,0,1,1,c)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......
......@@ -142,6 +142,43 @@ function c4058.initial_effect(c)
e25:SetRange(LOCATION_ONFIELD)
e25:SetOperation(c4058.actop)
c:RegisterEffect(e25)
--public
local e26=Effect.CreateEffect(c)
e26:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e26:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e26:SetCode(EVENT_TO_GRAVE)
e26:SetRange(LOCATION_ONFIELD)
e26:SetCondition(c4058.con)
e26:SetOperation(c4058.op)
c:RegisterEffect(e26)
local e27=e26:Clone()
e27:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e27)
local e28=e26:Clone()
e28:SetCode(EVENT_TO_HAND)
c:RegisterEffect(e28)
local e29=e26:Clone()
e29:SetCode(EVENT_TO_DECK)
c:RegisterEffect(e29)
local e30=e26:Clone()
e30:SetCode(EVENT_REMOVE)
c:RegisterEffect(e30)
local e31=Effect.CreateEffect(c)
e31:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e31:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e31:SetCode(EVENT_CHAIN_SOLVED)
e31:SetRange(LOCATION_ONFIELD)
e31:SetOperation(c4058.pubop)
c:RegisterEffect(e31)
local e32=e31:Clone()
e32:SetCode(EVENT_SUMMON)
c:RegisterEffect(e32)
local e33=Effect.CreateEffect(c)
e33:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e33:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e33:SetCode(EVENT_SPSUMMON_SUCCESS)
e33:SetOperation(c4058.sumsuc)
c:RegisterEffect(e33)
--plus effect
if not c4058.global_check then
c4058.global_check=true
......@@ -329,6 +366,36 @@ function c4058.actop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(rc:GetControler(),rc:GetOriginalCode(),RESET_PHASE+PHASE_END,0,1)
end
--public
function c4058.cfilter(c,tp)
return c:GetPreviousControler()==tp
and (c:IsPreviousLocation(LOCATION_DECK) or c:GetSummonLocation()==LOCATION_DECK
or (c:IsControler(tp) and c:IsPreviousLocation(LOCATION_DECK))
or c:IsLocation(LOCATION_DECK)) and not c:IsReason(REASON_DRAW)
end
function c4058.con(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c4058.cfilter,1,nil,tp)
end
function c4058.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetFieldGroup(tp,LOCATION_DECK,0)
if g:GetCount()<=1 then return end
c:RegisterFlagEffect(4058,RESET_EVENT+0x1fc0000+RESET_CHAIN,0,1)
end
function c4058.pubop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetFlagEffect(4058)~=0 and Duel.IsExistingMatchingCard(c4058.dafilter,tp,LOCATION_DECK,0,2,nil) then
local sg=Duel.GetMatchingGroup(c4058.dafilter,tp,LOCATION_DECK,0,nil)
Duel.ConfirmCards(tp,sg)
end
end
function c4058.sumsuc(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsExistingMatchingCard(c4058.dafilter,tp,LOCATION_DECK,0,2,nil) then
local sg=Duel.GetMatchingGroup(c4058.dafilter,tp,LOCATION_DECK,0,nil)
Duel.ConfirmCards(tp,sg)
end
end
--plus effect
function c4058.dafilter(c)
return c:IsType(TYPE_TRAP) and c:IsCode(16067089,93217231,80678380,1683982) and Duel.GetFlagEffect(c:GetControler(),c:GetOriginalCode())==0
......
......@@ -3,7 +3,7 @@ function c98920352.initial_effect(c)
c:SetSPSummonOnce(98920352)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFun2(c,aux.FilterBoolFunction(Card.IsFusionSetCard,0xef),aux.FilterBoolFunction(Card.IsFusionAttribute,ATTRIBUTE_DARK),true)
aux.AddFusionProcFun2(c,c98920352.matfilter,aux.FilterBoolFunction(Card.IsFusionAttribute,ATTRIBUTE_DARK),true)
aux.AddContactFusionProcedure(c,Card.IsAbleToGraveAsCost,LOCATION_ONFIELD,LOCATION_ONFIELD,Duel.SendtoGrave,REASON_COST)
--spsummon condition
local e1=Effect.CreateEffect(c)
......@@ -38,6 +38,9 @@ function c98920352.initial_effect(c)
e3:SetOperation(c98920352.desop)
c:RegisterEffect(e3)
end
function c98920352.matfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xef)
end
function c98920352.splimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION
end
......
......@@ -59,10 +59,12 @@ function c98920377.tdop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_DECK+LOCATION_EXTRA) then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c98920377.filter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(98920377,1))then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
if Duel.SelectYesNo(tp,aux.Stringid(98920377,1)) then
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c98920377.filter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
end
end
......@@ -106,9 +106,12 @@ function c98920400.desop(e,tp,eg,ep,ev,re,r,rp)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,0)
e1:SetTarget(c98920400.splimit)
e1:SetTarget(c98920400.splimit1)
Duel.RegisterEffect(e1,tp)
end
function c98920400.splimit1(e,c)
return c:IsLocation(LOCATION_EXTRA)
end
function c98920400.valcheck(e,c,tp)
local tp=e:GetOwner():GetControler()
local g=c:GetMaterial()
......@@ -124,6 +127,3 @@ end
function c98920400.indcon(e)
return ep==tp and Duel.IsExistingMatchingCard(c98920400.thfilter,tp,LOCATION_GRAVE,0,1,nil)
end
function c98920400.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsLocation(LOCATION_EXTRA)
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