Commit d530b735 authored by xiaoye's avatar xiaoye

fix bugs by huhu

parent 483cdd90
......@@ -784,7 +784,7 @@ function VgD.Register.MonsterBattle(c)
local def = tc:GetAttack()
if not tc:IsVanguard() or atk < def or tc:GetLeftScale() == 0 then goto continue end
tc:RegisterFlagEffect(FLAG_DAMAGE_TRIGGER, RESET_EVENT + RESETS_STANDARD, 0, 1, tc:GetLeftScale() - 1)
VgD.Register.Trigger(bc:GetControler())
VgF.Trigger(bc:GetControler())
::continue::
end
end)
......@@ -798,8 +798,8 @@ function VgD.Register.MonsterBattle(c)
e:SetOperation(function ()
local tc = Duel.GetAttacker()
local tp = tc:GetControler()
if not tc:GetFlagEffectLabel(FLAG_ATTACK_TRIGGER) or tc:GetFlagEffectLabel(FLAG_ATTACK_TRIGGER) == 0 or tc:IsRearguard() and tc:IsHasEffect(EFFECT_ALSO_CAN_TRIGGER) then return end
VgD.Register.Trigger(tp)
if not tc:GetFlagEffectLabel(FLAG_ATTACK_TRIGGER) or tc:GetFlagEffectLabel(FLAG_ATTACK_TRIGGER) == 0 or (tc:IsRearguard() and not tc:IsHasEffect(EFFECT_ALSO_CAN_TRIGGER)) then return end
VgF.Trigger(tp)
end)
Duel.RegisterEffect(e, 0)
end
......@@ -811,7 +811,7 @@ function VgD.Register.MonsterBattle(c)
e:SetOperation(function (_, _, eg, ep, ev, re, r, rp)
local tc = VgF.ReturnCard(eg)
local tp = tc:GetControler()
VgD.Register.Trigger(tp)
VgF.Trigger(tp)
end)
Duel.RegisterEffect(e, 0)
end
......@@ -911,11 +911,6 @@ function VgD.Register.MonsterBattle(c)
c:RegisterEffect(e2)
end
end
function VgD.Register.Trigger(tp)
local tg = Duel.GetDecktopGroup(tp, 1)
Duel.DisableShuffleCheck()
VgF.Sendto(LOCATION_TRIGGER, tg:GetFirst())
end
--起自永以外关键字----------------------------------------------------------------------------------------
......@@ -1416,7 +1411,7 @@ end
---【自】效果模板:当单位在loc时,code时点被触发时执行的效果
---@param c Card 拥有这个效果的卡
---@param m number|nil 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
---@param loc number 可以发动的区域
---@param loc number|nil 可以发动的区域
---@param typ number 若是自己状态变化引发,则填EFFECT_TYPE_SINGLE;<br>若是场上任意一卡状态变化引发,则填EFFECT_TYPE_FIELD。
---@param code number 触发的时点
---@param op function|nil 这个效果的处理函数
......@@ -1438,8 +1433,8 @@ function VgD.Action.AbilityAuto(c, m, loc, typ, code, op, cost, con, tg, count,
-- set param
typ = typ or EFFECT_TYPE_SINGLE
-- set effect
local e1 = VgD.AbilityAuto(c, m, loc, typ, EVENT_BATTLE_DESTROYING, op, cost, con, tg, count, property, id)
local e2 = VgD.AbilityAuto(c, m, loc, EFFECT_TYPE_FIELD, EVENT_CUSTOM + EVENT_DAMAGE_TRIGGER, op, cost, function (e, tp, eg, ep, ev, re, r, rp)
local e1 = VgD.Action.AbilityAuto(c, m, loc, typ, EVENT_BATTLE_DESTROYING, op, cost, con, tg, count, property, id)
local e2 = VgD.Action.AbilityAuto(c, m, loc, EFFECT_TYPE_FIELD, EVENT_CUSTOM + EVENT_DAMAGE_TRIGGER, op, cost, function (e, tp, eg, ep, ev, re, r, rp)
if con and not con(e, tp, eg, ep, ev, re, r, rp) then return false end
local p = e:GetHandlerPlayer()
if code == EVENT_BE_HITTED then p = 1 - p end
......@@ -1487,7 +1482,7 @@ function VgD.Action.AbilityAuto(c, m, loc, typ, code, op, cost, con, tg, count,
e:SetDescription(VgF.Stringid(VgID + 1, id or 1))
e:SetType(typ)
e:SetCode(code)
e:SetRange(loc)
if loc then e:SetRange(loc) end
e:SetProperty((property or 0) + EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DELAY)
if count then e:SetCountLimit(count) end
e:SetCondition(con)
......
......@@ -132,23 +132,26 @@ end
---根据 loc 回传转换后的 loc 以及 con, 用于区分V/R/M
function VgF.FixVRLoc(loc)
local loc_con = VgF.True
local has_v = loc & LOCATION_V_CIRCLE > 0
local has_r = loc & LOCATION_R_CIRCLE > 0
if has_v and has_r then
loc = (loc - LOCATION_V_CIRCLE - LOCATION_R_CIRCLE) | LOCATION_CIRCLE
elseif has_v then
loc = (loc - LOCATION_V_CIRCLE) | LOCATION_CIRCLE
loc_con = Card.IsVanguard
elseif has_r then
loc = (loc - LOCATION_R_CIRCLE) | LOCATION_CIRCLE
loc_con = Card.IsRearguard
if loc then
local has_v = loc & LOCATION_V_CIRCLE > 0
local has_r = loc & LOCATION_R_CIRCLE > 0
if has_v and has_r then
loc = (loc - LOCATION_V_CIRCLE - LOCATION_R_CIRCLE) | LOCATION_CIRCLE
elseif has_v then
loc = (loc - LOCATION_V_CIRCLE) | LOCATION_CIRCLE
loc_con = Card.IsVanguard
elseif has_r then
loc = (loc - LOCATION_R_CIRCLE) | LOCATION_CIRCLE
loc_con = Card.IsRearguard
end
end
return loc, loc_con
end
---检查并转换 loc 以及 con 用于【起】等模板函数
function VgF.GetLocCondition(loc, con)
local loc, loc_con = VgF.FixVRLoc(loc)
local loc_con
loc, loc_con = VgF.FixVRLoc(loc)
local condition = function(e, tp, eg, ep, ev, re, r, rp)
return (not con or con(e, tp, eg, ep, ev, re, r, rp)) and loc_con(e:GetHandler())
end
......@@ -1058,7 +1061,7 @@ function VgF.GetMatchingGroup(f, p, loc_self, loc_oppo, ex, ...)
if loc_oppo & LOCATION_SOUL > 0 then
g = g + VgF.GetSoulGroup(1 - p)
end
return g:Filter(f, ex, ...)
return g:Filter(f or VgF.True, ex, ...)
end
---过滤函数,返回玩家 p 来看的指定位置满足过滤条件 f 并且不等于 ex 的卡的数量
......@@ -1219,6 +1222,11 @@ function VgF.CallFilter(c, tp, zone)
return c:IsRearguard() and zone == VgF.SequenceToGlobal(tp, c:GetLocation(), c:GetSequence())
end
function VgF.Trigger(tp, to_tp)
Duel.DisableShuffleCheck()
VgF.Sendto(LOCATION_TRIGGER, Duel.GetDecktopGroup(tp, 1), to_tp or tp)
end
--catalogue:关键字相关检测函数----------------------------------------------------------------------------------
-- 一气呵成之势
function VgF.Filter.FinalRush(tp)
......@@ -1638,13 +1646,9 @@ end
---把卡片(组) g 送去判定区
---@param g Card|Group 操作的卡片组
---@return number 实际被操作的数量
function VgF.ToTrigger(g)
g = VgF.ReturnGroup(g)
if #g == 0 then return 0 end
local ct = 0
for tc in VgF.Next(g) do
local tp = tc:GetControler()
if Duel.MoveToField(tc, tp, tp, loc, POS_FACEUP, true) then ct = ct + 1 end
end
return ct
function VgF.ToTrigger(g, tp)
local c = VgF.ReturnCard(g)
if not c then return 0 end
if Duel.MoveToField(c, tp, tp, LOCATION_TRIGGER, POS_FACEUP, true) then return 1 end
return 0
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