Commit c5bff7c1 authored by jwyxym's avatar jwyxym Committed by GitHub

Add files via upload

parent d9fa953c
......@@ -586,6 +586,7 @@ function VgD.CardTriggerOperation(chkop,f)
local tc=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_DAMAGE,0,1,1,nil):GetFirst()
if tc then
Duel.SendtoGrave(tc,REASON_TRIGGER)
Duel.Recover(tp,1,REASON_RULE)
end
end
elseif c:IsRace(TRRIGGER_ADVANCE) then
......@@ -602,6 +603,7 @@ function VgD.CardTriggerOperation(chkop,f)
Duel.Exile(c,REASON_TRIGGER)
else
Duel.Sendto(c,tp,LOCATION_DAMAGE,POS_FACEUP_ATTACK,REASON_EFFECT)
Duel.Damage(tp,1,REASON_TRIGGER)
end
local rc=Duel.GetMatchingGroup(VgF.VMonsterFilter,tp,LOCATION_MZONE,0,nil):GetFirst()
local bc=rc:GetBattleTarget()
......@@ -721,11 +723,7 @@ function VgD.EventRideStart(e,tp,eg,ep,ev,re,r,rp)
end
function VgD.RuleWin(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetCurrentChain()>0 then return end
for WinReason=0x1, 0x2, 1 do
if WinReason==0x1 then
local lp=Duel.GetLP(tp)-Duel.GetFieldGroupCount(tp,LOCATION_ORDER,0)
Duel.SetLP(tp,lp)
end
for WinReason=0x1, 0xff, 1 do
if WinReason==0x2 then
local g1=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)
local g2=Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)
......
......@@ -380,24 +380,34 @@ end
---@param g Card|Group 要被上升攻击力的卡
---@param val integer 要上升的攻击力(可以为负)
---@param reset integer|nil 指示重置的时点,默认为“回合结束时”。无论如何,都会在离场时重置。
function VgF.AtkUp(c,g,val,reset,resetcount)
function VgF.AtkUp(c,g,val,reset,resetcount,resettype,resetcode)
if not c then return end
if not resetcount then resetcount=1 end
if not reset then reset=RESET_PHASE+PHASE_END end
if not resetcount then resetcount=1 end
if not resettype then resettype=EFFECT_TYPE_FIELD end
if not resetcode then resetcode=0 end
if not val or val==0 then return end
if VgF.GetValueType(g)=="Group" and g:GetCount()>0 then
local e={}
for tc in VgF.Next(g) do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(val)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+reset)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+reset,resetcount)
tc:RegisterEffect(e1)
table.insert(e,e1)
if resetcode>0 then
local e2=Effect.CreateEffect(c)
e2:SetType(resettype+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(resetcode)
e2:SetRange(LOCATION_MZONE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
e2:SetOperation(function (te)
e1:Reset()
te:Reset()
end)
tc:RegisterEffect(e2)
end
end
return e
elseif VgF.GetValueType(g)=="Card" then
local tc=VgF.ReturnCard(g)
local e1=Effect.CreateEffect(c)
......@@ -406,7 +416,18 @@ function VgF.AtkUp(c,g,val,reset,resetcount)
e1:SetValue(val)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+reset,resetcount)
tc:RegisterEffect(e1)
return e1
if resetcode>0 then
local e2=Effect.CreateEffect(c)
e2:SetType(resettype+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(resetcode)
e2:SetRange(LOCATION_MZONE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
e2:SetOperation(function (te)
e1:Reset()
te:Reset()
end)
tc:RegisterEffect(e2)
end
end
end
---以c的名义,使g(中的每一张卡)的盾值上升val,并在reset时重置。
......@@ -414,13 +435,13 @@ end
---@param g Card|Group 要被上升盾值的卡
---@param val integer 要上升的盾值(可以为负)
---@param reset integer|nil 指示重置的时点,默认为“回合结束时”。无论如何,都会在离场时重置。
function VgF.DefUp(c,g,val,reset,resetcount)
function VgF.DefUp(c,g,val,reset,resetcount,resettype,resetcode)
if not c then return end
if not reset then reset=RESET_PHASE+PHASE_END end
if not resetcount then resetcount=1 end
if not resettype then resettype=EFFECT_TYPE_FIELD end
if not val or val==0 then return end
if VgF.GetValueType(g)=="Group" and g:GetCount()>0 then
local e={}
for tc in VgF.Next(g) do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......@@ -428,9 +449,19 @@ function VgF.DefUp(c,g,val,reset,resetcount)
e1:SetValue(val)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+reset,resetcount)
tc:RegisterEffect(e1)
table.insert(e,e1)
if resetcode>0 then
local e2=Effect.CreateEffect(c)
e2:SetType(resettype+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(resetcode)
e2:SetRange(LOCATION_MZONE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
e2:SetOperation(function (te)
e1:Reset()
te:Reset()
end)
tc:RegisterEffect(e2)
end
end
return e
elseif VgF.GetValueType(g)=="Card" then
local tc=VgF.ReturnCard(g)
local e1=Effect.CreateEffect(c)
......@@ -439,7 +470,18 @@ function VgF.DefUp(c,g,val,reset,resetcount)
e1:SetValue(val)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+reset,resetcount)
tc:RegisterEffect(e1)
return e1
if resetcode>0 then
local e2=Effect.CreateEffect(c)
e2:SetType(resettype+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(resetcode)
e2:SetRange(LOCATION_MZONE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
e2:SetOperation(function (te)
e1:Reset()
te:Reset()
end)
tc:RegisterEffect(e2)
end
end
end
---以c的名义,使g(中的每一张卡)的☆上升val,并在reset时重置。
......@@ -447,14 +489,13 @@ end
---@param g Card|Group 要被上升☆的卡
---@param val integer 要上升的☆(可以为负)
---@param reset integer|nil 指示重置的时点,默认为“回合结束时”。无论如何,都会在离场时重置。
function VgF.StarUp(c,g,val,reset,resetcount)
function VgF.StarUp(c,g,val,reset,resetcount,resettype,resetcode)
if not c or not g then return end
if not reset then reset=RESET_PHASE+PHASE_END end
if not resetcount then resetcount=1 end
if not resettype then resettype=EFFECT_TYPE_FIELD end
if not val or val==0 then return end
if VgF.GetValueType(g)=="Group" and g:GetCount()>0 then
local t1={}
local t2={}
for tc in VgF.Next(g) do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......@@ -467,10 +508,25 @@ function VgF.StarUp(c,g,val,reset,resetcount)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_RSCALE)
tc:RegisterEffect(e2)
table.insert(t1,e1)
table.insert(t2,e2)
if resetcode>0 then
local e3=Effect.CreateEffect(c)
e3:SetType(resettype+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(resetcode)
e3:SetRange(LOCATION_MZONE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
e3:SetOperation(function (te)
e1:Reset()
te:Reset()
end)
tc:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetOperation(function (te)
e2:Reset()
te:Reset()
end)
tc:RegisterEffect(e4)
end
end
return t1,t2
elseif VgF.GetValueType(g)=="Card" then
local tc=VgF.ReturnCard(g)
local e1=Effect.CreateEffect(c)
......@@ -484,7 +540,24 @@ function VgF.StarUp(c,g,val,reset,resetcount)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_RSCALE)
tc:RegisterEffect(e2)
return e1,e2
if resetcode>0 then
local e3=Effect.CreateEffect(c)
e3:SetType(resettype+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(resetcode)
e3:SetRange(LOCATION_MZONE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
e3:SetOperation(function (te)
e1:Reset()
te:Reset()
end)
tc:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetOperation(function (te)
e2:Reset()
te:Reset()
end)
tc:RegisterEffect(e4)
end
end
end
---判断c是否可以以规则的手段到G区域。
......@@ -744,32 +817,17 @@ function VgF.CheckPrison(p)
end
--重置Effect
function VgF.EffectReset(c,e,code,con)
if VgF.GetValueType(e)=="Effect" then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(code)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_ALL)
e1:SetLabelObject(e)
if VgF.GetValueType(con)=="function" then e1:SetCondition(con) end
e1:SetOperation(VgF.EffectResetOperation)
c:RegisterEffect(e1)
elseif VgF.GetValueType(e)=="table" then
for i,v in ipairs(e) do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(code)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_ALL)
e1:SetLabelObject(v)
if VgF.GetValueType(con)=="function" then e1:SetCondition(con) end
e1:SetOperation(VgF.EffectResetOperation)
c:RegisterEffect(e1)
end
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(code)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_ALL)
e1:SetLabelObject(e)
if VgF.GetValueType(con)=="function" then e1:SetCondition(con) end
e1:SetOperation(VgF.EffectResetOperation)
c:RegisterEffect(e1)
end
function VgF.EffectResetOperation(e,tp,eg,ep,ev,re,r,rp)
local e1=e:GetLabelObject()
if VgF.GetValueType(e1)=="Effect" then e1:Reset() end
e:Reset()
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