Commit 05768e53 authored by 花桃白音's avatar 花桃白音

fix tgkwc fear add costself

parent bab0ffee
Pipeline #30905 passed with stages
in 30 minutes and 56 seconds
--炼金工作室-测试卡
--手冲魔女-菲雅
local m=4212320
local cm=_G["c"..m]
--増援
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
......@@ -9,12 +8,24 @@ function cm.initial_effect(c)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetRange(LOCATION_HAND)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,cm)
e1:SetCountLimit(1,m)
e1:SetCost(cm.discost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp,eg,ep,ev,re,r,rp) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,eg,ep,ev,re,r,rp)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
cm.cache={}
function cm.filter(c,e,tp,eg,ep,ev,re,r,rp)
return c:IsAbleToHand() and cm.CheckDiscard(c,e,tp,eg,ep,ev,re,r,rp)and not (c:IsCode(e:GetHandler():GetCode()))
......@@ -30,7 +41,12 @@ function cm.CheckDiscard(c,e,tp,eg,ep,ev,re,r,rp)
end
return temp(tc,te,f)
end
local tempc=cm.IgnoreActionCheck(Duel.CreateToken,c:GetControler(),code)
local tempc=(function(tp,code)
Duel.DisableActionCheck(true)
local sret = Duel.CreateToken(tp,code)
Duel.DisableActionCheck(false)
return sret
end)(c:GetControler(),code)
Card.RegisterEffect=temp
local found=false
for _,te in ipairs(eset) do
......@@ -42,22 +58,29 @@ function cm.CheckDiscard(c,e,tp,eg,ep,ev,re,r,rp)
if e==te then return tempc end
return temp_(e)
end
mt.IsDiscardable=function(tc,...)
if mt then
mt.IsDiscardable=function(tc,...)
if tempc==tc then found=true end
return Card.IsDiscardable(tc,...)
end
pcall(function()
cost(te,tp,eg,ep,ev,re,r,rp,0)
end)
mt.IsDiscardable=nil
return Card.IsDiscardable(tc,...)
end
pcall(function()
cost(te,tp,eg,ep,ev,re,r,rp,0)
end)
mt.IsDiscardable=nil
end
Effect.GetHandler=temp_
end
end
cm.cache[code]=(found and 1 or 0)
return found
end
function cm.IgnoreActionCheck(f,...)
Duel.DisableActionCheck(true)
function cm.discost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
end
--[[
local cr=coroutine.create(f)
local ret={}
while coroutine.status(cr)~="dead" do
......@@ -65,24 +88,4 @@ function cm.IgnoreActionCheck(f,...)
for i=2,#sret do
table.insert(ret,sret[i])
end
end
Duel.DisableActionCheck(false)
return table.unpack(ret)
end
function cm.discost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp,eg,ep,ev,re,r,rp) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,eg,ep,ev,re,r,rp)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
\ No newline at end of file
end]]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment