Commit 68d5f313 authored by Tachibana's avatar Tachibana

得得得得得

parent 128fe6b2
Pipeline #12577 passed with stages
in 21 minutes and 21 seconds
No preview for this file type
......@@ -5,25 +5,35 @@ function cm.initial_effect(c)
c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,function(c)return c:GetOriginalType()&TYPE_TRAP~=0 and c:IsFusionType(TYPE_MONSTER)end,2,true)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,2))
e2:SetDescription(aux.Stringid(m,0))
e2:SetCategory(CATEGORY_HANDES+CATEGORY_TOGRAVE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(2,m)
e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)return eg:IsExists(Card.IsControler,1,nil,1-tp)end)
e2:SetTarget(cm.alctg)
e2:SetOperation(cm.alcop)
e2:SetTarget(cm.alctg1)
e2:SetOperation(cm.alcop1)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
e4:SetCondition(cm.con)
e4:SetOperation(cm.op)
local e4=e2:Clone()
e4:SetDescription(aux.Stringid(m,1))
e4:SetCategory(CATEGORY_TOEXTRA)
e4:SetTarget(cm.alctg2)
e4:SetOperation(cm.alcop2)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e5)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e6:SetCode(EVENT_SPSUMMON_SUCCESS)
e6:SetCondition(cm.con)
e6:SetOperation(cm.op)
c:RegisterEffect(e6)
end
function cm.filter(c,tp)
return aux.NegateMonsterFilter(c) and c:IsControler(1-tp) and Duel.IsExistingMatchingCard(cm.setfilter1,tp,LOCATION_ONFIELD,0,1,nil,c:GetCode())
......@@ -37,68 +47,62 @@ end
function cm.setfilter2(c)
return c:IsFaceup() and c:IsCanTurnSet() and c:GetType()&0x20004==0x20004
end
function cm.alctg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local b1=eg:IsExists(cm.filter,1,nil,tp) and Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)~=0
local b2=Duel.IsExistingMatchingCard(cm.tefilter,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(cm.setfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
if chk==0 then return b1 or b2 end
local op=0
if b1 and b2 then op=Duel.SelectOption(tp,aux.Stringid(m,0),aux.Stringid(m,1)) elseif b1 then op=Duel.SelectOption(tp,aux.Stringid(m,0)) else op=Duel.SelectOption(tp,aux.Stringid(m,1))+1 end
e:SetLabel(op)
if op==0 then
e:SetCategory(CATEGORY_HANDES+CATEGORY_TOGRAVE)
Duel.SetTargetCard(eg)
local g=eg:Filter(cm.filter,nil,tp)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_HAND)
else
e:SetCategory(CATEGORY_TOEXTRA)
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,nil,1,tp,LOCATION_ONFIELD)
end
function cm.alctg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return eg:IsExists(cm.filter,1,nil,tp) and Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)~=0 end
Duel.SetTargetCard(eg)
local g=eg:Filter(cm.filter,nil,tp)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_HAND)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function cm.alctg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(cm.tefilter,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(cm.setfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,nil,1,tp,LOCATION_ONFIELD)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function cm.alcop1(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(cm.filter,nil,tp):Filter(Card.IsRelateToEffect,nil,e)
local tc=g:GetFirst()
if not tc then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
if #g>1 then tc=g:Select(tp,1,1,nil):GetFirst() end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=Duel.SelectMatchingCard(tp,cm.setfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,tc:GetCode())
local sc=sg:GetFirst()
if not sc then return end
Duel.HintSelection(Group.FromCards(sc,tc))
sc:CancelToGrave()
local pos=Duel.ChangePosition(sc,POS_FACEDOWN)
if pos==0 then return end
if sc:IsType(TYPE_SPELL+TYPE_TRAP) then Duel.RaiseEvent(sc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0) end
if tc:IsDisabled() then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
Duel.AdjustInstantly()
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local hg=Duel.GetFieldGroup(1-tp,LOCATION_HAND,0)
if #hg==0 then return end
local gg=hg:RandomSelect(1-tp,1)
Duel.SendtoGrave(Group.__add(tc,gg),REASON_EFFECT)
end
function cm.alcop(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==0 then
local g=eg:Filter(cm.filter,nil,tp):Filter(Card.IsRelateToEffect,nil,e)
local tc=g:GetFirst()
if not tc then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
if #g>1 then tc=g:Select(tp,1,1,nil):GetFirst() end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=Duel.SelectMatchingCard(tp,cm.setfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,tc:GetCode())
local sc=sg:GetFirst()
if not sc then return end
Duel.HintSelection(Group.FromCards(sc,tc))
sc:CancelToGrave()
local pos=Duel.ChangePosition(sc,POS_FACEDOWN)
if pos==0 then return end
if sc:IsType(TYPE_SPELL+TYPE_TRAP) then Duel.RaiseEvent(sc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0) end
if tc:IsDisabled() then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
Duel.AdjustInstantly()
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local hg=Duel.GetFieldGroup(1-tp,LOCATION_HAND,0)
if #hg==0 then return end
local gg=hg:RandomSelect(1-tp,1)
Duel.SendtoGrave(Group.__add(tc,gg),REASON_EFFECT)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,cm.tefilter,tp,LOCATION_ONFIELD,0,1,1,nil)
if #g==0 then return end
if Duel.SendtoDeck(g,nil,2,REASON_EFFECT)==0 or not g:GetFirst():IsLocation(LOCATION_EXTRA) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=Duel.SelectMatchingCard(tp,cm.setfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,2,nil)
if #sg==0 then return end
Duel.HintSelection(sg)
local rg=Group.CreateGroup()
for tc in aux.Next(sg) do
tc:CancelToGrave()
if Duel.ChangePosition(tc,POS_FACEDOWN)~=0 and tc:IsFacedown() then rg:AddCard(tc) end
end
Duel.RaiseEvent(rg,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
function cm.alcop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,cm.tefilter,tp,LOCATION_ONFIELD,0,1,1,nil)
if #g==0 then return end
if Duel.SendtoDeck(g,nil,2,REASON_EFFECT)==0 or not g:GetFirst():IsLocation(LOCATION_EXTRA) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=Duel.SelectMatchingCard(tp,cm.setfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,2,nil)
if #sg==0 then return end
Duel.HintSelection(sg)
local rg=Group.CreateGroup()
for tc in aux.Next(sg) do
tc:CancelToGrave()
if Duel.ChangePosition(tc,POS_FACEDOWN)~=0 and tc:IsFacedown() then rg:AddCard(tc) end
end
Duel.RaiseEvent(rg,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
end
function cm.con(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
......
......@@ -4,25 +4,31 @@ cm.name="ALC之脑 TIS"
function cm.initial_effect(c)
aux.AddFusionProcFunRep(c,function(c)return c:GetOriginalType()&TYPE_TRAP~=0 and c:IsFusionType(TYPE_MONSTER)end,2,true)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,3))
e3:SetCategory(CATEGORY_DESTROY)
e3:SetDescription(aux.Stringid(m,0))
e3:SetCategory(CATEGORY_REMOVE)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(2,m)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e3:SetTarget(cm.alctg)
e3:SetOperation(cm.alcop)
e3:SetTarget(cm.alctg1)
e3:SetOperation(cm.alcop1)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,2))
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCondition(cm.con)
e4:SetTarget(cm.tg)
e4:SetOperation(cm.op)
local e4=e3:Clone()
e4:SetDescription(aux.Stringid(m,1))
e4:SetCategory(CATEGORY_TOEXTRA)
e4:SetTarget(cm.alctg2)
e4:SetOperation(cm.alcop2)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,2))
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_SPSUMMON_SUCCESS)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCondition(cm.con)
e5:SetTarget(cm.tg)
e5:SetOperation(cm.op)
c:RegisterEffect(e5)
end
function cm.setfilter1(c,tp)
return c:IsFaceup() and c:IsCanTurnSet() and Duel.IsExistingMatchingCard(function(c,code)return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsCode(code)end,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE,1,nil,c:GetCode())
......@@ -33,67 +39,61 @@ end
function cm.setfilter2(c)
return c:IsFaceup() and c:IsCanTurnSet() and c:GetType()&0x20004==0x20004
end
function cm.alctg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local b1=Duel.IsExistingMatchingCard(cm.setfilter1,tp,LOCATION_ONFIELD,0,1,nil,tp) and Duel.GetFieldGroupCount(1-tp,LOCATION_DECK,0)>4
local b2=Duel.IsExistingMatchingCard(cm.tefilter,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(cm.setfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
if chk==0 then return b1 or b2 end
local op=0
if b1 and b2 then op=Duel.SelectOption(tp,aux.Stringid(m,0),aux.Stringid(m,1)) elseif b1 then op=Duel.SelectOption(tp,aux.Stringid(m,0)) else op=Duel.SelectOption(tp,aux.Stringid(m,1))+1 end
e:SetLabel(op)
if op==0 then
e:SetCategory(CATEGORY_REMOVE)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,5,1-tp,LOCATION_DECK)
else
e:SetCategory(CATEGORY_TOEXTRA)
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,nil,1,tp,LOCATION_ONFIELD)
function cm.alctg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(cm.setfilter1,tp,LOCATION_ONFIELD,0,1,nil,tp) and Duel.GetFieldGroupCount(1-tp,LOCATION_DECK,0)>4 end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,5,1-tp,LOCATION_DECK)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function cm.alctg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(cm.tefilter,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(cm.setfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,nil,1,tp,LOCATION_ONFIELD)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function cm.alcop1(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=Duel.SelectMatchingCard(tp,cm.setfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,tp)
local sc=sg:GetFirst()
if not sc then return end
Duel.HintSelection(sg)
sc:CancelToGrave()
local pos=Duel.ChangePosition(sc,POS_FACEDOWN)
if pos==0 then return end
if sc:IsType(TYPE_SPELL+TYPE_TRAP) then Duel.RaiseEvent(sc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0) end
local g=Duel.GetDecktopGroup(1-tp,5)
if #g>0 then
Duel.BreakEffect()
Duel.DisableShuffleCheck()
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
end
function cm.alcop(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=Duel.SelectMatchingCard(tp,cm.setfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,tp)
local sc=sg:GetFirst()
if not sc then return end
Duel.HintSelection(sg)
sc:CancelToGrave()
local pos=Duel.ChangePosition(sc,POS_FACEDOWN)
if pos==0 then return end
if sc:IsType(TYPE_SPELL+TYPE_TRAP) then Duel.RaiseEvent(sc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0) end
local g=Duel.GetDecktopGroup(1-tp,5)
if #g>0 then
Duel.BreakEffect()
Duel.DisableShuffleCheck()
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,cm.tefilter,tp,LOCATION_ONFIELD,0,1,1,nil)
if #g==0 then return end
if Duel.SendtoDeck(g,nil,2,REASON_EFFECT)==0 or not g:GetFirst():IsLocation(LOCATION_EXTRA) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=Duel.SelectMatchingCard(tp,cm.setfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,99,nil)
if #sg==0 then return end
Duel.HintSelection(sg)
local rg=Group.CreateGroup()
for tc in aux.Next(sg) do
tc:CancelToGrave()
if Duel.ChangePosition(tc,POS_FACEDOWN)~=0 and tc:IsFacedown() then rg:AddCard(tc) end
end
Duel.RaiseEvent(rg,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
for rc in aux.Next(rg) do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_TRIGGER)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
rc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e2:SetCode(EVENT_CHAINING)
e2:SetOperation(cm.reset)
e2:SetLabelObject(e1)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
function cm.alcop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,cm.tefilter,tp,LOCATION_ONFIELD,0,1,1,nil)
if #g==0 then return end
if Duel.SendtoDeck(g,nil,2,REASON_EFFECT)==0 or not g:GetFirst():IsLocation(LOCATION_EXTRA) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=Duel.SelectMatchingCard(tp,cm.setfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,99,nil)
if #sg==0 then return end
Duel.HintSelection(sg)
local rg=Group.CreateGroup()
for tc in aux.Next(sg) do
tc:CancelToGrave()
if Duel.ChangePosition(tc,POS_FACEDOWN)~=0 and tc:IsFacedown() then rg:AddCard(tc) end
end
Duel.RaiseEvent(rg,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
for rc in aux.Next(rg) do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_TRIGGER)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
rc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e2:SetCode(EVENT_CHAINING)
e2:SetOperation(cm.reset)
e2:SetLabelObject(e1)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
end
function cm.reset(e,tp,eg,ep,ev,re,r,rp)
......@@ -109,6 +109,7 @@ function cm.setfilter3(c)
end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.setfilter3,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
......
......@@ -5,15 +5,23 @@ function cm.initial_effect(c)
c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,function(c)return c:GetOriginalType()&TYPE_TRAP~=0 and c:IsFusionType(TYPE_MONSTER)end,2,true)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,2))
e2:SetDescription(aux.Stringid(m,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCategory(CATEGORY_DESTROY+CATEGORY_REMOVE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)return eg:IsExists(Card.IsSummonLocation,1,nil,LOCATION_EXTRA)end)
e2:SetTarget(cm.alctg)
e2:SetOperation(cm.alcop)
e2:SetTarget(cm.alctg1)
e2:SetOperation(cm.alcop1)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_TOEXTRA)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetTarget(cm.alctg2)
e3:SetOperation(cm.alcop2)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
......@@ -24,57 +32,50 @@ end
function cm.setfilter(c)
return c:IsFaceup() and c:IsCanTurnSet() and c:GetType()&0x20004==0x20004
end
function cm.alctg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
function cm.alctg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c,g=e:GetHandler(),eg:Filter(Card.IsSummonLocation,nil,LOCATION_EXTRA)
if chkc then return chkc:IsOnField() and chkc~=e:GetHandler() and not g:IsContains(chkc) end
local b1=Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,g) and Duel.GetFlagEffect(tp,m)==0
local b2=c:IsAbleToExtra() and Duel.IsExistingMatchingCard(cm.setfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) and Duel.GetFlagEffect(tp,m+50)==0
if chk==0 then return b1 or b2 end
local op=0
if b1 and b2 then op=Duel.SelectOption(tp,aux.Stringid(m,0),aux.Stringid(m,1)) elseif b1 then op=Duel.SelectOption(tp,aux.Stringid(m,0)) else op=Duel.SelectOption(tp,aux.Stringid(m,1))+1 end
e:SetLabel(op)
if op==0 then
Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1)
e:SetCategory(CATEGORY_DESTROY+CATEGORY_REMOVE)
e:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,1,0,0)
else
Duel.RegisterFlagEffect(tp,m+50,RESET_PHASE+PHASE_END,0,1)
e:SetCategory(CATEGORY_TOEXTRA)
e:SetProperty(EFFECT_FLAG_DELAY)
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,c,1,0,0)
end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,g) and Duel.GetFlagEffect(tp,m)==0 end
Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,1,0,0)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function cm.alctg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c,g=e:GetHandler(),eg:Filter(Card.IsSummonLocation,nil,LOCATION_EXTRA)
if chk==0 then return c:IsAbleToExtra() and Duel.IsExistingMatchingCard(cm.setfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) and Duel.GetFlagEffect(tp,m+50)==0 end
Duel.RegisterFlagEffect(tp,m+50,RESET_PHASE+PHASE_END,0,1)
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,c,1,0,0)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function cm.alcop1(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) then return end
Duel.Destroy(tc,REASON_EFFECT)
local dc=Duel.GetOperatedGroup():GetFirst()
if not dc then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
if not Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_ONFIELD,0,1,nil,dc:GetCode()) then return end
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rg=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,3,nil)
if #rg>0 then Duel.Remove(rg,POS_FACEUP,REASON_EFFECT) end
end
function cm.alcop(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==0 then
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) then return end
Duel.Destroy(tc,REASON_EFFECT)
local dc=Duel.GetOperatedGroup():GetFirst()
if not dc then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
if not Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_ONFIELD,0,1,nil,dc:GetCode()) then return end
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rg=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,3,nil)
if #rg>0 then Duel.Remove(rg,POS_FACEUP,REASON_EFFECT) end
else
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
if Duel.SendtoDeck(c,nil,2,REASON_EFFECT)==0 or not c:IsLocation(LOCATION_EXTRA) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=Duel.SelectMatchingCard(tp,cm.setfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,2,nil)
if #sg==0 then return end
Duel.HintSelection(sg)
local rg=Group.CreateGroup()
for tc in aux.Next(sg) do
tc:CancelToGrave()
if Duel.ChangePosition(tc,POS_FACEDOWN)~=0 and tc:IsFacedown() then rg:AddCard(tc) end
end
Duel.RaiseEvent(rg,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
function cm.alcop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
if Duel.SendtoDeck(c,nil,2,REASON_EFFECT)==0 or not c:IsLocation(LOCATION_EXTRA) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=Duel.SelectMatchingCard(tp,cm.setfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,2,nil)
if #sg==0 then return end
Duel.HintSelection(sg)
local rg=Group.CreateGroup()
for tc in aux.Next(sg) do
tc:CancelToGrave()
if Duel.ChangePosition(tc,POS_FACEDOWN)~=0 and tc:IsFacedown() then rg:AddCard(tc) end
end
Duel.RaiseEvent(rg,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
end
function cm.con(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
......
......@@ -5,16 +5,23 @@ function cm.initial_effect(c)
c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,function(c)return c:GetOriginalType()&TYPE_TRAP~=0 and c:IsFusionType(TYPE_MONSTER)end,2,true)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,2))
e2:SetDescription(aux.Stringid(m,0))
e2:SetCategory(CATEGORY_NEGATE+CATEGORY_TOGRAVE)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(2,m)
e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)return rp~=tp and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev)end)
e2:SetTarget(cm.alctg)
e2:SetOperation(cm.alcop)
e2:SetTarget(cm.alctg1)
e2:SetOperation(cm.alcop1)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_TOEXTRA)
e3:SetTarget(cm.alctg2)
e3:SetOperation(cm.alcop2)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
......@@ -31,50 +38,44 @@ end
function cm.setfilter2(c)
return c:GetType()&0x20004==0x20004 and c:IsSSetable()
end
function cm.alctg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local b1=Duel.IsExistingMatchingCard(cm.setfilter1,tp,LOCATION_ONFIELD,0,1,nil,eg:GetFirst():GetCode()) and Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,0,LOCATION_ONFIELD,1,nil)
local b2=Duel.IsExistingMatchingCard(cm.tefilter,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(cm.setfilter2,tp,LOCATION_GRAVE,0,1,nil)
if chk==0 then return b1 or b2 end
local op=0
if b1 and b2 then op=Duel.SelectOption(tp,aux.Stringid(m,0),aux.Stringid(m,1)) elseif b1 then op=Duel.SelectOption(tp,aux.Stringid(m,0)) else op=Duel.SelectOption(tp,aux.Stringid(m,1))+1 end
e:SetLabel(op)
if op==0 then
e:SetCategory(CATEGORY_NEGATE+CATEGORY_TOGRAVE)
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_ONFIELD)
else
e:SetCategory(CATEGORY_TOEXTRA)
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,nil,1,tp,LOCATION_ONFIELD)
end
function cm.alctg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(cm.setfilter1,tp,LOCATION_ONFIELD,0,1,nil,eg:GetFirst():GetCode()) and Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_ONFIELD)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function cm.alctg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(cm.tefilter,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(cm.setfilter2,tp,LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,nil,1,tp,LOCATION_ONFIELD)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function cm.alcop(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sc=Duel.SelectMatchingCard(tp,cm.setfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,eg:GetFirst():GetCode()):GetFirst()
if not sc then return end
Duel.HintSelection(Group.FromCards(sc))
sc:CancelToGrave()
local pos=Duel.ChangePosition(sc,POS_FACEDOWN)
if pos==0 then return end
if sc:IsType(TYPE_SPELL+TYPE_TRAP) then Duel.RaiseEvent(sc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0) end
if not Duel.NegateActivation(ev) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 then
Duel.HintSelection(g)
Duel.SendtoGrave(g,REASON_EFFECT)
end
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,cm.tefilter,tp,LOCATION_ONFIELD,0,1,1,nil)
if #g==0 then return end
if Duel.SendtoDeck(g,nil,2,REASON_EFFECT)==0 or not g:GetFirst():IsLocation(LOCATION_EXTRA) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.setfilter2),tp,LOCATION_GRAVE,0,1,1,nil)
if #sg==0 then return end
Duel.SSet(tp,sg:GetFirst())
function cm.alcop1(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sc=Duel.SelectMatchingCard(tp,cm.setfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,eg:GetFirst():GetCode()):GetFirst()
if not sc then return end
Duel.HintSelection(Group.FromCards(sc))
sc:CancelToGrave()
local pos=Duel.ChangePosition(sc,POS_FACEDOWN)
if pos==0 then return end
if sc:IsType(TYPE_SPELL+TYPE_TRAP) then Duel.RaiseEvent(sc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0) end
if not Duel.NegateActivation(ev) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 then
Duel.HintSelection(g)
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
function cm.alcop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,cm.tefilter,tp,LOCATION_ONFIELD,0,1,1,nil)
if #g==0 then return end
if Duel.SendtoDeck(g,nil,2,REASON_EFFECT)==0 or not g:GetFirst():IsLocation(LOCATION_EXTRA) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.setfilter2),tp,LOCATION_GRAVE,0,1,1,nil)
if #sg==0 then return end
Duel.SSet(tp,sg:GetFirst())
end
function cm.con(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
end
......
......@@ -67,11 +67,9 @@ function cm.accost(e,tp,eg,ep,ev,re,r,rp,chk)
local sg=g:SelectSubGroup(tp,cm.fselect,false,1,math.min(2,dct),ft)
local ct=Duel.SendtoGrave(sg,REASON_COST)
e:SetLabel(ct)
Debug.Message(ct)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local ct=e:GetLabel()
Debug.Message(ct)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,ct,nil)
if g:GetCount()>0 then Duel.SSet(tp,g) 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