Commit 09ea2177 authored by wyykak's avatar wyykak

fix c61122.lua

parent 47f5739b
--傲霜的透伞-小雪 --傲霜的透伞-小雪
function c61122.initial_effect(c) function c61122.initial_effect(c)
--umb --umb
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(61122,0)) e1:SetDescription(aux.Stringid(61122,0))
e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_DESTROY) e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION) e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND) e1:SetRange(LOCATION_HAND)
e1:SetCost(c61122.cost) e1:SetCost(c61122.cost)
e1:SetTarget(c61122.target) e1:SetTarget(c61122.target)
e1:SetOperation(c61122.operation) e1:SetOperation(c61122.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--to grave --to grave
local e2 = Effect.CreateEffect(c) local e2 = Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DISABLE) e2:SetCategory(CATEGORY_DISABLE)
e2:SetType(EFFECT_TYPE_IGNITION) e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetDescription(aux.Stringid(61122,1)) e2:SetDescription(aux.Stringid(61122,1))
e2:SetRange(LOCATION_GRAVE) e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,61122) e2:SetCountLimit(1,61122)
e2:SetCost(c61122.drcost) e2:SetCost(c61122.drcost)
e2:SetTarget(c61122.drtg) e2:SetTarget(c61122.drtg)
e2:SetOperation(c61122.drop) e2:SetOperation(c61122.drop)
e2:SetCountLimit(1) c:RegisterEffect(e2)
c:RegisterEffect(e2) end
end c61122.DescSetName = 0x229
c61122.DescSetName = 0x229 function c61122.umbfilter(c)
function c61122.umbfilter(c) local code=c:GetOriginalCode()
local code=c:GetOriginalCode() local mt=_G["c" .. code]
local mt=_G["c" .. code] return mt and mt.DescSetName == 0x229 and c:IsDiscardable()
return mt and mt.DescSetName == 0x229 and c:IsDiscardable() end
end function c61122.cost(e,tp,eg,ep,ev,re,r,rp,chk)
function c61122.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsDiscardable()
if chk==0 then return e:GetHandler():IsDiscardable() and Duel.IsExistingMatchingCard(c61122.umbfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end
and Duel.IsExistingMatchingCard(c61122.umbfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end local g=Duel.SelectMatchingCard(tp,c61122.umbfilter,tp,LOCATION_HAND,0,1,1,e:GetHandler())
local g=Duel.SelectMatchingCard(tp,c61122.umbfilter,tp,LOCATION_HAND,0,1,1,e:GetHandler()) g:AddCard(e:GetHandler())
g:AddCard(e:GetHandler()) Duel.SendtoGrave(g,REASON_COST+REASON_DISCARD)
Duel.SendtoGrave(g,REASON_COST+REASON_DISCARD) end
end function c61122.filter(c)
function c61122.filter(c) return aux.TRUE
return aux.TRUE end
end function c61122.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
function c61122.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and c:IsControler(1-tp) and c61122.filter(chkc) end
if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and c:IsControler(1-tp) and c61122.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c61122.filter,tp,0,LOCATION_ONFIELD,1,nil) end
if chk==0 then return Duel.IsExistingTarget(c61122.filter,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c61122.filter,tp,0,LOCATION_ONFIELD,1,2,nil)
local g=Duel.SelectTarget(tp,c61122.filter,tp,0,LOCATION_ONFIELD,1,2,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) end
end function c61122.operation(e,tp,eg,ep,ev,re,r,rp)
function c61122.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local tg=g:Filter(Card.IsRelateToEffect,nil,e)
local tg=g:Filter(Card.IsRelateToEffect,nil,e) if tg:GetCount()>0 then
if tg:GetCount()>0 then Duel.Destroy(tg,REASON_EFFECT)
Duel.Destroy(tg,REASON_EFFECT) end
end end
end function c61122.exfilter(c)
function c61122.exfilter(c) return c:IsFaceup() and not c:IsDisabled() and c:IsType(TYPE_SPELL+TYPE_TRAP)
return c:IsFaceup() and not c:IsDisabled() and c:IsType(TYPE_SPELL+TYPE_TRAP) end
end function c61122.drcost(e,tp,eg,ep,ev,re,r,rp,chk)
function c61122.drcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler()
local c=e:GetHandler() if chk==0 then return c:IsAbleToDeckAsCost() end
if chk==0 then return c:IsAbleToDeckAsCost() end Duel.SendtoDeck(c,nil,2,REASON_COST)
Duel.SendtoDeck(c,nil,2,REASON_COST) end
end function c61122.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
function c61122.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c61122.exfilter,tp,0,LOCATION_ONFIELD,1,nil) end
if chk==0 then return Duel.IsExistingMatchingCard(c61122.exfilter,tp,0,LOCATION_ONFIELD,1,nil) end local g=Duel.GetMatchingGroup(c61122.exfilter,tp,0,LOCATION_ONFIELD,nil)
local g=Duel.GetMatchingGroup(c61122.exfilter,tp,0,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,g:GetCount(),0,0) end
end function c61122.drop(e,tp,eg,ep,ev,re,r,rp)
function c61122.drop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c61122.exfilter,tp,0,LOCATION_ONFIELD,nil)
local g=Duel.GetMatchingGroup(c61122.exfilter,tp,0,LOCATION_ONFIELD,nil) local tc=g:GetFirst()
local tc=g:GetFirst() local c=e:GetHandler()
local c=e:GetHandler() while tc do
while tc do local e1=Effect.CreateEffect(c)
local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE)
e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1)
tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c)
local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e2)
tc:RegisterEffect(e2) tc=g:GetNext()
tc=g:GetNext() end
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