Commit 958028af authored by POLYMER's avatar POLYMER

fix

parent 175184a2
No preview for this file type
--秘计螺旋 球闪
local cm,m=GetID()
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DICE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(cm.cost)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
--Set
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,3))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_CUSTOM+11451961)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(0xff)
e2:SetTarget(cm.drtg)
e2:SetOperation(cm.drop)
c:RegisterEffect(e2)
if not DEFECT_ORAL_CHECK then
DEFECT_ORAL_CHECK=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_ADJUST)
ge1:SetOperation(cm.resetop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CUSTOM+11451961)
ge2:SetOperation(cm.evop)
Duel.RegisterEffect(ge2,0)
end
end
function cm.resetop(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetMatchingGroup(function(c) return c:IsFacedown() and c:GetFlagEffect(11451961)>0 end,0,0xff,0xff,nil)+Duel.GetOverlayGroup(0,1,1):Filter(function(c) return c:GetFlagEffect(11451961)>0 end,nil)
local g2=Duel.GetMatchingGroup(function(c) return c:IsFacedown() and c:GetFlagEffect(11451962)>0 end,0,0xff,0xff,nil)+Duel.GetOverlayGroup(0,1,1):Filter(function(c) return c:GetFlagEffect(11451962)>0 end,nil)
for tc in aux.Next(g1) do tc:ResetFlagEffect(11451961) end
for tc in aux.Next(g2) do tc:ResetFlagEffect(11451962) end
end
function cm.evop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
if Duel.GetCurrentChain()==0 then Duel.RaiseSingleEvent(tc,EVENT_CUSTOM+11451961,re,0,0,0,0) return end
local ge2=Effect.CreateEffect(e:GetHandler())
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_END)
ge2:SetOperation(function(e) Duel.RaiseSingleEvent(tc,EVENT_CUSTOM+11451961,re,0,0,0,0) e:Reset() end)
Duel.RegisterEffect(ge2,0)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
--c:ResetFlagEffect(11451961)
c:RegisterFlagEffect(11451962,RESET_EVENT+RESET_TODECK+RESET_TOHAND+RESET_TURN_SET+RESET_OVERLAY+RESET_CHAIN,EFFECT_FLAG_OATH,1)
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_CARD,0,m)
--Duel.Hint(HINT_OPSELECTED,tp,aux.Stringid(11451961,5))
--Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(11451961,5))
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetCondition(cm.recon)
e1:SetOperation(cm.reop)
Duel.RegisterEffect(e1,tp)
local eid=e1:GetFieldID()
e1:SetLabel(eid)
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
DEFECT_ORAL_COUNT=DEFECT_ORAL_COUNT or 3
if #eset==DEFECT_ORAL_COUNT then
local de=eset[1]
local ce=de:GetLabelObject()
if ce and aux.GetValueType(ce)=="Effect" then
local tc=ce:GetHandler()
local eset2={tc:IsHasEffect(EFFECT_FLAG_EFFECT+11451961)}
local res=false
for _,te in pairs(eset2) do
if te:GetLabel()==de:GetLabel() then res=true break end
end
if res then
Duel.RaiseEvent(tc,EVENT_CUSTOM+11451961,e,0,0,0,0)
Duel.Hint(HINT_OPSELECTED,tp,aux.Stringid(tc:GetOriginalCode(),3))
Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(tc:GetOriginalCode(),3))
end
ce:Reset()
end
de:Reset()
eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
for _,te in pairs(eset) do
local te2=te:Clone()
te2:SetDescription(te:GetDescription()-16)
Duel.RegisterEffect(te2,tp)
local ce=te:GetLabelObject()
if ce and aux.GetValueType(ce)=="Effect" then
local tc=ce:GetHandler()
local ce2=ce:Clone()
ce2:SetDescription(ce:GetDescription()-16)
tc:RegisterEffect(ce2,true)
te2:SetLabelObject(ce2)
ce:Reset()
end
te:Reset()
end
end
local ce=nil
eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
if c:GetFlagEffect(11451962)>0 or (c:IsFaceup() and c:IsLocation(LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED) and not e:IsHasType(EFFECT_TYPE_ACTIVATE)) then
--Duel.HintSelection(Group.FromCards(c))
ce=c:RegisterFlagEffect(11451961,RESET_EVENT+RESET_TODECK+RESET_TOHAND+RESET_TURN_SET+RESET_OVERLAY,EFFECT_FLAG_CLIENT_HINT,1,eid,aux.Stringid(11451961+#eset,1))
end
--[[local id=5
local res=false
while not res do
res=true
for _,te in pairs(eset) do
if te:GetDescription()==aux.Stringid(m,id) then res=false id=id+1 end
end
end--]]
local de=Effect.CreateEffect(c)
de:SetDescription(aux.Stringid(11451961+#eset,5))
de:SetLabel(eid)
de:SetType(EFFECT_TYPE_FIELD)
de:SetCode(EFFECT_FLAG_EFFECT+11451961)
de:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
de:SetTargetRange(1,0)
Duel.RegisterEffect(de,tp)
if ce and aux.GetValueType(ce)=="Effect" then de:SetLabelObject(ce) end
end
function cm.recon(e,tp,eg,ep,ev,re,r,rp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and rp==tp
end
function cm.filter(c,tp,seq)
return aux.GetColumn(c,tp) and aux.GetColumn(c,tp)==seq-1
end
function cm.reop(e,tp,eg,ep,ev,re,r,rp)
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
local res=false
for _,te in pairs(eset) do
if te:GetLabel()==e:GetLabel() then res=true break end
end
if not res then e:Reset() return end
for i=1,1+#{Duel.IsPlayerAffectedByEffect(0,11451973)} do
local d=Duel.TossDice(tp,1)
if d>5 then return end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,2))
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,0,1,nil,tp,d)
if #g>0 then
Duel.Hint(HINT_CARD,0,m)
Duel.HintSelection(g)
Duel.Destroy(g,REASON_EFFECT)
end
end
end
function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(function(c) return c:GetSequence()<5 end,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if chk==0 then return true end
if c:IsLocation(LOCATION_GRAVE) then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,0,0) end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function cm.cclfilter(c,tc)
local seq1=aux.GetColumn(c)
local seq2=aux.GetColumn(tc)
return seq1 and seq2 and math.abs(seq1-seq2)==1
end
function cm.drop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SSet(tp,c)>0 and c:IsLocation(LOCATION_SZONE) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,cm.cclfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil,e:GetHandler())
if not g or #g==0 then return end
Duel.Destroy(g,REASON_EFFECT)
end
end
\ No newline at end of file
--秘计螺旋 寒流
local cm,m=GetID()
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(cm.cost)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
--Set
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,3))
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_CUSTOM+11451961)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(0xff)
e2:SetTarget(cm.drtg)
e2:SetOperation(cm.drop)
c:RegisterEffect(e2)
if not DEFECT_ORAL_CHECK then
DEFECT_ORAL_CHECK=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_ADJUST)
ge1:SetOperation(cm.resetop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CUSTOM+11451961)
ge2:SetOperation(cm.evop)
Duel.RegisterEffect(ge2,0)
end
if not PNFL_IMMUNE_CHECK then
PNFL_IMMUNE_CHECK=true
local _IsImmuneToEffect=Card.IsImmuneToEffect
function Card.IsImmuneToEffect(c,...)
c:RegisterFlagEffect(11451965,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1)
local res=_IsImmuneToEffect(c,...)
c:ResetFlagEffect(11451965)
return res
end
end
end
function cm.resetop(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetMatchingGroup(function(c) return c:IsFacedown() and c:GetFlagEffect(11451961)>0 end,0,0xff,0xff,nil)+Duel.GetOverlayGroup(0,1,1):Filter(function(c) return c:GetFlagEffect(11451961)>0 end,nil)
local g2=Duel.GetMatchingGroup(function(c) return c:IsFacedown() and c:GetFlagEffect(11451962)>0 end,0,0xff,0xff,nil)+Duel.GetOverlayGroup(0,1,1):Filter(function(c) return c:GetFlagEffect(11451962)>0 end,nil)
for tc in aux.Next(g1) do tc:ResetFlagEffect(11451961) end
for tc in aux.Next(g2) do tc:ResetFlagEffect(11451962) end
end
function cm.evop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
if Duel.GetCurrentChain()==0 then Duel.RaiseSingleEvent(tc,EVENT_CUSTOM+11451961,re,0,0,0,0) return end
local ge2=Effect.CreateEffect(e:GetHandler())
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_END)
ge2:SetOperation(function(e) Duel.RaiseSingleEvent(tc,EVENT_CUSTOM+11451961,re,0,0,0,0) e:Reset() end)
Duel.RegisterEffect(ge2,0)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
c:RegisterFlagEffect(11451962,RESET_EVENT+RESET_TODECK+RESET_TOHAND+RESET_TURN_SET+RESET_OVERLAY+RESET_CHAIN,EFFECT_FLAG_OATH,1)
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_CARD,0,m)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_SOLVING)
e1:SetCondition(cm.recon)
e1:SetOperation(cm.reop)
Duel.RegisterEffect(e1,tp)
local eid=e1:GetFieldID()
e1:SetLabel(eid)
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
DEFECT_ORAL_COUNT=DEFECT_ORAL_COUNT or 3
if #eset==DEFECT_ORAL_COUNT then
local de=eset[1]
local ce=de:GetLabelObject()
if ce and aux.GetValueType(ce)=="Effect" then
local tc=ce:GetHandler()
local eset2={tc:IsHasEffect(EFFECT_FLAG_EFFECT+11451961)}
local res=false
for _,te in pairs(eset2) do
if te:GetLabel()==de:GetLabel() then res=true break end
end
if res then
Duel.RaiseEvent(tc,EVENT_CUSTOM+11451961,e,0,0,0,0)
Duel.Hint(HINT_OPSELECTED,tp,aux.Stringid(tc:GetOriginalCode(),3))
Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(tc:GetOriginalCode(),3))
end
ce:Reset()
end
de:Reset()
eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
for _,te in pairs(eset) do
local te2=te:Clone()
te2:SetDescription(te:GetDescription()-16)
Duel.RegisterEffect(te2,tp)
local ce=te:GetLabelObject()
if ce and aux.GetValueType(ce)=="Effect" then
local tc=ce:GetHandler()
local ce2=ce:Clone()
ce2:SetDescription(ce:GetDescription()-16)
tc:RegisterEffect(ce2,true)
te2:SetLabelObject(ce2)
ce:Reset()
end
te:Reset()
end
end
local ce=nil
eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
if c:GetFlagEffect(11451962)>0 or (c:IsFaceup() and c:IsLocation(LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED) and not e:IsHasType(EFFECT_TYPE_ACTIVATE)) then
ce=c:RegisterFlagEffect(11451961,RESET_EVENT+RESET_TODECK+RESET_TOHAND+RESET_TURN_SET+RESET_OVERLAY,EFFECT_FLAG_CLIENT_HINT,1,eid,aux.Stringid(11451961+#eset,1))
end
local de=Effect.CreateEffect(c)
de:SetDescription(aux.Stringid(11451961+#eset,6))
de:SetLabel(eid)
de:SetType(EFFECT_TYPE_FIELD)
de:SetCode(EFFECT_FLAG_EFFECT+11451961)
de:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
de:SetTargetRange(1,0)
Duel.RegisterEffect(de,tp)
if ce and aux.GetValueType(ce)=="Effect" then de:SetLabelObject(ce) end
end
function cm.recon(e,tp,eg,ep,ev,re,r,rp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and rp==tp
end
local KOISHI_CHECK=false
if Duel.DisableActionCheck then KOISHI_CHECK=true end
function cm.reop(e,tp,eg,ep,ev,re,r,rp)
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
local res=false
for _,te in pairs(eset) do
if te:GetLabel()==e:GetLabel() then res=true break end
end
if not res then e:Reset() return end
for i=1,1+#{Duel.IsPlayerAffectedByEffect(0,11451973)} do
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,2))
local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,0,1,1,nil)
if #g>0 then
Duel.HintSelection(g)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(m,4))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
--e1:SetCondition(cm.recon)
e1:SetValue(cm.efilter)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
g:GetFirst():RegisterEffect(e1,true)
local eid=e1:GetFieldID()
e1:SetLabel(eid)
g:GetFirst():RegisterFlagEffect(m+0xffffff,RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(m,4))
end
end
end
function cm.efilter(e,te)
if e:GetHandler():GetFlagEffect(m+0xffffff)>0 and te and te:GetHandler() and not te:IsHasProperty(EFFECT_FLAG_UNCOPYABLE) and te:IsHasType(EFFECT_TYPE_ACTIONS) then
if KOISHI_CHECK then
Duel.DisableActionCheck(true)
pcall(Duel.HintSelection,Group.FromCards(e:GetHandler()))
local tc=te:GetHandler()
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(m)
e1:SetLabel(te:GetOwnerPlayer())
e1:SetOperation(function(e) pcall(Duel.Draw,e:GetLabel(),1,REASON_EFFECT) e:Reset() end)
Duel.RegisterEffect(e1,0)
pcall(Duel.RaiseEvent,tc,m,e,0,0,0,0)
e1:Reset()
Duel.DisableActionCheck(false)
else
local e5=Effect.CreateEffect(te:GetHandler())
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e5:SetCode(EVENT_ADJUST)
e5:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e5:SetLabel(te:GetOwnerPlayer())
e5:SetCondition(function() return not pnfl_adjusting end)
e5:SetOperation(cm.acop)
Duel.RegisterEffect(e5,tp)
end
if e:GetHandler():GetFlagEffect(11451965)>0 then
e:SetLabelObject(te)
e:SetLabel(Duel.GetCurrentChain())
e:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET+RESET_CHAIN)
end
e:GetHandler():ResetFlagEffect(m+0xffffff)
e:SetValue(function(e,te) return e:GetLabelObject() and te==e:GetLabelObject() and e:GetLabel()==Duel.GetCurrentChain() end)
e:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e:SetDescription(0)
return true
end
return false
end
function cm.filter1(c,fid)
return c:GetFlagEffect(m)>0 and c:GetFlagEffectLabel(m)==fid
end
function cm.acop(e,tp,eg,ep,ev,re,r,rp)
if pnfl_adjusting then return end
pnfl_adjusting=true
Duel.Draw(e:GetLabel(),1,REASON_EFFECT)
pnfl_adjusting=false
e:Reset()
end
function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return true end
if c:IsLocation(LOCATION_GRAVE) then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,0,0) end
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function cm.drop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SSet(tp,c)>0 and c:IsLocation(LOCATION_SZONE) then
Duel.Draw(tp,1,REASON_EFFECT)
--[[local cid=c:GetFieldID()
c:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,cid,aux.Stringid(m,4))
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE)
e1:SetTargetRange(LOCATION_SZONE,0)
e1:SetLabel(cid)
e1:SetCondition(cm.con)
e1:SetValue(cm.efilter)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
Duel.RegisterEffect(e1,tp)--]]
end
end
function cm.con(e,tp,eg,ep,ev,re,r,rp)
if not (e:GetHandler():GetFlagEffect(m)>0 and e:GetHandler():GetFlagEffectLabel(m)==e:GetLabel() and e:GetHandler():IsFacedown()) then e:SetLabel(0) return false end
return true
end
\ No newline at end of file
--秘计螺旋 聚变
local cm,m=GetID()
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(cm.cost)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
--Set
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,3))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_CUSTOM+11451961)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(0xff)
e2:SetTarget(cm.drtg)
e2:SetOperation(cm.drop)
c:RegisterEffect(e2)
if not DEFECT_ORAL_CHECK then
DEFECT_ORAL_CHECK=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_ADJUST)
ge1:SetOperation(cm.resetop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CUSTOM+11451961)
ge2:SetOperation(cm.evop)
Duel.RegisterEffect(ge2,0)
end
end
function cm.resetop(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetMatchingGroup(function(c) return c:IsFacedown() and c:GetFlagEffect(11451961)>0 end,0,0xff,0xff,nil)+Duel.GetOverlayGroup(0,1,1):Filter(function(c) return c:GetFlagEffect(11451961)>0 end,nil)
local g2=Duel.GetMatchingGroup(function(c) return c:IsFacedown() and c:GetFlagEffect(11451962)>0 end,0,0xff,0xff,nil)+Duel.GetOverlayGroup(0,1,1):Filter(function(c) return c:GetFlagEffect(11451962)>0 end,nil)
for tc in aux.Next(g1) do tc:ResetFlagEffect(11451961) end
for tc in aux.Next(g2) do tc:ResetFlagEffect(11451962) end
end
function cm.evop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
if Duel.GetCurrentChain()==0 then Duel.RaiseSingleEvent(tc,EVENT_CUSTOM+11451961,re,0,0,0,0) return end
local ge2=Effect.CreateEffect(e:GetHandler())
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_END)
ge2:SetOperation(function(e) Duel.RaiseSingleEvent(tc,EVENT_CUSTOM+11451961,re,0,0,0,0) e:Reset() end)
Duel.RegisterEffect(ge2,0)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
c:RegisterFlagEffect(11451962,RESET_EVENT+RESET_TODECK+RESET_TOHAND+RESET_TURN_SET+RESET_OVERLAY+RESET_CHAIN,EFFECT_FLAG_OATH,1)
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_CARD,0,m)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,2))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetTargetRange(LOCATION_SZONE,0)
e1:SetCountLimit(1)
Duel.RegisterEffect(e1,tp)
local eid=e1:GetFieldID()
e1:SetTarget(function(e,c)
if e:GetLabel()==0 or Duel.GetFlagEffect(0,m+0xffffff+eid)>0 then return false end
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
local res=false
for _,te in pairs(eset) do
if te:GetLabel()==e:GetLabel() then res=true break end
end
if not res then e:SetLabel(0) return false end
return not c:IsCode(m)
end)
e1:SetCost(function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.RegisterFlagEffect(0,m+0xffffff+eid,RESET_PHASE+PHASE_END,0,1)
end)
e1:SetLabel(eid)
local e3=e1:Clone()
e3:SetCode(EFFECT_QP_ACT_IN_SET_TURN)
Duel.RegisterEffect(e3,tp)
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
DEFECT_ORAL_COUNT=DEFECT_ORAL_COUNT or 3
if #eset==DEFECT_ORAL_COUNT then
local de=eset[1]
local ce=de:GetLabelObject()
if ce and aux.GetValueType(ce)=="Effect" then
local tc=ce:GetHandler()
local eset2={tc:IsHasEffect(EFFECT_FLAG_EFFECT+11451961)}
local res=false
for _,te in pairs(eset2) do
if te:GetLabel()==de:GetLabel() then res=true break end
end
if res then
Duel.RaiseEvent(tc,EVENT_CUSTOM+11451961,e,0,0,0,0)
Duel.Hint(HINT_OPSELECTED,tp,aux.Stringid(tc:GetOriginalCode(),3))
Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(tc:GetOriginalCode(),3))
end
ce:Reset()
end
de:Reset()
eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
for _,te in pairs(eset) do
local te2=te:Clone()
te2:SetDescription(te:GetDescription()-16)
Duel.RegisterEffect(te2,tp)
local ce=te:GetLabelObject()
if ce and aux.GetValueType(ce)=="Effect" then
local tc=ce:GetHandler()
local ce2=ce:Clone()
ce2:SetDescription(ce:GetDescription()-16)
tc:RegisterEffect(ce2,true)
te2:SetLabelObject(ce2)
ce:Reset()
end
te:Reset()
end
end
local ce=nil
eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
if c:GetFlagEffect(11451962)>0 or (c:IsFaceup() and c:IsLocation(LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED) and not e:IsHasType(EFFECT_TYPE_ACTIVATE)) then
ce=c:RegisterFlagEffect(11451961,RESET_EVENT+RESET_TODECK+RESET_TOHAND+RESET_TURN_SET+RESET_OVERLAY,EFFECT_FLAG_CLIENT_HINT,1,eid,aux.Stringid(11451961+#eset,1))
end
local de=Effect.CreateEffect(c)
de:SetDescription(aux.Stringid(11451961+#eset,7))
de:SetLabel(eid)
de:SetType(EFFECT_TYPE_FIELD)
de:SetCode(EFFECT_FLAG_EFFECT+11451961)
de:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
de:SetTargetRange(1,0)
Duel.RegisterEffect(de,tp)
if ce and aux.GetValueType(ce)=="Effect" then de:SetLabelObject(ce) end
end
function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return true end
if c:IsLocation(LOCATION_GRAVE) then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,0,0) end
end
function cm.cclfilter(c,tc)
local seq1=aux.GetColumn(c)
local seq2=aux.GetColumn(tc)
return seq1 and seq2 and math.abs(seq1-seq2)==1 and c:IsAbleToHand()
end
function cm.drop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SSet(tp,c)>0 and c:IsLocation(LOCATION_SZONE) and c:IsFacedown() then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,4))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_NO_TURN_RESET)
e1:SetTargetRange(LOCATION_SZONE,0)
e1:SetCountLimit(1)
e1:SetLabel(cid)
e1:SetCondition(cm.con)
Duel.RegisterEffect(e1,tp)
local eid=e1:GetFieldID()
c:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,eid,aux.Stringid(m,9))
c:RegisterFlagEffect(m+1,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,eid,aux.Stringid(m,10))
e1:SetTarget(function(e,c)
local seq1=aux.GetColumn(c,e:GetHandlerPlayer())
local seq2=aux.GetColumn(e:GetHandler(),e:GetHandlerPlayer())
return seq1 and seq2 and seq1-seq2==1
end)
e1:SetCost(function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:GetHandler():ResetFlagEffect(m)
end)
e1:SetLabel(eid)
local e2=e1:Clone()
e2:SetCondition(cm.con2)
e2:SetTarget(function(e,c)
local seq1=aux.GetColumn(c,e:GetHandlerPlayer())
local seq2=aux.GetColumn(e:GetHandler(),e:GetHandlerPlayer())
return seq1 and seq2 and seq1-seq2==-1
end)
e2:SetCost(function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:GetHandler():ResetFlagEffect(m+1)
end)
Duel.RegisterEffect(e2,tp)
--[[Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectMatchingCard(tp,cm.cclfilter,tp,LOCATION_ONFIELD,0,1,1,nil,e:GetHandler())
if not g or #g==0 then return end
Duel.SendtoHand(g,nil,REASON_EFFECT)--]]
end
end
function cm.con(e,tp,eg,ep,ev,re,r,rp)
if not (e:GetHandler():GetFlagEffect(m)>0 and e:GetHandler():GetFlagEffectLabel(m)==e:GetLabel() and e:GetHandler():IsFacedown()) then e:SetLabel(0) return false end
return true
end
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
if not (e:GetHandler():GetFlagEffect(m+1)>0 and e:GetHandler():GetFlagEffectLabel(m+1)==e:GetLabel() and e:GetHandler():IsFacedown()) then e:SetLabel(0) return false end
return true
end
\ No newline at end of file
--秘计螺旋 漆黑
local cm,m=GetID()
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(cm.cost)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
--Set
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,3))
e2:SetCategory(CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_CUSTOM+11451961)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(0xff)
e2:SetTarget(cm.drtg)
e2:SetOperation(cm.drop)
c:RegisterEffect(e2)
if not DEFECT_ORAL_CHECK then
DEFECT_ORAL_CHECK=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_ADJUST)
ge1:SetOperation(cm.resetop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CUSTOM+11451961)
ge2:SetOperation(cm.evop)
Duel.RegisterEffect(ge2,0)
end
end
function cm.resetop(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetMatchingGroup(function(c) return c:IsFacedown() and c:GetFlagEffect(11451961)>0 end,0,0xff,0xff,nil)+Duel.GetOverlayGroup(0,1,1):Filter(function(c) return c:GetFlagEffect(11451961)>0 end,nil)
local g2=Duel.GetMatchingGroup(function(c) return c:IsFacedown() and c:GetFlagEffect(11451962)>0 end,0,0xff,0xff,nil)+Duel.GetOverlayGroup(0,1,1):Filter(function(c) return c:GetFlagEffect(11451962)>0 end,nil)
for tc in aux.Next(g1) do tc:ResetFlagEffect(11451961) end
for tc in aux.Next(g2) do tc:ResetFlagEffect(11451962) end
end
function cm.evop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
if Duel.GetCurrentChain()==0 then Duel.RaiseSingleEvent(tc,EVENT_CUSTOM+11451961,re,0,0,0,0) return end
local ge2=Effect.CreateEffect(e:GetHandler())
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_END)
ge2:SetOperation(function(e) Duel.RaiseSingleEvent(tc,EVENT_CUSTOM+11451961,re,0,0,0,0) e:Reset() end)
Duel.RegisterEffect(ge2,0)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
c:RegisterFlagEffect(11451962,RESET_EVENT+RESET_TODECK+RESET_TOHAND+RESET_TURN_SET+RESET_OVERLAY+RESET_CHAIN,EFFECT_FLAG_OATH,1)
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_CARD,0,m)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
--[[e1:SetCode(EVENT_CHAINING)
e1:SetCondition(cm.recon)
e1:SetOperation(cm.reop)--]]
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EFFECT_ACTIVATE_COST)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
e1:SetTarget(cm.actarget2)
e1:SetOperation(cm.costop2)
Duel.RegisterEffect(e1,tp)
local eid=e1:GetFieldID()
e1:SetLabel(eid)
cm[e1]={}
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
DEFECT_ORAL_COUNT=DEFECT_ORAL_COUNT or 3
if #eset==DEFECT_ORAL_COUNT then
local de=eset[1]
local ce=de:GetLabelObject()
if ce and aux.GetValueType(ce)=="Effect" then
local tc=ce:GetHandler()
local eset2={tc:IsHasEffect(EFFECT_FLAG_EFFECT+11451961)}
local res=false
for _,te in pairs(eset2) do
if te:GetLabel()==de:GetLabel() then res=true break end
end
if res then
Duel.RaiseEvent(tc,EVENT_CUSTOM+11451961,e,0,0,0,0)
Duel.Hint(HINT_OPSELECTED,tp,aux.Stringid(tc:GetOriginalCode(),3))
Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(tc:GetOriginalCode(),3))
end
ce:Reset()
end
de:Reset()
eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
for _,te in pairs(eset) do
local te2=te:Clone()
te2:SetDescription(te:GetDescription()-16)
Duel.RegisterEffect(te2,tp)
local ce=te:GetLabelObject()
if ce and aux.GetValueType(ce)=="Effect" then
local tc=ce:GetHandler()
local ce2=ce:Clone()
ce2:SetDescription(ce:GetDescription()-16)
tc:RegisterEffect(ce2,true)
te2:SetLabelObject(ce2)
ce:Reset()
end
te:Reset()
end
end
local ce=nil
eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
if c:GetFlagEffect(11451962)>0 or (c:IsFaceup() and c:IsLocation(LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED) and not e:IsHasType(EFFECT_TYPE_ACTIVATE)) then
ce=c:RegisterFlagEffect(11451961,RESET_EVENT+RESET_TODECK+RESET_TOHAND+RESET_TURN_SET+RESET_OVERLAY,EFFECT_FLAG_CLIENT_HINT,1,eid,aux.Stringid(11451961+#eset,1))
end
local de=Effect.CreateEffect(c)
de:SetDescription(aux.Stringid(11451961+#eset,8))
de:SetLabel(eid)
de:SetType(EFFECT_TYPE_FIELD)
de:SetCode(EFFECT_FLAG_EFFECT+11451961)
de:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
de:SetTargetRange(1,0)
Duel.RegisterEffect(de,tp)
if ce and aux.GetValueType(ce)=="Effect" then de:SetLabelObject(ce) end
end
function cm.actarget2(e,te,tp)
local tc=te:GetHandler()
e:SetLabelObject(te)
return te:IsHasType(EFFECT_TYPE_ACTIVATE) and not cm[e][te]
end
function cm.costop2(e,tp,eg,ep,ev,re,r,rp)
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
local res=false
for _,te in pairs(eset) do
if te:GetLabel()==e:GetLabel() then res=true break end
end
if not res then e:Reset() return false end
local c=e:GetHandler()
local te=e:GetLabelObject()
cm[e][te]=true
local tg=te:GetTarget() or aux.TRUE
local tg2=function(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return tg(e,tp,eg,ep,ev,re,r,rp,0,1) end
if chk==0 then return tg(e,tp,eg,ep,ev,re,r,rp,0) end
e:SetTarget(tg)
tg(e,tp,eg,ep,ev,re,r,rp,1)
for i=1,1+#{Duel.IsPlayerAffectedByEffect(0,11451973)} do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_COUNTER)
local g=Duel.SelectMatchingCard(tp,Card.IsCanAddCounter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil,0x1972,1)
if #g>0 then
local prop1,prop2=e:GetProperty()
te:SetProperty(prop1|EFFECT_FLAG_IGNORE_IMMUNE,prop2)
g:GetFirst():AddCounter(0x1972,1)
te:SetProperty(prop1,prop2)
end
end
end
te:SetTarget(tg2)
end
function cm.recon(e,tp,eg,ep,ev,re,r,rp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function cm.reop(e,tp,eg,ep,ev,re,r,rp)
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
local res=false
for _,te in pairs(eset) do
if te:GetLabel()==e:GetLabel() then res=true break end
end
if not res then e:Reset() return end
for i=1,1+#{Duel.IsPlayerAffectedByEffect(0,11451973)} do
Duel.Hint(HINT_SELECTMSG,rp,HINTMSG_COUNTER)
local g=Duel.SelectMatchingCard(rp,Card.IsCanAddCounter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil,0x1972,1)
if #g>0 then
g:GetFirst():AddCounter(0x1972,1)
end
end
end
function cm.efilter(e,re)
return e:GetHandlerPlayer()~=re:GetOwnerPlayer()
end
function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return true end
if c:IsLocation(LOCATION_GRAVE) then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,0,0) end
end
function cm.drop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SSet(tp,c)>0 then
local ct=Duel.GetCounter(tp,1,1,0x1972)
if ct>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rg=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_GRAVE,ct//2,ct//2,nil)
if #rg>0 then
Duel.HintSelection(rg)
Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)
end
end
end
end
\ No newline at end of file
--秘计螺旋 混沌
local cm,m=GetID()
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(cm.tg)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
end
function cm.filter(c,code)
return (not code or c:GetOriginalCode()==code) and c:IsSetCard(0x836) and not (c:IsFaceup() and c:IsOnField()) and c:CheckActivateEffect(false,false,false)~=nil
end
function cm.fselect(g)
for code=11451961,11451964 do
if not g:IsExists(cm.filter,1,nil,code) then return false end
end
return Duel.GetLocationCount(g:GetFirst():GetControler(),LOCATION_SZONE)>0 or not g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK)
end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=0
if e:IsHasType(EFFECT_TYPE_ACTIVATE) and not e:GetHandler():IsLocation(LOCATION_SZONE) then ft=1 end
local c=e:GetHandler()
if chk==0 then
local all=true
for code=11451961,11451964 do
if not Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_ONFIELD+LOCATION_DECK,0,1,nil,code) then return false end
if not Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_ONFIELD,0,1,nil,code) then all=false end
end
return Duel.GetLocationCount(tp,LOCATION_SZONE)>ft or all
end
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_ONFIELD+LOCATION_DECK,0,nil,code)
if not g:CheckSubGroup(cm.fselect,4,4) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sg=g:SelectSubGroup(tp,cm.fselect,false,4,4)
if #sg==4 then
local ct=sg:FilterCount(Card.IsOnField,nil)+1
for i=1,math.min(ct,4) do
if i>1 then Duel.BreakEffect() end
local tg=sg
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then tg=sg:Filter(Card.IsOnField,nil) end
if #tg<=0 then break end
local tc=tg:RandomSelect(tp,1):GetFirst()
if not tc:IsOnField() then
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
else
Duel.ChangePosition(tc,POS_FACEUP)
end
--Duel.Hint(HINT_CARD,0,tc:GetOriginalCode())
local te,ceg,cep,cev,cre,cr,crp=tc:CheckActivateEffect(false,false,true)
te:UseCountLimit(tp,1,true)
local cost=te:GetCost()
local target=te:GetTarget()
local operation=te:GetOperation()
e:SetCategory(te:GetCategory())
e:SetProperty(te:GetProperty())
Duel.ClearTargetCard()
if not tc:IsType(TYPE_EQUIP) then tc:CancelToGrave(false) end
tc:CreateEffectRelation(te)
if cost then cost(te,tp,ceg,cep,cev,cre,cr,crp,1) end
if target then target(te,tp,ceg,cep,cev,cre,cr,crp,1) end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g then
for fc in aux.Next(g) do
fc:CreateEffectRelation(te)
end
end
if operation then operation(te,tp,ceg,cep,cev,cre,cr,crp) end
tc:ReleaseEffectRelation(te)
if g then
for fc in aux.Next(g) do
fc:ReleaseEffectRelation(te)
end
end
sg:RemoveCard(tc)
end
end
end
\ No newline at end of file
--秘计螺旋 电动
local cm,m=GetID()
function cm.initial_effect(c)
aux.AddCodeList(c,m-5)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(cm.tg)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
--change effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(cm.chcon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(cm.chtg)
e2:SetOperation(cm.chop)
c:RegisterEffect(e2)
end
function cm.filter(c)
return c:IsCode(m-5) and c:CheckActivateEffect(false,false,false)~=nil
end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=0
if e:IsHasType(EFFECT_TYPE_ACTIVATE) and not e:GetHandler():IsLocation(LOCATION_SZONE) then ft=1 end
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_GRAVE+LOCATION_DECK,0,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>ft end
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.filter),tp,LOCATION_GRAVE+LOCATION_DECK,0,nil,code)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local sg=g:Select(tp,1,1,nil)
if #sg>0 then
local tc=sg:GetFirst()
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
--Duel.Hint(HINT_CARD,0,tc:GetOriginalCode())
local te,ceg,cep,cev,cre,cr,crp=tc:CheckActivateEffect(false,false,true)
te:UseCountLimit(tp,1,true)
local cost=te:GetCost()
local target=te:GetTarget()
local operation=te:GetOperation()
e:SetCategory(te:GetCategory())
e:SetProperty(te:GetProperty())
Duel.ClearTargetCard()
if not tc:IsType(TYPE_EQUIP) then tc:CancelToGrave(false) end
tc:CreateEffectRelation(te)
if cost then cost(te,tp,ceg,cep,cev,cre,cr,crp,1) end
if target then target(te,tp,ceg,cep,cev,cre,cr,crp,1) end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g then
for fc in aux.Next(g) do
fc:CreateEffectRelation(te)
end
end
if operation then
operation(te,tp,ceg,cep,cev,cre,cr,crp)
Duel.BreakEffect()
operation(te,tp,ceg,cep,cev,cre,cr,crp)
end
tc:ReleaseEffectRelation(te)
if g then
for fc in aux.Next(g) do
fc:ReleaseEffectRelation(te)
end
end
end
end
function cm.chcon(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
return rc:IsSetCard(0x836)
end
function cm.thfilter(c)
return c:IsSetCard(0x836) and c:IsType(TYPE_SPELL) and c:IsSSetable()
end
function cm.chtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if rp==tp then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil)
else return Duel.IsExistingMatchingCard(nil,tp,0,LOCATION_DECK,1,nil) and Duel.IsPlayerCanSSet(1-tp) end
end
end
function cm.chop(e,tp,eg,ep,ev,re,r,rp)
local g=Group.CreateGroup()
Duel.ChangeTargetCard(ev,g)
Duel.ChangeChainOperation(ev,cm.repop)
end
function cm.repop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SSet(tp,g,tp,true)
--Duel.ConfirmCards(1-tp,g)
end
end
\ No newline at end of file
--秘计螺旋 冰川
local cm,m=GetID()
function cm.initial_effect(c)
aux.AddCodeList(c,m-5)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(cm.tg)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
--change effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(cm.chcon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(cm.chtg)
e2:SetOperation(cm.chop)
c:RegisterEffect(e2)
end
function cm.filter(c)
return c:IsCode(m-5) and c:CheckActivateEffect(false,false,false)~=nil
end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=0
if e:IsHasType(EFFECT_TYPE_ACTIVATE) and not e:GetHandler():IsLocation(LOCATION_SZONE) then ft=1 end
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_GRAVE+LOCATION_DECK,0,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>ft end
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.filter),tp,LOCATION_GRAVE+LOCATION_DECK,0,nil,code)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local sg=g:Select(tp,1,1,nil)
if #sg>0 then
local tc=sg:GetFirst()
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
--Duel.Hint(HINT_CARD,0,tc:GetOriginalCode())
local te,ceg,cep,cev,cre,cr,crp=tc:CheckActivateEffect(false,false,true)
te:UseCountLimit(tp,1,true)
local cost=te:GetCost()
local target=te:GetTarget()
local operation=te:GetOperation()
e:SetCategory(te:GetCategory())
e:SetProperty(te:GetProperty())
Duel.ClearTargetCard()
if not tc:IsType(TYPE_EQUIP) then tc:CancelToGrave(false) end
tc:CreateEffectRelation(te)
if cost then cost(te,tp,ceg,cep,cev,cre,cr,crp,1) end
if target then target(te,tp,ceg,cep,cev,cre,cr,crp,1) end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g then
for fc in aux.Next(g) do
fc:CreateEffectRelation(te)
end
end
if operation then
operation(te,tp,ceg,cep,cev,cre,cr,crp)
Duel.BreakEffect()
operation(te,tp,ceg,cep,cev,cre,cr,crp)
end
tc:ReleaseEffectRelation(te)
if g then
for fc in aux.Next(g) do
fc:ReleaseEffectRelation(te)
end
end
end
end
function cm.chcon(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
return rc:IsSetCard(0x836)
end
function cm.thfilter(c)
return c:IsSetCard(0x836) and c:IsAbleToHand() and c:IsFaceupEx()
end
function cm.chtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if rp==tp then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil)
else return Duel.IsExistingMatchingCard(cm.thfilter,tp,0,LOCATION_GRAVE+LOCATION_REMOVED,1,nil) end
end
end
function cm.chop(e,tp,eg,ep,ev,re,r,rp)
local g=Group.CreateGroup()
Duel.ChangeTargetCard(ev,g)
Duel.ChangeChainOperation(ev,cm.repop)
end
function cm.repop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.thfilter),tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
\ No newline at end of file
--秘计螺旋 陨击
local cm,m=GetID()
function cm.initial_effect(c)
aux.AddCodeList(c,m-5)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_RELEASE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(cm.cost)
e1:SetTarget(cm.tg)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_ACTIVATE_COST)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetLabelObject(e1)
e3:SetTargetRange(1,1)
e3:SetTarget(cm.actarget)
e3:SetOperation(cm.costop)
Duel.RegisterEffect(e3,0)
--change effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(cm.chcon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(cm.chtg)
e2:SetOperation(cm.chop)
c:RegisterEffect(e2)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
local ct=Duel.GetTurnCount()-c:GetTurnID()
if not (c:IsLocation(LOCATION_SZONE) and c:IsFacedown()) then ct=1 end
local eset={c:IsHasEffect(EFFECT_TRAP_ACT_IN_SET_TURN)}
return ct+#eset>1
end
end
function cm.actarget(e,te,tp)
return te:GetHandler()==e:GetHandler() and te==e:GetLabelObject()
end
function cm.costop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=Duel.GetTurnCount()-c:GetTurnID()
if not (c:IsLocation(LOCATION_SZONE) and c:IsFacedown()) then ct=1 end
local eset={c:IsHasEffect(EFFECT_TRAP_ACT_IN_SET_TURN)}
if ct==1 then
local tab=cm[flag]
local options={}
for _,te in ipairs(eset) do
table.insert(options,te:GetDescription())
end
local op=Duel.SelectOption(tp,table.unpack(options))
eset[op+1]:UseCountLimit(tp,1)
local cost=eset[op+1]:GetCost()
if cost then cost(eset[op+1],tp,eg,ep,ev,re,r,rp,1) end
end
if ct==0 then
Debug.Message("请依次选择两个「在盖放的回合发动」效果。")
local tab=cm[flag]
local options={}
for _,te in ipairs(eset) do
table.insert(options,te:GetDescription())
end
local op=Duel.SelectOption(tp,table.unpack(options))
eset[op+1]:UseCountLimit(tp,1)
local cost=eset[op+1]:GetCost()
if cost then cost(eset[op+1],tp,eg,ep,ev,re,r,rp,1) end
table.remove(eset,op+1)
options={}
for _,te in ipairs(eset) do
table.insert(options,te:GetDescription())
end
op=Duel.SelectOption(tp,table.unpack(options))
eset[op+1]:UseCountLimit(tp,1)
local cost=eset[op+1]:GetCost()
if cost then cost(eset[op+1],tp,eg,ep,ev,re,r,rp,1) end
Debug.Message("选择完毕。")
end
end
function cm.filter(c)
return c:IsCode(m-5) and c:CheckActivateEffect(false,false,false)~=nil
end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=0
if e:IsHasType(EFFECT_TYPE_ACTIVATE) and not e:GetHandler():IsLocation(LOCATION_SZONE) then ft=1 end
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(Card.IsReleasableByEffect,tp,0,LOCATION_ONFIELD,nil)
if chk==0 then return #g>0 and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_GRAVE+LOCATION_DECK,0,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>ft end
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local sg=Duel.GetMatchingGroup(Card.IsReleasableByEffect,tp,0,LOCATION_ONFIELD,nil)
if sg:GetCount()>0 then
Duel.Release(sg,REASON_EFFECT)
end
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.filter),tp,LOCATION_GRAVE+LOCATION_DECK,0,nil,code)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local sg=g:Select(tp,1,1,nil)
if #sg>0 then
local tc=sg:GetFirst()
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
--Duel.Hint(HINT_CARD,0,tc:GetOriginalCode())
local te,ceg,cep,cev,cre,cr,crp=tc:CheckActivateEffect(false,false,true)
te:UseCountLimit(tp,1,true)
local cost=te:GetCost()
local target=te:GetTarget()
local operation=te:GetOperation()
e:SetCategory(te:GetCategory())
e:SetProperty(te:GetProperty())
Duel.ClearTargetCard()
if not tc:IsType(TYPE_EQUIP) then tc:CancelToGrave(false) end
tc:CreateEffectRelation(te)
if cost then cost(te,tp,ceg,cep,cev,cre,cr,crp,1) end
if target then target(te,tp,ceg,cep,cev,cre,cr,crp,1) end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g then
for fc in aux.Next(g) do
fc:CreateEffectRelation(te)
end
end
if operation then
operation(te,tp,ceg,cep,cev,cre,cr,crp)
Duel.BreakEffect()
operation(te,tp,ceg,cep,cev,cre,cr,crp)
Duel.BreakEffect()
operation(te,tp,ceg,cep,cev,cre,cr,crp)
end
tc:ReleaseEffectRelation(te)
if g then
for fc in aux.Next(g) do
fc:ReleaseEffectRelation(te)
end
end
end
end
function cm.chcon(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
return rc:IsSetCard(0x836)
end
function cm.filter0(c)
return c:IsCanBeFusionMaterial()
end
function cm.filter1(c,e)
return c:IsCanBeFusionMaterial() and not c:IsImmuneToEffect(e)
end
function cm.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function cm.chtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if rp==tp then
local chkf=tp
local mg1=Duel.GetMatchingGroup(cm.filter0,tp,LOCATION_ONFIELD,0,nil)
local res=Duel.IsExistingMatchingCard(cm.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 mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(cm.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf)
end
end
return res
else return Duel.IsExistingMatchingCard(nil,tp,0,LOCATION_EXTRA,1,nil) end
end
end
function cm.chop(e,tp,eg,ep,ev,re,r,rp)
local g=Group.CreateGroup()
Duel.ChangeTargetCard(ev,g)
Duel.ChangeChainOperation(ev,cm.repop)
end
function cm.repop(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg1=Duel.GetMatchingGroup(cm.filter1,tp,LOCATION_ONFIELD,0,nil,e)
local sg1=Duel.GetMatchingGroup(cm.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg2=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(cm.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,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)
Duel.SendtoGrave(mat1,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,mg2,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
\ No newline at end of file
--秘计螺旋 愁云
local cm,m=GetID()
function cm.initial_effect(c)
aux.AddCodeList(c,m-5)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_COUNTER)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(cm.tg)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
--change effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(cm.chcon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(cm.chtg)
e2:SetOperation(cm.chop)
c:RegisterEffect(e2)
end
function cm.filter(c)
return c:IsCode(m-5) and c:CheckActivateEffect(false,false,false)~=nil
end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=0
if e:IsHasType(EFFECT_TYPE_ACTIVATE) and not e:GetHandler():IsLocation(LOCATION_SZONE) then ft=1 end
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsCanAddCounter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,0x1972,1) and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_GRAVE+LOCATION_DECK,0,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>ft end
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsCanAddCounter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,0x1972,1)
local tc=g:GetFirst()
while tc do
tc:AddCounter(0x1972,1)
tc=g:GetNext()
end
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.filter),tp,LOCATION_GRAVE+LOCATION_DECK,0,nil,code)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local sg=g:Select(tp,1,1,nil)
if #sg>0 then
local tc=sg:GetFirst()
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
--Duel.Hint(HINT_CARD,0,tc:GetOriginalCode())
local te,ceg,cep,cev,cre,cr,crp=tc:CheckActivateEffect(false,false,true)
te:UseCountLimit(tp,1,true)
local cost=te:GetCost()
local target=te:GetTarget()
local operation=te:GetOperation()
e:SetCategory(te:GetCategory())
e:SetProperty(te:GetProperty())
Duel.ClearTargetCard()
if not tc:IsType(TYPE_EQUIP) then tc:CancelToGrave(false) end
tc:CreateEffectRelation(te)
if cost then cost(te,tp,ceg,cep,cev,cre,cr,crp,1) end
if target then target(te,tp,ceg,cep,cev,cre,cr,crp,1) end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g then
for fc in aux.Next(g) do
fc:CreateEffectRelation(te)
end
end
if operation then
operation(te,tp,ceg,cep,cev,cre,cr,crp)
end
tc:ReleaseEffectRelation(te)
if g then
for fc in aux.Next(g) do
fc:ReleaseEffectRelation(te)
end
end
end
end
function cm.chcon(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
return rc:IsSetCard(0x836)
end
function cm.chtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if rp==tp then return Duel.IsExistingMatchingCard(cm.disfilter,tp,0,LOCATION_ONFIELD,1,nil)
else return Duel.IsExistingMatchingCard(cm.disfilter,tp,LOCATION_ONFIELD,0,1,nil) end
--if rp==tp then return Duel.IsExistingMatchingCard(Card.IsSSetable,tp,LOCATION_HAND,0,1,nil) and Duel.IsPlayerCanDraw(tp,2) and Duel.GetLocationCount(tp,LOCATION_SZONE)>1
--else return Duel.IsExistingMatchingCard(nil,tp,0,LOCATION_HAND,2,nil) and Duel.IsPlayerCanDraw(1-tp,2) and Duel.GetLocationCount(1-tp,LOCATION_SZONE)>1 end
end
end
function cm.chop(e,tp,eg,ep,ev,re,r,rp)
local g=Group.CreateGroup()
Duel.ChangeTargetCard(ev,g)
Duel.ChangeChainOperation(ev,cm.repop)
end
function cm.repop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ng=Duel.GetMatchingGroup(cm.disfilter,tp,0,LOCATION_ONFIELD,nil)
for nc in aux.Next(ng) do
Duel.NegateRelatedChain(nc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
nc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
nc:RegisterEffect(e2)
if nc:IsType(TYPE_TRAPMONSTER) then
local e3=e1:Clone()
e3:SetCode(EFFECT_DISABLE_TRAPMONSTER)
nc:RegisterEffect(e3)
end
end
--[[local ph=Duel.GetCurrentPhase()
if ph>PHASE_MAIN1 and ph<PHASE_MAIN2 then ph=PHASE_BATTLE end
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_DISABLE)
e2:SetTargetRange(0,LOCATION_ONFIELD)
e2:SetTarget(cm.disable)
e2:SetReset(RESET_PHASE+ph)
Duel.RegisterEffect(e2,tp)--]]
end
function cm.disfilter(c)
return c:GetCounter(0x1972)>0 and aux.NegateAnyFilter(c) --(not c:IsType(TYPE_MONSTER) or (c:IsType(TYPE_EFFECT) or bit.band(c:GetOriginalType(),TYPE_EFFECT)==TYPE_EFFECT))
end
function cm.repop2(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsSSetable,tp,LOCATION_HAND,0,nil)
if #g<2 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=g:Select(tp,2,2,nil)
if Duel.SSet(tp,sg,tp,false)>0 then Duel.Draw(tp,2,REASON_EFFECT) end
end
\ No newline at end of file
--秘计螺旋 递归
local cm,m=GetID()
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(cm.tg)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
end
function cm.filter(c,code)
return (c:IsCode(code) or aux.IsCodeListed(c,code)) and c:IsSSetable()
end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=0
if e:IsHasType(EFFECT_TYPE_ACTIVATE) and not e:GetHandler():IsLocation(LOCATION_SZONE) then ft=1 end
local c=e:GetHandler()
if chk==0 then
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
if #eset==0 then return false end
for _,te in pairs(eset) do
local code=te:GetHandler():GetOriginalCode()
if Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_DECK,0,1,nil,code) then return Duel.GetLocationCount(tp,LOCATION_SZONE)>ft end
end
return false
end
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
if #eset==0 then return false end
local tab={}
for _,te in pairs(eset) do
tab[#tab+1]=te:GetDescription()
end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,1))
local op=1+Duel.SelectOption(tp,table.unpack(tab))
local de=eset[op]
local ce=de:GetLabelObject()
if ce and aux.GetValueType(ce)=="Effect" then
local tc=ce:GetHandler()
local eset2={tc:IsHasEffect(EFFECT_FLAG_EFFECT+11451961)}
local res=false
for _,te in pairs(eset2) do
if te:GetLabel()==de:GetLabel() then res=true break end
end
if res then
Duel.RaiseEvent(tc,EVENT_CUSTOM+11451961,e,0,0,0,0)
Duel.Hint(HINT_OPSELECTED,tp,aux.Stringid(tc:GetOriginalCode(),3))
Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(tc:GetOriginalCode(),3))
end
ce:Reset()
end
de:Reset()
eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
for i,te in pairs(eset) do
if i>=op then
local te2=te:Clone()
te2:SetDescription(te:GetDescription()-16)
Duel.RegisterEffect(te2,tp)
local ce=te:GetLabelObject()
if ce and aux.GetValueType(ce)=="Effect" then
local tc=ce:GetHandler()
local ce2=ce:Clone()
ce2:SetDescription(ce:GetDescription()-16)
tc:RegisterEffect(ce2,true)
te2:SetLabelObject(ce2)
ce:Reset()
end
te:Reset()
end
end
local code=de:GetHandler():GetOriginalCode()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil,code)
if #g>0 and Duel.SSet(tp,g)>0 then --and g:GetFirst():IsCode(code) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(m,2))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EFFECT_QP_ACT_IN_SET_TURN)
if g:GetFirst():IsType(TYPE_TRAP) then e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN) end
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
g:GetFirst():RegisterEffect(e1)
end
end
\ No newline at end of file
--秘计螺旋 耗尽
local cm,m=GetID()
function cm.initial_effect(c)
c:SetSPSummonOnce(11451971)
--spsummon condition
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e2)
--special summon
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_SPSUMMON_PROC)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetRange(LOCATION_EXTRA)
e3:SetCondition(cm.spcon)
e3:SetTarget(cm.sptg)
e3:SetOperation(cm.spop)
c:RegisterEffect(e3)
--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_MZONE)
e1:SetCountLimit(1)
e1:SetTarget(cm.destg)
e1:SetOperation(cm.desop)
c:RegisterEffect(e1)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetCode(m)
e4:SetRange(LOCATION_MZONE)
e4:SetTargetRange(1,1)
c:RegisterEffect(e4)
if not cm.global_check then
cm.global_check=true
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_ADJUST)
ge2:SetOperation(cm.adop)
Duel.RegisterEffect(ge2,0)
end
end
function cm.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)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
end
function cm.tgfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToGraveAsCost()
end
function cm.thfilter(c)
return c:IsFacedown() and c:IsAbleToHandAsCost()
end
function cm.fselect(g)
return g:GetFirst():GetType()&(TYPE_SPELL+TYPE_TRAP)~=g:GetNext():GetType()&(TYPE_SPELL+TYPE_TRAP)
end
function cm.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(cm.tgfilter,tp,LOCATION_HAND,0,nil)
local hg=Duel.GetMatchingGroup(cm.thfilter,tp,LOCATION_ONFIELD,0,nil)
return #hg>0 and g:CheckSubGroup(cm.fselect,2,2)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c)
local g=Duel.GetMatchingGroup(cm.tgfilter,tp,LOCATION_HAND,0,nil)
local hg=Duel.GetMatchingGroup(cm.thfilter,tp,LOCATION_ONFIELD,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=g:SelectSubGroup(tp,cm.fselect,true,2,2)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local sg2=hg:Select(tp,1,1,nil)
if #sg>0 and #sg2>0 then
sg:Merge(sg2)
sg:KeepAlive()
e:SetLabelObject(sg)
return true
else return false end
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=e:GetLabelObject()
local sg=g:Filter(Card.IsOnField,nil)
Duel.SendtoGrave(g-sg,REASON_SPSUMMON+REASON_COST)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
g:DeleteGroup()
end
function cm.adop(e,tp,eg,ep,ev,re,r,rp)
DEFECT_ORAL_COUNT=DEFECT_ORAL_COUNT or 3
local ct=3+2*#{Duel.IsPlayerAffectedByEffect(0,11451971)}-#{Duel.IsPlayerAffectedByEffect(0,11451973)}
if DEFECT_ORAL_COUNT<ct then
DEFECT_ORAL_COUNT=ct
elseif DEFECT_ORAL_COUNT>ct then
DEFECT_ORAL_COUNT=ct
for tp=0,1 do
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
while #eset>DEFECT_ORAL_COUNT do
local de=eset[#eset]
local ce=de:GetLabelObject()
if ce and aux.GetValueType(ce)=="Effect" then
local tc=ce:GetHandler()
local eset2={tc:IsHasEffect(EFFECT_FLAG_EFFECT+11451961)}
local res=false
for _,te in pairs(eset2) do
if te:GetLabel()==de:GetLabel() then res=true break end
end
if res then
Duel.RaiseEvent(tc,EVENT_CUSTOM+11451961,e,0,0,0,0)
Duel.Hint(HINT_OPSELECTED,tp,aux.Stringid(tc:GetOriginalCode(),3))
Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(tc:GetOriginalCode(),3))
end
ce:Reset()
end
de:Reset()
eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_FLAG_EFFECT+11451961)}
end
end
end
end
\ No newline at end of file
......@@ -112,7 +112,7 @@ function cm.thcon(e)
local tp=e:GetHandlerPlayer()
return not Duel.IsExistingMatchingCard(cm.setfilter,tp,LOCATION_SZONE,0,1,nil)
end
function cm.thfilter(c,e,tp)
function cm.thfilter(c)
return c:IsCode(14000099) and c:IsAbleToHand()
end
function cm.tdfilter(c)
......@@ -125,9 +125,10 @@ function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.tdfilter,tp,LOCATION_GRAVE,0,nil)
if Duel.SendtoDeck(g,nil,2,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil,tp) and Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
if Duel.SendtoDeck(g,nil,2,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
Duel.BreakEffect()
local g=Duel.GetFirstMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
......
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