Commit d530b735 authored by xiaoye's avatar xiaoye

fix bugs by huhu

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