Commit 562c5fa2 authored by xiaoye's avatar xiaoye

增加cost中判断c:IsRelateToEffect(e)

parent 853dfaeb
......@@ -14,7 +14,7 @@ function cm.filter(c)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return true end
if chk==0 then return c:IsRelateToEffect(e) end
local rc=vgf.GetMatchingGroup(vgf.VMonsterFilter,tp,LOCATION_MZONE,0,nil):GetFirst()
vgf.Sendto(LOCATION_OVERLAY,c,rc)
end
\ No newline at end of file
......@@ -8,7 +8,7 @@ function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return vgf.RMonsterFilter(c) and vgf.VMonsterFilter(Duel.GetAttackTarget()) and vgf.IsExistingMatchingCard(nil,tp,LOCATION_MZONE+LOCATION_DROP,0,4,nil)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return vgf.GetMatchingGroup(vgf.VMonsterFilter,tp,LOCATION_MZONE,0,nil,nil):GetFirst():GetOverlayCount()>=1 end
if chk==0 then return vgf.OverlayCost(1)(e,tp,eg,ep,ev,re,r,rp,chk) and e:GetHandler():IsRelateToEffect(e) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVEXYZ)
local g=vgf.GetMatchingGroup(vgf.VMonsterFilter,tp,LOCATION_MZONE,0,nil):GetFirst():GetOverlayGroup():Select(tp,1,1,nil)
g:AddCard(e:GetHandler())
......
......@@ -12,7 +12,7 @@ function cm.filter(c,code)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToGraveAsCost() and vgf.DamageCost(1)(e,tp,eg,ep,ev,re,r,rp,chk) end
if chk==0 then return c:IsAbleToGraveAsCost() and vgf.DamageCost(1)(e,tp,eg,ep,ev,re,r,rp,chk) and c:IsRelateToEffect(e) end
vgf.DamageCost(1)(e,tp,eg,ep,ev,re,r,rp,chk)
vgf.Sendto(LOCATION_DROP,c,REASON_COST)
end
......
......@@ -5,7 +5,7 @@ function cm.initial_effect(c)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return true end
if chk==0 then return c:IsRelateToEffect(e) end
vgf.Sendto(LOCATION_OVERLAY,c)
end
function cm.con(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -13,7 +13,7 @@ end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
return vgf.OverlayCost(1)(e,tp,eg,ep,ev,re,r,rp,chk)
return vgf.OverlayCost(1)(e,tp,eg,ep,ev,re,r,rp,chk) and c:IsRelateToEffect(e) and c:IsAbleToGrave()
end
vgf.OverlayCost(1)(e,tp,eg,ep,ev,re,r,rp,chk)
vgf.Sendto(LOCATION_DROP,c,REASON_COST)
......
......@@ -12,6 +12,6 @@ function cm.op1(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(tp,AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX,RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,0,vgf.Stringid(m,0))
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() and e:GetHandler():IsRelateToEffect(e) end
vgf.Sendto(LOCATION_DROP,e:GetHandler(),REASON_COST)
end
\ No newline at end of file
......@@ -12,7 +12,7 @@ function cm.condition2(e,tp,eg,ep,ev,re,r,rp)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return true end
if chk==0 then return c:IsRelateToEffect(e) end
local rc=vgf.GetMatchingGroup(vgf.VMonsterFilter,tp,LOCATION_MZONE,0,nil):GetFirst()
vgf.Sendto(LOCATION_OVERLAY,c,rc)
end
......
......@@ -4,9 +4,9 @@ function cm.initial_effect(c)
vgd.EffectTypeTrigger(c,m,nil,EFFECT_TYPE_SINGLE,EVENT_SPSUMMON_SUCCESS,cm.op,cm.cost,vgf.RSummonCondition)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanChangePosition() and e:GetHandler():IsPosition(POS_FACEUP_ATTACK) and vgf.OverlayCost(1)(e,tp,eg,ep,ev,re,r,rp,chk) end
if chk==0 then return vgf.ChangePosDefence(e:GetHandler())(e,tp,eg,ep,ev,re,r,rp,chk) and vgf.OverlayCost(1)(e,tp,eg,ep,ev,re,r,rp,chk) end
vgf.OverlayCost(1)(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.ChangePosition(e:GetHandler(),POS_FACEUP_DEFENCE)
vgf.ChangePosDefence(e:GetHandler())(e,tp,eg,ep,ev,re,r,rp,chk)
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetDecktopGroup(tp,2)
......
......@@ -9,6 +9,6 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
vgf.AtkUp(c,g,5000)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() and e:GetHandler():IsRelateToEffect(e) end
vgf.Sendto(LOCATION_DROP,e:GetHandler(),REASON_COST)
end
\ No newline at end of file
......@@ -17,7 +17,7 @@ end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
return c:IsAbleToGraveAsCost() and vgf.DamageCost(1)(e,tp,eg,ep,ev,re,r,rp,chk)
return c:IsAbleToGraveAsCost() and vgf.DamageCost(1)(e,tp,eg,ep,ev,re,r,rp,chk) and c:IsRelateToEffect(e)
end
vgf.DamageCost(1)(e,tp,eg,ep,ev,re,r,rp,chk)
vgf.Sendto(LOCATION_DROP,c,REASON_COST)
......
......@@ -10,7 +10,7 @@ end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c = e:GetHandler()
if chk ==0 then
return c:IsAbleToGraveAsCost()
return c:IsAbleToGraveAsCost() and e:GetHandler():IsRelateToEffect(e)
end
vgf.Sendto(LOCATION_DROP,c,REASON_COST)
end
......
......@@ -9,7 +9,7 @@ function cm.initial_effect(c)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return true end
if chk==0 then return c:IsRelateToEffect(e) end
local rc=vgf.GetMatchingGroup(vgf.VMonsterFilter,tp,LOCATION_MZONE,0,nil):GetFirst()
vgf.Sendto(LOCATION_OVERLAY,c,rc)
end
......
......@@ -7,7 +7,7 @@ function cm.initial_effect(c)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return true end
if chk==0 then return c:IsRelateToEffect(e) end
local rc=vgf.GetMatchingGroup(vgf.VMonsterFilter,tp,LOCATION_MZONE,0,nil):GetFirst()
vgf.Sendto(LOCATION_OVERLAY,c,rc)
end
......
......@@ -5,9 +5,10 @@ function cm.initial_effect(c)
vgd.EffectTypeTrigger(c,m,LOCATION_MZONE,EFFECT_TYPE_FIELD,EVENT_PHASE+PHASE_BATTLE_START,cm.op1,nil,cm.con1)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanChangePosition() and e:GetHandler():IsPosition(POS_FACEUP_ATTACK) and vgf.OverlayCost(1)(e,tp,eg,ep,ev,re,r,rp,chk) end
local c=e:GetHandler()
if chk==0 then return vgf.ChangePosDefence(c)(e,tp,eg,ep,ev,re,r,rp,chk) and vgf.OverlayCost(1)(e,tp,eg,ep,ev,re,r,rp,chk) end
vgf.OverlayCost(1)(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.ChangePosition(e:GetHandler(),POS_FACEUP_DEFENCE)
vgf.ChangePosDefence(c)(e,tp,eg,ep,ev,re,r,rp,chk)
end
function cm.con(e,tp,eg,ep,ev,re,r,rp)
return vgf.RMonsterCondition(e) and vgf.GetVMonster(tp):IsCode(10401002)
......
......@@ -15,7 +15,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return true end
if chk==0 then return c:IsRelateToEffect(e) end
local rc=vgf.GetMatchingGroup(vgf.VMonsterFilter,tp,LOCATION_MZONE,0,nil):GetFirst()
vgf.Sendto(LOCATION_OVERLAY,c,rc)
end
\ No newline at end of file
......@@ -555,7 +555,7 @@ end
function VgF.ChangePosAttack(c)
return function (e, tp, eg, ep, ev, re, r, rp, chk)
if VgF.GetValueType(c) ~= "Card" then c = e:GetHandler() end
if chk == 0 then return c:IsCanChangePosition() and c:IsPosition(POS_FACEUP_DEFENCE) end
if chk == 0 then return c:IsCanChangePosition() and c:IsPosition(POS_FACEUP_DEFENCE) and (c ~= e:GetHandler() or c:IsRelateToEffect(e)) end
Duel.ChangePosition(c, POS_FACEUP_ATTACK)
end
end
......@@ -563,7 +563,7 @@ end
function VgF.ChangePosDefence(c)
return function (e, tp, eg, ep, ev, re, r, rp, chk)
if VgF.GetValueType(c) ~= "Card" then c = e:GetHandler() end
if chk == 0 then return c:IsCanChangePosition() and c:IsPosition(POS_FACEUP_ATTACK) end
if chk == 0 then return c:IsCanChangePosition() and c:IsPosition(POS_FACEUP_ATTACK) and (c ~= e:GetHandler() or c:IsRelateToEffect(e)) end
Duel.ChangePosition(c, POS_FACEUP_DEFENCE)
end
end
......@@ -694,7 +694,7 @@ end
---@param ... any
---@return function 效果的Cost函数
function VgF.LeaveFieldCost(card_code_func, val_max, val_min, except, ...)
if not card_code_func then
if not card_code_func then
return VgF.LeaveFieldCostGroup()
elseif VgF.GetValueType(card_code_func) == "Card" then
return VgF.LeaveFieldCostGroup(Group.FromCards(card_code_func))
......@@ -720,7 +720,8 @@ end
function VgF.LeaveFieldCostGroup(g)
return function (e, tp, eg, ep, ev, re, r, rp, chk)
g = g or Group.FromCards(e:GetHandler())
if chk == 0 then return not g:IsExists(VgF.NOT(Card.IsAbleToGraveAsCost), 1, nil) end
g = g:Filter(function(c) return c:IsAbleToGraveAsCost() and (c ~= e:GetHandler() or c:IsRelateToEffect(e)) end, nil)
if chk == 0 then return g:GetCount() > 0 end
VgF.Sendto(LOCATION_DROP, g, REASON_COST)
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