Commit fac425cd authored by POLYMER's avatar POLYMER

fix

parent 2cbe37fa
function c114303426.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_RECOVER)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_DESTROYED)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,114303426+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c114303426.condition)
e1:SetTarget(c114303426.target)
e1:SetOperation(c114303426.operation)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_GRAVE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCondition(c114303426.sumcon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c114303426.target2)
e2:SetOperation(c114303426.activate)
c:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetRange(LOCATION_DECK)
e3:SetCondition(c114303426.condition2)
e3:SetOperation(c114303426.operation2)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_ACTIVATE_COST)
e4:SetRange(LOCATION_DECK)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetTargetRange(1,0)
e4:SetTarget(c114303426.actarget)
e4:SetOperation(c114303426.costop)
c:RegisterEffect(e4)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_RECOVER)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_DESTROYED)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,114303426+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c114303426.condition)
e1:SetTarget(c114303426.target)
e1:SetOperation(c114303426.operation)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_GRAVE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCondition(c114303426.sumcon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c114303426.target2)
e2:SetOperation(c114303426.activate)
c:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetRange(LOCATION_DECK)
e3:SetCondition(c114303426.condition2)
e3:SetOperation(c114303426.operation2)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_ACTIVATE_COST)
e4:SetRange(LOCATION_DECK)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetTargetRange(1,0)
e4:SetTarget(c114303426.actarget)
e4:SetOperation(c114303426.costop)
c:RegisterEffect(e4)
if not c114303426.initcheck then
c114303426.initcheck=true
local st=Effect.SetTargetRange
Effect.SetTargetRange=function(e,s,o)
if e:GetOwner():IsOriginalCodeRule(51194046) and e:GetCode()==EFFECT_MATERIAL_CHECK then
return st(e,LOCATION_HAND+LOCATION_DECK,LOCATION_HAND+LOCATION_DECK)
else
return st(e,s,o)
end
end
local rg=Duel.GetMatchingGroup(Card.IsOriginalCodeRule,tp,0xff,0xff,nil,51194046)
for tc in aux.Next(rg) do
if tc.initial_effect then
local tinit=c114303426.initial_effect
c114303426.initial_effect=function() end
tc:ReplaceEffect(114303426,0)
c114303426.initial_effect=tinit
tc.initial_effect(tc)
end
end
end
end
function c114303426.cfilter(c,tp)
return c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:GetPreviousControler()==tp and c:IsSetCard(0xaa)
return c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:GetPreviousControler()==tp and c:IsSetCard(0xaa)
end
function c114303426.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c114303426.cfilter,1,nil,tp)
return eg:IsExists(c114303426.cfilter,1,nil,tp)
end
function c114303426.thfilter(c)
return c:IsSetCard(0xaa) and c:IsAbleToHand()
return c:IsSetCard(0xaa) and c:IsAbleToHand()
end
function c114303426.refilter(c)
return c:IsSetCard(0xaa) and c:IsFaceup()
return c:IsSetCard(0xaa) and c:IsFaceup()
end
function c114303426.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c114303426.thfilter,tp,LOCATION_DECK,0,1,nil) end
local ct=Duel.GetMatchingGroupCount(c114303426.refilter,tp,LOCATION_EXTRA,0,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,ct*800)
if chk==0 then return Duel.IsExistingMatchingCard(c114303426.thfilter,tp,LOCATION_DECK,0,1,nil) end
local ct=Duel.GetMatchingGroupCount(c114303426.refilter,tp,LOCATION_EXTRA,0,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,ct*800)
end
function c114303426.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c114303426.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
local ct=Duel.GetMatchingGroupCount(c114303426.refilter,tp,LOCATION_EXTRA,0,nil)
if ct>0 then
Duel.BreakEffect()
Duel.Recover(tp,ct*800,REASON_EFFECT)
end
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c114303426.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
local ct=Duel.GetMatchingGroupCount(c114303426.refilter,tp,LOCATION_EXTRA,0,nil)
if ct>0 then
Duel.BreakEffect()
Duel.Recover(tp,ct*800,REASON_EFFECT)
end
end
end
function c114303426.sumcon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return ph==PHASE_MAIN1 or ph==PHASE_MAIN2
local ph=Duel.GetCurrentPhase()
return ph==PHASE_MAIN1 or ph==PHASE_MAIN2
end
function c114303426.sumfilter(c)
local a=c:GetTributeRequirement()
if a==0 then a=1 end
if c:IsCode(27279764,40061558) then a=3 end
return c:IsSetCard(0xaa) and c:IsSummonable(true,nil,1) and Duel.CheckTribute(c,a)
local a=c:GetTributeRequirement()
if a==0 then a=1 end
if c:IsCode(27279764,40061558) then a=3 end
return c:IsSetCard(0xaa) and c:IsSummonable(true,nil,1) and Duel.CheckTribute(c,a)
end
function c114303426.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c114303426.sumfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
if chk==0 then return Duel.IsExistingMatchingCard(c114303426.sumfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
end
function c114303426.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,c114303426.sumfilter,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.Summon(tp,tc,true,nil,1)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,c114303426.sumfilter,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.Summon(tp,tc,true,nil,1)
end
end
function c114303426.actarget(e,te,tp)
e:SetLabelObject(te)
return te:GetHandler()==e:GetHandler()
e:SetLabelObject(te)
return te:GetHandler()==e:GetHandler()
end
function c114303426.costop(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
local c=e:GetHandler()
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(c114303426.rsop)
e1:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(e2,tp)
local te=e:GetLabelObject()
local c=e:GetHandler()
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(c114303426.rsop)
e1:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(e2,tp)
end
function c114303426.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) and not (rc:IsOnField() and rc:IsFacedown()) then
rc:SetStatus(STATUS_ACTIVATE_DISABLED,true)
end
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) and not (rc:IsOnField() and rc:IsFacedown()) then
rc:SetStatus(STATUS_ACTIVATE_DISABLED,true)
end
end
function c114303426.condition2(e,tp,eg,ep,ev,re,r,rp)
return c114303426.condition(e,tp,eg,ep,ev,re,r,rp) and not Duel.IsExistingMatchingCard(aux.NOT(Card.IsSetCard),tp,LOCATION_EXTRA,0,1,nil,0xaa)
return c114303426.condition(e,tp,eg,ep,ev,re,r,rp) and not Duel.IsExistingMatchingCard(aux.NOT(Card.IsSetCard),tp,LOCATION_EXTRA,0,1,nil,0xaa)
end
function c114303426.operation2(e,tp,eg,ep,ev,re,r,rp)
Duel.ConfirmCards(1-tp,Duel.GetFieldGroup(tp,LOCATION_EXTRA,0))
c114303426.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.ConfirmCards(1-tp,Duel.GetFieldGroup(tp,LOCATION_EXTRA,0))
c114303426.operation(e,tp,eg,ep,ev,re,r,rp)
end
local st=Effect.SetTargetRange
Effect.SetTargetRange=function(e,s,o)
if e:GetOwner():IsOriginalCodeRule(51194046) and e:GetCode()==EFFECT_MATERIAL_CHECK then
return st(e,LOCATION_HAND+LOCATION_DECK,LOCATION_HAND+LOCATION_DECK)
else
return st(e,s,o)
end
if e:GetOwner():IsOriginalCodeRule(51194046) and e:GetCode()==EFFECT_MATERIAL_CHECK then
return st(e,LOCATION_HAND+LOCATION_DECK,LOCATION_HAND+LOCATION_DECK)
else
return st(e,s,o)
end
end
......@@ -61,6 +61,33 @@ function c118776531.initial_effect(c)
ge2:SetCode(EVENT_PHASE_START+PHASE_DRAW)
ge2:SetOperation(c118776531.clearop)
Duel.RegisterEffect(ge2,0)
local st=Effect.SetTarget
Effect.SetTarget=function(e,tg)
if e:GetDescription()==aux.Stringid(58984738,1) or e:GetDescription()==aux.Stringid(22499034,1) then
return st(e,c118776531.tg)
else
return st(e,tg)
end
end
local so=Effect.SetOperation
Effect.SetOperation=function(e,op)
if e:GetDescription()==aux.Stringid(58984738,1) or e:GetDescription()==aux.Stringid(22499034,1) then
return so(e,c118776531.op)
else
return so(e,op)
end
end
local rg=Duel.GetMatchingGroup(Card.IsOriginalCodeRule,tp,0xff,0xff,nil,58984738,22499034)
for tc in aux.Next(rg) do
if tc.initial_effect then
local tinit=c118776531.initial_effect
c118776531.initial_effect=function() end
tc:ReplaceEffect(118776531,0)
c118776531.initial_effect=tinit
tc.initial_effect(tc)
end
end
end
end
......@@ -163,22 +190,6 @@ end
--change script
local st=Effect.SetTarget
Effect.SetTarget=function(e,tg)
if e:GetDescription()==aux.Stringid(58984738,1) or e:GetDescription()==aux.Stringid(22499034,1) then
return st(e,c118776531.tg)
else
return st(e,tg)
end
end
local so=Effect.SetOperation
Effect.SetOperation=function(e,op)
if e:GetDescription()==aux.Stringid(58984738,1) or e:GetDescription()==aux.Stringid(22499034,1) then
return so(e,c118776531.op)
else
return so(e,op)
end
end
function c118776531.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
......
--混沌
function c121082832.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c121082832.actcost)
e1:SetTarget(c121082832.target)
c:RegisterEffect(e1)
--duel start
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_TO_HAND)
e2:SetRange(LOCATION_DECK+LOCATION_HAND)
e2:SetCountLimit(1,121082832+EFFECT_COUNT_CODE_DUEL)
e2:SetCondition(c121082832.chcon)
e2:SetOperation(c121082832.chop)
c:RegisterEffect(e2)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c121082832.actcost)
e1:SetTarget(c121082832.target)
c:RegisterEffect(e1)
--duel start
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_TO_HAND)
e2:SetRange(LOCATION_DECK+LOCATION_HAND)
e2:SetCountLimit(1,121082832+EFFECT_COUNT_CODE_DUEL)
e2:SetCondition(c121082832.chcon)
e2:SetOperation(c121082832.chop)
c:RegisterEffect(e2)
if not c121082832.initcheck then
c121082832.initcheck=true
local st=Effect.SetTarget
Effect.SetTarget=function(e,tg)
if e:GetOwner():IsOriginalCodeRule(92746535) and e:GetCategory()==CATEGORY_TOHAND+CATEGORY_SEARCH then
return st(e,c121082832.thtg)
else
return st(e,tg)
end
end
local so=Effect.SetOperation
Effect.SetOperation=function(e,op)
if e:GetOwner():IsOriginalCodeRule(92746535) and e:GetCategory()==CATEGORY_TOHAND+CATEGORY_SEARCH then
return so(e,c121082832.thop)
else
return so(e,op)
end
end
local rg=Duel.GetMatchingGroup(Card.IsOriginalCodeRule,tp,0xff,0xff,nil,92746535)
for tc in aux.Next(rg) do
if tc.initial_effect then
local tinit=c121082832.initial_effect
c121082832.initial_effect=function() end
tc:ReplaceEffect(121082832,0)
c121082832.initial_effect=tinit
tc.initial_effect(tc)
end
end
end
end
function c121082832.actcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,121082832)==0 end
Duel.RegisterFlagEffect(tp,121082832,0,0,0)
if chk==0 then return Duel.GetFlagEffect(tp,121082832)==0 end
Duel.RegisterFlagEffect(tp,121082832,0,0,0)
end
function c121082832.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_FZONE)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetLabel(0)
e1:SetCountLimit(1)
e1:SetCondition(c121082832.tgcon)
e1:SetOperation(c121082832.tgop)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END+RESET_OPPO_TURN,3)
e:GetHandler():RegisterEffect(e1)
if chk==0 then return true end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_FZONE)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetLabel(0)
e1:SetCountLimit(1)
e1:SetCondition(c121082832.tgcon)
e1:SetOperation(c121082832.tgop)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END+RESET_OPPO_TURN,3)
e:GetHandler():RegisterEffect(e1)
end
function c121082832.tgcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
return Duel.GetTurnPlayer()~=tp
end
function c121082832.tgop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=e:GetLabel()
ct=ct+1
e:SetLabel(ct)
if ct<=3 then e:GetHandler():SetTurnCounter(ct) end
if ct==3 then
--search & destroy
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(LOCATION_FZONE)
e1:SetCountLimit(1)
e1:SetTarget(c121082832.destg)
e1:SetOperation(c121082832.desop)
e1:SetReset(RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
local c=e:GetHandler()
local ct=e:GetLabel()
ct=ct+1
e:SetLabel(ct)
if ct<=3 then e:GetHandler():SetTurnCounter(ct) end
if ct==3 then
--search & destroy
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(LOCATION_FZONE)
e1:SetCountLimit(1)
e1:SetTarget(c121082832.destg)
e1:SetOperation(c121082832.desop)
e1:SetReset(RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
end
function c121082832.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0)
end
function c121082832.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFacedown() or not c:IsRelateToEffect(e) then return end
if Duel.Destroy(c,REASON_EFFECT)==0 then return end
Duel.SetLP(tp,4000)
local dc=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)
if Duel.GetLP(tp)<Duel.GetLP(1-tp) and dc>1 and Duel.SelectYesNo(tp,aux.Stringid(121082832,2)) then
local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
Duel.ConfirmDecktop(tp,1)
end
end
local c=e:GetHandler()
if c:IsFacedown() or not c:IsRelateToEffect(e) then return end
if Duel.Destroy(c,REASON_EFFECT)==0 then return end
Duel.SetLP(tp,4000)
local dc=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)
if Duel.GetLP(tp)<Duel.GetLP(1-tp) and dc>1 and Duel.SelectYesNo(tp,aux.Stringid(121082832,2)) then
local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
Duel.ConfirmDecktop(tp,1)
end
end
end
function c121082832.chcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount()==0
return Duel.GetTurnCount()==0
end
function c121082832.chop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tp=c:GetOwner()
if not c:IsLocation(LOCATION_DECK+LOCATION_HAND) then return end
local g=Duel.GetFieldGroup(tp,LOCATION_HAND,LOCATION_HAND)
if g:GetCount()>0 then Duel.SendtoDeck(g,nil,2,REASON_RULE) end
if c:GetActivateEffect():IsActivatable(tp) then
Duel.SSet(tp,c)
c:RegisterFlagEffect(121082832,RESET_EVENT+0x1fe0000,0,1)
--cannot activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetRange(LOCATION_FZONE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_SET_AVAILABLE)
e1:SetTargetRange(1,0)
e1:SetCondition(c121082832.negcon)
e1:SetValue(c121082832.actlimit)
Duel.RegisterEffect(e1,tp)
--cannot set
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_SSET)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(1,0)
e2:SetCondition(c121082832.negcon)
e2:SetTarget(c121082832.setlimit)
e2:SetValue(c121082832.actlimit)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(1,1)
e3:SetCondition(c121082832.negcon)
e3:SetValue(c121082832.nofilter)
Duel.RegisterEffect(e3,tp)
--indes
local e4=Effect.CreateEffect(c)
e4:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetTargetRange(LOCATION_SZONE,0)
e4:SetTarget(c121082832.indtg)
e4:SetCondition(c121082832.negcon)
e4:SetCode(EFFECT_INDESTRUCTABLE)
e4:SetValue(1)
Duel.RegisterEffect(e4,tp)
local e5=e4:Clone()
e5:SetCode(EFFECT_CANNOT_REMOVE)
Duel.RegisterEffect(e5,tp)
local e6=e4:Clone()
e6:SetCode(EFFECT_CANNOT_TO_DECK)
Duel.RegisterEffect(e6,tp)
local e7=e4:Clone()
e7:SetCode(EFFECT_CANNOT_TO_HAND)
Duel.RegisterEffect(e7,tp)
local e8=e4:Clone()
e8:SetCode(EFFECT_UNRELEASABLE_SUM)
Duel.RegisterEffect(e8,tp)
local e9=e4:Clone()
e9:SetCode(EFFECT_UNRELEASABLE_NONSUM)
Duel.RegisterEffect(e9,tp)
local e10=e4:Clone()
e10:SetCode(EFFECT_CANNOT_TO_GRAVE)
Duel.RegisterEffect(e10,tp)
--chage name
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_REPEAT+EFFECT_FLAG_DELAY+EFFECT_FLAG_SET_AVAILABLE)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetRange(LOCATION_FZONE)
e1:SetTargetRange(0xff,0xff)
e1:SetValue(121082832)
c:RegisterEffect(e1)
end
Duel.BreakEffect()
Duel.ShuffleDeck(tp)
Duel.Draw(Duel.GetTurnPlayer(),5,REASON_RULE)
local c=e:GetHandler()
local tp=c:GetOwner()
if not c:IsLocation(LOCATION_DECK+LOCATION_HAND) then return end
local g=Duel.GetFieldGroup(tp,LOCATION_HAND,LOCATION_HAND)
if g:GetCount()>0 then Duel.SendtoDeck(g,nil,2,REASON_RULE) end
if c:GetActivateEffect():IsActivatable(tp) then
Duel.SSet(tp,c)
c:RegisterFlagEffect(121082832,RESET_EVENT+0x1fe0000,0,1)
--cannot activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetRange(LOCATION_FZONE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_SET_AVAILABLE)
e1:SetTargetRange(1,0)
e1:SetCondition(c121082832.negcon)
e1:SetValue(c121082832.actlimit)
Duel.RegisterEffect(e1,tp)
--cannot set
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_SSET)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(1,0)
e2:SetCondition(c121082832.negcon)
e2:SetTarget(c121082832.setlimit)
e2:SetValue(c121082832.actlimit)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(1,1)
e3:SetCondition(c121082832.negcon)
e3:SetValue(c121082832.nofilter)
Duel.RegisterEffect(e3,tp)
--indes
local e4=Effect.CreateEffect(c)
e4:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetTargetRange(LOCATION_SZONE,0)
e4:SetTarget(c121082832.indtg)
e4:SetCondition(c121082832.negcon)
e4:SetCode(EFFECT_INDESTRUCTABLE)
e4:SetValue(1)
Duel.RegisterEffect(e4,tp)
local e5=e4:Clone()
e5:SetCode(EFFECT_CANNOT_REMOVE)
Duel.RegisterEffect(e5,tp)
local e6=e4:Clone()
e6:SetCode(EFFECT_CANNOT_TO_DECK)
Duel.RegisterEffect(e6,tp)
local e7=e4:Clone()
e7:SetCode(EFFECT_CANNOT_TO_HAND)
Duel.RegisterEffect(e7,tp)
local e8=e4:Clone()
e8:SetCode(EFFECT_UNRELEASABLE_SUM)
Duel.RegisterEffect(e8,tp)
local e9=e4:Clone()
e9:SetCode(EFFECT_UNRELEASABLE_NONSUM)
Duel.RegisterEffect(e9,tp)
local e10=e4:Clone()
e10:SetCode(EFFECT_CANNOT_TO_GRAVE)
Duel.RegisterEffect(e10,tp)
--chage name
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_REPEAT+EFFECT_FLAG_DELAY+EFFECT_FLAG_SET_AVAILABLE)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetRange(LOCATION_FZONE)
e1:SetTargetRange(0xff,0xff)
e1:SetValue(121082832)
c:RegisterEffect(e1)
end
Duel.BreakEffect()
Duel.ShuffleDeck(tp)
Duel.Draw(Duel.GetTurnPlayer(),5,REASON_RULE)
end
function c121082832.negcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsFacedown()
return e:GetHandler():IsFacedown()
end
function c121082832.indtg(e,c)
return c:IsCode(121082832) and c:IsFacedown() and c:IsType(TYPE_FIELD) and c:GetFlagEffect(121082832)~=0
return c:IsCode(121082832) and c:IsFacedown() and c:IsType(TYPE_FIELD) and c:GetFlagEffect(121082832)~=0
end
function c121082832.actlimit(e,re,tp)
return re:IsActiveType(TYPE_FIELD) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and not re:GetHandler():IsCode(121082832)
return re:IsActiveType(TYPE_FIELD) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and not re:GetHandler():IsCode(121082832)
end
function c121082832.setlimit(e,c,tp)
return c:IsType(TYPE_FIELD)
return c:IsType(TYPE_FIELD)
end
function c121082832.nofilter(e,re,tp)
return re:GetHandler():IsCode(73468603)
end
local st=Effect.SetTarget
Effect.SetTarget=function(e,tg)
if e:GetOwner():IsOriginalCodeRule(92746535) and e:GetCategory()==CATEGORY_TOHAND+CATEGORY_SEARCH then
return st(e,c121082832.thtg)
else
return st(e,tg)
end
end
local so=Effect.SetOperation
Effect.SetOperation=function(e,op)
if e:GetOwner():IsOriginalCodeRule(92746535) and e:GetCategory()==CATEGORY_TOHAND+CATEGORY_SEARCH then
return so(e,c121082832.thop)
else
return so(e,op)
end
return re:GetHandler():IsCode(73468603)
end
function c121082832.thfilter(c,code)
return c:IsCode(code) and c:IsAbleToHand()
return c:IsCode(code) and c:IsAbleToHand()
end
function c121082832.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
local sc=Duel.GetFirstMatchingCard(nil,tp,LOCATION_PZONE,0,e:GetHandler())
if chk==0 then return Duel.IsExistingMatchingCard(c121082832.thfilter,tp,LOCATION_DECK,0,1,nil,sc:GetCode()) end
Duel.SetTargetCard(sc)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,sc,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
local sc=Duel.GetFirstMatchingCard(nil,tp,LOCATION_PZONE,0,e:GetHandler())
if chk==0 then return Duel.IsExistingMatchingCard(c121082832.thfilter,tp,LOCATION_DECK,0,1,nil,sc:GetCode()) end
Duel.SetTargetCard(sc)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,sc,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c121082832.thop(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) and Duel.Destroy(tc,REASON_EFFECT)~=0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c121082832.thfilter,tp,LOCATION_DECK,0,1,1,nil,tc:GetCode())
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c121082832.thfilter,tp,LOCATION_DECK,0,1,1,nil,tc:GetCode())
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
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