Commit c9ada5d7 authored by POLYMER's avatar POLYMER

fix

parent 66c61037
...@@ -11,8 +11,9 @@ function s.initial_effect(c) ...@@ -11,8 +11,9 @@ function s.initial_effect(c)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0)) e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_TOGRAVE+CATEGORY_REMOVE) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_TOGRAVE+CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_SZONE)
e1:SetCountLimit(1,id) e1:SetCountLimit(1,id)
e1:SetCost(s.descost) e1:SetCost(s.descost)
e1:SetTarget(s.destg) e1:SetTarget(s.destg)
...@@ -47,61 +48,22 @@ function s.initial_effect(c) ...@@ -47,61 +48,22 @@ function s.initial_effect(c)
end end
-- ①: Cost function -- ①: Cost function
function s.costfilter(c) function s.costfilter(c,types)
return (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and return (c:IsAbleToGraveAsCost() or c:IsAbleToRemoveAsCost()) and (c:GetType()&types)~=0
(c:IsAbleToGrave() or c:IsAbleToRemove())
end end
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
local types={} local types=0
for tc in aux.Next(g) do for tc in aux.Next(g) do
local ttype=tc:GetType()&(TYPE_MONSTER+TYPE_SPELL+TYPE_TRAP) types=types|(tc:GetType()&(TYPE_MONSTER+TYPE_SPELL+TYPE_TRAP))
if ttype>0 and not types[ttype] then
types[ttype]=true
end
end end
if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,e:GetHandler(),types) end
-- 2. 检测手卡/场上是否有可送去墓地/除外的同类型卡
if chk==0 then
for ttype,_ in pairs(types) do
local sg=Duel.GetMatchingGroup(s.costfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,e:GetHandler(),ttype)
if #sg>0 then return true end
end
return false
end
-- 选择操作
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELECT)
local types_list={}
for ttype,_ in pairs(types) do
table.insert(types_list,ttype)
end
table.sort(types_list)
-- 让玩家选择要处理的卡类型
local ttype=nil
if #types_list>1 then
local opts={}
for i,v in ipairs(types_list) do
if v&TYPE_MONSTER>0 then
table.insert(opts,aux.Stringid(id,5)) -- 怪兽
elseif v&TYPE_SPELL>0 then
table.insert(opts,aux.Stringid(id,6)) -- 魔法
elseif v&TYPE_TRAP>0 then
table.insert(opts,aux.Stringid(id,7)) -- 陷阱
end
end
local opt=Duel.SelectOption(tp,table.unpack(opts))
ttype=types_list[opt+1]
else
ttype=types_list[1]
end
-- 选择要送去墓地/除外的卡 -- 选择要送去墓地/除外的卡
local sg=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,e:GetHandler(),ttype) local sg=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,e:GetHandler(),types)
local tc=sg:GetFirst() local tc=sg:GetFirst()
local opt=Duel.SelectOption(tp,aux.Stringid(id,3),aux.Stringid(id,4)) local opt=Duel.SelectOption(tp,aux.Stringid(11180016,3),aux.Stringid(11180016,4))
if opt==0 then if opt==0 then
Duel.SendtoGrave(tc,REASON_COST) Duel.SendtoGrave(tc,REASON_COST)
e:SetLabel(tc:GetType()&(TYPE_MONSTER+TYPE_SPELL+TYPE_TRAP)) e:SetLabel(tc:GetType()&(TYPE_MONSTER+TYPE_SPELL+TYPE_TRAP))
...@@ -111,37 +73,30 @@ function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -111,37 +73,30 @@ function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
end end
end end
function s.costfilter(c,ttype)
return c:IsAbleToGrave() or c:IsAbleToRemove() and
c:IsType(ttype) and
(c:IsLocation(LOCATION_HAND) or c:IsFaceup())
end
-- ①: Target function -- ①: Target function
function s.desfilter(c,ty) function s.desfilter(c,ty)
return c:IsFaceup() and c:IsType(ty) and c:IsCanBeEffectTarget() return c:IsFaceup() and c:IsType(ty)
end end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local ty=e:GetLabel() local ty=e:GetLabel()
if chkc then return chkc:IsOnField() and s.desfilter(chkc,ty) end if chk==0 then return true end
if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil,ty) end local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,ty)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil,ty)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end end
-- ①: Operation -- ①: Operation
function s.desop(e,tp,eg,ep,ev,re,r,rp) function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local ty=e:GetLabel()
if tc and tc:IsRelateToEffect(e) then local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,ty)
Duel.Destroy(tc,REASON_EFFECT) if #g>0 then
Duel.Destroy(g,REASON_EFFECT)
end end
end end
-- ②: Condition for being sent to GY -- ②: Condition for being sent to GY
function s.sentfilter(c)
return c:IsSetCard(0x146) or c:IsSetCard(0x147) -- "Dragonborn" or "Phantom Sorrow"
end
function s.gycon(e,tp,eg,ep,ev,re,r,rp) function s.gycon(e,tp,eg,ep,ev,re,r,rp)
return re and return re and
......
...@@ -51,8 +51,7 @@ end ...@@ -51,8 +51,7 @@ end
function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local g=Duel.GetDecktopGroup(tp,2) local g=Duel.GetDecktopGroup(tp,2)
local tc=g:GetFirst() return g:FilterCount(Card.IsAbleToRemove,nil)==2
return tc and tc:IsAbleToRemove()
end end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,2,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,2,tp,LOCATION_DECK)
local lab=0 local lab=0
...@@ -64,7 +63,7 @@ function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -64,7 +63,7 @@ function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
end end
function s.rmop(e,tp,eg,ep,ev,re,r,rp) function s.rmop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local g=Duel.GetDecktopGroup(tp,1) local g=Duel.GetDecktopGroup(tp,2)
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
Duel.Remove(g,POS_FACEUP,REASON_EFFECT) Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
if e:GetLabel()==1 and Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) then if e:GetLabel()==1 and Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) then
......
...@@ -12,8 +12,11 @@ function c9910438.initial_effect(c) ...@@ -12,8 +12,11 @@ function c9910438.initial_effect(c)
e1:SetOperation(c9910438.activate) e1:SetOperation(c9910438.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c9910438.cfilter(c,e)
return c:IsFaceup() and c:IsCanBeEffectTarget(e)
end
function c9910438.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c9910438.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil) local g=Duel.GetMatchingGroup(c9910438.cfilter,tp,LOCATION_MZONE,0,nil,e)
if chkc then return false end if chkc then return false end
if chk==0 then return g:CheckSubGroup(aux.drccheck,2) end if chk==0 then return g:CheckSubGroup(aux.drccheck,2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
......
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