Commit 440f94ee authored by wind2009's avatar wind2009

Fix 影の災い

parent f512f867
Pipeline #31144 passed with stages
in 1 minute and 43 seconds
...@@ -12,36 +12,38 @@ function s.initial_effect(c) ...@@ -12,36 +12,38 @@ function s.initial_effect(c)
e1:SetOperation(s.activate) e1:SetOperation(s.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function s.rmfdfilter(c,code,tp)
return c:IsCode(code) and c:IsFaceupEx() and c:IsAbleToRemove(tp,POS_FACEDOWN)
end
function s.rmfilter(c,tp) function s.rmfilter(c,tp)
local g=Duel.GetMatchingGroup(Card.IsCode,tp,0,LOCATION_GRAVE,1,nil,c:GetCode())
local ct=g:GetCount()
if not c:IsFaceup() then return false end if not c:IsFaceup() then return false end
local g=Duel.GetMatchingGroup(Card.IsCode,tp,0,LOCATION_GRAVE,nil,c:GetCode())
local ct=g:GetCount()
if ct==0 then return false end if ct==0 then return false end
if ct==1 then return true end if ct==1 then return true end
if ct==2 then return c:IsAbleToRemove() end if ct==2 then return c:IsAbleToRemove() end
if ct>=2 then return c:IsAbleToRemove(tp,POS_FACEDOWN) and g:FilterCount(Card.IsAbleToRemove,nil,tp,POS_FACEDOWN)==ct end if ct>2 then return Duel.IsExistingMatchingCard(s.rmfdfilter,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE,1,nil,c:GetCode(),tp) end
return false return false
end end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and s.rmfilter(chkc,tp) end if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and s.rmfilter(chkc,tp) end
if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,0,LOCATION_ONFIELD,1,nil,tp) end if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,0,LOCATION_ONFIELD,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,s.rmfilter,tp,0,LOCATION_ONFIELD,1,1,nil) local g=Duel.SelectTarget(tp,s.rmfilter,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
end end
function s.activate(e,tp,eg,ep,ev,re,r,rp) function s.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local g=Duel.GetMatchingGroup(Card.IsCode,tp,0,LOCATION_GRAVE,1,nil,tc:GetCode()) local g=Duel.GetMatchingGroup(Card.IsCode,tp,0,LOCATION_GRAVE,nil,tc:GetCode())
local ct=g:GetCount() local ct=g:GetCount()
if ct==1 then if ct==1 then
Duel.Destroy(tc,REASON_EFFECT) Duel.Destroy(tc,REASON_EFFECT)
elseif ct==2 then elseif ct==2 then
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)
elseif ct>=2 then elseif ct>2 then
if g:FilterCount(Card.IsAbleToRemove,nil,tp,POS_FACEDOWN)~=ct then return end local rg=Duel.GetMatchingGroup(s.rmfdfilter,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE,nil,tc:GetCode(),tp)
g:AddCard(tc) Duel.Remove(rg,POS_FACEDOWN,REASON_EFFECT)
Duel.Remove(g,POS_FACEDOWN,REASON_EFFECT)
end end
end end
end 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