Commit 5df0a361 authored by HidarimeYume's avatar HidarimeYume Committed by GitHub

Fix quick spell card "Unity" (#2795)

* Update c14731897.lua

* Update c14731897.lua
parent ed922540
...@@ -13,14 +13,23 @@ function c14731897.initial_effect(c) ...@@ -13,14 +13,23 @@ function c14731897.initial_effect(c)
e1:SetOperation(c14731897.activate) e1:SetOperation(c14731897.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c14731897.filter(c) function c14731897.filter(c,def)
return c:IsFaceup() and c:IsDefenseAbove(0) return c:IsFaceup() and c:IsDefenseAbove(0) and not c:IsDefense(def)
end end
function c14731897.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c14731897.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c14731897.filter(chkc) end local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
if chk==0 then return Duel.IsExistingTarget(c14731897.filter,tp,LOCATION_MZONE,0,1,nil) end local def=0
local sc=g:GetFirst()
while sc do
local cdef=sc:GetBaseDefense()
if cdef<0 then cdef=0 end
def=def+cdef
sc=g:GetNext()
end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c14731897.filter(chkc,def) end
if chk==0 then return Duel.IsExistingTarget(c14731897.filter,tp,LOCATION_MZONE,0,1,nil,def) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c14731897.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SelectTarget(tp,c14731897.filter,tp,LOCATION_MZONE,0,1,1,nil,def)
end end
function c14731897.activate(e,tp,eg,ep,ev,re,r,rp) function c14731897.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
......
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