Commit 7b894e5f authored by xiaoye's avatar xiaoye

update additional_effect

parent cb85092d
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
local cm,m,o=GetID() local cm,m,o=GetID()
function cm.initial_effect(c) function cm.initial_effect(c)
vgd.VgCard(c) vgd.VgCard(c)
vgf.AddEffectWhenTrigger(c,m,cm.operation) vgd.AdditionalEffect(c,m,cm.operation)
end end
function cm.operation(e,tp,eg,ep,ev,re,r,rp) function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
......
local cm,m,o=GetID() local cm,m,o=GetID()
function cm.initial_effect(c) function cm.initial_effect(c)
vgd.VgCard(c) vgd.VgCard(c)
vgf.AddEffectWhenTrigger(c,m,cm.op) vgd.AdditionalEffect(c,m,cm.op)
end end
function cm.op(e,tp,eg,ep,ev,re,r,rp) function cm.op(e,tp,eg,ep,ev,re,r,rp)
local g=vgf.SelectMatchingCard(HINTMSG_VMONSTER,e,tp,vgf.filter.IsV,tp,LOCATION_CIRCLE,0,1,1,nil) local g=vgf.SelectMatchingCard(HINTMSG_VMONSTER,e,tp,vgf.filter.IsV,tp,LOCATION_CIRCLE,0,1,1,nil)
......
local cm,m,o=GetID() local cm,m,o=GetID()
function cm.initial_effect(c) function cm.initial_effect(c)
vgd.VgCard(c) vgd.VgCard(c)
vgf.AddEffectWhenTrigger(c,m,cm.op) vgd.AdditionalEffect(c,m,cm.op)
end end
function cm.op(e,tp,eg,ep,ev,re,r,rp) function cm.op(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
......
local cm,m,o=GetID() local cm,m,o=GetID()
function cm.initial_effect(c) function cm.initial_effect(c)
vgd.VgCard(c) vgd.VgCard(c)
vgf.AddEffectWhenTrigger(c,m,cm.op) vgd.AdditionalEffect(c,m,cm.op)
end end
function cm.op(e,tp,eg,ep,ev,re,r,rp) function cm.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
......
local cm,m,o=GetID() local cm,m,o=GetID()
function cm.initial_effect(c) function cm.initial_effect(c)
vgd.VgCard(c) vgd.VgCard(c)
vgf.AddEffectWhenTrigger(c,m,cm.operation) vgd.AdditionalEffect(c,m,cm.operation)
end end
function cm.operation(e,tp,eg,ep,ev,re,r,rp) function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
......
...@@ -3,7 +3,7 @@ local cm,m,o=GetID() ...@@ -3,7 +3,7 @@ local cm,m,o=GetID()
function cm.initial_effect(c) function cm.initial_effect(c)
vgd.VgCard(c) vgd.VgCard(c)
--追加效果——抽1张卡!选择你的1个单位,这个回合中,☆+1!将当前存在于前列的你所有的单位的力量+10000!你的伤害区中的卡的张数在对手的伤害区中的卡的张数以上的话,选择你的伤害区中的1张卡,回复! --追加效果——抽1张卡!选择你的1个单位,这个回合中,☆+1!将当前存在于前列的你所有的单位的力量+10000!你的伤害区中的卡的张数在对手的伤害区中的卡的张数以上的话,选择你的伤害区中的1张卡,回复!
vgf.AddEffectWhenTrigger(c,m,cm.operation) vgd.AdditionalEffect(c,m,cm.operation)
end end
function cm.operation(e,tp,eg,ep,ev,re,r,rp) function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
......
...@@ -575,24 +575,29 @@ function VgD.CardTriggerOperation(chkop) ...@@ -575,24 +575,29 @@ function VgD.CardTriggerOperation(chkop)
end end
function VgD.OperationWhenCardTrigger(e, tp, eg, ep, ev, re, r, rp, c, chk) function VgD.OperationWhenCardTrigger(e, tp, eg, ep, ev, re, r, rp, c, chk)
local effect_when_trigger = c.effect_when_trigger local additional_effect = c.additional_effect
local cost, con, tg = true, true, true if not additional_effect or #additional_effect == 0 then return end
if not effect_when_trigger or #effect_when_trigger == 0 then return end if VgF.GetValueType(additional_effect['chk']) == "boolean" then
if (VgF.GetValueType(effect_when_trigger[5]) == "boolean" and not effect_when_trigger[5]) or (VgF.GetValueType(effect_when_trigger[5]) ~= "boolean" and Duel.GetTurnPlayer() ~= c:GetControler()) then return false end if not additional_effect['chk'] then
if VgF.GetValueType(effect_when_trigger[2]) == "function" then cost = effect_when_trigger[2](e, tp, eg, ep, ev, re, r, rp, 0) end return false
if VgF.GetValueType(effect_when_trigger[3]) == "function" then con = effect_when_trigger[3](e, tp, eg, ep, ev, re, r, rp) end end
if VgF.GetValueType(effect_when_trigger[4]) == "function" then tg = effect_when_trigger[4](e, tp, eg, ep, ev, re, r, rp, 0) end else
if VgF.GetValueType(effect_when_trigger[1]) == "function" and cost and con and tg then if Duel.GetTurnPlayer() ~= c:GetControler() then return false end
end
local cost = type(additional_effect['cost']) == "function" and additional_effect['cost'](e, tp, eg, ep, ev, re, r, rp, c, 0) or true
local con = type(additional_effect['con']) == "function" and additional_effect['con'](e, tp, eg, ep, ev, re, r, rp, c) or true
local tg = type(additional_effect['tg']) == "function" and additional_effect['tg'](e, tp, eg, ep, ev, re, r, rp, c, 0) or true
if type(additional_effect['op']) == "function" and cost and con and tg then
if chk == 0 then return true end if chk == 0 then return true end
local activate_chk = true local activate_chk = true
if VgF.GetValueType(effect_when_trigger[2]) == "function" then activate_chk = Duel.SelectYesNo(tp, VgF.Stringid(VgID, 15)) end if type(additional_effect['cost']) == "function" then activate_chk = Duel.SelectYesNo(tp, VgF.Stringid(VgID, 15)) end
if activate_chk then if activate_chk then
Duel.HintSelection(Group.FromCards(c)) Duel.HintSelection(Group.FromCards(c))
local _, m = c:GetOriginalCode() local _, m = c:GetOriginalCode()
Duel.Hint(HINT_CARD, 0, m) Duel.Hint(HINT_CARD, 0, m)
if VgF.GetValueType(effect_when_trigger[2]) == "function" then effect_when_trigger[2](e, tp, eg, ep, ev, re, r, rp, 1) end if type(additional_effect['cost']) == "function" then additional_effect['cost'](e, tp, eg, ep, ev, re, r, rp, 1) end
if VgF.GetValueType(effect_when_trigger[4]) == "function" then effect_when_trigger[4](e, tp, eg, ep, ev, re, r, rp, 1) end if type(additional_effect['tg']) == "function" then additional_effect['tg'](e, tp, eg, ep, ev, re, r, rp, 1) end
effect_when_trigger[1](e, tp, eg, ep, ev, re, r, rp) additional_effect['op'](e, tp, eg, ep, ev, re, r, rp)
end end
end end
return false return false
...@@ -870,6 +875,13 @@ end ...@@ -870,6 +875,13 @@ end
--起自永以外关键字---------------------------------------------------------------------------------------- --起自永以外关键字----------------------------------------------------------------------------------------
---超限触发的追加效果
---
function VgD.AdditionalEffect(c, m, op, cost, con, tg, chk)
local cm = _G["c"..m]
cm.additional_effect = {['op'] = op, ['cost'] = cost, ['con'] = con, ['tg'] = tg, ['chk'] = chk}
end
---使卡片具有超限舞装的功能 ---使卡片具有超限舞装的功能
---@param c Card 要注册超限舞装功能的卡 ---@param c Card 要注册超限舞装功能的卡
---@param filter number 卡名为 filter 的后防者,或符合 filter 的后防者等 ---@param filter number 卡名为 filter 的后防者,或符合 filter 的后防者等
......
...@@ -1521,11 +1521,6 @@ function VgF.AddAlchemagic(m, from, to, min, max, filter) ...@@ -1521,11 +1521,6 @@ function VgF.AddAlchemagic(m, from, to, min, max, filter)
end end
end end
function VgF.AddEffectWhenTrigger(c, m, op, cost, con, tg, chk)
local cm = _G["c"..m]
cm.effect_when_trigger = {op, cost, con, tg, chk}
end
---创建一个函数检查器 检查func是否为nil或函数 ---创建一个函数检查器 检查func是否为nil或函数
function VgF.IllegalFunctionCheck(name, c) function VgF.IllegalFunctionCheck(name, c)
if VgF.GetValueType(c) ~= "Card" then Debug.Message("VgD."..name.." param c isn't Card") end if VgF.GetValueType(c) ~= "Card" then Debug.Message("VgD."..name.." param c isn't Card") 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