Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
V
Vgdpro Scripts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaoye
Vgdpro Scripts
Commits
683948c8
Commit
683948c8
authored
Feb 14, 2025
by
xiaoye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
cb12d359
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
4236 deletions
+0
-4236
VgD.Lua
VgD.Lua
+0
-1882
VgDefinition.Lua
VgDefinition.Lua
+0
-894
VgFuncLib.lua
VgFuncLib.lua
+0
-1460
No files found.
VgD.Lua
deleted
100644 → 0
View file @
cb12d359
--VgD库
VgD
=
{}
vgd
,
vgf
=
VgD
,
VgF
---初始化卡片,使卡片具有基本的功能。
---@param c Card 要初始化的卡
function
vgd
.
VgCard
(
c
)
VgD
.
Rule
(
c
)
VgD
.
RideUp
(
c
)
VgD
.
CardTrigger
(
c
)
if
c
:
IsType
(
TYPE_MONSTER
)
then
VgD
.
CallToR
(
c
)
VgD
.
MonsterBattle
(
c
)
end
end
---使卡片遵守VG的规则,已包含在 vgd.VgCard(c) 内
---@param c Card 要注册规则的卡
function
VgD
.
Rule
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e1
:
SetCode
(
EVENT_PHASE
+
PHASE_DRAW
)
e1
:
SetRange
(
LOCATION_ALL
)
e1
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e1
:
SetCountLimit
(
1
,
VgID
+
2
)
e1
:
SetCondition
(
VgD
.
RuelDrawCondition
)
e1
:
SetOperation
(
VgD
.
RuelDrawOperation
)
c
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e2
:
SetCode
(
EVENT_BATTLED
)
e2
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e2
:
SetRange
(
LOCATION_MZONE
)
e2
:
SetOperation
(
VgD
.
ResetOperation
)
c
:
RegisterEffect
(
e2
)
local
e3
=
Effect
.
CreateEffect
(
c
)
e3
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e3
:
SetCode
(
EVENT_PHASE_START
+
PHASE_STANDBY
)
e3
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e3
:
SetRange
(
LOCATION_ALL
)
e3
:
SetCountLimit
(
1
,
VgID
+
3
)
e3
:
SetCondition
(
VgF
.
RuleCardCondtion
)
e3
:
SetOperation
(
VgD
.
EventRideStart
)
c
:
RegisterEffect
(
e3
)
local
e10
=
Effect
.
CreateEffect
(
c
)
e10
:
SetType
(
EFFECT_TYPE_FIELD
)
e10
:
SetCode
(
EFFECT_HAND_LIMIT
)
e10
:
SetProperty
(
EFFECT_FLAG_PLAYER_TARGET
+
EFFECT_FLAG_CANNOT_DISABLE
)
e10
:
SetRange
(
LOCATION_ALL
)
e10
:
SetTargetRange
(
1
,
0
)
e10
:
SetValue
(
100
)
e10
:
SetCondition
(
VgF
.
RuleCardCondtion
)
c
:
RegisterEffect
(
e10
)
local
e11
=
Effect
.
CreateEffect
(
c
)
e11
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e11
:
SetCode
(
EVENT_ADJUST
)
e11
:
SetRange
(
LOCATION_ALL
)
e11
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e11
:
SetCondition
(
VgF
.
RuleCardCondtion
)
e11
:
SetOperation
(
VgD
.
RuleWin
)
c
:
RegisterEffect
(
e11
)
local
e12
=
Effect
.
CreateEffect
(
c
)
e12
:
SetType
(
EFFECT_TYPE_FIELD
)
e12
:
SetCode
(
EFFECT_SKIP_M2
)
e12
:
SetRange
(
LOCATION_ALL
)
e12
:
SetProperty
(
EFFECT_FLAG_PLAYER_TARGET
+
EFFECT_FLAG_CANNOT_DISABLE
)
e12
:
SetTargetRange
(
1
,
0
)
c
:
RegisterEffect
(
e12
)
local
e13
=
e12
:
Clone
()
e13
:
SetCode
(
EFFECT_CANNOT_SUMMON
)
c
:
RegisterEffect
(
e13
)
local
e14
=
e12
:
Clone
()
e14
:
SetCode
(
EFFECT_CANNOT_MSET
)
c
:
RegisterEffect
(
e14
)
local
e15
=
e12
:
Clone
()
e15
:
SetCode
(
EFFECT_CANNOT_SSET
)
c
:
RegisterEffect
(
e15
)
local
e16
=
Effect
.
CreateEffect
(
c
)
e16
:
SetType
(
EFFECT_TYPE_FIELD
)
e16
:
SetCode
(
EFFECT_QP_ACT_IN_NTPHAND
)
e16
:
SetRange
(
LOCATION_ALL
)
e16
:
SetCondition
(
VgF
.
RuleCardCondtion
)
e16
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e16
:
SetTargetRange
(
LOCATION_HAND
,
0
)
c
:
RegisterEffect
(
e16
)
end
function
VgD
.
EventRideStart
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
if
Duel
.
GetTurnPlayer
()
==
tp
then
Duel
.
RaiseEvent
(
c
,
EVENT_CUSTOM
+
EVENT_RIDE_START
,
e
,
0
,
tp
,
tp
,
0
)
end
end
function
VgD
.
RuleWin
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
if
Duel
.
GetCurrentChain
()
>
0
then
return
end
local
g1
=
Duel
.
GetFieldGroupCount
(
tp
,
LOCATION_DECK
,
0
)
local
g2
=
Duel
.
GetFieldGroupCount
(
tp
,
0
,
LOCATION_DECK
)
if
g1
==
0
and
g2
==
0
then
Duel
.
Win
(
PLAYER_NONE
,
0x2
)
elseif
g1
==
0
then
Duel
.
Win
(
1
-
tp
,
0x2
)
elseif
g2
==
0
then
Duel
.
Win
(
tp
,
0x2
)
end
end
function
VgD
.
RuelDrawCondition
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
return
VgF
.
RuleTurnCondtion
(
e
)
and
VgF
.
RuleCardCondtion
(
e
)
end
function
VgD
.
RuelDrawOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
ct
=
Duel
.
GetFieldGroupCount
(
tp
,
LOCATION_HAND
,
0
)
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_TODECK
)
local
g
=
Duel
.
GetFieldGroup
(
tp
,
LOCATION_HAND
,
0
):
Select
(
tp
,
0
,
ct
,
nil
)
if
g
:
GetCount
()
>
0
then
ct
=
Duel
.
SendtoDeck
(
g
,
tp
,
1
,
REASON_PHASEDRAW
)
Duel
.
Draw
(
tp
,
ct
,
REASON_PHASEDRAW
)
Duel
.
ShuffleDeck
(
tp
)
end
if
Duel
.
GetTurnPlayer
()
==
tp
then
Duel
.
Draw
(
tp
,
1
,
REASON_PHASEDRAW
)
end
end
function
VgD
.
ResetOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
if
c
:
GetFlagEffect
(
FLAG_SUPPORT
)
>
0
then
c
:
ResetFlagEffect
(
FLAG_SUPPORT
)
end
if
c
:
GetFlagEffect
(
FLAG_SUPPORTED
)
>
0
then
c
:
ResetFlagEffect
(
FLAG_SUPPORTED
)
end
if
c
:
GetFlagEffect
(
FLAG_DEFENSE_ENTIRELY
)
>
0
then
c
:
ResetFlagEffect
(
FLAG_DEFENSE_ENTIRELY
)
end
if
c
:
GetFlagEffect
(
FLAG_ATTACK_TRIGGER
)
>
0
then
c
:
ResetFlagEffect
(
FLAG_ATTACK_TRIGGER
)
end
if
c
:
GetFlagEffect
(
FLAG_DAMAGE_TRIGGER
)
>
0
then
c
:
ResetFlagEffect
(
FLAG_DAMAGE_TRIGGER
)
end
end
---使卡片具有骑升的功能,已包含在 vgd.VgCard(c) 内
---@param c Card 要注册骑升功能的卡
function
VgD
.
RideUp
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e1
:
SetCode
(
EVENT_PREDRAW
)
e1
:
SetCountLimit
(
1
,
VgID
)
e1
:
SetRange
(
LOCATION_ALL
)
e1
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e1
:
SetCondition
(
VgD
.
RideZeroCondition
)
e1
:
SetOperation
(
VgD
.
RideZeroOperation
)
c
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e2
:
SetCode
(
EVENT_PHASE
+
PHASE_STANDBY
)
e2
:
SetRange
(
LOCATION_ALL
)
e2
:
SetCountLimit
(
1
,
VgID
+
1
)
e2
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e2
:
SetCondition
(
VgD
.
RideUpCondition
)
e2
:
SetOperation
(
VgD
.
RideUpOperation
)
c
:
RegisterEffect
(
e2
)
end
function
VgD
.
RideUpMaterialCheck
(
c
,
rc
)
if
VgF
.
GetValueType
(
c
.
ride_material_code_chk
)
==
"nil"
and
VgF
.
GetValueType
(
c
.
ride_material_setcard_chk
)
==
"nil"
then
return
true
end
if
VgF
.
GetValueType
(
c
.
ride_material_code_chk
)
==
"number"
then
if
VgF
.
GetValueType
(
rc
.
ride_code
)
==
"number"
and
c
.
ride_material_code_chk
==
rc
.
ride_code
then
return
true
elseif
VgF
.
GetValueType
(
rc
.
ride_code
)
==
"tabel"
then
for
code
in
ipairs
(
rc
.
ride_code
)
do
if
c
.
ride_material_code_chk
==
code
then
return
true
end
end
end
return
c
.
ride_material_code_chk
==
rc
:
GetCode
()
elseif
VgF
.
GetValueType
(
c
.
ride_material_code_chk
)
==
"tabel"
then
for
i
in
ipairs
(
c
.
ride_material_code_chk
)
do
if
VgF
.
GetValueType
(
rc
.
ride_code
)
==
"number"
and
i
==
rc
.
ride_code
then
return
true
elseif
VgF
.
GetValueType
(
rc
.
ride_code
)
==
"tabel"
then
for
code
in
ipairs
(
rc
.
ride_code
)
do
if
i
==
code
then
return
true
end
end
end
if
rc
:
IsCode
(
i
)
then
return
true
end
end
end
if
VgF
.
GetValueType
(
c
.
ride_material_setcard_chk
)
==
"number"
then
if
VgF
.
GetValueType
(
rc
.
ride_setcard
)
==
"number"
and
c
.
ride_material_setcard_chk
==
rc
.
ride_setcard
then
return
true
elseif
VgF
.
GetValueType
(
rc
.
ride_setcard
)
==
"tabel"
then
for
setcard
in
ipairs
(
rc
.
ride_setcard
)
do
if
c
.
ride_material_code_chk
==
setcard
then
return
true
end
end
end
return
rc
:
IsSetCard
(
c
.
ride_material_setcard_chk
)
elseif
VgF
.
GetValueType
(
c
.
ride_material_setcard_chk
)
==
"tabel"
then
for
i
in
ipairs
(
c
.
ride_material_setcard_chk
)
do
if
VgF
.
GetValueType
(
rc
.
ride_setcard
)
==
"number"
and
i
==
rc
.
ride_setcard
then
return
true
elseif
VgF
.
GetValueType
(
rc
.
ride_setcard
)
==
"tabel"
then
for
setcard
in
ipairs
(
rc
.
ride_setcard
)
do
if
i
==
setcard
then
return
true
end
end
end
if
rc
:
IsSetCard
(
i
)
then
return
true
end
end
end
return
false
end
function
VgD
.
RideUpFilter1
(
c
,
lv
,
code
,
rc
)
local
tp
=
c
:
GetControler
()
if
not
c
:
IsType
(
TYPE_MONSTER
)
then
return
false
end
if
rc
:
IsAttribute
(
SKILL_SELF_RIDE
)
and
c
:
IsCode
(
code
)
then
return
false
end
if
(
c
:
IsLevel
(
lv
,
lv
+
1
)
and
c
:
IsLocation
(
LOCATION_HAND
))
then
return
VgD
.
RideUpMaterialCheck
(
c
,
rc
)
end
if
(
c
:
IsLevel
(
lv
+
1
)
and
c
:
IsLocation
(
LOCATION_RIDE
)
and
(
VgF
.
IsExistingMatchingCard
(
nil
,
tp
,
LOCATION_HAND
,
0
,
1
,
nil
)
or
(
Duel
.
IsPlayerAffectedByEffect
(
tp
,
AFFECT_CODE_OVERLAY_INSTEAD_WHEN_RIDE
)
and
VgF
.
GetVMonster
(
tp
):
GetOverlayCount
()
>
0
)))
then
return
VgD
.
RideUpMaterialCheck
(
c
,
rc
)
end
return
false
end
function
VgD
.
DisCardRideUpFilter
(
c
,
e
,
lv
,
code
,
rc
)
local
tp
=
c
:
GetControler
()
return
c
:
IsDiscardable
()
and
VgF
.
IsExistingMatchingCard
(
VgD
.
RideUpFilter1
,
tp
,
LOCATION_HAND
+
LOCATION_RIDE
,
0
,
1
,
c
,
lv
,
code
,
rc
)
end
function
VgD
.
RideUpFilter2
(
c
,
lv
,
code
,
rc
)
return
c
:
IsLevel
(
lv
)
and
c
:
IsType
(
TYPE_MONSTER
)
and
c
:
IsCode
(
code
)
and
rc
:
IsAttribute
(
SKILL_SELF_RIDE
)
end
function
VgD
.
RideUpCondition
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
rc
=
Duel
.
GetMatchingGroup
(
VgF
.
VMonsterFilter
,
tp
,
LOCATION_MZONE
,
0
,
nil
):
GetFirst
()
if
not
rc
then
return
false
end
local
lv
=
rc
:
GetLevel
()
local
code
=
rc
:
GetCode
()
local
rg1
=
Duel
.
GetMatchingGroup
(
VgD
.
RideUpFilter1
,
tp
,
LOCATION_HAND
+
LOCATION_RIDE
,
0
,
nil
,
lv
,
code
,
rc
)
local
rg2
=
Duel
.
GetMatchingGroup
(
VgD
.
RideUpFilter2
,
tp
,
LOCATION_HAND
,
0
,
nil
,
lv
,
code
,
rc
)
local
a
=
rg1
:
GetCount
()
>
0
local
b
=
rg2
:
GetCount
()
>
0
return
Duel
.
GetTurnPlayer
()
==
tp
and
VgF
.
RuleCardCondtion
(
e
)
and
(
a
or
b
)
end
function
VgD
.
RideUpOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
rc
=
VgF
.
GetVMonster
(
tp
)
if
not
rc
then
return
end
local
lv
=
rc
:
GetLevel
()
local
code
=
rc
:
GetCode
()
local
rg1
=
Duel
.
GetMatchingGroup
(
VgD
.
RideUpFilter1
,
tp
,
LOCATION_HAND
+
LOCATION_RIDE
,
0
,
nil
,
lv
,
code
,
rc
)
local
rg2
=
Duel
.
GetMatchingGroup
(
VgD
.
RideUpFilter2
,
tp
,
LOCATION_HAND
,
0
,
nil
,
lv
,
code
,
rc
)
local
a
=
rg1
:
GetCount
()
>
0
local
b
=
rg2
:
GetCount
()
>
0
local
off
=
1
local
ops
=
{}
if
a
then
ops
[
off
]
=
VgF
.
Stringid
(
VgID
,
3
)
off
=
off
+
1
end
if
b
then
ops
[
off
]
=
VgF
.
Stringid
(
VgID
,
4
)
off
=
off
+
1
end
ops
[
off
]
=
VgF
.
Stringid
(
VgID
,
5
)
local
sel
=
Duel
.
SelectOption
(
tp
,
table.unpack
(
ops
))
if
sel
==
0
and
a
then
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_CALL
)
local
sg
=
rg1
:
FilterSelect
(
tp
,
Card
.
IsLocation
,
1
,
1
,
nil
,
LOCATION_HAND
+
LOCATION_RIDE
)
local
sc
=
sg
:
GetFirst
()
if
sc
:
IsLocation
(
LOCATION_EXTRA
)
then
if
Duel
.
IsPlayerAffectedByEffect
(
tp
,
AFFECT_CODE_OVERLAY_INSTEAD_WHEN_RIDE
)
and
Duel
.
SelectYesNo
(
tp
,
VgF
.
Stringid
(
VgID
,
14
))
then
VgF
.
DamageCost
(
1
)(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
1
)
else
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_DISCARD
)
local
g
=
Duel
.
SelectMatchingCard
(
tp
,
VgD
.
DisCardRideUpFilter
,
tp
,
LOCATION_HAND
,
0
,
1
,
1
,
nil
,
e
,
lv
,
code
,
rc
)
VgF
.
Sendto
(
LOCATION_DROP
,
g
,
REASON_COST
+
REASON_DISCARD
)
end
end
local
mg
=
rc
:
GetOverlayGroup
()
if
mg
:
GetCount
()
~=
0
then
VgF
.
Sendto
(
LOCATION_OVERLAY
,
mg
,
sc
)
end
sc
:
SetMaterial
(
Group
.
FromCards
(
rc
))
VgF
.
Sendto
(
LOCATION_OVERLAY
,
Group
.
FromCards
(
rc
),
sc
)
VgF
.
Sendto
(
LOCATION_MZONE
,
sc
,
SUMMON_TYPE_RIDE
,
tp
,
0x20
)
if
VgF
.
IsExistingMatchingCard
(
Card
.
IsType
,
tp
,
LOCATION_RIDE
,
0
,
1
,
nil
,
TYPE_EMBLEM
)
then
local
tc
=
Duel
.
GetMatchingGroup
(
Card
.
IsType
,
tp
,
LOCATION_RIDE
,
0
,
nil
,
TYPE_EMBLEM
):
GetFirst
()
VgF
.
Sendto
(
LOCATION_EMBLEM
,
tc
,
tp
,
POS_FACEUP_DEFENSE
,
REASON_EFFECT
)
end
elseif
sel
==
0
or
(
sel
==
1
and
a
and
b
)
then
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_CALL
)
local
sg
=
rg2
:
Select
(
tp
,
1
,
1
,
nil
)
local
sc
=
sg
:
GetFirst
()
local
mg
=
rc
:
GetOverlayGroup
()
if
mg
:
GetCount
()
~=
0
then
VgF
.
Sendto
(
LOCATION_OVERLAY
,
mg
,
sg
)
end
sc
:
SetMaterial
(
Group
.
FromCards
(
rc
))
VgF
.
Sendto
(
LOCATION_OVERLAY
,
Group
.
FromCards
(
rc
),
sc
)
VgF
.
Sendto
(
LOCATION_MZONE
,
sc
,
SUMMON_TYPE_SELFRIDE
,
tp
,
0x20
)
Duel
.
Draw
(
tp
,
1
,
REASON_EFFECT
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_FIELD
)
e1
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
e1
:
SetTargetRange
(
LOCATION_MZONE
,
0
)
e1
:
SetValue
(
10000
)
e1
:
SetTarget
(
VgD
.
SelfRideAtk
)
e1
:
SetReset
(
RESET_PHASE
+
PHASE_END
)
Duel
.
RegisterEffect
(
e1
,
tp
)
end
end
function
VgD
.
SelfRideAtk
(
e
,
c
)
return
VgF
.
IsSequence
(
c
,
0
,
4
,
5
)
end
function
VgD
.
RideZeroCondition
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
rc
=
Duel
.
GetMatchingGroup
(
VgF
.
VMonsterFilter
,
tp
,
LOCATION_MZONE
,
0
,
nil
):
GetFirst
()
if
rc
then
return
false
end
local
ct
=
Duel
.
GetMatchingGroupCount
(
Card
.
IsLevel
,
tp
,
LOCATION_RIDE
,
0
,
nil
,
0
)
return
VgF
.
RuleTurnCondtion
(
e
)
and
ct
>
0
and
VgF
.
RuleCardCondtion
(
e
)
end
function
VgD
.
RideZeroOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
g
=
Duel
.
GetMatchingGroup
(
Card
.
IsLevel
,
tp
,
LOCATION_RIDE
,
0
,
nil
,
0
)
if
g
:
GetCount
()
>
0
then
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_CALL
)
g
=
g
:
Select
(
tp
,
1
,
1
,
nil
)
end
VgF
.
Sendto
(
LOCATION_MZONE
,
g
,
SUMMON_TYPE_RIDE
,
tp
,
0x20
)
end
---使卡片具有触发卡的功能,已包含在 vgd.VgCard(c) 内
---@param c Card 要注册触发功能的卡
function
VgD
.
CardTrigger
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
+
EFFECT_TYPE_TRIGGER_F
)
e1
:
SetProperty
(
EFFECT_FLAG_DELAY
+
EFFECT_CANNOT_DISABLE
+
EFFECT_FLAG_DAMAGE_STEP
)
e1
:
SetCode
(
EVENT_MOVE
)
e1
:
SetCondition
(
VgD
.
CardTriggerCondtion
(
'Damage'
))
e1
:
SetOperation
(
VgD
.
CardTriggerOperation
(
'Damage'
))
c
:
RegisterEffect
(
e1
)
local
e2
=
e1
:
Clone
()
e2
:
SetCondition
(
VgD
.
CardTriggerCondtion
(
'Normal'
))
e2
:
SetOperation
(
VgD
.
CardTriggerOperation
(
'Normal'
))
c
:
RegisterEffect
(
e2
)
local
e3
=
e1
:
Clone
()
e3
:
SetCondition
(
VgD
.
CardTriggerCondtion
(
'EffectDamage'
))
e3
:
SetOperation
(
VgD
.
CardTriggerOperation
(
'EffectDamage'
))
c
:
RegisterEffect
(
e3
)
end
function
VgD
.
CardTriggerCondtion
(
chkcon
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
if
chkcon
==
'EffectDamage'
then
return
c
:
IsLocation
(
LOCATION_TRIGGER
)
and
Duel
.
GetFlagEffect
(
tp
,
FLAG_EFFECT_DAMAGE
)
>
0
end
local
cp
=
tp
if
chkcon
==
'Damage'
then
cp
=
1
-
tp
end
return
Duel
.
GetAttacker
()
and
Duel
.
GetAttacker
():
GetControler
()
==
cp
and
c
:
IsLocation
(
LOCATION_TRIGGER
)
and
Duel
.
GetFlagEffect
(
tp
,
FLAG_EFFECT_DAMAGE
)
==
0
end
end
function
VgD
.
CardTriggerOperation
(
chkop
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
if
c
:
IsRace
(
TRIGGER_CRITICAL_STRIKE
)
then
local
g1
=
VgF
.
SelectMatchingCard
(
HINTMSG_CRITICAL_STRIKE
,
e
,
tp
,
nil
,
tp
,
LOCATION_MZONE
,
0
,
1
,
1
,
nil
)
VgF
.
StarUp
(
c
,
g1
,
1
,
nil
)
local
g2
=
VgF
.
SelectMatchingCard
(
HINTMSG_ATKUP
,
e
,
tp
,
nil
,
tp
,
LOCATION_MZONE
,
0
,
1
,
1
,
nil
)
VgF
.
AtkUp
(
c
,
g2
,
10000
,
nil
)
elseif
c
:
IsRace
(
TRIGGER_DRAW
)
then
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_ATKUP
,
e
,
tp
,
nil
,
tp
,
LOCATION_MZONE
,
0
,
1
,
1
,
nil
)
VgF
.
AtkUp
(
c
,
g
,
10000
,
nil
)
Duel
.
Draw
(
tp
,
1
,
REASON_TRIGGER
)
elseif
c
:
IsRace
(
TRIGGER_HEAL
)
then
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_ATKUP
,
e
,
tp
,
nil
,
tp
,
LOCATION_MZONE
,
0
,
1
,
1
,
nil
)
VgF
.
AtkUp
(
c
,
g
,
10000
,
nil
)
if
Duel
.
GetMatchingGroupCount
(
nil
,
tp
,
LOCATION_DAMAGE
,
0
,
nil
)
>=
Duel
.
GetMatchingGroupCount
(
nil
,
tp
,
0
,
LOCATION_DAMAGE
,
nil
)
then
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_TODROP
)
local
tc
=
Duel
.
SelectMatchingCard
(
tp
,
nil
,
tp
,
LOCATION_DAMAGE
,
0
,
1
,
1
,
nil
):
GetFirst
()
if
tc
then
VgF
.
Sendto
(
LOCATION_DROP
,
tc
,
REASON_TRIGGER
)
Duel
.
Recover
(
tp
,
1
,
REASON_RULE
)
end
end
elseif
c
:
IsRace
(
TRIGGER_ADVANCE
)
then
local
g
=
Duel
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
0
,
4
,
5
)
VgF
.
AtkUp
(
c
,
g
,
10000
,
nil
)
end
if
chkop
==
'Damage'
then
if
c
:
IsRace
(
TRIGGER_SUPER
)
then
local
ops
=
{}
local
sel
=
{}
if
c
:
IsRelateToEffect
(
e
)
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
3
))
table.insert
(
sel
,
function
()
VgF
.
Sendto
(
LOCATION_EXILE
,
c
,
REASON_TRIGGER
)
end
)
end
if
true
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
4
))
table.insert
(
sel
,
function
()
Duel
.
Draw
(
tp
,
1
,
REASON_TRIGGER
)
end
)
end
if
VgF
.
IsExistingMatchingCard
(
nil
,
tp
,
LOCATION_MZONE
,
0
,
1
,
nil
)
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
5
))
table.insert
(
sel
,
function
()
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_ATKUP
,
e
,
tp
,
nil
,
tp
,
LOCATION_MZONE
,
0
,
1
,
1
,
nil
)
VgF
.
AtkUp
(
c
,
g
,
100000000
,
nil
)
end
)
end
if
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
0
)
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
5
))
table.insert
(
sel
,
function
()
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
1
)
end
)
end
while
#
ops
>
0
do
local
i
=
Duel
.
SelectOption
(
tp
,
table.unpack
(
ops
))
+
1
sel
[
i
]()
table.remove
(
ops
,
i
)
table.remove
(
sel
,
i
)
end
else
if
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
0
)
then
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
1
)
end
if
c
:
IsRelateToEffect
(
e
)
then
VgF
.
Sendto
(
LOCATION_DAMAGE
,
c
,
tp
,
POS_FACEUP_ATTACK
,
REASON_EFFECT
)
Duel
.
Damage
(
tp
,
1
,
REASON_TRIGGER
)
end
end
local
bc
=
Duel
.
GetAttackTarget
()
local
label
=
bc
:
GetFlagEffectLabel
(
FLAG_DAMAGE_TRIGGER
)
if
not
label
then
return
end
if
label
>
0
then
label
=
label
-
1
Duel
.
RaiseEvent
(
c
,
EVENT_CUSTOM
+
EVENT_TRIGGER
,
e
,
0
,
tp
,
tp
,
0
)
bc
:
ResetFlagEffect
(
FLAG_DAMAGE_TRIGGER
)
bc
:
RegisterFlagEffect
(
FLAG_DAMAGE_TRIGGER
,
RESET_EVENT
+
RESETS_STANDARD
,
0
,
1
,
label
)
elseif
label
==
0
then
bc
:
ResetFlagEffect
(
FLAG_DAMAGE_TRIGGER
)
Duel
.
RaiseEvent
(
bc
,
EVENT_CUSTOM
+
EVENT_DAMAGE_TRIGGER
,
e
,
0
,
tp
,
tp
,
0
)
end
elseif
chkop
==
'Normal'
then
if
c
:
IsRace
(
TRIGGER_SUPER
)
then
local
ops
=
{}
local
sel
=
{}
if
c
:
IsRelateToEffect
(
e
)
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
3
))
table.insert
(
sel
,
function
()
VgF
.
Sendto
(
LOCATION_EXILE
,
c
,
REASON_TRIGGER
)
end
)
end
if
true
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
4
))
table.insert
(
sel
,
function
()
Duel
.
Draw
(
tp
,
1
,
REASON_TRIGGER
)
end
)
end
if
VgF
.
IsExistingMatchingCard
(
nil
,
tp
,
LOCATION_MZONE
,
0
,
1
,
nil
)
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
5
))
table.insert
(
sel
,
function
()
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_ATKUP
,
e
,
tp
,
nil
,
tp
,
LOCATION_MZONE
,
0
,
1
,
1
,
nil
)
VgF
.
AtkUp
(
c
,
g
,
100000000
,
nil
)
end
)
end
if
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
0
)
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
6
))
table.insert
(
sel
,
function
()
return
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
1
)
end
)
end
while
#
ops
>
0
do
local
i
=
Duel
.
SelectOption
(
tp
,
table.unpack
(
ops
))
+
1
sel
[
i
]()
table.remove
(
ops
,
i
)
table.remove
(
sel
,
i
)
end
else
if
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
0
)
then
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
1
)
end
if
c
:
IsRelateToEffect
(
e
)
then
VgF
.
Sendto
(
LOCATION_HAND
,
c
,
nil
,
REASON_TRIGGER
)
end
end
local
bc
=
Duel
.
GetAttacker
()
local
label
=
bc
:
GetFlagEffectLabel
(
FLAG_ATTACK_TRIGGER
)
if
not
label
then
return
end
if
label
>
1
then
label
=
label
-
1
Duel
.
RaiseEvent
(
c
,
EVENT_CUSTOM
+
EVENT_TRIGGER
,
e
,
0
,
tp
,
tp
,
0
)
bc
:
ResetFlagEffect
(
FLAG_ATTACK_TRIGGER
)
bc
:
RegisterFlagEffect
(
FLAG_ATTACK_TRIGGER
,
RESET_EVENT
+
RESETS_STANDARD
,
0
,
1
,
label
)
elseif
label
==
1
then
bc
:
ResetFlagEffect
(
FLAG_ATTACK_TRIGGER
)
end
else
if
c
:
IsRace
(
TRIGGER_SUPER
)
then
local
ops
=
{}
local
sel
=
{}
if
c
:
IsRelateToEffect
(
e
)
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
3
))
table.insert
(
sel
,
function
()
VgF
.
Sendto
(
LOCATION_EXILE
,
c
,
REASON_TRIGGER
)
end
)
end
if
true
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
4
))
table.insert
(
sel
,
function
()
Duel
.
Draw
(
tp
,
1
,
REASON_TRIGGER
)
end
)
end
if
VgF
.
IsExistingMatchingCard
(
nil
,
tp
,
LOCATION_MZONE
,
0
,
1
,
nil
)
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
5
))
table.insert
(
sel
,
function
()
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_ATKUP
,
e
,
tp
,
nil
,
tp
,
LOCATION_MZONE
,
0
,
1
,
1
,
nil
)
VgF
.
AtkUp
(
c
,
g
,
100000000
,
nil
)
end
)
end
if
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
0
)
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
5
))
table.insert
(
sel
,
function
()
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
1
)
end
)
end
while
#
ops
>
0
do
local
i
=
Duel
.
SelectOption
(
tp
,
table.unpack
(
ops
))
+
1
sel
[
i
]()
table.remove
(
ops
,
i
)
table.remove
(
sel
,
i
)
end
else
if
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
0
)
then
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
1
)
end
if
c
:
IsRelateToEffect
(
e
)
then
VgF
.
Sendto
(
LOCATION_DAMAGE
,
c
,
tp
,
POS_FACEUP_ATTACK
,
REASON_EFFECT
)
Duel
.
Damage
(
tp
,
1
,
REASON_EFFECT
)
end
end
if
VgF
.
GetValueType
(
VgF
.
EffectDamageE
)
~=
"Effect"
then
return
end
local
bc
=
VgF
.
EffectDamageE
:
GetHandler
()
local
label
=
bc
:
GetFlagEffectLabel
(
FLAG_DAMAGE_TRIGGER
)
if
not
label
then
return
end
if
label
>
0
then
label
=
label
-
1
Duel
.
RaiseEvent
(
c
,
EVENT_CUSTOM
+
EVENT_TRIGGER
,
e
,
0
,
tp
,
tp
,
0
)
bc
:
ResetFlagEffect
(
FLAG_DAMAGE_TRIGGER
)
bc
:
RegisterFlagEffect
(
FLAG_DAMAGE_TRIGGER
,
0
,
0
,
1
,
label
)
elseif
label
==
0
then
bc
:
ResetFlagEffect
(
FLAG_DAMAGE_TRIGGER
)
VgF
.
EffectDamageE
:
Reset
()
VgF
.
EffectDamageE
=
nil
end
end
end
end
function
VgD
.
OperationWhenCardTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
chk
)
local
effect_when_trigger
=
c
.
effect_when_trigger
local
cost
,
con
,
tg
=
true
,
true
,
true
if
not
effect_when_trigger
or
#
effect_when_trigger
==
0
then
return
end
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
VgF
.
GetValueType
(
effect_when_trigger
[
2
])
==
"function"
then
cost
=
effect_when_trigger
[
2
](
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
0
)
end
if
VgF
.
GetValueType
(
effect_when_trigger
[
3
])
==
"function"
then
con
=
effect_when_trigger
[
3
](
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
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
if
VgF
.
GetValueType
(
effect_when_trigger
[
1
])
==
"function"
and
cost
and
con
and
tg
then
if
chk
==
0
then
return
true
end
local
activate_chk
=
true
if
VgF
.
GetValueType
(
effect_when_trigger
[
2
])
==
"function"
then
activate_chk
=
Duel
.
SelectYesNo
(
tp
,
VgF
.
Stringid
(
VgID
,
15
))
end
if
activate_chk
then
Duel
.
HintSelection
(
Group
.
FromCards
(
c
))
local
_
,
m
=
c
:
GetOriginalCode
()
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
VgF
.
GetValueType
(
effect_when_trigger
[
4
])
==
"function"
then
effect_when_trigger
[
4
](
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
1
)
end
effect_when_trigger
[
1
](
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
end
end
return
false
end
---使卡片具有Call到R位的功能,已包含在 vgd.VgCard(c) 内
---@param c Card 要注册Call到R位功能的卡
function
VgD
.
CallToR
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetDescription
(
1152
)
e1
:
SetType
(
EFFECT_TYPE_FIELD
)
e1
:
SetCode
(
EFFECT_SPSUMMON_PROC
)
e1
:
SetRange
(
LOCATION_HAND
)
e1
:
SetProperty
(
EFFECT_FLAG_SPSUM_PARAM
)
e1
:
SetTargetRange
(
POS_FACEUP_ATTACK
,
0
)
e1
:
SetCondition
(
VgD
.
CallCondition
)
e1
:
SetOperation
(
VgD
.
CallOperation
)
c
:
RegisterEffect
(
e1
)
end
function
VgD
.
CallCondition
(
e
,
c
)
if
c
==
nil
then
return
true
end
local
tp
=
e
:
GetHandlerPlayer
()
if
VgF
.
GetAvailableLocation
(
tp
)
<=
0
then
return
end
return
VgF
.
LvCondition
(
e
)
end
function
VgD
.
CallFilter
(
c
,
tp
,
zone
)
return
VgF
.
RMonsterFilter
(
c
)
and
zone
==
VgF
.
SequenceToGlobal
(
tp
,
c
:
GetLocation
(),
c
:
GetSequence
())
end
function
VgD
.
CallOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
z
=
bit
.
bnot
(
VgF
.
GetAvailableLocation
(
tp
))
local
rg
=
Duel
.
GetMatchingGroup
(
Card
.
IsPosition
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
POS_FACEDOWN_ATTACK
)
for
tc
in
VgF
.
Next
(
rg
)
do
local
szone
=
VgF
.
SequenceToGlobal
(
tp
,
tc
:
GetLocation
(),
tc
:
GetSequence
())
z
=
bit
.
bor
(
z
,
szone
)
end
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_CallZONE
)
local
zone
=
Duel
.
SelectField
(
tp
,
1
,
LOCATION_MZONE
,
0
,
z
)
if
VgF
.
IsExistingMatchingCard
(
VgD
.
CallFilter
,
tp
,
LOCATION_MZONE
,
0
,
1
,
nil
,
tp
,
zone
)
then
local
tc
=
Duel
.
GetMatchingGroup
(
VgD
.
CallFilter
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
tp
,
zone
):
GetFirst
()
VgF
.
Sendto
(
LOCATION_DROP
,
tc
,
REASON_COST
)
end
e
:
SetValue
(
function
()
return
SUMMON_VALUE_CALL
,
zone
end
)
end
---使卡片遵守VG的战斗规则,已包含在 vgd.VgCard(c) 内
---@param c Card 要注册战斗规则的卡
function
VgD
.
MonsterBattle
(
c
)
--攻击转守备
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
+
EFFECT_TYPE_CONTINUOUS
)
e1
:
SetCode
(
EVENT_ATTACK_ANNOUNCE
)
e1
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e1
:
SetOperation
(
VgD
.
MonsterPosDefenseOperation
)
c
:
RegisterEffect
(
e1
)
--回合开始转攻
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e2
:
SetCode
(
EVENT_PREDRAW
)
e2
:
SetRange
(
LOCATION_ALL
)
e2
:
SetCountLimit
(
1
,
VgID
+
4
)
e2
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e2
:
SetCondition
(
VgF
.
RuleCardCondtion
)
e2
:
SetOperation
(
VgD
.
MonsterPosAttackOperation
)
c
:
RegisterEffect
(
e2
)
--扣血
local
e3
=
Effect
.
CreateEffect
(
c
)
e3
:
SetType
(
EFFECT_TYPE_SINGLE
+
EFFECT_TYPE_TRIGGER_F
)
e3
:
SetCode
(
EVENT_BATTLED
)
e3
:
SetRange
(
LOCATION_MZONE
)
e3
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e3
:
SetCondition
(
VgD
.
MonsterBattleDamageCondition
)
e3
:
SetOperation
(
VgD
.
MonsterBattleDamageOperation
)
c
:
RegisterEffect
(
e3
)
--攻击判定
local
e4
=
Effect
.
CreateEffect
(
c
)
e4
:
SetType
(
EFFECT_TYPE_QUICK_F
)
e4
:
SetRange
(
LOCATION_MZONE
)
e4
:
SetCode
(
EVENT_PRE_DAMAGE_CALCULATE
)
e4
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e4
:
SetCondition
(
VgD
.
MonsterAttackCondition
)
e4
:
SetCost
(
VgD
.
MonsterAttackCost
)
e4
:
SetOperation
(
VgD
.
TriggerCard
)
c
:
RegisterEffect
(
e4
)
--多次判定
local
e5
=
Effect
.
CreateEffect
(
c
)
e5
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_TRIGGER_F
)
e5
:
SetCode
(
EVENT_CUSTOM
+
EVENT_TRIGGER
)
e5
:
SetRange
(
LOCATION_MZONE
)
e5
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e5
:
SetCondition
(
VgD
.
MonsterNextTrigger
)
e5
:
SetOperation
(
VgD
.
TriggerCard
)
c
:
RegisterEffect
(
e5
)
--支援
local
e6
=
Effect
.
CreateEffect
(
c
)
e6
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_TRIGGER_O
)
e6
:
SetRange
(
LOCATION_MZONE
)
e6
:
SetCode
(
EVENT_ATTACK_ANNOUNCE
)
e6
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e6
:
SetCondition
(
VgD
.
SupportCondition
)
e6
:
SetOperation
(
VgD
.
SupportOperation
)
c
:
RegisterEffect
(
e6
)
local
e9
=
Effect
.
CreateEffect
(
c
)
e9
:
SetType
(
EFFECT_TYPE_SINGLE
)
e9
:
SetProperty
(
EFFECT_FLAG_SINGLE_RANGE
+
EFFECT_FLAG_CANNOT_DISABLE
)
e9
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
e9
:
SetRange
(
LOCATION_MZONE
)
e9
:
SetValue
(
VgD
.
SupportValue
)
c
:
RegisterEffect
(
e9
)
--防御
local
e7
=
Effect
.
CreateEffect
(
c
)
e7
:
SetCategory
(
CATEGORY_DEFENDER
)
e7
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_TRIGGER_O
)
e7
:
SetCode
(
EVENT_BATTLE_START
)
e7
:
SetRange
(
LOCATION_MZONE
+
LOCATION_HAND
)
e7
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e7
:
SetCountLimit
(
1
)
e7
:
SetCondition
(
VgD
.
SendToGCondition
)
e7
:
SetTarget
(
VgD
.
SendToGTarget
)
e7
:
SetOperation
(
VgD
.
SendToGOperation
)
c
:
RegisterEffect
(
e7
)
local
e8
=
Effect
.
CreateEffect
(
c
)
e8
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e8
:
SetCode
(
EVENT_DAMAGE_STEP_END
)
e8
:
SetProperty
(
EFFECT_FLAG_DAMAGE_STEP
+
EFFECT_FLAG_CANNOT_DISABLE
+
EFFECT_FLAG_DELAY
)
e8
:
SetRange
(
LOCATION_ALL
)
e8
:
SetCondition
(
VgF
.
RuleCardCondtion
)
e8
:
SetOperation
(
VgD
.
GToGraveOperation
)
c
:
RegisterEffect
(
e8
)
--其他永续
local
e10
=
Effect
.
CreateEffect
(
c
)
e10
:
SetType
(
EFFECT_TYPE_SINGLE
)
e10
:
SetCode
(
EFFECT_DEFENSE_ATTACK
)
e10
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e10
:
SetValue
(
1
)
c
:
RegisterEffect
(
e10
)
local
e11
=
Effect
.
CreateEffect
(
c
)
e11
:
SetType
(
EFFECT_TYPE_SINGLE
)
e11
:
SetCode
(
EFFECT_CANNOT_ATTACK_ANNOUNCE
)
e11
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e11
:
SetCondition
(
VgD
.
MonsterAttackAnnounceCondition
)
c
:
RegisterEffect
(
e11
)
local
e12
=
Effect
.
CreateEffect
(
c
)
e12
:
SetType
(
EFFECT_TYPE_SINGLE
)
e12
:
SetCode
(
EFFECT_CANNOT_DIRECT_ATTACK
)
e12
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
c
:
RegisterEffect
(
e12
)
local
e13
=
Effect
.
CreateEffect
(
c
)
e13
:
SetType
(
EFFECT_TYPE_SINGLE
)
e13
:
SetCode
(
EFFECT_AVOID_BATTLE_DAMAGE
)
e13
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e13
:
SetValue
(
1
)
c
:
RegisterEffect
(
e13
)
local
e14
=
Effect
.
CreateEffect
(
c
)
e14
:
SetType
(
EFFECT_TYPE_SINGLE
)
e14
:
SetProperty
(
EFFECT_FLAG_SINGLE_RANGE
+
EFFECT_FLAG_CANNOT_DISABLE
)
e14
:
SetRange
(
LOCATION_MZONE
)
e14
:
SetCode
(
EFFECT_INDESTRUCTABLE_BATTLE
)
e14
:
SetCondition
(
VgD
.
MonsterCannotBeDestoryCondition
)
e14
:
SetValue
(
1
)
c
:
RegisterEffect
(
e14
)
local
e15
=
Effect
.
CreateEffect
(
c
)
e15
:
SetType
(
EFFECT_TYPE_SINGLE
)
e15
:
SetCode
(
EFFECT_EXTRA_ATTACK
)
e15
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e15
:
SetValue
(
100
)
c
:
RegisterEffect
(
e15
)
local
e16
=
Effect
.
CreateEffect
(
c
)
e16
:
SetType
(
EFFECT_TYPE_SINGLE
)
e16
:
SetCode
(
EFFECT_CANNOT_BE_BATTLE_TARGET
)
e16
:
SetProperty
(
EFFECT_FLAG_SINGLE_RANGE
+
EFFECT_FLAG_CANNOT_DISABLE
)
e16
:
SetRange
(
LOCATION_MZONE
)
e16
:
SetCondition
(
VgD
.
MonsterCannotBeAttackedCondition
)
e16
:
SetValue
(
VgF
.
True
)
c
:
RegisterEffect
(
e16
)
end
function
VgD
.
TriggerCard
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
tg
=
Duel
.
GetDecktopGroup
(
tp
,
1
)
Duel
.
DisableShuffleCheck
()
VgF
.
Sendto
(
LOCATION_TRIGGER
,
tg
:
GetFirst
())
end
function
VgD
.
MonsterPosDefenseOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
Duel
.
ChangePosition
(
c
,
POS_FACEUP_DEFENSE
)
local
label
=
1
if
c
:
IsAttribute
(
SKILL_TWICE_TRIGGER
)
then
label
=
label
+
1
elseif
c
:
IsAttribute
(
SKILL_THRICE_TRIGGER
)
then
label
=
label
+
2
end
c
:
RegisterFlagEffect
(
FLAG_ATTACK_TRIGGER
,
RESET_EVENT
+
RESETS_STANDARD
,
0
,
1
,
label
)
Duel
.
RaiseEvent
(
c
,
EVENT_CUSTOM
+
EVENT_TRIGGERCOUNTUP
,
e
,
0
,
tp
,
tp
,
0
)
end
function
VgD
.
MonsterPosAttackOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
g
=
Duel
.
GetMatchingGroup
(
Card
.
IsPosition
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
POS_FACEUP_DEFENSE
)
if
g
:
GetCount
()
>
0
and
Duel
.
GetTurnPlayer
()
==
tp
then
Duel
.
ChangePosition
(
g
,
POS_FACEUP_ATTACK
)
Duel
.
Hint
(
HINT_LINES
,
tp
,
VgF
.
Stringid
(
VgID
,
8
))
end
end
function
VgD
.
MonsterBattleDamageCondition
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
bc
=
c
:
GetBattleTarget
()
if
not
bc
or
not
bc
:
IsRelateToBattle
()
then
return
false
end
local
atk
=
bc
:
GetAttack
()
local
def
=
c
:
GetAttack
()
if
Duel
.
GetAttackTarget
():
GetFlagEffect
(
FLAG_DEFENSE_ENTIRELY
)
>
0
and
Duel
.
GetAttackTarget
():
GetFlagEffectLabel
(
FLAG_DEFENSE_ENTIRELY
)
==
10402017
and
bc
:
IsLevelBelow
(
2
)
then
return
false
end
if
Duel
.
GetAttackTarget
():
GetFlagEffect
(
FLAG_DEFENSE_ENTIRELY
)
>
0
and
Duel
.
GetAttackTarget
():
GetFlagEffectLabel
(
FLAG_DEFENSE_ENTIRELY
)
==
0
then
return
false
end
return
VgF
.
VMonsterFilter
(
c
)
and
c
==
Duel
.
GetAttackTarget
()
and
atk
>=
def
and
bc
:
GetLeftScale
()
>
0
end
function
VgD
.
MonsterBattleDamageOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
bc
=
Duel
.
GetAttacker
()
local
label
=
bc
:
GetLeftScale
()
-
1
bc
:
RegisterFlagEffect
(
FLAG_DAMAGE_TRIGGER
,
RESET_EVENT
+
RESETS_STANDARD
,
0
,
1
,
label
)
VgD
.
TriggerCard
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
end
function
VgD
.
MonsterNextTrigger
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
return
VgF
.
ReturnCard
(
eg
):
GetControler
()
==
tp
and
VgF
.
VMonsterFilter
(
c
)
and
Duel
.
GetFlagEffect
(
tp
,
FLAG_EFFECT_DAMAGE
)
==
0
end
function
VgD
.
SupportCondition
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
return
VgF
.
GetColumnGroup
(
Duel
.
GetAttacker
()):
IsContains
(
e
:
GetHandler
())
and
Duel
.
GetTurnPlayer
()
==
tp
and
e
:
GetHandler
():
IsAttribute
(
SKILL_SUPPORT
)
end
function
VgD
.
SupportOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
Duel
.
ChangePosition
(
c
,
POS_FACEUP_DEFENSE
)
c
:
RegisterFlagEffect
(
FLAG_SUPPORT
,
RESET_EVENT
+
RESETS_STANDARD
,
0
,
1
)
Duel
.
GetAttacker
():
RegisterFlagEffect
(
FLAG_SUPPORTED
,
RESET_EVENT
+
RESETS_STANDARD
,
0
,
1
)
Duel
.
RaiseEvent
(
c
,
EVENT_CUSTOM
+
EVENT_SUPPORT
,
e
,
0
,
tp
,
tp
,
0
)
end
function
VgD
.
SupportValue
(
e
)
local
tp
=
e
:
GetHandlerPlayer
()
local
atk
=
0
if
Duel
.
GetAttacker
()
==
e
:
GetHandler
()
then
local
g
=
Duel
.
GetMatchingGroup
(
function
(
c
)
return
c
:
GetFlagEffect
(
FLAG_SUPPORT
)
>
0
end
,
tp
,
LOCATION_MZONE
,
0
,
nil
)
for
tc
in
VgF
.
Next
(
g
)
do
atk
=
atk
+
tc
:
GetAttack
()
end
return
atk
elseif
Duel
.
GetAttackTarget
()
==
e
:
GetHandler
()
then
local
g
=
Duel
.
GetMatchingGroup
(
nil
,
tp
,
LOCATION_GZONE
,
0
,
nil
)
for
tc
in
VgF
.
Next
(
g
)
do
local
def
=
tc
:
GetDefense
()
if
def
<
0
then
def
=
0
end
atk
=
atk
+
def
end
return
atk
else
return
0
end
end
function
VgD
.
SendToGCondition
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
bc
=
Duel
.
GetAttackTarget
()
return
bc
and
bc
:
IsControler
(
tp
)
and
bc
~=
c
end
function
VgD
.
SendToGTarget
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
local
c
=
e
:
GetHandler
()
if
chk
==
0
then
return
VgF
.
IsAbleToGZone
(
c
)
end
end
function
VgD
.
SendToGOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
VgF
.
Sendto
(
LOCATION_GZONE
,
c
,
tp
,
POS_FACEUP
,
REASON_EFFECT
)
end
function
VgD
.
GToGraveOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
g
=
Duel
.
GetFieldGroup
(
tp
,
LOCATION_GZONE
,
0
)
if
g
:
GetCount
()
>
0
then
VgF
.
Sendto
(
LOCATION_DROP
,
g
,
REASON_RULE
)
end
end
function
VgD
.
MonsterAttackAnnounceCondition
(
e
,
c
)
return
e
:
GetHandler
():
IsPosition
(
POS_DEFENSE
)
or
(
VgF
.
IsSequence
(
e
:
GetHandler
(),
1
,
2
,
3
)
and
e
:
GetHandler
():
GetFlagEffect
(
FLAG_ATTACK_AT_REAR
)
==
0
)
end
function
VgD
.
MonsterAttackCondition
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
if
not
VgF
.
VMonsterFilter
(
c
)
and
c
:
GetFlagEffect
(
FLAG_ALSO_CAN_TRIGGER
)
==
0
then
return
false
end
local
a
=
c
:
GetFlagEffectLabel
(
FLAG_ATTACK_TRIGGER
)
and
c
:
GetFlagEffectLabel
(
FLAG_ATTACK_TRIGGER
)
>
0
return
a
and
Duel
.
GetAttacker
()
==
c
end
function
VgD
.
MonsterAttackCost
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
local
c
=
e
:
GetHandler
()
if
chk
==
0
then
return
c
:
GetFlagEffect
(
FLAG_COUNT_TRIGGER
)
==
0
end
c
:
RegisterFlagEffect
(
FLAG_COUNT_TRIGGER
,
RESET_EVENT
+
RESETS_STANDARD
+
RESET_PHASE
+
PHASE_DAMAGE_CAL
,
0
,
1
)
end
function
VgD
.
MonsterCannotBeDestoryCondition
(
e
)
local
c
=
e
:
GetHandler
()
return
VgF
.
VMonsterFilter
(
c
)
or
Duel
.
GetAttacker
()
==
e
:
GetHandler
()
end
function
VgD
.
MonsterCannotBeAttackedCondition
(
e
,
c
)
return
VgF
.
IsSequence
(
e
:
GetHandler
(),
1
,
2
,
3
)
end
--起自永以外关键字----------------------------------------------------------------------------------------
---使卡片具有超限舞装的功能
---@param c Card 要注册超限舞装功能的卡
---@param filter number 卡名为 filter 的后防者,或符合 filter 的后防者等
---@return Effect 这个效果
function
VgD
.
OverDress
(
c
,
filter
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetDescription
(
VgF
.
Stringid
(
VgID
,
9
))
e1
:
SetType
(
EFFECT_TYPE_FIELD
)
e1
:
SetCode
(
EFFECT_SPSUMMON_PROC
)
e1
:
SetRange
(
LOCATION_HAND
)
e1
:
SetProperty
(
EFFECT_FLAG_SPSUM_PARAM
)
e1
:
SetTargetRange
(
POS_FACEUP_ATTACK
,
0
)
e1
:
SetCondition
(
VgD
.
OverDressCondition
(
filter
))
e1
:
SetOperation
(
VgD
.
OverDressOperation
(
filter
))
c
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetType
(
EFFECT_TYPE_SINGLE
+
EFFECT_TYPE_CONTINUOUS
)
e2
:
SetCode
(
EVENT_SPSUMMON_SUCCESS
)
e2
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e2
:
SetOperation
(
VgD
.
OverDressSum
)
c
:
RegisterEffect
(
e2
)
return
e1
end
function
VgD
.
OverDressCondition
(
filter
)
return
function
(
e
,
c
)
if
c
==
nil
then
return
true
end
local
tp
=
e
:
GetHandlerPlayer
()
return
VgF
.
LvCondition
(
e
)
and
VgF
.
IsExistingMatchingCard
(
VgD
.
OverDressFilter
,
tp
,
LOCATION_MZONE
,
0
,
1
,
nil
,
filter
)
end
end
function
VgD
.
OverDressFilter
(
c
,
filter
,
tp
,
zone
)
if
not
c
:
IsFaceup
()
then
return
false
end
if
zone
and
zone
~=
VgF
.
SequenceToGlobal
(
tp
,
c
:
GetLocation
(),
c
:
GetSequence
())
then
return
false
end
return
not
filter
or
(
type
(
filter
)
==
"function"
and
filter
(
c
))
or
(
type
(
filter
)
==
"number"
and
c
:
IsCode
(
filter
))
end
function
VgD
.
OverDressOperation
(
filter
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
g
=
Duel
.
GetMatchingGroup
(
VgD
.
OverDressFilter
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
filter
,
tp
)
local
zone
,
szone
=
0
,
0
for
tc
in
VgF
.
Next
(
g
)
do
zone
=
bit
.
bor
(
zone
,
VgF
.
SequenceToGlobal
(
tp
,
tc
:
GetLocation
(),
tc
:
GetSequence
()))
end
if
zone
==
0
then
return
end
zone
=
bit
.
bnot
(
zone
)
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_CallZONE
)
szone
=
Duel
.
SelectField
(
tp
,
1
,
LOCATION_MZONE
,
0
,
zone
)
e
:
SetValue
(
function
()
return
SUMMON_VALUE_CALL
+
SUMMON_VALUE_OverDress
,
szone
end
)
local
mg
=
Duel
.
GetMatchingGroup
(
VgD
.
OverDressFilter
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
filter
,
tp
,
szone
)
if
#
mg
==
0
then
return
end
local
og
=
tc
:
GetOverlayGroup
()
if
#
og
~=
0
then
VgF
.
Sendto
(
LOCATION_OVERLAY
,
og
,
c
)
end
c
:
SetMaterial
(
Group
.
FromCards
(
tc
))
VgF
.
Sendto
(
LOCATION_OVERLAY
,
mg
,
c
)
end
end
function
VgD
.
OverDressSum
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
e
:
GetHandler
():
RegisterFlagEffect
(
FLAG_CONDITION
,
RESET_EVENT
+
RESETS_STANDARD
,
EFFECT_FLAG_CLIENT_HINT
,
1
,
201
,
VgF
.
Stringid
(
10101006
,
0
))
end
---使卡片具有交织超限舞装的功能
---@param c Card 要注册交织超限舞装功能的卡
---@param filter number 卡名为 filter 的后防者,或符合 filter 的后防者等
---@return Effect 这个效果
function
VgD
.
XOverDress
(
c
,
filter
)
end
---使卡片具有舞装加身的功能
---@param c Card 要注册舞装加身功能的卡
---@param code number 指定卡的卡号
---@return Effect 这个效果
function
VgD
.
DressUp
(
c
,
code
)
local
e
=
Effect
.
CreateEffect
(
c
)
e
:
SetType
(
EFFECT_TYPE_SINGLE
)
e
:
SetCode
(
EFFECT_ADD_CODE
)
e
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
+
EFFECT_FLAG_UNCOPYABLE
)
e
:
SetValue
(
code
)
c
:
RegisterEffect
(
e
)
return
e
end
--指令卡相关----------------------------------------------------------------------------------------
---使卡片可以作为指令卡发动
---@param c Card 要注册指令卡功能的卡
---@param m number|nil 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
---@param op function|nil 作为指令卡的效果
---@param cost function|nil 作为指令卡的发动费用
---@param con function|nil 作为指令卡的发动条件
---@return Effect 这个效果
function
VgD
.
SpellActivate
(
c
,
m
,
op
,
cost
,
con
)
-- check func
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"SpellActivate"
,
c
)
if
fchk
.
con
(
con
)
or
fchk
.
cost
(
cost
)
or
fchk
.
op
(
op
)
then
return
end
-- set param
m
=
m
or
c
:
GetOriginalCode
()
-- set effect
local
e
=
Effect
.
CreateEffect
(
c
)
e
:
SetDescription
(
VgF
.
Stringid
(
m
,
0
))
e
:
SetType
(
EFFECT_TYPE_ACTIVATE
)
e
:
SetCode
(
EVENT_FREE_CHAIN
)
e
:
SetCondition
(
VgD
.
SpellCondtion
(
con
))
e
:
SetCost
(
VgD
.
MixCost
(
cost
))
e
:
SetTarget
(
VgD
.
SpellTarget
)
e
:
SetOperation
(
VgD
.
SpellOperation
(
op
))
c
:
RegisterEffect
(
e
)
return
e
end
function
VgD
.
SpellCondtion
(
con
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
return
VgF
.
LvCondition
(
e
)
and
(
not
con
or
con
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
))
end
end
function
VgD
.
MixCost
(
cost
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
cost
=
cost
or
aux
.
TRUE
local
c
=
e
:
GetHandler
()
local
alchemagic_g
=
Duel
.
GetMatchingGroup
(
VgD
.
MixCostFilter
,
tp
,
LOCATION_DROP
,
0
,
nil
,
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
)
local
alchemagic_chk
=
Duel
.
IsPlayerAffectedByEffect
(
tp
,
AFFECT_CODE_MIX
)
and
#
alchemagic_g
>
0
local
cost_chk
=
cost
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
0
)
if
chk
==
0
then
return
cost_chk
or
alchemagic_chk
end
if
alchemagic_chk
and
(
not
cost_chk
or
Duel
.
SelectYesNo
(
tp
,
VgF
.
Stringid
(
VgID
,
6
)))
then
local
alchemagic_c
=
alchemagic_g
:
Select
(
tp
,
1
,
1
,
nil
):
GetFirst
()
VgF
.
Sendto
(
LOCATION_LOCK
,
alchemagic_c
,
POS_FACEUP
,
REASON_COST
)
e
:
SetLabelObject
(
alchemagic_c
)
VgD
.
MixCostOperation
(
c
,
alchemagic_c
,
tp
)
else
cost
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
1
)
end
end
end
function
VgD
.
MixCostFilter
(
c
,
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
mc
)
if
Duel
.
IsPlayerAffectedByEffect
(
tp
,
AFFECT_CODE_MIX_DIFFERENT_NAME
)
and
c
:
IsCode
(
mc
:
GetCode
())
then
return
false
end
--得到需要支付的费用(从哪来,几张卡,什么卡)
local
cfrom
,
cval
,
cfilter
,
mcfrom
,
mcval
,
mcfilter
table
.
copy
(
cfrom
,
c
.
cos_from
)
table
.
copy
(
cval
,
c
.
cos_val
)
table
.
copy
(
cfilter
,
c
.
cos_filter
)
table
.
copy
(
mcfrom
,
mc
.
cos_from
)
table
.
copy
(
mcval
,
mc
.
cos_val
)
table
.
copy
(
mcfilter
,
mc
.
cos_filter
)
--如果都有费用要付,则合成费用
if
#
cfrom
>
0
and
#
mcfrom
>
0
then
for
cv
=
1
,
#
cfrom
do
local
c_cost_from
=
VgF
.
ShiftLocationFromString
(
cfrom
[
cv
])
local
pos
=
0
for
mcv
=
1
,
#
mcfrom
do
local
mc_cost_from
=
VgF
.
ShiftLocationFromString
(
mcfrom
[
mcv
])
if
mc_cost_from
==
c_cost_from
then
local
mc_cos_val
=
mcval
[
mcv
]
local
c_cos_val
=
cval
[
cv
]
if
VgF
.
GetValueType
(
mc_cos_val
)
~=
"number"
then
mc_cos_val
=
0
end
if
VgF
.
GetValueType
(
c_cos_val
)
~=
"number"
then
c_cos_val
=
0
end
local
both_cos_val
=
mc_cos_val
+
c_cos_val
--判断其他减少费用的效果
if
mc_cost_from
==
LOCATION_OVERLAY
and
Duel
.
GetFlagEffect
(
tp
,
AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX
)
>
0
then
mc_cos_val
,
c_cos_val
,
both_cos_val
=
0
,
0
,
0
end
local
mcg
=
VgF
.
GetMatchingGroup
(
mcfilter
[
mcv
],
tp
,
mc_cost_from
,
0
,
c
,
e
,
tp
)
local
cg
=
VgF
.
GetMatchingGroup
(
cfilter
[
cv
],
tp
,
c_cost_from
,
0
,
mc
,
e
,
tp
)
local
a
=
mcg
:
GetCount
()
<
mc_cos_val
local
b
=
cg
:
GetCount
()
<
c_cos_val
if
mc_cost_from
==
LOCATION_DAMAGE
and
Duel
.
GetFlagEffect
(
tp
,
10402010
)
>
0
then
local
c_10402010
=
Duel
.
GetFlagEffectLabel
(
tp
,
10402010
)
if
both_cos_val
>
c_10402010
then
both_cos_val
=
both_cos_val
-
c_10402010
else
both_cos_val
=
0
end
if
a
then
if
mc_cos_val
-
mcg
:
GetCount
()
<=
c_10402010
then
a
=
false
c_10402010
=
c_10402010
-
(
mc_cos_val
-
mcg
:
GetCount
())
end
end
if
b
then
if
c_cos_val
-
cg
:
GetCount
()
<=
c_10402010
then
b
=
false
c_10402010
=
c_10402010
-
(
c_cos_val
-
cg
:
GetCount
())
end
end
end
--判断是否足够支付费用
if
a
or
b
then
return
false
end
mcg
:
Merge
(
cg
)
if
mcg
:
GetCount
()
<
both_cos_val
then
return
false
end
pos
=
mcv
end
end
--如果合成了,则删去已合成的内容
if
pos
>
0
then
table.remove
(
mcfrom
,
pos
)
table.remove
(
mcval
,
pos
)
table.remove
(
mcfilter
,
pos
)
--如果没有合成,则在原费用上操作
else
local
c_cos_val
=
cval
[
cv
]
if
VgF
.
GetValueType
(
c_cos_val
)
~=
"number"
then
c_cos_val
=
0
end
--判断其他减少费用的效果
if
c_cost_from
==
LOCATION_OVERLAY
and
Duel
.
GetFlagEffect
(
tp
,
AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX
)
>
0
then
c_cos_val
=
0
end
if
c_cost_from
==
LOCATION_DAMAGE
and
Duel
.
GetFlagEffect
(
tp
,
10402010
)
>
0
then
local
c_10402010
=
Duel
.
GetFlagEffectLabel
(
tp
,
10402010
)
if
c_cos_val
>
c_10402010
then
c_cos_val
=
c_cos_val
-
c_10402010
else
c_cos_val
=
0
end
end
local
cg
=
VgF
.
GetMatchingGroup
(
cfilter
[
cv
],
tp
,
c_cost_from
,
0
,
mc
,
e
,
tp
)
if
cg
:
GetCount
()
<
c_cos_val
then
return
false
end
end
end
--如果本体需要支付而合成的卡不需要支付
elseif
#
mcfrom
>
0
then
for
mcv
=
1
,
#
mcfrom
do
local
mc_cost_from
=
VgF
.
ShiftLocationFromString
(
mcfrom
[
mcv
])
local
mc_cos_val
=
mcval
[
mcv
]
if
VgF
.
GetValueType
(
mc_cos_val
)
~=
"number"
then
mc_cos_val
=
0
end
--判断其他减少费用的效果
if
mc_cost_from
==
LOCATION_OVERLAY
and
Duel
.
GetFlagEffect
(
tp
,
AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX
)
>
0
then
mc_cos_val
=
0
end
local
mcg
=
VgF
.
GetMatchingGroup
(
mcfilter
[
mcv
],
tp
,
mc_cost_from
,
0
,
c
,
e
,
tp
)
if
mc_cost_from
==
LOCATION_DAMAGE
and
Duel
.
GetFlagEffect
(
tp
,
10402010
)
>
0
then
local
c_10402010
=
Duel
.
GetFlagEffectLabel
(
tp
,
10402010
)
if
mc_cos_val
>
c_10402010
then
mc_cos_val
=
mc_cos_val
-
c_10402010
else
mc_cos_val
=
0
end
end
--判断是否足够支付费用
if
mcg
:
GetCount
()
<
mc_cos_val
then
return
false
end
end
--如果本体不需要支付而合成的卡需要支付
elseif
#
cfrom
>
0
then
for
cv
=
1
,
#
cfrom
do
local
c_cost_from
=
VgF
.
ShiftLocationFromString
(
cfrom
[
cv
])
local
c_cos_val
=
mcval
[
cv
]
if
VgF
.
GetValueType
(
c_cos_val
)
~=
"number"
then
c_cos_val
=
0
end
--判断其他减少费用的效果
if
c_cost_from
==
LOCATION_OVERLAY
and
Duel
.
GetFlagEffect
(
tp
,
AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX
)
>
0
then
c_cos_val
=
0
end
local
cg
=
VgF
.
GetMatchingGroup
(
cfilter
[
cv
],
tp
,
c_cost_from
,
0
,
c
,
e
,
tp
)
if
c_cost_from
==
LOCATION_DAMAGE
and
Duel
.
GetFlagEffect
(
tp
,
10402010
)
>
0
then
local
c_10402010
=
Duel
.
GetFlagEffectLabel
(
tp
,
10402010
)
if
c_cos_val
>
c_10402010
then
c_cos_val
=
c_cos_val
-
c_10402010
else
c_cos_val
=
0
end
end
--判断是否足够支付费用
if
cg
:
GetCount
()
<
c_cos_val
then
return
false
end
end
--都不需要支付
else
return
true
end
return
VgF
.
LvCondition
(
c
)
end
function
VgD
.
MixCostOperation
(
c
,
bc
,
tp
)
--得到需要支付的费用(从哪来,到哪去,最少几张卡,最多几张卡,什么卡)
local
cfrom
,
cto
,
cval
,
cval_max
,
cfilter
,
bcfrom
,
bcto
,
bcval
,
bcval_max
,
bcfilter
table
.
copy
(
cfrom
,
c
.
cos_from
)
table
.
copy
(
cto
,
c
.
cos_to
)
table
.
copy
(
cval
,
c
.
cos_val
)
table
.
copy
(
cval_max
,
c
.
cos_val_max
)
table
.
copy
(
cfilter
,
bc
.
cos_filter
)
table
.
copy
(
bcfrom
,
bc
.
cos_from
)
table
.
copy
(
bcto
,
bc
.
cos_to
)
table
.
copy
(
bcval
,
bc
.
cos_val
)
table
.
copy
(
bcval_max
,
bc
.
cos_val_max
)
table
.
copy
(
bcfilter
,
bc
.
cos_filter
)
local
g_from
=
{}
local
g_to
=
{}
local
g_filter_c
=
{}
local
g_filter_bc
=
{}
local
g_val_c
=
{}
local
g_val_bc
=
{}
local
g_val_c_max
=
{}
local
g_val_bc_max
=
{}
local
except_group
=
Group
.
FromCards
(
c
,
bc
)
--在这里合成
if
#
bcfrom
>
0
and
#
cfrom
>
0
then
for
bcv
=
1
,
#
bcfrom
do
local
bc_cost_from
=
VgF
.
ShiftLocationFromString
(
bcfrom
[
bcv
])
local
pos
=
0
for
cv
=
1
,
#
cfrom
do
local
c_cost_from
=
VgF
.
ShiftLocationFromString
(
cfrom
[
cv
])
if
bc_cost_from
==
c_cost_from
and
VgF
.
ShiftLocationFromString
(
cto
[
cv
])
==
VgF
.
ShiftLocationFromString
(
bcto
[
bcv
])
then
pos
=
bcv
table.insert
(
g_from
,
cfrom
[
cv
])
table.insert
(
g_to
,
cto
[
cv
])
table.insert
(
g_filter_c
,
cfilter
[
cv
])
table.insert
(
g_filter_bc
,
bcfilter
[
bcv
])
if
VgF
.
GetValueType
(
cval
[
cv
])
==
"number"
then
table.insert
(
g_val_c
,
cval
[
cv
])
else
table.insert
(
g_val_c
,
0
)
end
if
VgF
.
GetValueType
(
bcval
[
bcv
])
==
"number"
then
table.insert
(
g_val_bc
,
bcval
[
bcv
])
else
table.insert
(
g_val_bc
,
0
)
end
if
VgF
.
GetValueType
(
cval_max
[
cv
])
==
"number"
then
table.insert
(
g_val_c_max
,
cval_max
[
cv
])
else
table.insert
(
g_val_c_max
,
0
)
end
if
VgF
.
GetValueType
(
bcval_max
[
bcv
])
==
"number"
then
table.insert
(
g_val_bc_max
,
bcval_max
[
bcv
])
else
table.insert
(
g_val_bc_max
,
0
)
end
end
end
if
pos
>
0
then
table.remove
(
bcfrom
,
pos
)
table.remove
(
bcto
,
pos
)
table.remove
(
bcval
,
pos
)
table.remove
(
bcval_max
,
pos
)
table.remove
(
bcfilter
,
pos
)
else
table.insert
(
g_from
,
bcfrom
[
bcv
])
table.insert
(
g_to
,
bcto
[
bcv
])
table.insert
(
g_filter_c
,
VgF
.
False
())
table.insert
(
g_filter_bc
,
bcfilter
[
bcv
])
table.insert
(
g_val_c
,
0
)
if
VgF
.
GetValueType
(
bcval
[
bcv
])
==
"number"
then
table.insert
(
g_val_bc
,
bcval
[
bcv
])
else
table.insert
(
g_val_bc
,
0
)
end
table.insert
(
g_val_c_max
,
0
)
if
VgF
.
GetValueType
(
bcval_max
[
bcv
])
==
"number"
then
table.insert
(
g_val_bc_max
,
bcval_max
[
bcv
])
else
table.insert
(
g_val_bc_max
,
0
)
end
end
end
elseif
#
bcfrom
>
0
then
for
bcv
=
1
,
#
bcfrom
do
table.insert
(
g_from
,
bcfrom
[
bcv
])
table.insert
(
g_to
,
bcto
[
bcv
])
table.insert
(
g_filter_c
,
VgF
.
False
())
table.insert
(
g_filter_bc
,
bcfilter
[
bcv
])
table.insert
(
g_val_c
,
0
)
if
VgF
.
GetValueType
(
bcval
[
bcv
])
==
"number"
then
table.insert
(
g_val_bc
,
bcval
[
bcv
])
else
table.insert
(
g_val_bc
,
0
)
end
table.insert
(
g_val_c_max
,
0
)
if
VgF
.
GetValueType
(
bcval_max
[
bcv
])
==
"number"
then
table.insert
(
g_val_bc_max
,
bcval_max
[
bcv
])
else
table.insert
(
g_val_bc_max
,
0
)
end
end
elseif
#
cfrom
>
0
then
for
cv
=
1
,
#
cfrom
do
table.insert
(
g_from
,
cfrom
[
cv
])
table.insert
(
g_to
,
cto
[
cv
])
table.insert
(
g_filter_c
,
cfilter
[
cv
])
table.insert
(
g_filter_bc
,
VgF
.
False
())
if
VgF
.
GetValueType
(
cval
[
cv
])
==
"number"
then
table.insert
(
g_val_c
,
cval
[
cv
])
else
table.insert
(
g_val_c
,
0
)
end
table.insert
(
g_val_bc
,
0
)
if
VgF
.
GetValueType
(
cval_max
[
cv
])
==
"number"
then
table.insert
(
g_val_c_max
,
cval_max
[
cv
])
else
table.insert
(
g_val_c_max
,
0
)
end
table.insert
(
g_val_bc_max
,
0
)
end
end
--开始支付合成完的费用
for
i
=
1
,
#
g_from
do
local
tg_from
=
VgF
.
ShiftLocationFromString
(
g_from
[
i
])
local
tg_to
=
VgF
.
ShiftLocationFromString
(
g_to
[
i
])
local
tg
=
VgF
.
GetMatchingGroup
(
nil
,
tp
,
tg_from
,
0
,
except_group
)
local
tg_filter_c
=
g_filter_c
[
i
]
local
tg_filter_bc
=
g_filter_bc
[
i
]
local
tg_val_c
=
g_val_c
[
i
]
local
tg_val_bc
=
g_val_bc
[
i
]
local
tg_val_c_max
=
g_val_c_max
[
i
]
local
tg_val_bc_max
=
g_val_bc_max
[
i
]
local
hintmsg
=
HINTMSG_SELECT
local
ext_params
=
{}
if
tg_val_c_max
<
tg_val_c
then
tg_val_c_max
=
tg_val_c
end
if
tg_val_bc_max
<
tg_val_bc
then
tg_val_bc_max
=
tg_val_bc
end
--判断其他减少费用的效果
--继承的少女 亨德莉娜
if
tg_from
==
LOCATION_OVERLAY
and
Duel
.
GetFlagEffect
(
tp
,
AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX
)
>
0
then
if
tg
:
GetCount
()
<
tg_val_c
+
tg_val_bc
or
tg
:
FilterCount
(
tg_filter_c
,
nil
)
<
tg_val_c
or
tg
:
FilterCount
(
tg_filter_bc
,
nil
)
<
tg_val_bc
then
Duel
.
ResetFlagEffect
(
tp
,
AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX
)
goto
continue
elseif
Duel
.
SelectYesNo
(
tp
,
VgF
.
Stringid
(
10401023
,
1
))
then
Duel
.
ResetFlagEffect
(
tp
,
AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX
)
goto
continue
end
end
--鬼首狩灵
if
tg_from
==
LOCATION_DAMAGE
and
Duel
.
GetFlagEffect
(
tp
,
10402010
)
>
0
then
local
c_10402010
=
Duel
.
GetFlagEffectLabel
(
tp
,
10402010
)
local
filter_count_c
=
tg
:
FilterCount
(
tg_filter_c
,
nil
)
local
filter_count_bc
=
tg
:
FilterCount
(
tg_filter_bc
,
nil
)
if
filter_count_c
<
tg_val_c
and
tg_val_c
-
filter_count_c
<=
c_10402010
then
c_10402010
=
c_10402010
-
(
tg_val_c
-
filter_count_c
)
tg_val_c
=
filter_count_c
end
if
filter_count_bc
<
tg_val_bc
and
tg_val_bc
-
filter_count_bc
<=
c_10402010
then
c_10402010
=
c_10402010
-
(
tg_val_bc
-
filter_count_bc
)
tg_val_bc
=
filter_count_bc
end
if
filter_count_c
<
tg_val_c
or
filter_count_bc
<
tg_val_bc
then
Debug
.
Message
(
"There is a value error in mixing costs"
)
goto
continue
else
Duel
.
ResetFlagEffect
(
tp
,
10402010
)
end
end
if
tg
:
GetCount
()
<
tg_val_c
+
tg_val_bc
then
goto
continue
end
if
VgF
.
GetValueType
(
tg_to
)
==
"number"
then
if
tg_to
==
LOCATION_DROP
then
if
tg_from
==
LOCATION_MZONE
then
hintmsg
=
HINTMSG_LEAVEFIELD
elseif
tg_from
==
LOCATION_OVERLAY
then
hintmsg
=
HINTMSG_REMOVEXYZ
else
hintmsg
=
HINTMSG_TODROP
end
ext_params
=
{
REASON_COST
}
elseif
bit
.
band
(
tg_to
,
LOCATION_LOCK
)
>
0
then
hintmsg
=
HINTMSG_LOCK
if
bit
.
band
(
tg_to
,
POS_FACEUP
)
>
0
then
ext_params
=
{
POS_FACEUP
,
REASON_COST
}
end
if
bit
.
band
(
tg_to
,
POS_FACEDOWN
)
>
0
then
ext_params
=
{
POS_FACEDOWN
,
REASON_COST
}
end
elseif
bit
.
band
(
tg_to
,
LOCATION_EXILE
)
>
0
then
hintmsg
=
HINTMSG_REMOVE
if
bit
.
band
(
tg_to
,
POS_FACEUP
)
>
0
then
ext_params
=
{
tp
,
POS_FACEUP
,
REASON_COST
}
end
if
bit
.
band
(
tg_to
,
POS_FACEDOWN
)
>
0
then
ext_params
=
{
tp
,
POS_FACEDOWN
,
REASON_COST
}
end
elseif
tg_to
==
LOCATION_DECK
then
hintmsg
=
HINTMSG_TODECK
ext_params
=
{
tp
,
SEQ_DECKSHUFFLE
,
REASON_COST
}
elseif
tg_to
==
LOCATION_HAND
then
hintmsg
=
HINTMSG_ATOHAND
ext_params
=
{
nil
,
REASON_COST
}
elseif
tg_to
==
LOCATION_OVERLAY
then
hintmsg
=
HINTMSG_XMATERIAL
ext_params
=
{
VgF
.
GetVMonster
(
tp
)}
end
elseif
VgF
.
GetValueType
(
tg_to
)
==
"string"
and
tg_to
==
"POSCHANGE"
then
hintmsg
=
HINTMSG_POSCHANGE
end
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
hintmsg
)
local
sg
=
tg
:
SelectDoubleSubGroup
(
tp
,
tg_filter_c
,
tg_val_c
,
tg_val_c_max
,
tg_filter_bc
,
tg_val_bc
,
tg_val_bc_max
,
Group
.
FromCards
(
c
,
bc
))
if
VgF
.
GetValueType
(
tg_to
)
==
"string"
and
tg_to
==
"POSCHANGE"
and
tg_from
==
LOCATION_DAMAGE
then
Duel
.
ChangePosition
(
sg
,
POS_FACEDOWN_ATTACK
,
POS_FACEUP_ATTACK
)
elseif
VgF
.
GetValueType
(
tg_to
)
==
"string"
and
tg_to
==
"POSCHANGE"
and
tg_from
~=
LOCATION_DAMAGE
then
Duel
.
ChangePosition
(
sg
,
POS_FACEUP_DEFENCE
,
POS_FACEDOWN_ATTACK
,
POS_FACEUP_ATTACK
,
POS_FACEDOWN_DEFENCE
)
elseif
VgF
.
GetValueType
(
tg_to
)
==
"number"
then
VgF
.
Sendto
(
tg_to
,
sg
,
table.unpack
(
ext_params
))
end
::
continue
::
end
end
function
VgD
.
SpellTarget
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
local
ct1
=
Duel
.
GetFlagEffectLabel
(
tp
,
FLAG_SPELL_COUNT_LIMIT
)
or
1
local
ct2
=
Duel
.
GetFlagEffectLabel
(
tp
,
FLAG_SPELL_USED_COUNT
)
or
0
if
chk
==
0
then
return
ct2
<
ct1
end
Duel
.
RegisterFlagEffect
(
tp
,
FLAG_SPELL_USED_COUNT
,
RESET_PHASE
+
PHASE_END
,
0
,
1
,
ct2
+
1
)
end
function
VgD
.
SpellOperation
(
op
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
no_alchemagic
)
if
op
then
op
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
true
)
end
local
mc
=
e
:
GetLabelObject
()
if
no_alchemagic
or
not
mc
then
return
end
local
alchemagic_op
=
mc
:
GetActivateEffect
():
GetOperation
()
if
alchemagic_op
then
alchemagic_op
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
true
)
end
end
end
---使卡片可以作为闪现指令卡发动
---@param c Card 要注册闪现指令卡功能的卡
---@param op function|nil 作为指令卡的效果
---@param cost function|nil 作为指令卡的发动费用
---@param con function|nil 作为指令卡的发动条件
---@param tg function|nil 作为指令卡的发动检查
---@return Effect 这个效果
function
VgD
.
QuickSpell
(
c
,
op
,
cost
,
con
,
tg
)
-- check func
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"QuickSpell"
,
c
)
if
fchk
.
con
(
con
)
or
fchk
.
cost
(
cost
)
or
fchk
.
tg
(
tg
)
or
fchk
.
op
(
op
)
then
return
end
-- set param
local
condition
=
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
bc
=
Duel
.
GetAttackTarget
()
return
bc
and
bc
:
IsControler
(
tp
)
and
VgD
.
SpellCondtion
(
con
)(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
end
-- set effect
local
e
=
Effect
.
CreateEffect
(
c
)
e
:
SetType
(
EFFECT_TYPE_ACTIVATE
)
e
:
SetCode
(
EVENT_BATTLE_START
)
e
:
SetCondition
(
condition
)
if
cost
then
e
:
SetCost
(
cost
)
end
if
tg
then
e
:
SetTarget
(
tg
)
end
if
op
then
e
:
SetOperation
(
op
)
end
c
:
RegisterEffect
(
e
)
return
e
end
---使卡片可以作为设置指令卡发动
---@param c Card 要注册设置指令卡功能的卡
---@param cost function|nil 作为指令卡的发动费用
---@param con function|nil 作为指令卡的发动条件
---@param tg function|nil 作为指令卡的发动检查
---@return Effect 这个效果
function
VgD
.
ContinuousSpell
(
c
,
cost
,
con
,
tg
)
-- check func
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"ContinuousSpell"
,
c
)
if
fchk
.
con
(
con
)
or
fchk
.
cost
(
cost
)
or
fchk
.
tg
(
tg
)
then
return
end
-- set param
local
operation
=
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
VgF
.
Sendto
(
LOCATION_ORDER
,
e
:
GetHandler
(),
tp
,
POS_FACEUP_ATTACK
,
REASON_RULE
)
end
-- set effect
local
e
=
Effect
.
CreateEffect
(
c
)
e
:
SetType
(
EFFECT_TYPE_ACTIVATE
)
e
:
SetCode
(
EVENT_FREE_CHAIN
)
e
:
SetCountLimit
(
1
,
VgID
+
EFFECT_COUNT_CODE_OATH
)
e
:
SetCondition
(
VgD
.
SpellCondtion
(
con
))
if
cost
then
e
:
SetCost
(
cost
)
end
if
tg
then
e
:
SetTarget
(
tg
)
end
e
:
SetOperation
(
operation
)
c
:
RegisterEffect
(
e
)
return
e
end
--自相关----------------------------------------------------------------------------------------
---【自】效果模板:当单位在loc时,code时点被触发时执行的效果
---@param c Card 拥有这个效果的卡
---@param m number|nil 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
---@param loc number 可以发动的区域
---@param typ number 若是自己状态变化引发,则填EFFECT_TYPE_SINGLE;<br>若是场上任意一卡状态变化引发,则填EFFECT_TYPE_FIELD。
---@param code number 触发的时点
---@param op function|nil 这个效果的处理函数
---@param cost function|nil 这个效果的费用函数
---@param con function|nil 这个效果的条件函数
---@param tg function|nil 这个效果的检查函数
---@param count number|nil 同一回合内最多发动的次数
---@param property number|nil 这个效果的特殊属性。
---@param id number|nil 提示脚本的卡号索引
---@return Effect 这个效果
function
VgD
.
EffectTypeTrigger
(
c
,
m
,
loc
,
typ
,
code
,
op
,
cost
,
con
,
tg
,
count
,
property
,
id
)
-- check func
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"EffectTypeTrigger"
,
c
)
if
fchk
.
con
(
con
)
or
fchk
.
cost
(
cost
)
or
fchk
.
tg
(
tg
)
or
fchk
.
op
(
op
)
then
return
end
-- set param
m
=
m
or
c
:
GetOriginalCode
()
_G
[
"c"
..
m
].
is_has_trigger
=
true
typ
=
(
typ
or
EFFECT_TYPE_SINGLE
)
+
(
cost
and
EFFECT_TYPE_TRIGGER_O
or
EFFECT_TYPE_TRIGGER_F
)
loc
,
con
=
VgF
.
GetLocCondition
(
loc
,
con
)
-- set effect
local
e
=
Effect
.
CreateEffect
(
c
)
e
:
SetDescription
(
VgF
.
Stringid
(
VgID
+
1
,
id
or
1
))
e
:
SetType
(
typ
)
e
:
SetCode
(
code
)
e
:
SetRange
(
loc
)
e
:
SetProperty
((
property
or
0
)
+
EFFECT_FLAG_DAMAGE_STEP
+
EFFECT_FLAG_DELAY
)
if
count
then
e
:
SetCountLimit
(
count
)
end
e
:
SetCondition
(
con
)
if
cost
then
e
:
SetCost
(
cost
)
end
if
tg
then
e
:
SetTarget
(
tg
)
end
if
op
then
e
:
SetOperation
(
op
)
end
c
:
RegisterEffect
(
e
)
return
e
end
---【自】攻击击中时触发
---@param c Card 拥有这个效果的卡
---@param m number|nil 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
---@param loc number 可以发动的区域
---@param typ number 若是自己状态变化引发,则填EFFECT_TYPE_SINGLE;<br>若是场上任意一卡状态变化引发,则填EFFECT_TYPE_FIELD
---@param op function|nil 这个效果的处理函数
---@param cost function|nil 这个效果的费用函数
---@param con function|nil 这个效果的条件函数
---@param tg function|nil 这个效果的检查函数
---@param count number|nil 同一回合内最多发动的次数
---@param p number|nil 被击中的卡的控制者
---@param property number|nil 这个效果的特殊属性。
---@param id number|nil 提示脚本的卡号索引
---@return Effect 这个效果 *回传两个效果*
function
VgD
.
EffectTypeTriggerWhenHitting
(
c
,
m
,
loc
,
typ
,
op
,
cost
,
con
,
tg
,
count
,
p
,
property
,
id
)
-- check func
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"EffectTypeTriggerWhenHitting"
,
c
)
if
fchk
.
con
(
con
)
or
fchk
.
cost
(
cost
)
or
fchk
.
tg
(
tg
)
or
fchk
.
op
(
op
)
then
return
end
-- set param
typ
=
typ
or
EFFECT_TYPE_SINGLE
-- set effect
local
e1
=
VgD
.
EffectTypeTrigger
(
c
,
m
,
loc
,
typ
,
EVENT_BATTLE_DESTROYING
,
op
,
cost
,
con
,
tg
,
count
,
property
,
id
)
local
e2
=
VgD
.
EffectTypeTrigger
(
c
,
m
,
loc
,
EFFECT_TYPE_FIELD
,
EVENT_CUSTOM
+
EVENT_DAMAGE_TRIGGER
,
op
,
cost
,
VgD
.
EffectTypeTriggerWhenHittingCon
(
typ
,
con
,
p
),
tg
,
count
,
property
,
id
)
return
e1
,
e2
end
function
VgD
.
EffectTypeTriggerWhenHittingCon
(
typ
,
con
,
p
)
return
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
eg
:
GetFirst
():
IsControler
(
p
or
e
:
GetOwner
():
GetControl
())
then
return
false
end
return
typ
==
EFFECT_TYPE_FIELD
or
Duel
.
GetAttacker
()
==
e
:
GetHandler
()
end
end
---【自】这个单位被放置到G时触发
---@param c Card 拥有这个效果的卡
---@param m number|nil 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
---@param op function|nil 这个效果的处理函数
---@param cost function|nil 这个效果的费用函数
---@param con function|nil 这个效果的条件函数
---@return Effect 这个效果
function
VgD
.
CardToG
(
c
,
m
,
op
,
cost
,
con
)
-- check func
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"CardToG"
,
c
)
if
fchk
.
con
(
con
)
or
fchk
.
cost
(
cost
)
or
fchk
.
op
(
op
)
then
return
end
-- set param
m
=
m
or
c
:
GetOriginalCode
()
_G
[
"c"
..
m
].
is_has_trigger
=
true
local
typ
=
cost
and
EFFECT_TYPE_TRIGGER_O
or
EFFECT_TYPE_TRIGGER_F
op
=
op
or
VgD
.
CardToGOperation
-- set effect
local
e
=
Effect
.
CreateEffect
(
c
)
e
:
SetDescription
(
VgF
.
Stringid
(
VgID
,
2
))
e
:
SetType
(
EFFECT_TYPE_SINGLE
+
typ
)
e
:
SetProperty
(
EFFECT_FLAG_DELAY
+
EFFECT_FLAG_DAMAGE_STEP
)
e
:
SetCode
(
EVENT_MOVE
)
if
cost
then
e
:
SetCost
(
cost
)
end
e
:
SetCondition
(
VgD
.
CardToGCondition
(
con
))
e
:
SetOperation
(
op
)
c
:
RegisterEffect
(
e
)
return
e
end
function
VgD
.
CardToGCondition
(
con
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
return
(
not
con
or
con
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
))
and
e
:
GetHandler
():
IsLocation
(
LOCATION_GZONE
)
and
Duel
.
GetAttackTarget
()
end
end
function
VgD
.
CardToGOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
tc
=
Duel
.
GetAttackTarget
()
if
vgf
.
RMonsterFilter
(
tc
)
then
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_SINGLE_RANGE
)
e1
:
SetRange
(
LOCATION_MZONE
)
e1
:
SetCode
(
EFFECT_INDESTRUCTABLE_BATTLE
)
e1
:
SetReset
(
RESET_EVENT
+
RESETS_STANDARD
)
e1
:
SetValue
(
1
)
tc
:
RegisterEffect
(
e1
)
vgf
.
EffectReset
(
c
,
e1
,
EVENT_BATTLED
)
elseif
vgf
.
VMonsterFilter
(
tc
)
then
tc
:
RegisterFlagEffect
(
FLAG_DEFENSE_ENTIRELY
,
RESET_EVENT
+
RESETS_STANDARD
,
0
,
1
)
end
end
---【自】这个单位被 Ride 时触发
---@param c Card 被Ride的卡
---@param m number|nil 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
---@param filter number|nil Ride c 的卡
---@param op function|nil 这个效果的处理函数
---@param cost function|nil 这个效果的费用函数
---@param con function|nil 这个效果的条件函数
---@param tg function|nil 这个效果的检查函数
---@param id number|nil 提示脚本的卡号索引
---@return Effect 这个效果
function
VgD
.
BeRidedByCard
(
c
,
m
,
filter
,
op
,
cost
,
con
,
tg
,
id
)
-- check func
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"BeRidedByCard"
,
c
)
if
fchk
.
con
(
con
)
or
fchk
.
cost
(
cost
)
or
fchk
.
tg
(
tg
)
or
fchk
.
op
(
op
)
then
return
end
-- set param
m
=
m
or
c
:
GetOriginalCode
()
_G
[
"c"
..
m
].
is_has_trigger
=
true
local
desc
=
VgF
.
Stringid
(
m
,
id
or
2
)
-- set effect
local
e
=
Effect
.
CreateEffect
(
c
)
e
:
SetType
(
EFFECT_TYPE_SINGLE
+
EFFECT_TYPE_CONTINUOUS
)
e
:
SetCode
(
EVENT_BE_MATERIAL
)
e
:
SetProperty
(
EFFECT_FLAG_EVENT_PLAYER
)
e
:
SetCondition
(
VgD
.
BeRidedByCardCondition
(
con
,
filter
))
e
:
SetOperation
(
VgD
.
BeRidedByCardOperation
(
desc
,
op
,
cost
,
tg
))
c
:
RegisterEffect
(
e
)
return
e
end
function
VgD
.
BeRidedByCardCondition
(
con
,
filter
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
if
r
~=
REASON_RIDEUP
or
(
con
and
not
con
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
))
then
return
false
end
local
c
,
rc
=
e
:
GetHandler
(),
e
:
GetHandler
():
GetReasonCard
()
filter
=
filter
or
vgf
.
True
if
type
(
filter
)
==
"number"
then
filter
=
function
(
c
,
rc
)
return
rc
:
IsCode
(
filter
)
end
end
return
filter
(
c
:
GetReasonCard
(),
c
)
end
end
function
VgD
.
BeRidedByCardOperation
(
desc
,
op
,
cost
,
tg
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
rc
=
c
:
GetReasonCard
()
local
typ
=
cost
and
EFFECT_TYPE_TRIGGER_O
or
EFFECT_TYPE_TRIGGER_F
local
e
=
Effect
.
CreateEffect
(
rc
)
e
:
SetDescription
(
desc
)
e
:
SetType
(
typ
+
EFFECT_TYPE_FIELD
)
e
:
SetProperty
(
EFFECT_FLAG_DELAY
+
EFFECT_FLAG_IGNORE_IMMUNE
)
e
:
SetCode
(
EVENT_SPSUMMON_SUCCESS
)
e
:
SetLabelObject
(
c
)
e
:
SetRange
(
LOCATION_MZONE
)
e
:
SetCondition
(
VgD
.
BeRidedByCardOpCondtion
)
if
cost
then
e
:
SetCost
(
cost
)
end
if
tg
then
e
:
SetTarget
(
tg
)
end
if
op
then
e
:
SetOperation
(
op
)
end
e
:
SetReset
(
RESET_EVENT
+
RESETS_STANDARD
)
rc
:
RegisterEffect
(
e
)
end
end
function
VgD
.
BeRidedByCardOpCondtion
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetLabelObject
()
return
eg
:
GetFirst
()
==
e
:
GetHandler
()
and
e
:
GetHandler
():
GetOverlayGroup
():
IsContains
(
c
)
end
---【自】这个单位被RIDE时,你是后攻的话,抽1张卡。
---@param c Card 拥有这个效果的卡
---@return Effect 这个效果
function
VgD
.
Grade0BeRide
(
c
)
return
vgd
.
BeRidedByCard
(
c
,
nil
,
nil
,
VgD
.
Grade0BeRideOperation
,
nil
,
VgD
.
Grade0BeRideCondition
)
end
function
VgD
.
Grade0BeRideCondition
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
return
tp
==
1
and
Duel
.
GetTurnPlayer
()
==
tp
end
function
VgD
.
Grade0BeRideOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
Duel
.
Draw
(
tp
,
1
,
REASON_EFFECT
)
end
--起相关----------------------------------------------------------------------------------------
---【起】效果模板:当单位在loc时,可以发动的【起】效果
---@param c Card 要触发效果的卡
---@param m number|nil 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
---@param loc number 可以发动的区域
---@param op function|nil 这个效果的处理函数
---@param cost function|nil 这个效果的费用函数
---@param con function|nil 这个效果的条件函数
---@param tg function|nil 这个效果的检查函数
---@param count number|nil 同一回合内最多发动的次数
---@param property number|nil 这个效果的特殊属性。
---@param id number|nil 提示脚本的卡号索引
---@return Effect 这个效果
function
VgD
.
EffectTypeIgnition
(
c
,
m
,
loc
,
op
,
cost
,
con
,
tg
,
count
,
property
,
id
)
-- check func
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"EffectTypeIgnition"
,
c
)
if
fchk
.
con
(
con
)
or
fchk
.
cost
(
cost
)
or
fchk
.
tg
(
tg
)
or
fchk
.
op
(
op
)
then
return
end
-- set param
m
=
m
or
c
:
GetOriginalCode
()
_G
[
"c"
..
m
].
is_has_ignition
=
true
loc
,
con
=
VgF
.
GetLocCondition
(
loc
,
con
)
-- set effect
local
e
=
Effect
.
CreateEffect
(
c
)
e
:
SetDescription
(
VgF
.
Stringid
(
VgID
+
2
,
id
or
1
))
e
:
SetType
(
EFFECT_TYPE_IGNITION
)
e
:
SetRange
(
loc
)
if
property
then
e
:
SetProperty
(
property
)
end
if
count
then
e
:
SetCountLimit
(
count
)
end
e
:
SetCondition
(
con
)
if
cost
then
e
:
SetCost
(
cost
)
end
if
tg
then
e
:
SetTarget
(
tg
)
end
if
op
then
e
:
SetOperation
(
op
)
end
c
:
RegisterEffect
(
e
)
return
e
end
--永相关----------------------------------------------------------------------------------------
---【永】效果模板
---@param c Card 效果的创建者
---@param m number|nil 效果的创建者的卡号
---@param loc number 生效的区域
---@param typ number 只影响自己,则填EFFECT_TYPE_SINGLE;<br>影响场上,则填EFFECT_TYPE_FIELD。
---@param code number 触发的效果
---@param val number 触发的效果的数值
---@param con function|nil 这个效果的条件函数
---@param tg function|nil 这个效果的影响目标(全域)
---@param loc_self number|nil 这个效果影响的自己区域,影响全域范围才需填
---@param loc_op number|nil 这个效果影响的对方区域,影响全域范围才需填
---@param reset number|nil 效果的重置条件
---@param hc Card|nil 效果的拥有者, 没有则为 c
---@return Effect 这个效果
function
VgD
.
EffectTypeContinuous
(
c
,
m
,
loc
,
typ
,
code
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
hc
)
-- check func
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"EffectTypeContinuous"
,
c
)
if
fchk
.
con
(
con
)
or
fchk
.
tg
(
tg
)
then
return
end
-- set param
local
cm
=
_G
[
"c"
..
(
m
or
c
:
GetOriginalCode
())]
cm
.
is_has_continuous
=
cm
.
is_has_continuous
or
not
reset
loc
,
con
=
VgF
.
GetLocCondition
(
loc
,
con
)
hc
=
hc
or
c
-- set effect
local
e
=
Effect
.
CreateEffect
(
c
)
e
:
SetType
(
typ
or
EFFECT_TYPE_SINGLE
)
e
:
SetCode
(
code
)
e
:
SetRange
(
loc
)
if
typ
==
EFFECT_TYPE_FIELD
then
e
:
SetTargetRange
(
loc_self
or
0
,
loc_op
or
0
)
end
e
:
SetCondition
(
con
)
e
:
SetValue
(
val
)
if
tg
then
e
:
SetTarget
(
tg
)
end
if
reset
then
e
:
SetReset
(
RESET_EVENT
+
RESETS_STANDARD
+
reset
)
end
hc
:
RegisterEffect
(
e
)
return
e
end
---【永】力量数值变更
---@param c Card 效果的创建者
---@param m number|nil 效果的创建者的卡号
---@param loc number 生效的区域
---@param typ number 只影响自己,则填EFFECT_TYPE_SINGLE;<br>影响场上,则填EFFECT_TYPE_FIELD。
---@param val number 变更的数值
---@param con function|nil 这个效果的条件函数
---@param tg function|nil 这个效果的影响目标(全域)
---@param loc_self number|nil 这个效果影响的自己区域,影响全域范围才需填
---@param loc_op number|nil 这个效果影响的对方区域,影响全域范围才需填
---@param reset number|nil 效果的重置条件
---@param hc Card|nil 效果的拥有者, 没有则为 c
---@return Effect 这个效果
function
VgD
.
EffectTypeContinuousChangeAttack
(
c
,
m
,
loc
,
typ
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
hc
)
return
VgD
.
EffectTypeContinuous
(
c
,
m
,
loc
,
typ
,
EFFECT_UPDATE_ATTACK
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
hc
)
end
---【永】盾护数值变更
---@param c Card 效果的创建者
---@param m number|nil 效果的创建者的卡号
---@param typ number 只影响自己,则填EFFECT_TYPE_SINGLE;<br>影响场上,则填EFFECT_TYPE_FIELD。
---@param val number 变更的数值
---@param con function|nil 这个效果的条件函数
---@param tg function|nil 这个效果的影响目标(全域)
---@param loc_self number|nil 这个效果影响的自己区域,影响全域范围才需填
---@param loc_op number|nil 这个效果影响的对方区域,影响全域范围才需填
---@param reset number|nil 效果的重置条件
---@param hc Card|nil 效果的拥有者, 没有则为 c
---@return Effect 这个效果
function
VgD
.
EffectTypeContinuousChangeDefense
(
c
,
m
,
typ
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
hc
)
return
VgD
.
EffectTypeContinuous
(
c
,
m
,
LOCATION_GZONE
,
typ
,
EFFECT_UPDATE_DEFENSE
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
hc
)
end
---【永】暴击数值变更
---@param c Card 效果的创建者
---@param m number|nil 效果的创建者的卡号
---@param typ number 只影响自己,则填EFFECT_TYPE_SINGLE;<br>影响场上,则填EFFECT_TYPE_FIELD。
---@param val number 变更的数值
---@param con function|nil 这个效果的条件函数
---@param tg function|nil 这个效果的影响目标(全域)
---@param loc_self number|nil 这个效果影响的自己区域,影响全域范围才需填
---@param loc_op number|nil 这个效果影响的对方区域,影响全域范围才需填
---@param reset number|nil 效果的重置条件
---@param hc Card|nil 效果的拥有者, 没有则为 c
---@return Effect 两个效果
function
VgD
.
EffectTypeContinuousChangeStar
(
c
,
m
,
typ
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
hc
)
local
e1
=
VgD
.
EffectTypeContinuous
(
c
,
m
,
LOCATION_MZONE
,
typ
,
EFFECT_UPDATE_LSCALE
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
hc
)
local
e2
=
VgD
.
EffectTypeContinuous
(
c
,
m
,
LOCATION_MZONE
,
typ
,
EFFECT_UPDATE_RSCALE
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
hc
)
return
e1
,
e2
end
---【永】驱动数值变更
---@param c Card 效果的创建者
---@param m number|nil 效果的创建者的卡号
---@param num number 变更的数值
---@param con function|nil 这个效果的条件函数
---@param reset number|nil 效果的重置条件
---@param hc Card|nil 效果的拥有者, 没有则为 c
---@return Effect 这个效果
function
VgD
.
TriggerCountUp
(
c
,
m
,
num
,
con
,
reset
,
hc
)
-- check func
if
VgF
.
IllegalFunctionCheck
(
"TriggerCountUp"
,
c
).
con
(
con
)
then
return
end
-- set param
local
cm
=
_G
[
"c"
..
(
m
or
c
:
GetOriginalCode
())]
cm
.
is_has_continuous
=
cm
.
is_has_continuous
or
not
reset
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
VgF
.
ReturnCard
(
eg
)
==
e
:
GetHandler
()
end
hc
=
hc
and
VgF
.
ReturnCard
(
hc
)
or
c
-- set effect
local
e
=
Effect
.
CreateEffect
(
c
)
e
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e
:
SetRange
(
LOCATION_MZONE
)
e
:
SetCode
(
EVENT_CUSTOM
+
EVENT_TRIGGERCOUNTUP
)
e
:
SetProperty
(
EFFECT_FLAG_DELAY
)
e
:
SetCondition
(
condition
)
if
reset
then
e
:
SetReset
(
RESET_EVENT
+
RESETS_STANDARD
+
reset
)
end
e
:
SetOperation
(
VgD
.
TriggerCountUpOperation
(
num
))
hc
:
RegisterEffect
(
e
)
return
e
end
function
VgD
.
TriggerCountUpOperation
(
num
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
label
=
c
:
GetFlagEffectLabel
(
FLAG_ATTACK_TRIGGER
)
if
not
label
then
label
=
0
end
label
=
label
+
num
if
label
<
0
then
label
=
0
end
c
:
ResetFlagEffect
(
FLAG_ATTACK_TRIGGER
)
c
:
RegisterFlagEffect
(
FLAG_ATTACK_TRIGGER
,
RESET_EVENT
+
RESETS_STANDARD
,
0
,
1
,
label
)
end
end
---【永】这个单位不会被对手的卡片的效果选择
---@param c Card 拥有这个效果的卡
---@param m number|nil 效果的拥有者的卡号
---@param loc number 生效的区域
---@param typ number 只影响自己,则填EFFECT_TYPE_SINGLE;<br>影响场上,则填EFFECT_TYPE_FIELD。
---@param val number 不会被 val 的效果选择
---@param con function|nil 这个效果的条件函数
---@param tg function|nil 这个效果的影响目标,影响全域范围才需填
---@param loc_self number|nil 这个效果影响的自己区域,影响全域范围才需填
---@return Effect 这个效果
function
VgD
.
CannotBeTarget
(
c
,
m
,
loc
,
typ
,
val
,
con
,
tg
,
loc_self
)
-- check func
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"CannotBeTarget"
,
c
)
if
fchk
.
con
(
con
)
or
fchk
.
tg
(
tg
)
then
return
end
-- set param
local
cm
=
_G
[
"c"
..
(
m
or
c
:
GetOriginalCode
())]
cm
.
is_has_continuous
=
true
typ
=
typ
or
EFFECT_TYPE_SINGLE
loc
,
con
=
VgF
.
GetLocCondition
(
loc
,
con
)
val
=
val
or
function
(
e
,
re
,
rp
)
return
rp
==
1
-
e
:
GetHandlerPlayer
()
end
-- set effect
local
e
=
Effect
.
CreateEffect
(
c
)
e
:
SetRange
(
loc
)
e
:
SetCode
(
EFFECT_CANNOT_BE_EFFECT_TARGET
)
e
:
SetCondition
(
con
)
e
:
SetValue
(
val
)
if
typ
==
EFFECT_TYPE_FIELD
or
tg
or
loc_self
then
e
:
SetType
(
EFFECT_TYPE_FIELD
)
e
:
SetTargetRange
(
loc_self
or
LOCATION_MZONE
,
0
)
if
tg
then
e
:
SetTarget
(
tg
)
end
else
e
:
SetType
(
EFFECT_TYPE_SINGLE
)
e
:
SetProperty
(
EFFECT_FLAG_SINGLE_RANGE
)
end
c
:
RegisterEffect
(
e
)
return
e
end
---【永】【指令区】:你的指令区中没有世界卡以外的设置指令卡的话,根据你的指令区中的卡的张数生效以下全部的效果。
---●1张——你的世界卡的内容变为黑夜。
---●2张以上——你的世界卡的内容变为深渊黑夜。
---@param c Card 要注册以上功能的卡
---@param m number|nil 效果的创建者的卡号
---@return Effect 两个效果
function
VgD
.
NightEffect
(
c
,
m
)
-- set param
local
cm
=
_G
[
"c"
..
(
m
or
c
:
GetOriginalCode
())]
cm
.
is_has_continuous
=
true
local
condition
=
function
(
equl_one
)
return
function
(
e
)
local
og
=
vgf
.
GetMatchingGroup
(
nil
,
e
:
GetHandlerPlayer
(),
LOCATION_ORDER
,
0
,
nil
)
if
og
:
IsExists
(
VgD
.
NightFilter
,
1
,
nil
)
then
return
false
end
if
equl_one
then
return
#
og
==
1
end
return
#
og
>=
2
end
end
-- set effect
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_FIELD
)
e1
:
SetProperty
(
EFFECT_FLAG_PLAYER_TARGET
)
e1
:
SetCode
(
AFFECT_CODE_NIGHT
)
e1
:
SetRange
(
LOCATION_ORDER
)
e1
:
SetTargetRange
(
1
,
0
)
e1
:
SetCondition
(
condition
(
true
))
c
:
RegisterEffect
(
e1
)
local
e2
=
e1
:
Clone
()
e2
:
SetCode
(
AFFECT_CODE_DEEP_NIGHT
)
e2
:
SetCondition
(
condition
(
false
))
c
:
RegisterEffect
(
e2
)
return
e1
,
e2
end
function
VgD
.
NightFilter
(
c
)
return
not
c
:
IsSetCard
(
0x5040
)
and
c
:
IsType
(
TYPE_CONTINUOUS
)
end
---【永】【指令区】:对手在可以将后防者通常CALL出场的时段,对手可以将以下的效果执行。
---●灵魂爆发1。这样做了的话,选择被收容的他自己的1张卡,CALL到他自己的R上。
---●计数爆发1。这样做了的话,选择被收容的他自己的2张卡,CALL到他自己的R上。
---@param c Card 要注册以上功能的卡
---@param m number|nil 效果的创建者的卡号
---@return Effect 两个效果
function
VgD
.
CallInPrison
(
c
,
m
)
-- set param
local
cm
=
_G
[
"c"
..
(
m
or
c
:
GetOriginalCode
())]
cm
.
is_has_continuous
=
true
-- set effect
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetDescription
(
VgF
.
Stringid
(
VgID
,
11
))
e1
:
SetType
(
EFFECT_TYPE_FIELD
)
e1
:
SetCode
(
EFFECT_SPSUMMON_PROC_G
)
e1
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
+
EFFECT_FLAG_UNCOPYABLE
+
EFFECT_FLAG_BOTH_SIDE
)
e1
:
SetRange
(
LOCATION_ORDER
)
e1
:
SetCondition
(
VgD
.
CallInPrisonCondition
(
1
))
e1
:
SetOperation
(
VgD
.
CallInPrisonOperation
(
1
))
c
:
RegisterEffect
(
e1
)
local
e2
=
e1
:
Clone
()
e2
:
SetDescription
(
VgF
.
Stringid
(
VgID
,
12
))
e2
:
SetCondition
(
VgD
.
CallInPrisonCondition
(
2
))
e2
:
SetOperation
(
VgD
.
CallInPrisonOperation
(
2
))
c
:
RegisterEffect
(
e2
)
return
e1
,
e2
end
function
VgD
.
CallInPrisonCondition
(
val
)
return
function
(
e
,
c
,
og
)
local
tp
=
1
-
e
:
GetHandlerPlayer
()
local
eg
,
ep
,
ev
,
re
,
r
,
rp
if
Duel
.
GetTurnPlayer
()
==
e
:
GetHandlerPlayer
()
then
return
false
end
if
val
==
1
then
return
(
VgF
.
OverlayCost
(
1
)(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
0
)
and
VgF
.
IsExistingMatchingCard
(
VgD
.
CallInPrisonFilter
,
tp
,
LOCATION_HAND
,
0
,
1
,
nil
,
e
,
tp
))
elseif
val
==
2
then
return
(
VgF
.
DamageCost
(
1
)(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
0
)
and
VgF
.
IsExistingMatchingCard
(
VgD
.
CallInPrisonFilter
,
tp
,
LOCATION_HAND
,
0
,
2
,
nil
,
e
,
tp
))
end
end
end
function
VgD
.
CallInPrisonOperation
(
val
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
,
sg
,
og
)
if
val
==
1
then
VgF
.
OverlayCost
(
1
)(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
1
)
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_CALL
,
e
,
tp
,
VgD
.
CallInPrisonFilter
,
tp
,
LOCATION_ORDER
,
0
,
1
,
1
,
nil
,
e
,
tp
)
if
g
:
GetFirst
():
IsType
(
TYPE_MONSTER
)
then
VgF
.
Sendto
(
LOCATION_MZONE
,
g
,
0
,
tp
)
else
VgF
.
Sendto
(
LOCATION_DROP
,
g
,
REASON_EFFECT
)
end
elseif
val
==
2
then
VgF
.
DamageCost
(
1
)(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
1
)
local
tg
=
VgF
.
SelectMatchingCard
(
HINTMSG_CALL
,
e
,
tp
,
VgD
.
CallInPrisonFilter
,
tp
,
LOCATION_ORDER
,
0
,
2
,
2
,
nil
,
e
,
tp
)
local
g
=
tg
:
Filter
(
Card
.
IsType
,
nil
,
TYPE_MONSTER
)
if
g
:
GetCount
()
>
0
then
VgF
.
Sendto
(
LOCATION_MZONE
,
g
,
0
,
tp
)
tg
:
Sub
(
g
)
end
if
tg
:
GetCount
()
>
0
then
VgF
.
Sendto
(
LOCATION_DROP
,
tg
,
REASON_EFFECT
)
end
end
sg
=
Group
.
CreateGroup
()
Duel
.
AdjustAll
()
end
end
function
VgD
.
CallInPrisonFilter
(
c
,
e
,
tp
)
return
c
:
GetFlagEffect
(
FLAG_IMPRISON
)
>
0
and
(
vgf
.
IsCanBeCalled
(
c
,
e
,
tp
)
or
not
c
:
IsType
(
TYPE_MONSTER
))
end
--其他----------------------------------------------------------------------------------------
---建立一个全局检查
---@param c Card 效果的创建者
---@param m number|nil 效果的创建者的卡号
---@param code number 触发的时点
---@param op function|nil 这个效果的处理函数
---@param con function|nil 这个效果的条件函数
function
VgD
.
GlobalCheckEffect
(
c
,
m
,
code
,
con
,
op
)
-- check func
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"GlobalCheckEffect"
,
c
)
if
fchk
.
con
(
con
)
or
fchk
.
op
(
op
)
then
return
end
-- set param and check global
m
=
m
or
c
:
GetOriginalCode
()
local
cm
=
_G
[
"c"
..
m
]
cm
.
global_check
=
cm
.
global_check
or
{}
cm
.
global_check
[
code
]
=
cm
.
global_check
[
code
]
or
{}
local
code_tab
=
cm
.
global_check
[
code
]
local
key
,
tab
=
next
(
code_tab
)
if
next
(
code_tab
)
then
while
key
do
if
tab
.
con
==
con
and
tab
.
op
==
op
then
return
end
key
,
tab
=
next
(
code_tab
,
key
)
end
end
cm
.
global_check
[
code
][
#
code_tab
+
1
]
=
{
con
=
con
,
op
=
op
}
op
=
op
or
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
Duel
.
RegisterFlagEffect
(
rp
,
m
,
RESET_PHASE
+
PHASE_END
,
0
,
1
)
end
-- set effect
Debug
.
Message
(
"set"
)
local
ge
=
Effect
.
CreateEffect
(
c
)
ge
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
ge
:
SetCode
(
code
)
if
con
then
ge
:
SetCondition
(
con
)
end
ge
:
SetOperation
(
op
)
Duel
.
RegisterEffect
(
ge
,
0
)
end
VgDefinition.Lua
deleted
100644 → 0
View file @
cb12d359
VgDefinition
=
{}
VgID
=
10000001
CARD_ENERGY
=
10800730
CARD_ENERGY_EMBLEM
=
10800851
--min/max value
MIN_ID
=
1000
--4 digits, by DataManager::GetDesc()
MAX_ID
=
268435455
--28 bits, by DataManager::GetDesc()
MAX_COUNTER
=
65535
--max number for adding/removing counters, by card::add_counter(), field::remove_counter()
MAX_PARAMETER
=
0xffff
--Locations 区域
LOCATION_DECK
=
0x01
--卡组
LOCATION_HAND
=
0x02
--手牌
LOCATION_MZONE
=
0x04
--主要怪兽区(0- 4) + 额外怪兽区(5- 6)
LOCATION_SZONE
=
0x08
--魔陷区(0- 4) + 场地区(5)
LOCATION_GRAVE
=
0x10
--弃牌区
LOCATION_REMOVED
=
0x20
--封锁区
LOCATION_EXTRA
=
0x40
--额外
LOCATION_OVERLAY
=
0x80
--灵魂
LOCATION_ONFIELD
=
0x0c
--场上(LOCATION_MZONE + LOCATION_SZONE)
LOCATION_EXILE
=
0x400
--除外区
LOCATION_DAMAGE
=
0x800
--伤害区
LOCATION_ORDER
=
0x1000
--指令区
LOCATION_SPARE
=
0x2000
--备用格子(用于怪物箱等)
LOCATION_GZONE
=
0x4000
--G区域
LOCATION_EMBLEM
=
0x8000
--纹章区
LOCATION_RIDE
=
LOCATION_EXTRA
LOCATION_DROP
=
LOCATION_GRAVE
LOCATION_LOCK
=
LOCATION_REMOVED
LOCATION_ALL
=
0xffff
LOCATION_RZONE
=
0x10000
LOCATION_VZONE
=
0x20000
LOCATION_LIST
=
{
0x1
,
0x2
,
0x4
,
0x10
,
0x20
,
0x40
,
0x80
,
0x400
,
0x800
,
0x1000
,
0x2000
,
0x4000
,
0x8000
}
--LOCATION_LIST={LOCATION_HAND, LOCATION_MZONE, LOCATION_DROP, LOCATION_LOCK, LOCATION_RIDE, LOCATION_OVERLAY, LOCATION_EXILE, LOCATION_DAMAGE, LOCATION_ORDER, LOCATION_SPARE, LOCATION_GZONE, LOCATION_EMBLEM}
LOCATION_LIST_STRING
=
{
"LOCATION_DECK"
,
"LOCATION_HAND"
,
"LOCATION_MZONE"
,
"LOCATION_DROP"
,
"LOCATION_LOCK"
,
"LOCATION_RIDE"
,
"LOCATION_OVERLAY"
,
"LOCATION_EXILE"
,
"LOCATION_DAMAGE"
,
"LOCATION_ORDER"
,
"LOCATION_SPARE"
,
"LOCATION_GZONE"
,
"LOCATION_EMBLEM"
}
--Locations (for redirect) 若在重定向类效果中仅指定LOCATION_DECK则为弹回卡组顶部
LOCATION_DECKBOT
=
0x10001
--弹回卡组底部
LOCATION_DECKSHF
=
0x20001
--弹回卡组并洗牌
--Sequences (for Duel.SendtoDeck)
SEQ_DECKTOP
=
0
--弹回卡组顶端
SEQ_DECKBOTTOM
=
1
--弹回卡组底端
SEQ_DECKSHUFFLE
=
2
--弹回卡组并洗牌(洗牌前暂时放在底端)
--Locations of spell cards
LOCATION_FZONE
=
0x100
--判定区
LOCATION_TRIGGER
=
LOCATION_FZONE
LOCATION_PZONE
=
0x200
--灵摆区
--Positions 表示形式
POS_FACEUP_ATTACK
=
0x1
--表侧攻击
POS_FACEDOWN_ATTACK
=
0x2
--(reserved)
POS_FACEUP_DEFENSE
=
0x4
--表侧守备
POS_FACEDOWN_DEFENSE
=
0x8
--里侧守备
POS_FACEUP
=
0x5
--正面表示
POS_FACEDOWN
=
0xa
--背面表示
POS_ATTACK
=
0x3
--攻击表示
POS_DEFENSE
=
0xc
--守备表示
NO_FLIP_EFFECT
=
0x10000
--不发动反转效果
--Types 卡片类型
TYPE_MONSTER
=
0x1
--怪兽卡
TYPE_SPELL
=
0x2
--魔法卡
TYPE_TRAP
=
0x4
--陷阱卡
TYPE_NORMAL
=
0x10
--通常怪兽
TYPE_EFFECT
=
0x20
--效果
TYPE_FUSION
=
0x40
--融合
TYPE_RITUAL
=
0x80
--仪式
TYPE_TRAPMONSTER
=
0x100
--陷阱怪兽
TYPE_SPIRIT
=
0x200
--灵魂
TYPE_UNION
=
0x400
--同盟
TYPE_DUAL
=
0x800
--二重
TYPE_TUNER
=
0x1000
--调整
TYPE_SYNCHRO
=
0x2000
--同调
TYPE_TOKEN
=
0x4000
--衍生物
TYPE_QUICKPLAY
=
0x10000
--速攻
TYPE_CONTINUOUS
=
0x20000
--永续
TYPE_EQUIP
=
0x40000
--装备
TYPE_FIELD
=
0x80000
--场地
TYPE_COUNTER
=
0x100000
--反击
TYPE_FLIP
=
0x200000
--翻转
TYPE_TOON
=
0x400000
--卡通
TYPE_XYZ
=
0x800000
--超量
TYPE_PENDULUM
=
0x1000000
--灵摆
TYPE_SPSUMMON
=
0x2000000
--特殊召唤
TYPE_LINK
=
0x4000000
--连接
--组合类型
TYPES_TOKEN_MONSTER
=
0x4011
TYPES_NORMAL_TRAP_MONSTER
=
0x111
TYPES_EFFECT_TRAP_MONSTER
=
0x121
TYPE_EMBLEM
=
TYPE_TRAP
+
TYPE_COUNTER
+
TYPE_FUSION
--技能 --属性
SKILL_ALL
=
0x7f
--All
SKILL_NONE
=
0x01
--无
SKILL_SUPPORT
=
0x02
--支援
SKILL_BLOCK
=
0x04
--截击
SKILL_THRICE_TRIGGER
=
0x08
--三判
SKILL_TWICE_TRIGGER
=
0x10
--双判
SKILL_SELF_RIDE
=
0x20
--人格骑升
SKILL_DEBRIS
=
0x40
--结晶碎片
--触发类型 --种族
TRIGGER_ALL
=
0x3ffffff
--All
TRIGGER_NONE
=
0x1
--无
TRIGGER_CRITICAL_STRIKE
=
0x2
--暴击触发
TRIGGER_DRAW
=
0x4
--抽牌触发
TRIGGER_HEAL
=
0x8
--治愈触发
TRIGGER_ADVANCE
=
0x10
--前列触发
TRIGGER_SUPER
=
0x20
--超限触发
--组合类型
TRIGGER_CARDS
=
0x3e
--触发单位卡
--Category 效果分类
CATEGORY_DEFENDER
=
0x1
--守护者
--Reason 卡片到当前位置的原因
REASON_DESTROY
=
0x1
--破坏
REASON_RELEASE
=
0x2
--解放
REASON_TEMPORARY
=
0x4
--暂时
REASON_MATERIAL
=
0x8
--作为融合/同调/超量素材或用於儀式/升級召喚
REASON_SUMMON
=
0x10
--召唤
REASON_BATTLE
=
0x20
--战斗破坏
REASON_EFFECT
=
0x40
--效果
REASON_COST
=
0x80
--用於代價或無法支付代價而破壞
REASON_ADJUST
=
0x100
--调整(御前试合)
REASON_LOST_TARGET
=
0x200
--失去装备对象
REASON_RULE
=
0x400
--规则
REASON_SPSUMMON
=
0x800
--特殊召唤
REASON_DISSUMMON
=
0x1000
--召唤失败
REASON_FLIP
=
0x2000
--翻转
REASON_DISCARD
=
0x4000
--丢弃
REASON_RDAMAGE
=
0x8000
--回復轉換後的傷害
REASON_RRECOVER
=
0x10000
--傷害轉換後的回復
REASON_RETURN
=
0x20000
--回到墓地
REASON_FUSION
=
0x40000
--用於融合召喚
REASON_SYNCHRO
=
0x80000
--用於同调召喚
REASON_RITUAL
=
0x100000
--用於仪式召喚
REASON_XYZ
=
0x200000
--用於超量召喚
REASON_REPLACE
=
0x1000000
--代替
REASON_DRAW
=
0x2000000
--抽卡
REASON_REDIRECT
=
0x4000000
--改变去向(大宇宙,带菌等)
REASON_REVEAL
=
0x8000000
--翻开卡组(森罗)
REASON_LINK
=
0x10000000
--用于连接召唤
REASON_LOST_OVERLAY
=
0x20000000
--超量素材随着超量怪兽离场
REASON_MAINTENANCE
=
0x40000000
--维持代价
REASON_ACTION
=
0x80000000
--攻击宣言之际等
REASON_RIDEUP
=
REASON_XYZ
--用於骑升
REASON_PHASEDRAW
=
REASON_RULE
--抽卡
REASON_TRIGGER
=
REASON_EFFECT
--判定
--Location Reason
LOCATION_REASON_TOFIELD
=
0x1
--Duel.GetLocationCount()預設值, 凱薩競技場
LOCATION_REASON_CONTROL
=
0x2
--Card.IsControlerCanBeChanged()使用
--Summon Type --召唤类型
SUMMON_TYPE_NORMAL
=
0x10000000
--通常召唤(EFFECT_SUMMON_PROC, EFFECT_SET_PROC 可用Value修改數值)
SUMMON_TYPE_ADVANCE
=
0x11000000
--上级召唤
SUMMON_TYPE_DUAL
=
0x12000000
--再度召唤(二重)
SUMMON_TYPE_FLIP
=
0x20000000
--翻转召唤
SUMMON_TYPE_SPECIAL
=
0x40000000
--特殊召唤(EFFECT_SPSUMMON_PROC, EFFECT_SPSUMMON_PROC_G 可用Value修改數值)
SUMMON_TYPE_FUSION
=
0x43000000
--融合召唤
SUMMON_TYPE_RITUAL
=
0x45000000
--仪式召唤
SUMMON_TYPE_SELFRIDE
=
0x46000000
--人格骑升
SUMMON_TYPE_RIDE
=
0x49000000
--骑升
--SUMMON_TYPE_CALL = 0x4a000000 --Call到R位
SUMMON_TYPE_LINK
=
0x4c000000
--连接召唤
--Summon Value --特定的召唤方式
SUMMON_VALUE_CALL
=
0x1
--通常CALL出场
SUMMON_VALUE_REVOLT
=
0x2
--反抗舞装
SUMMON_VALUE_OverDress
=
0x4
--超限舞装
SUMMON_VALUE_DARK_SANCTUARY
=
0x12
--暗黑圣域
SUMMON_VALUE_MONSTER_REBORN
=
0x13
--死者苏生(千年的启示)
SUMMON_VALUE_MASK_CHANGE
=
0x14
--
SUMMON_VALUE_ASSAULT_MODE
=
0x15
--
SUMMON_VALUE_LV
=
0x1000
--对应LV怪兽的效果
SUMMON_VALUE_GLADIATOR
=
0x2000
--剑斗兽
SUMMON_VALUE_EVOLTILE
=
0x4000
--进化虫
SUMMON_VALUE_DARK_FUSION
=
SUMMON_TYPE_FUSION
|
0x16
--
SUMMON_VALUE_FOSSIL_FUSION
=
SUMMON_TYPE_FUSION
|
0x17
--
--Status --卡片当前状态
STATUS_DISABLED
=
0x0001
--效果被无效
STATUS_TO_ENABLE
=
0x0002
--将变成有效
STATUS_TO_DISABLE
=
0x0004
--将变成无效
STATUS_PROC_COMPLETE
=
0x0008
--完成正规召唤(解除苏生限制)
STATUS_SET_TURN
=
0x0010
--在本回合覆盖
STATUS_NO_LEVEL
=
0x0020
--无等级
STATUS_BATTLE_RESULT
=
0x0040
--傷害計算結果預計要破壞的怪獸
STATUS_SPSUMMON_STEP
=
0x0080
--效果特召處理中
STATUS_FORM_CHANGED
=
0x0100
--改变过表示形式
STATUS_SUMMONING
=
0x0200
--召唤中
STATUS_EFFECT_ENABLED
=
0x0400
--卡片準備就緒(不在移動、召喚、魔法陷阱發動中)
STATUS_SUMMON_TURN
=
0x0800
--在本回合召喚/SET
STATUS_DESTROY_CONFIRMED
=
0x1000
--预定被破坏
STATUS_LEAVE_CONFIRMED
=
0x2000
--連鎖處理完後送去墓地的魔法陷阱
STATUS_BATTLE_DESTROYED
=
0x4000
--战斗破坏确定後尚未移動
STATUS_COPYING_EFFECT
=
0x8000
--正在复制效果
STATUS_CHAINING
=
0x10000
--正在連鎖串中
STATUS_SUMMON_DISABLED
=
0x20000
--召唤无效後尚未移動
STATUS_ACTIVATE_DISABLED
=
0x40000
--发动无效後尚未移動
STATUS_EFFECT_REPLACED
=
0x80000
--效果被替代(红莲霸权)
STATUS_FUTURE_FUSION
=
0x100000
--未来融合特殊召唤(不触发融合素材效果)
STATUS_ATTACK_CANCELED
=
0x200000
--若其為攻擊者,則攻擊中止
STATUS_INITIALIZING
=
0x400000
--正在初始化
STATUS_TO_HAND_WITHOUT_CONFIRM
=
0x800000
--非公开的卡被效果加入手卡但未给对方确认
STATUS_JUST_POS
=
0x1000000
--已改變表示形式(用於STATUS_CONTINUOUS_POS判定)
STATUS_CONTINUOUS_POS
=
0x2000000
--改變後再次設定成其他表示形式
STATUS_FORBIDDEN
=
0x4000000
--不能play
STATUS_ACT_FROM_HAND
=
0x8000000
--從手牌发动
STATUS_OPPO_BATTLE
=
0x10000000
--和對手的怪兽戰鬥
STATUS_FLIP_SUMMON_TURN
=
0x20000000
--在本回合反转召唤
STATUS_SPSUMMON_TURN
=
0x40000000
--在本回合特殊召唤
--Assume
ASSUME_CODE
=
1
ASSUME_TYPE
=
2
ASSUME_LEVEL
=
3
ASSUME_RANK
=
4
ASSUME_ATTRIBUTE
=
5
ASSUME_RACE
=
6
ASSUME_ATTACK
=
7
ASSUME_DEFENSE
=
8
--Counter --指示物
COUNTER_WITHOUT_PERMIT
=
0x1000
--可以放置在非特定對象的指示物
COUNTER_NEED_ENABLE
=
0x2000
--N/A
--Phase --阶段
PHASE_DRAW
=
0x01
--抽卡阶段
PHASE_STANDBY
=
0x02
--准备阶段
PHASE_MAIN1
=
0x04
--主要阶段1
PHASE_BATTLE_START
=
0x08
--战斗阶段开始
PHASE_BATTLE_STEP
=
0x10
--战斗步驟
PHASE_DAMAGE
=
0x20
--伤害步驟
PHASE_DAMAGE_CAL
=
0x40
--伤害计算时
PHASE_BATTLE
=
0x80
--战斗阶段結束
PHASE_MAIN2
=
0x100
--主要阶段2
PHASE_END
=
0x200
--结束阶段
--Player --玩家
PLAYER_NONE
=
2
--2个玩家都不是
PLAYER_ALL
=
3
--2个玩家都是
--Chain info --连锁信息
CHAININFO_CHAIN_COUNT
=
0x01
--连锁数
CHAININFO_TRIGGERING_EFFECT
=
0x02
--连锁的效果
CHAININFO_TRIGGERING_PLAYER
=
0x04
--连锁的玩家
CHAININFO_TRIGGERING_CONTROLER
=
0x08
--连锁的卡的控制者
CHAININFO_TRIGGERING_LOCATION
=
0x10
--连锁的位置
CHAININFO_TRIGGERING_SEQUENCE
=
0x20
--连锁的位置的编号(指怪兽和魔陷区的格子)
CHAININFO_TARGET_CARDS
=
0x40
--连锁的效果的对象(以下3个需要在target函数里设置)
CHAININFO_TARGET_PLAYER
=
0x80
--连锁的效果的对象(玩家)
CHAININFO_TARGET_PARAM
=
0x100
--连锁的效果的参数值
CHAININFO_DISABLE_REASON
=
0x200
--无效的原因
CHAININFO_DISABLE_PLAYER
=
0x400
--无效的玩家
CHAININFO_CHAIN_ID
=
0x800
--连锁ID
CHAININFO_TYPE
=
0x1000
--连锁类型
CHAININFO_EXTTYPE
=
0x2000
--连锁额外类型
CHAININFO_TRIGGERING_POSITION
=
0x4000
--连锁发生时的表示形式
CHAININFO_TRIGGERING_CODE
=
0x8000
--连锁发生时的密码
CHAININFO_TRIGGERING_CODE2
=
0x10000
--连锁发生时的其他密码
CHAININFO_TRIGGERING_LEVEL
=
0x40000
--连锁发生时的等级
CHAININFO_TRIGGERING_RANK
=
0x80000
--连锁发生时的阶级
CHAININFO_TRIGGERING_ATTRIBUTE
=
0x100000
--连锁发生时的属性
CHAININFO_TRIGGERING_RACE
=
0x200000
--连锁发生时的种族
CHAININFO_TRIGGERING_ATTACK
=
0x400000
--连锁发生时的攻击力
CHAININFO_TRIGGERING_DEFENSE
=
0x800000
--连锁发生时的守备力
--Summon info
SUMMON_INFO_CODE
=
0x01
SUMMON_INFO_CODE2
=
0x02
SUMMON_INFO_TYPE
=
0x04
SUMMON_INFO_LEVEL
=
0x08
SUMMON_INFO_RANK
=
0x10
SUMMON_INFO_ATTRIBUTE
=
0x20
SUMMON_INFO_RACE
=
0x40
SUMMON_INFO_ATTACK
=
0x80
SUMMON_INFO_DEFENSE
=
0x100
SUMMON_INFO_REASON_EFFECT
=
0x200
SUMMON_INFO_REASON_PLAYER
=
0x400
--========== Reset ========== --重置条件(注意:重置条件可以多个相加)
RESET_SELF_TURN
=
0x10000000
--自己回合的階段重置
RESET_OPPO_TURN
=
0x20000000
--对方回合的階段重置
RESET_PHASE
=
0x40000000
--阶段结束重置(一般和上面那些阶段配合使用)
RESET_CHAIN
=
0x80000000
--连锁结束重置
RESET_EVENT
=
0x1000
--指定的條件下重置(一般和下面这些事件配合使用)
RESET_CARD
=
0x2000
--重置Owner為指定卡片的效果
RESET_CODE
=
0x4000
--重置指定Code的single效果(不含EFFECT_FLAG_SINGLE_RANGE)
RESET_COPY
=
0x8000
--重置以复制取得的效果
RESET_DISABLE
=
0x00010000
--效果无效重置(只適用於owner==handler的效果)
RESET_TURN_SET
=
0x00020000
--变里侧重置(皆為事件觸發前重置)
RESET_TOGRAVE
=
0x00040000
--去墓地重置
RESET_REMOVE
=
0x00080000
--除外重置
RESET_TEMP_REMOVE
=
0x00100000
--暂时除外重置
RESET_TOHAND
=
0x00200000
--回手牌或加入手牌重置
RESET_TODECK
=
0x00400000
--回卡组重置
RESET_LEAVE
=
0x00800000
--从怪兽区或魔法区到不同区域
RESET_TOFIELD
=
0x01000000
--除了返回场上以外,从不同区域移动到怪兽区或魔法区
RESET_CONTROL
=
0x02000000
--控制者变更重置
RESET_OVERLAY
=
0x04000000
--超量叠放重置
RESET_MSCHANGE
=
0x08000000
--从怪兽区到魔法区,或者从魔法区到怪兽区(move_to_field()、寶玉獸)
----组合时点
RESETS_STANDARD
=
0x1fe0000
--RESET_TOFIELD + RESET_LEAVE + RESET_TODECK + RESET_TOHAND + RESET_TEMP_REMOVE + RESET_REMOVE + RESET_TOGRAVE + RESET_TURN_SET
RESETS_REDIRECT
=
0xc7e0000
--RESETS_STANDARD + RESET_OVERLAY + RESET_MSCHANGE- RESET_TOFIELD- RESET_LEAVE (EFFECT_LEAVE_FIELD_REDIRECT)
RESETS_WITHOUT_TEMP_REMOVE
=
0x56e0000
--RESETS_STANDARD- RESET_TEMP_REMOVE- RESET_LEAVE + RESET_OVERLAY
--========== Types ========== --效果类型(定义效果触发类型,和codes一起使用)
EFFECT_TYPE_SINGLE
=
0x0001
--自己状态变化时触发
EFFECT_TYPE_FIELD
=
0x0002
--场上所有卡状态变化时触发
EFFECT_TYPE_EQUIP
=
0x0004
--装备效果
EFFECT_TYPE_ACTIONS
=
0x0008
--触发型,以下類型會自動添加此屬性(对峙的G)
EFFECT_TYPE_ACTIVATE
=
0x0010
--魔陷发动
EFFECT_TYPE_FLIP
=
0x0020
--翻转效果
EFFECT_TYPE_IGNITION
=
0x0040
--起动效果
EFFECT_TYPE_TRIGGER_O
=
0x0080
--诱发选发效果
EFFECT_TYPE_QUICK_O
=
0x0100
--诱发即时效果
EFFECT_TYPE_TRIGGER_F
=
0x0200
--诱发必发效果
EFFECT_TYPE_QUICK_F
=
0x0400
--诱发即时必发效果(熊猫龙等)
EFFECT_TYPE_CONTINUOUS
=
0x0800
--由事件觸發的輔助用效果/永續效果
EFFECT_TYPE_XMATERIAL
=
0x1000
--作为超量素材时超量怪兽获得的效果(十二兽)
EFFECT_TYPE_GRANT
=
0x2000
--使其他卡片获得效果(天气模样)
EFFECT_TYPE_TARGET
=
0x4000
--影响持续取的对象的效果(基本只用于魔陷)
--========== Flags ========== --效果的特殊性质
EFFECT_FLAG_INITIAL
=
0x0001
--可以发动的
EFFECT_FLAG_FUNC_VALUE
=
0x0002
--此效果的Value属性是函数
EFFECT_FLAG_COUNT_LIMIT
=
0x0004
--发动次数限制
EFFECT_FLAG_FIELD_ONLY
=
0x0008
--此效果是注册给全局环境的
EFFECT_FLAG_CARD_TARGET
=
0x0010
--取对象效果
EFFECT_FLAG_IGNORE_RANGE
=
0x0020
--影响所有区域的卡(大宇宙)
EFFECT_FLAG_ABSOLUTE_TARGET
=
0x0040
--Target Range固定為某個玩家的視角所見的自己/對方(SetAbsoluteRange()專用)
EFFECT_FLAG_IGNORE_IMMUNE
=
0x0080
--无视效果免疫
EFFECT_FLAG_SET_AVAILABLE
=
0x0100
--裡側狀態可發動的效果、影响场上里侧的卡的永續型效果
EFFECT_FLAG_CANNOT_NEGATE
=
0x0200
--含有"此效果不會被無效"的敘述
EFFECT_FLAG_CANNOT_DISABLE
=
0x0400
--效果不会被无效
EFFECT_FLAG_PLAYER_TARGET
=
0x0800
--含有"以玩家为对象"的特性(精靈之鏡)、影響玩家的永續型效果(SetTargetRange()改成指定玩家)
EFFECT_FLAG_BOTH_SIDE
=
0x1000
--双方都能使用(部分场地,弹压)
EFFECT_FLAG_COPY_INHERIT
=
0x2000
--若由复制的效果產生則继承其Reset属性
EFFECT_FLAG_DAMAGE_STEP
=
0x4000
--可以在伤害步骤发动
EFFECT_FLAG_DAMAGE_CAL
=
0x8000
--可以在伤害计算时发动
EFFECT_FLAG_DELAY
=
0x10000
--場合型誘發效果、用於永續效果的EFFECT_TYPE_CONTINUOUS
EFFECT_FLAG_SINGLE_RANGE
=
0x20000
--只对自己有效
EFFECT_FLAG_UNCOPYABLE
=
0x40000
--不能复制的原始效果(效果外文本)
EFFECT_FLAG_OATH
=
0x80000
--誓约效果
EFFECT_FLAG_SPSUM_PARAM
=
0x100000
--指定召喚/规则特殊召唤的位置和表示形式(熔岩魔神)
EFFECT_FLAG_REPEAT
=
0x200000
--N/A
EFFECT_FLAG_NO_TURN_RESET
=
0x400000
--发条等“这张卡在场上只能发动一次”的效果
EFFECT_FLAG_EVENT_PLAYER
=
0x800000
--发动/处理效果的玩家为触发事件的玩家而不是卡片的持有者,如仪式魔人,万魔殿
EFFECT_FLAG_OWNER_RELATE
=
0x1000000
--与效果owner关联的效果
EFFECT_FLAG_CANNOT_INACTIVATE
=
0x2000000
--發動不會被無效
EFFECT_FLAG_CLIENT_HINT
=
0x4000000
--客户端提示
EFFECT_FLAG_CONTINUOUS_TARGET
=
0x8000000
--建立持續對象的永續魔法/永續陷阱/早埋系以外的裝備魔法卡
EFFECT_FLAG_LIMIT_ZONE
=
0x10000000
--限制魔法·陷阱卡发动时可以放置的区域
EFFECT_FLAG_COF
=
0x20000000
--N/A
EFFECT_FLAG_CVAL_CHECK
=
0x40000000
--N/A
EFFECT_FLAG_IMMEDIATELY_APPLY
=
0x80000000
--卡在发动时效果就立即适用
EFFECT_FLAG2_REPEAT_UPDATE
=
0x0001
--最后计算的攻击力上升
EFFECT_FLAG2_COF
=
0x0002
--通常魔法卡在MP1以外发动(邪恶的仪式的特殊处理)
EFFECT_FLAG2_WICKED
=
0x0004
--神之化身/恐惧之源的攻击力变化最后计算
EFFECT_FLAG2_OPTION
=
0x0008
--子機
--========== Codes ========== --对永续性效果表示效果类型(EFFECT开头),对诱发型效果表示触发效果的事件/时点(EVENT开头)
EFFECT_IMMUNE_EFFECT
=
1
--效果免疫
EFFECT_DISABLE
=
2
--效果无效(技能抽取)
EFFECT_CANNOT_DISABLE
=
3
--卡的效果不能被无效
EFFECT_SET_CONTROL
=
4
--设置控制权
EFFECT_CANNOT_CHANGE_CONTROL
=
5
--不能改变控制权
EFFECT_CANNOT_ACTIVATE
=
6
--玩家不能发动效果
EFFECT_CANNOT_TRIGGER
=
7
--卡不能发动效果
EFFECT_DISABLE_EFFECT
=
8
--效果无效(聖杯)
EFFECT_DISABLE_CHAIN
=
9
--在連鎖串中無效(processor.cpp)
EFFECT_DISABLE_TRAPMONSTER
=
10
--陷阱怪兽无效
EFFECT_CANNOT_INACTIVATE
=
12
--发动不能被无效
EFFECT_CANNOT_DISEFFECT
=
13
--发动的效果不能被无效
EFFECT_CANNOT_CHANGE_POSITION
=
14
--不能改变表示形式
EFFECT_TRAP_ACT_IN_HAND
=
15
--陷阱可以从手牌发动
EFFECT_TRAP_ACT_IN_SET_TURN
=
16
--陷阱可以在盖放的回合发动
EFFECT_REMAIN_FIELD
=
17
--X回合内留在场上(光之护封剑等)
EFFECT_MONSTER_SSET
=
18
--怪兽可以在魔陷区放置
EFFECT_CANNOT_SUMMON
=
20
--不能召唤怪兽
EFFECT_CANNOT_FLIP_SUMMON
=
21
--不能翻转召唤怪兽
EFFECT_CANNOT_SPECIAL_SUMMON
=
22
--不能特殊召唤怪兽
EFFECT_CANNOT_MSET
=
23
--不能覆盖怪兽
EFFECT_CANNOT_SSET
=
24
--不能覆盖魔陷
EFFECT_CANNOT_DRAW
=
25
--不能抽卡
EFFECT_CANNOT_DISABLE_SUMMON
=
26
--召唤不会无效
EFFECT_CANNOT_DISABLE_SPSUMMON
=
27
--特殊召唤不会无效
EFFECT_SET_SUMMON_COUNT_LIMIT
=
28
--设置每回合召唤次数
EFFECT_EXTRA_SUMMON_COUNT
=
29
--增加召唤(通常召唤)次数
EFFECT_SPSUMMON_CONDITION
=
30
--特殊召唤条件
EFFECT_REVIVE_LIMIT
=
31
--有苏生限制的怪獸(Card.EnableReviveLimit())
EFFECT_SUMMON_PROC
=
32
--召唤规则效果
EFFECT_LIMIT_SUMMON_PROC
=
33
--召唤规则限制
EFFECT_SPSUMMON_PROC
=
34
--特殊召唤规则
EFFECT_EXTRA_SET_COUNT
=
35
--增加盖放(通常召唤)次数
EFFECT_SET_PROC
=
36
--放置(通常召唤)规则
EFFECT_LIMIT_SET_PROC
=
37
--放置(通常召唤)规则限制
EFFECT_DIVINE_LIGHT
=
38
--神圣光辉
EFFECT_CANNOT_DISABLE_FLIP_SUMMON
=
39
--翻转召唤不会无效
EFFECT_INDESTRUCTABLE
=
40
--不会被破坏
EFFECT_INDESTRUCTABLE_EFFECT
=
41
--不会被效果破坏
EFFECT_INDESTRUCTABLE_BATTLE
=
42
--不会被战斗破坏
EFFECT_UNRELEASABLE_SUM
=
43
--不能做上级召唤的祭品
EFFECT_UNRELEASABLE_NONSUM
=
44
--不能做上级召唤以外的祭品
EFFECT_DESTROY_SUBSTITUTE
=
45
--必選的代替破壞(此卡被破壞時用其他卡代替)
EFFECT_CANNOT_RELEASE
=
46
--不能进行解放行为
EFFECT_INDESTRUCTABLE_COUNT
=
47
--一回合几次不会被破坏
EFFECT_UNRELEASABLE_EFFECT
=
48
--不能被解放
EFFECT_DESTROY_REPLACE
=
50
--可選的代替破壞(將破壞改成其他動作)
EFFECT_RELEASE_REPLACE
=
51
--代替解放
EFFECT_SEND_REPLACE
=
52
--可以不送去XX而送去OO(甜点城堡等)
EFFECT_CANNOT_DISCARD_HAND
=
55
--不能丢弃手牌
EFFECT_CANNOT_DISCARD_DECK
=
56
--不能把卡组的卡送去墓地
EFFECT_CANNOT_USE_AS_COST
=
57
--不能作为COST使用
EFFECT_CANNOT_PLACE_COUNTER
=
58
--不能放置counter
EFFECT_CANNOT_TO_GRAVE_AS_COST
=
59
--不能作为COST送去墓地
EFFECT_LEAVE_FIELD_REDIRECT
=
60
--离场时重新指定去向
EFFECT_TO_HAND_REDIRECT
=
61
--回手牌时重新指定去向
EFFECT_TO_DECK_REDIRECT
=
62
--回卡组时重新指定去向
EFFECT_TO_GRAVE_REDIRECT
=
63
--去墓地时重新指定去向
EFFECT_REMOVE_REDIRECT
=
64
--除外时重新指定去向
EFFECT_CANNOT_TO_HAND
=
65
--不能加入手牌
EFFECT_CANNOT_TO_DECK
=
66
--不能回卡组
EFFECT_CANNOT_REMOVE
=
67
--不能封锁
EFFECT_CANNOT_TO_GRAVE
=
68
--不能去墓地
EFFECT_CANNOT_TURN_SET
=
69
--不能变里侧
EFFECT_CANNOT_BE_BATTLE_TARGET
=
70
--不能成为攻击对象
EFFECT_CANNOT_BE_EFFECT_TARGET
=
71
--不能成为效果对象
EFFECT_IGNORE_BATTLE_TARGET
=
72
--不能成为攻击对象- 鶸型(传说的渔人)
EFFECT_CANNOT_DIRECT_ATTACK
=
73
--不能直接攻击
EFFECT_DIRECT_ATTACK
=
74
--可以直接攻击
EFFECT_DUAL_STATUS
=
75
--二重状态
EFFECT_EQUIP_LIMIT
=
76
--装备对象限制
EFFECT_DUAL_SUMMONABLE
=
77
--可以再度召唤
EFFECT_UNION_LIMIT
=
78
--
EFFECT_REVERSE_DAMAGE
=
80
--伤害变回复
EFFECT_REVERSE_RECOVER
=
81
--回复变伤害
EFFECT_CHANGE_DAMAGE
=
82
--改变伤害数值
EFFECT_REFLECT_DAMAGE
=
83
--反射伤害
EFFECT_CANNOT_ATTACK
=
85
--不能攻击
EFFECT_CANNOT_ATTACK_ANNOUNCE
=
86
--不能攻击宣言
EFFECT_CANNOT_CHANGE_POS_E
=
87
--不会被卡的效果变成守备表示(攻击性云魔物)
EFFECT_ACTIVATE_COST
=
90
--发动代价(魔力之枷)
EFFECT_SUMMON_COST
=
91
--召唤代价
EFFECT_SPSUMMON_COST
=
92
--特殊召唤代价(暴君龙)
EFFECT_FLIPSUMMON_COST
=
93
--翻转召唤代价
EFFECT_MSET_COST
=
94
--怪兽放置代价
EFFECT_SSET_COST
=
95
--魔陷放置代价
EFFECT_ATTACK_COST
=
96
--攻击代价(霞之谷猎鹰)
EFFECT_UPDATE_ATTACK
=
100
--增减攻击力
EFFECT_SET_ATTACK
=
101
--设置自身攻击力、攻击力变成X特殊召唤、持续改变攻击力
EFFECT_SET_ATTACK_FINAL
=
102
--暂时改变攻击力(所有置入连锁的效果)
EFFECT_SET_BASE_ATTACK
=
103
--设置自身原本攻击力、持续改变原本攻击力
EFFECT_UPDATE_DEFENSE
=
104
--增减守备力
EFFECT_SET_DEFENSE
=
105
--设置自身守备力、守备力变成X特殊召唤、持续改变守备力
EFFECT_SET_DEFENSE_FINAL
=
106
--暂时改变守备力(所有置入连锁的效果)
EFFECT_SET_BASE_DEFENSE
=
107
--设置自身原本守备力、持续改变原本守备力
EFFECT_REVERSE_UPDATE
=
108
--倒置增减攻击力、防御力(天邪鬼)
EFFECT_SWAP_AD
=
109
--交换攻守(超級漏洞人)
EFFECT_SWAP_BASE_AD
=
110
--交换原本攻守
EFFECT_SET_BASE_ATTACK_FINAL
=
111
--暂时改变原本攻击力
EFFECT_SET_BASE_DEFENSE_FINAL
=
112
--暂时改变原本防御力
EFFECT_ADD_CODE
=
113
--增加卡名
EFFECT_CHANGE_CODE
=
114
--改变卡名
EFFECT_ADD_TYPE
=
115
--增加卡片种类(types)
EFFECT_REMOVE_TYPE
=
116
--删除卡片种类
EFFECT_CHANGE_TYPE
=
117
--改变卡片种类
EFFECT_ADD_RACE
=
120
--增加种族
EFFECT_REMOVE_RACE
=
121
--删除种族
EFFECT_CHANGE_RACE
=
122
--改变种族
EFFECT_ADD_SKILL
=
125
--增加技能
EFFECT_REMOVE_SKILL
=
126
--删除技能
EFFECT_CHANGE_SKILL
=
127
--改变技能
EFFECT_UPDATE_LEVEL
=
130
--改变等级
EFFECT_CHANGE_LEVEL
=
131
--设置等级
EFFECT_UPDATE_RANK
=
132
--改变阶级
EFFECT_CHANGE_RANK
=
133
--设置阶级
EFFECT_UPDATE_LSCALE
=
134
--改变左刻度
EFFECT_CHANGE_LSCALE
=
135
--设置左刻度
EFFECT_UPDATE_RSCALE
=
136
--改变右刻度
EFFECT_CHANGE_RSCALE
=
137
--设置右刻度
EFFECT_SET_POSITION
=
140
--設定表示形式
EFFECT_SELF_DESTROY
=
141
--不入連鎖的破壞(罪系列等)
EFFECT_SELF_TOGRAVE
=
142
--不入連鎖的送墓
EFFECT_DOUBLE_TRIBUTE
=
150
--可以作为2个祭品
EFFECT_DECREASE_TRIBUTE
=
151
--减少祭品
EFFECT_DECREASE_TRIBUTE_SET
=
152
--减少放置怪兽的祭品
EFFECT_EXTRA_RELEASE
=
153
--必須使用的代替解放(灵魂交错)
EFFECT_TRIBUTE_LIMIT
=
154
--祭品限制
EFFECT_EXTRA_RELEASE_SUM
=
155
--代替召唤解放(帝王的烈旋)
EFFECT_TRIPLE_TRIBUTE
=
156
--N/A
EFFECT_ADD_EXTRA_TRIBUTE
=
157
--增加可使用的祭品(真龙)
EFFECT_EXTRA_RELEASE_NONSUM
=
158
--代替效果COST的解放(闇黒世界)
EFFECT_PUBLIC
=
160
--公开手牌
EFFECT_COUNTER_PERMIT
=
0x10000
--允许放置指示物类型
EFFECT_COUNTER_LIMIT
=
0x20000
--允许放置指示物数量
EFFECT_RCOUNTER_REPLACE
=
0x30000
--代替取除指示物
EFFECT_LPCOST_CHANGE
=
170
--改变生命值代价數值
EFFECT_LPCOST_REPLACE
=
171
--以其他動作代替生命值代价
EFFECT_SKIP_DP
=
180
--跳过抽卡阶段
EFFECT_SKIP_SP
=
181
--跳过准备阶段
EFFECT_SKIP_M1
=
182
--跳过主要阶段1
EFFECT_SKIP_BP
=
183
--跳过战斗阶段
EFFECT_SKIP_M2
=
184
--跳过主要阶段2
EFFECT_CANNOT_BP
=
185
--不能进入战斗阶段
EFFECT_CANNOT_M2
=
186
--不能进入主要阶段2
EFFECT_CANNOT_EP
=
187
--不能进入结束阶段
EFFECT_SKIP_TURN
=
188
--跳过整个回合
EFFECT_DEFENSE_ATTACK
=
190
--可以守备表示攻击
EFFECT_MUST_ATTACK
=
191
--必须攻击
EFFECT_FIRST_ATTACK
=
192
--必须第一个攻击
EFFECT_ATTACK_ALL
=
193
--可以攻击所有怪兽
EFFECT_EXTRA_ATTACK
=
194
--增加攻击次数
EFFECT_MUST_BE_ATTACKED
=
195
--N/A
EFFECT_ONLY_BE_ATTACKED
=
196
--只能攻击此卡
EFFECT_ATTACK_DISABLED
=
197
--攻击已被無效(Duel.NegateAttack()成功的標記)
EFFECT_NO_BATTLE_DAMAGE
=
200
--不会给对方造成战斗伤害
EFFECT_AVOID_BATTLE_DAMAGE
=
201
--不会对自己造成战斗伤害
EFFECT_REFLECT_BATTLE_DAMAGE
=
202
--战斗伤害由对方代为承受
EFFECT_PIERCE
=
203
--贯穿伤害
EFFECT_BATTLE_DESTROY_REDIRECT
=
204
--战斗破坏时重新指定去向
EFFECT_BATTLE_DAMAGE_TO_EFFECT
=
205
--战斗伤害视为效果伤害
EFFECT_BOTH_BATTLE_DAMAGE
=
206
--战斗伤害由双方承受
EFFECT_ALSO_BATTLE_DAMAGE
=
207
--对自己的战斗伤害让对方也承受
EFFECT_CHANGE_BATTLE_DAMAGE
=
208
--改变此卡给予的战斗伤害、改变玩家受到的战斗伤害
EFFECT_TOSS_COIN_REPLACE
=
220
--重新抛硬币
EFFECT_TOSS_DICE_REPLACE
=
221
--重新掷骰子
EFFECT_FUSION_MATERIAL
=
230
--指定融合素材的條件
EFFECT_CHAIN_MATERIAL
=
231
--改变融合素材选取方法(连锁素材、电子融合支援)
EFFECT_EXTRA_SYNCHRO_MATERIAL
=
232
--在手卡或对方场上也可以当作自己的同调素材
EFFECT_XYZ_MATERIAL
=
233
--在对方场上也可以当作自己的超量素材
EFFECT_FUSION_SUBSTITUTE
=
234
--代替融合素材
EFFECT_CANNOT_BE_FUSION_MATERIAL
=
235
--不能做融合素材
EFFECT_CANNOT_BE_SYNCHRO_MATERIAL
=
236
--不能做同调素材
EFFECT_SYNCHRO_MATERIAL_CUSTOM
=
237
--自定义Tuner的同调过程
EFFECT_CANNOT_BE_XYZ_MATERIAL
=
238
--不能做超量素材
EFFECT_CANNOT_BE_LINK_MATERIAL
=
239
--不能做连接素材
EFFECT_SYNCHRO_LEVEL
=
240
--做同调素材时的等级
EFFECT_RITUAL_LEVEL
=
241
--做仪式祭品时的等级
EFFECT_XYZ_LEVEL
=
242
--做超量素材时的等级
EFFECT_EXTRA_RITUAL_MATERIAL
=
243
--在墓地当做仪式祭品
EFFECT_NONTUNER
=
244
--同调召唤时可以当作调整以外的怪兽(幻影王 幽骑)
EFFECT_OVERLAY_REMOVE_REPLACE
=
245
--代替去除超量素材
EFFECT_SCRAP_CHIMERA
=
246
--废铁奇美拉
EFFECT_TUNE_MAGICIAN_X
=
247
--调弦之魔术师超量素材限制
EFFECT_TUNE_MAGICIAN_F
=
248
--调弦之魔术师融合素材限制
EFFECT_PRE_MONSTER
=
250
--可存取怪獸的各項數值(Card.AddMonsterAttribute()專用)
EFFECT_MATERIAL_CHECK
=
251
--检查素材
EFFECT_DISABLE_FIELD
=
260
--无效区域(扰乱王等)
EFFECT_USE_EXTRA_MZONE
=
261
--怪兽区域封锁
EFFECT_USE_EXTRA_SZONE
=
262
--魔法区域封锁
EFFECT_MAX_MZONE
=
263
--怪獸区格數上限
EFFECT_MAX_SZONE
=
264
--魔陷区格數上限
EFFECT_MUST_USE_MZONE
=
265
--必须使用怪兽区的格子
EFFECT_HAND_LIMIT
=
270
--手牌数量限制
EFFECT_DRAW_COUNT
=
271
--抽卡阶段的抽卡数
EFFECT_SPIRIT_DONOT_RETURN
=
280
--灵魂怪兽不返回手牌
EFFECT_SPIRIT_MAYNOT_RETURN
=
281
--灵魂怪兽可以不返回手牌
EFFECT_CHANGE_ENVIRONMENT
=
290
--改变场地
EFFECT_NECRO_VALLEY
=
291
--王家长眠之谷
EFFECT_FORBIDDEN
=
292
--不能Play(禁止令)
EFFECT_NECRO_VALLEY_IM
=
293
--不受「王家长眠之谷」的影响
EFFECT_REVERSE_DECK
=
294
--翻转卡组
EFFECT_REMOVE_BRAINWASHING
=
295
--洗脑解除
EFFECT_BP_TWICE
=
296
--2次战斗阶段
EFFECT_UNIQUE_CHECK
=
297
--場上只能存在1張(Card.SetUniqueOnField()專用)
EFFECT_MATCH_KILL
=
300
--Match胜利(胜利龙)
EFFECT_SYNCHRO_CHECK
=
310
--基因组斗士
EFFECT_QP_ACT_IN_NTPHAND
=
311
--对方回合从自己手卡发动(失乐的圣女)
EFFECT_MUST_BE_SMATERIAL
=
312
--必须作为同调素材(波动龙 声子龙)
EFFECT_TO_GRAVE_REDIRECT_CB
=
313
--重新指定去向(寶玉獸)
EFFECT_CHANGE_INVOLVING_BATTLE_DAMAGE
=
314
--改变此卡的战斗产生的战斗伤害
EFFECT_CHANGE_RANK_FINAL
=
315
--N/A
EFFECT_MUST_BE_FMATERIAL
=
316
--必须作为融合素材
EFFECT_MUST_BE_XMATERIAL
=
317
--必须作为超量素材
EFFECT_MUST_BE_LMATERIAL
=
318
--必须作为连接素材
EFFECT_SPSUMMON_PROC_G
=
320
--P召唤规则
EFFECT_SPSUMMON_COUNT_LIMIT
=
330
--特殊召唤次数限制
EFFECT_LEFT_SPSUMMON_COUNT
=
331
--剩餘召喚次數(召喚限制網)
EFFECT_CANNOT_SELECT_BATTLE_TARGET
=
332
--對手不能選擇為攻擊對象
EFFECT_CANNOT_SELECT_EFFECT_TARGET
=
333
--對手不能選擇為效果對象
EFFECT_ADD_SETCODE
=
334
--视为「XX」字段的效果
EFFECT_NO_EFFECT_DAMAGE
=
335
--玩家已受到"效果傷害變成0"的效果影響(只用于检查,实际免伤仍需要EFFECT_CHANGE_DAMAGE等)
EFFECT_UNSUMMONABLE_CARD
=
336
--N/A
EFFECT_DISABLE_CHAIN_FIELD
=
337
--N/A
EFFECT_DISCARD_COST_CHANGE
=
338
--反制陷阱捨棄手牌的代價改變(解放之阿里阿德涅)
EFFECT_HAND_SYNCHRO
=
339
--用手牌的怪獸當作同步素材
EFFECT_ADD_FUSION_CODE
=
340
--作为融合素材时可以当作某一卡名(融合识别)
EFFECT_ADD_FUSION_SETCODE
=
341
--作为融合素材时可以当作某一字段(魔玩具改造)
EFFECT_RISE_TO_FULL_HEIGHT
=
342
--N/A
EFFECT_ONLY_ATTACK_MONSTER
=
343
--只能攻擊X
EFFECT_MUST_ATTACK_MONSTER
=
344
--若攻擊則必須攻擊X
EFFECT_PATRICIAN_OF_DARKNESS
=
345
--由對手選擇攻擊對象(黑暗貴族)
EFFECT_EXTRA_ATTACK_MONSTER
=
346
--對怪獸攻擊X次
EFFECT_UNION_STATUS
=
347
--同盟状态
EFFECT_OLDUNION_STATUS
=
348
--旧同盟状态
EFFECT_ADD_FUSION_ATTRIBUTE
=
349
--reserve
EFFECT_REMOVE_FUSION_ATTRIBUTE
=
350
--reserve
EFFECT_CHANGE_FUSION_ATTRIBUTE
=
351
--用作融合素材时的属性
EFFECT_EXTRA_FUSION_MATERIAL
=
352
--增加融合素材(万溶炼金师)
EFFECT_TUNER_MATERIAL_LIMIT
=
353
--同调素材限制
EFFECT_ADD_LINK_CODE
=
354
--用作连接素材时的卡名
EFFECT_ADD_LINK_SETCODE
=
355
--reserve
EFFECT_ADD_LINK_ATTRIBUTE
=
356
--用作连接素材时的属性
EFFECT_ADD_LINK_RACE
=
357
--用作连接素材时的种族
EFFECT_EXTRA_LINK_MATERIAL
=
358
--手卡的连接素材
EFFECT_QP_ACT_IN_SET_TURN
=
359
--速攻魔法可以在盖放的回合发动
EFFECT_EXTRA_PENDULUM_SUMMON
=
360
--extra pendulum summon
EFFECT_MATERIAL_LIMIT
=
361
--
EFFECT_SET_BATTLE_ATTACK
=
362
--战斗的伤害计算用设置的攻击力进行
EFFECT_SET_BATTLE_DEFENSE
=
363
--战斗的伤害计算用设置的守备力进行
EFFECT_OVERLAY_RITUAL_MATERIAL
=
364
--此卡的超量素材也能用于仪式召唤
EFFECT_CHANGE_GRAVE_ATTRIBUTE
=
365
--墓地的卡将会改变属性(升级转变)
EFFECT_CHANGE_GRAVE_RACE
=
366
--墓地的卡将会改变种族(升级转变)
EFFECT_ACTIVATION_COUNT_LIMIT
=
367
--reserve
EFFECT_LIMIT_SPECIAL_SUMMON_POSITION
=
368
--不能以特定表示形式特殊召唤
EFFECT_TUNER
=
369
--同调召唤时可以当作调整(百檎龙- 苹果鳞虫)
EFFECT_KAISER_COLOSSEUM
=
370
--皇帝斗技场
EFFECT_REPLACE_DAMAGE
=
371
--伤害由特定行动代替
EFFECT_FLAG_EFFECT
=
0x20000000
--标记类效果,即RegisterFlagEffect()创建的效果
EFFECT_CANNOT_TO_EXILE
=
0x688
----不能除外
--下面是诱发效果的诱发事件、时点 (如果是TYPE_SINGLE则自己发生以下事件后触发,如果TYPE_FIELD则场上任何卡发生以下事件都触发)
EVENT_STARTUP
=
1000
--N/A
EVENT_FLIP
=
1001
--翻转时
EVENT_FREE_CHAIN
=
1002
--自由时点(强脱等,还有昴星团等诱发即时效果)
EVENT_DESTROY
=
1010
--確定被破壞的卡片移動前
EVENT_REMOVE
=
1011
--除外时
EVENT_TO_HAND
=
1012
--加入手牌时
EVENT_TO_DECK
=
1013
--回卡组时
EVENT_TO_GRAVE
=
1014
--送去墓地时(不含REASON_RETURN)
EVENT_LEAVE_FIELD
=
1015
--离场时
EVENT_CHANGE_POS
=
1016
--表示形式变更时
EVENT_RELEASE
=
1017
--解放时
EVENT_DISCARD
=
1018
--丢弃手牌时
EVENT_LEAVE_FIELD_P
=
1019
--離場的卡片移動前
EVENT_CHAIN_SOLVING
=
1020
--连锁处理开始时(EVENT_CHAIN_ACTIVATING之後)
EVENT_CHAIN_ACTIVATING
=
1021
--连锁处理准备中
EVENT_CHAIN_SOLVED
=
1022
--连锁处理结束时
EVENT_CHAIN_ACTIVATED
=
1023
--N/A
EVENT_CHAIN_NEGATED
=
1024
--连锁发动无效时(EVENT_CHAIN_ACTIVATING之後)
EVENT_CHAIN_DISABLED
=
1025
--连锁效果无效时
EVENT_CHAIN_END
=
1026
--连锁串结束时
EVENT_CHAINING
=
1027
--效果发动时
EVENT_BECOME_TARGET
=
1028
--成为效果对象时
EVENT_DESTROYED
=
1029
--被破坏时
EVENT_MOVE
=
1030
--移動卡片(急兔馬)
EVENT_LEAVE_GRAVE
=
1031
--离开墓地时
EVENT_LEAVE_DECK
=
1032
--离开卡组或额外卡组时
EVENT_ADJUST
=
1040
--adjust_all()调整後(御前试合)
EVENT_BREAK_EFFECT
=
1050
--Duel.BreakEffect()被调用时
EVENT_SUMMON_SUCCESS
=
1100
--通常召唤成功时
EVENT_FLIP_SUMMON_SUCCESS
=
1101
--翻转召唤成功时
EVENT_SPSUMMON_SUCCESS
=
1102
--特殊召唤成功时
EVENT_SUMMON
=
1103
--召唤之际(怪兽还没上场、神宣等时点)
EVENT_FLIP_SUMMON
=
1104
--翻转召唤之际
EVENT_SPSUMMON
=
1105
--特殊召唤之际
EVENT_MSET
=
1106
--放置怪兽时
EVENT_SSET
=
1107
--放置魔陷时
EVENT_BE_MATERIAL
=
1108
--作为同调/超量/连结素材、用于升级召唤的解放、作为仪式/融合召唤的素材
EVENT_BE_PRE_MATERIAL
=
1109
--将要作为同调/超量/连结素材、用于升级召唤的解放
EVENT_DRAW
=
1110
--抽卡时
EVENT_DAMAGE
=
1111
--造成战斗/效果伤害时
EVENT_RECOVER
=
1112
--回复生命值时
EVENT_PREDRAW
=
1113
--抽卡阶段通常抽卡前
EVENT_SUMMON_NEGATED
=
1114
--召唤被无效时
EVENT_FLIP_SUMMON_NEGATED
=
1115
--反转召唤被无效时
EVENT_SPSUMMON_NEGATED
=
1116
--特殊召唤被无效时
EVENT_SPSUMMON_SUCCESS_G_P
=
1117
--EFFECT_SPSUMMON_PROC_G特殊召唤成功前(只能使用EFFECT_TYPE_CONTINUOUS)
EVENT_CONTROL_CHANGED
=
1120
--控制权变更
EVENT_EQUIP
=
1121
--装备卡装备时
EVENT_ATTACK_ANNOUNCE
=
1130
--攻击宣言时
EVENT_BE_BATTLE_TARGET
=
1131
--被选为攻击对象时
EVENT_BATTLE_START
=
1132
--伤害步骤开始时(反转前)
EVENT_BATTLE_CONFIRM
=
1133
--伤害计算前(反转後)
EVENT_PRE_DAMAGE_CALCULATE
=
1134
--伤害计算时(羽斬)
EVENT_DAMAGE_CALCULATING
=
1135
--N/A
EVENT_PRE_BATTLE_DAMAGE
=
1136
--即将产生战斗伤害(只能使用EFFECT_TYPE_CONTINUOUS)
EVENT_BATTLE_END
=
1137
--N/A
EVENT_BATTLED
=
1138
--伤害计算后(异女、同反转效果时点)
EVENT_BATTLE_DESTROYING
=
1139
--以战斗破坏怪兽送去墓地时(BF- 苍炎之修罗)
EVENT_BATTLE_DESTROYED
=
1140
--被战斗破坏送去墓地时(杀人番茄等)
EVENT_DAMAGE_STEP_END
=
1141
--伤害步骤结束时
EVENT_ATTACK_DISABLED
=
1142
--攻击无效时(翻倍机会)
EVENT_BATTLE_DAMAGE
=
1143
--造成战斗伤害时
EVENT_TOSS_DICE
=
1150
--掷骰子的结果产生后
EVENT_TOSS_COIN
=
1151
--抛硬币的结果产生后
EVENT_TOSS_COIN_NEGATE
=
1152
--重新抛硬币
EVENT_TOSS_DICE_NEGATE
=
1153
--重新掷骰子
EVENT_LEVEL_UP
=
1200
--等级上升时
EVENT_PAY_LPCOST
=
1201
--支付生命值时
EVENT_DETACH_MATERIAL
=
1202
--去除超量素材时
EVENT_RETURN_TO_GRAVE
=
1203
--回到墓地时
EVENT_TURN_END
=
1210
--回合结束时
EVENT_PHASE
=
0x1000
--阶段结束时
EVENT_PHASE_START
=
0x2000
--阶段开始时
EVENT_ADD_COUNTER
=
0x10000
--增加指示物时
EVENT_REMOVE_COUNTER
=
0x20000
--去除指示物时(A指示物),Card.RemoveCounter()必須手動觸發此事件
EVENT_CUSTOM
=
0x10000000
--自訂事件
--自定时点
EVENT_TRIGGER
=
VgID
--判定时点
EVENT_CRITICAL_STRIKE
=
VgID
+
1
--暴击值结算时点
EVENT_DAMAGE_TRIGGER
=
VgID
+
2
--受伤判定完毕时点
EVENT_RIDE_START
=
VgID
+
3
--骑升时点
EVENT_SUPPORT
=
VgID
+
4
--支援时点
EVENT_TRIGGERCOUNTUP
=
VgID
+
5
--驱动追加
EVENT_SING
=
VgID
+
6
--演唱时
EVENT_OVERLAY_FILL
=
VgID
+
7
--灵魂填充时
--攻击时(EVENT_ATTACK_ANNOUNCE)
--支援时(EVENT_CUSTOM + EVENT_SUPPORT)
--截击|放置到G(EVENT_MOVE)
--攻击击中时(EVENT_CUSTOM + EVENT_DAMAGE_TRIGGER|EVENT_BATTLE_DESTROYING)
--战斗结束时(EVENT_BATTLED)
--Hint
HINT_EVENT
=
1
HINT_MESSAGE
=
2
HINT_SELECTMSG
=
3
HINT_OPSELECTED
=
4
HINT_EFFECT
=
5
HINT_RACE
=
6
HINT_ATTRIB
=
7
HINT_CODE
=
8
HINT_NUMBER
=
9
HINT_CARD
=
10
HINT_ZONE
=
11
HINT_LINES
=
24
--Card Hint
CHINT_TURN
=
1
CHINT_CARD
=
2
CHINT_RACE
=
3
CHINT_ATTRIBUTE
=
4
CHINT_NUMBER
=
5
CHINT_DESC
=
6
--Opcode
OPCODE_ADD
=
0x40000000
OPCODE_SUB
=
0x40000001
OPCODE_MUL
=
0x40000002
OPCODE_DIV
=
0x40000003
OPCODE_AND
=
0x40000004
OPCODE_OR
=
0x40000005
OPCODE_NEG
=
0x40000006
OPCODE_NOT
=
0x40000007
OPCODE_ISCODE
=
0x40000100
OPCODE_ISSETCARD
=
0x40000101
OPCODE_ISTYPE
=
0x40000102
OPCODE_ISRACE
=
0x40000103
OPCODE_ISATTRIBUTE
=
0x40000104
--
DOUBLE_DAMAGE
=
-
2147483648
HALF_DAMAGE
=
-
2147483647
--Hint Message --提示消息,显示在窗口的上面
HINTMSG_LEAVEFIELD
=
500
--请选择要退场的卡
HINTMSG_DISCARD
=
501
--请选择要丢弃的手牌
HINTMSG_IMPRISON
=
502
--请选择要收容的卡
HINTMSG_REMOVE
=
503
--请选择要除外的卡
HINTMSG_TODROP
=
504
--请选择要置入弃牌区的卡
HINTMSG_LOCK
=
505
--请选择要封锁的卡
HINTMSG_ATOHAND
=
506
--请选择要加入手牌的卡
HINTMSG_TODECK
=
507
--请选择要返回卡组的卡
HINTMSG_CALL
=
508
--请选择要Call到圆阵的卡
HINTMSG_SPSUMMON
=
509
--请选择要特殊召唤的卡
HINTMSG_DAMAGE
=
510
--请选择要消耗的费用
HINTMSG_ATKUP
=
511
--请选择力量上升的卡
HINTMSG_CRITICAL_STRIKE
=
512
--请选择☆值上升的卡
HINTMSG_FACEUP
=
514
--请选择表侧表示的卡
HINTMSG_FACEDOWN
=
515
--请选择里侧表示的卡
HINTMSG_ATTACK
=
516
--请选择攻击表示的怪兽
HINTMSG_DEFENSE
=
517
--请选择守备表示的怪兽
HINTMSG_EQUIP
=
518
--请选择要装备的卡
HINTMSG_TO_GZONE
=
519
--请选择要CALL到防卫者圆阵的卡
HINTMSG_VMONSTER
=
522
--请选择先导者
HINTMSG_RMONSTER
=
523
--请选择后防者
HINTMSG_MONSTER
=
524
--请选择单位
HINTMSG_FACEDOWNDEFENSE
=
525
--请选择里侧守备表示的怪兽
HINTMSG_CONFIRM
=
526
--请选择给对方确认的卡
HINTMSG_TOFIELD
=
527
--请选择要放置到场上的卡
HINTMSG_POSCHANGE
=
528
--请选择要改变表示形式的怪兽
HINTMSG_SELF
=
529
--请选择自己的卡
HINTMSG_OPPO
=
530
--请选择对方的卡
HINTMSG_TRIBUTE
=
531
--请选择上级召唤用需要解放的怪兽
HINTMSG_REMOVEXYZ
=
532
--请选择要拔除的卡
HINTMSG_OVERLAY
=
533
--请选择要重叠的卡
HINTMSG_ATTACKTARGET
=
549
--请选择攻击的对象
HINTMSG_EFFECT
=
550
--请选择要发动的效果
HINTMSG_TARGET
=
551
--请选择效果的对象
HINTMSG_COIN
=
552
--请选择硬币的正反面
HINTMSG_DICE
=
553
--请选择骰子的结果
HINTMSG_CARDTYPE
=
554
--请选择一个种类
HINTMSG_OPTION
=
555
--请选择一个选项
HINTMSG_RESOLVEEFFECT
=
556
--请选择要发动/处理的效果
HINTMSG_SELECT
=
560
--请选择
HINTMSG_POSITION
=
561
--请选择表示形式
HINTMSG_ATTRIBUTE
=
562
--请选择要宣言的属性
HINTMSG_RACE
=
563
--请选择要宣言的种族
HINTMSG_CODE
=
564
--请宣言一个卡名
HINGMSG_NUMBER
=
565
--请选择一个数字
HINGMSG_LVRANK
=
567
--请宣言一个等级
HINTMSG_RESOLVECARD
=
568
--请选择要处理效果的卡
HINTMSG_ZONE
=
569
--请选择[%ls]的位置
HINTMSG_CallZONE
=
570
--请选择圆阵
HINTMSG_TOZONE
=
571
--请选择要移动到的位置
HINTMSG_TOTOP
=
572
--请选择要放置到牌堆顶的卡
HINTMSG_DISABLE
=
573
--请选择要无效的卡
HINTMSG_OPERATECARD
=
574
--请选择要操作的卡
HINTMSG_XMATERIAL
=
513
--请选择要充入魂中的卡
--Select --请选择
SELECT_HEADS
=
60
--正面
SELECT_TAILS
=
61
--反面
--Timing --提示时点,可以给freechain卡片增加自动提示时点
TIMING_DRAW_PHASE
=
0x1
--抽卡阶段时点
TIMING_STANDBY_PHASE
=
0x2
--准备阶段时点
TIMING_MAIN_END
=
0x4
--主要阶段结束时点
TIMING_BATTLE_START
=
0x8
--战斗阶段开始时点
TIMING_BATTLE_END
=
0x10
--战斗阶段结束时点
TIMING_END_PHASE
=
0x20
--结束阶段时点
TIMING_SUMMON
=
0x40
--召唤时点
TIMING_SPSUMMON
=
0x80
--特殊召唤时点
TIMING_FLIPSUMMON
=
0x100
--翻转召唤时点
TIMING_MSET
=
0x200
--放置怪兽时点
TIMING_SSET
=
0x400
--放置魔陷时点
TIMING_POS_CHANGE
=
0x800
--表示形式变更时点
TIMING_ATTACK
=
0x1000
--攻击宣言时点
TIMING_DAMAGE_STEP
=
0x2000
--伤害步骤时点
TIMING_DAMAGE_CAL
=
0x4000
--伤害计算时点
TIMING_CHAIN_END
=
0x8000
--连锁结束时点
TIMING_DRAW
=
0x10000
--抽卡时点(不是抽卡阶段
TIMING_DAMAGE
=
0x20000
--造成伤害时点
TIMING_RECOVER
=
0x40000
--回复时点
TIMING_DESTROY
=
0x80000
--破坏时点
TIMING_REMOVE
=
0x100000
--除外时点
TIMING_TOHAND
=
0x200000
--加入手牌时点(检索、回收等)
TIMING_TODECK
=
0x400000
--回卡组时点
TIMING_TOGRAVE
=
0x800000
--进墓地时点
TIMING_BATTLE_PHASE
=
0x1000000
--战斗阶段时点
TIMING_EQUIP
=
0x2000000
--装备时点
TIMING_BATTLE_STEP_END
=
0x4000000
--戰鬥步驟結束時
TIMING_BATTLED
=
0x8000000
--伤害计算后时点
----组合时点
TIMINGS_CHECK_MONSTER
=
0x1c0
-- 怪兽正面上场
--Global flag --特殊标记
GLOBALFLAG_DECK_REVERSE_CHECK
=
0x1
--卡组翻转标记
GLOBALFLAG_BRAINWASHING_CHECK
=
0x2
--洗脑解除标记
GLOBALFLAG_SCRAP_CHIMERA
=
0x4
--废铁奇美拉标记
GLOBALFLAG_DELAYED_QUICKEFFECT
=
0x8
--N/A
GLOBALFLAG_DETACH_EVENT
=
0x10
--EVENT_DETACH_MATERIAL
GLOBALFLAG_MUST_BE_SMATERIAL
=
0x20
--N/A
GLOBALFLAG_SPSUMMON_COUNT
=
0x40
--玩家的特殊召唤次数限制
GLOBALFLAG_XMAT_COUNT_LIMIT
=
0x80
--超量素材数量限制标记(光天使 天座)
GLOBALFLAG_SELF_TOGRAVE
=
0x100
--不入連鎖的送墓檢查(EFFECT_SELF_TOGRAVE)
GLOBALFLAG_SPSUMMON_ONCE
=
0x200
--1回合只能特殊召喚1次(Card.SetSPSummonOnce())
GLOBALFLAG_TUNE_MAGICIAN
=
0x400
--超量素材检查标记(调弦之魔术师)
--count_code
EFFECT_COUNT_CODE_OATH
=
0x10000000
--发动次数限制(誓约次数, 发动被无效不计数)
EFFECT_COUNT_CODE_DUEL
=
0x20000000
--决斗中使用次数
EFFECT_COUNT_CODE_CHAIN
=
0x40000000
--同一连锁中使用次数
EFFECT_COUNT_CODE_SINGLE
=
0x1
--同一张卡的多个效果公共使用次数
--特殊选项
DUEL_TEST_MODE
=
0x01
--测试模式(目前暫無)
DUEL_ATTACK_FIRST_TURN
=
0x02
--第一回合可以攻击(用于残局)
DUEL_OLD_REPLAY
=
0x04
--旧录像
DUEL_OBSOLETE_RULING
=
0x08
--使用舊規則
DUEL_PSEUDO_SHUFFLE
=
0x10
--不洗牌
DUEL_TAG_MODE
=
0x20
--双打PP
DUEL_SIMPLE_AI
=
0x40
--AI(用于残局)
DUEL_RETURN_DECK_TOP
=
0x80
--回卡组洗切的卡放到卡组最上方(不洗牌模式下曾经的默认行为)
--Activity counter
--global: 1- 6 (binary: 5, 6)
--custom: 1- 5, 7 (binary: 1- 5)
ACTIVITY_SUMMON
=
1
--
ACTIVITY_NORMALSUMMON
=
2
--
ACTIVITY_SPSUMMON
=
3
--
ACTIVITY_FLIPSUMMON
=
4
--
ACTIVITY_ATTACK
=
5
--
ACTIVITY_BATTLE_PHASE
=
6
-- not available in custom counter
ACTIVITY_CHAIN
=
7
-- only available in custom counter
--Special flag effect id
FLAG_ID_CHAINING
=
1
FLAG_ID_UNION
=
2
FLAG_ID_NO_NORMAL_DRAW
=
3
--Flag
FLAG_COUNT_TRIGGER
=
VgID
--计数标识
FLAG_ATTACK_TRIGGER
=
VgID
+
1
--多次攻击判定标识
FLAG_DAMAGE_TRIGGER
=
VgID
+
2
--多次伤害判定标识
FLAG_DEFENSE_ENTIRELY
=
VgID
+
3
--完全防御标识
FLAG_CONDITION
=
VgID
+
4
--处于XX状态标识
FLAG_SUPPORT
=
VgID
+
5
--支援状态标识
FLAG_SUPPORTED
=
VgID
+
6
--被支援
FLAG_ATTACK_AT_REAR
=
VgID
+
7
--后列攻击
FLAG_IMPRISON
=
VgID
+
8
--被收容
FLAG_SPELL_COUNT_LIMIT
=
VgID
+
9
--指令卡次数
FLAG_SPELL_USED_COUNT
=
VgID
+
10
--指令卡已使用次数
FLAG_ALSO_CAN_TRIGGER
=
VgID
+
11
--后防着也能驱动判定
FLAG_EFFECT_DAMAGE
=
VgID
+
12
--效果伤害标识
--AffectedByEffect
AFFECT_CODE_MIX
=
VgID
--魔合成
AFFECT_CODE_MIX_DIFFERENT_NAME
=
VgID
+
1
--魔合成(卡名不同)
AFFECT_CODE_BOTH_WING
=
VgID
+
2
--你的卡片的白翼能力和黑翼能力两方均有效
AFFECT_CODE_NIGHT
=
VgID
+
3
--黑夜
AFFECT_CODE_DEEP_NIGHT
=
VgID
+
4
--深渊黑夜
AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX
=
VgID
+
5
--魔合成可以不支付灵魂爆发
AFFECT_CODE_DEFENDER_CANNOT_TO_GZONE
=
VgID
+
6
--不能将守护者从手牌CALL到G上
AFFECT_CODE_OVERLAY_INSTEAD_WHEN_RIDE
=
10501082
--不执行『选择手牌中的1张卡,舍弃』而是执行『灵魂爆发1』来将卡RIDE
POS_FACEUP_DEFENCE
=
POS_FACEUP_DEFENSE
POS_FACEDOWN_DEFENCE
=
POS_FACEDOWN_DEFENSE
\ No newline at end of file
VgFuncLib.lua
deleted
100644 → 0
View file @
cb12d359
--VgF库
VgF
=
{}
vgf
=
VgF
bit
=
{}
---@class Card
---@class Group
---@class Effect
---获取脚本基本信息
function
GetID
()
local
offset
=
self_code
<
100000000
and
1
or
100
return
self_table
,
self_code
,
offset
end
---根据卡号和索引获取描述编号
---@param code number 卡片密码
---@param id number 索引
---@return number 描述的编号
function
VgF
.
Stringid
(
code
,
id
)
return
code
*
16
+
id
end
---根据控制者,区域和编号获取zone;不合法的数据会返回0
---@param p number 控制者
---@param loc number 所在区域,若不是LOCATION_MZONE或LOCATION_SZONE则返回0
---@param seq number 编号
---@return number 卡片所在的zone
function
VgF
.
SequenceToGlobal
(
p
,
loc
,
seq
)
if
p
~=
0
or
p
~=
1
or
loc
&
0xc
~=
loc
then
return
0
end
if
loc
==
LOCATION_MZONE
and
seq
<=
6
then
return
0x0001
<<
(
seq
)
elseif
loc
==
LOCATION_SZONE
and
seq
<=
4
then
return
0x0100
<<
(
16
*
p
+
seq
)
end
return
0
end
---一个总是返回true的函数。
---@return true
function
VgF
.
True
()
return
true
end
---一个总是返回false的函数。
---@return false
function
VgF
.
False
()
return
false
end
---返回g中的“下一张卡”。第一次调用会返回第一张卡。没有下一张卡会返回nil。
---@param g Group 要遍历的卡片组
---@return function 指示返回的卡的函数
function
VgF
.
Next
(
g
)
local
first
=
true
return
function
()
if
first
then
first
=
false
return
g
:
GetFirst
()
else
return
g
:
GetNext
()
end
end
end
---返回v在lua中的变量类型,以string方式呈现。
---@param v any 要获取类型的变量(或常量)
---@return string 以字符串形式呈现的类型
function
VgF
.
GetValueType
(
v
)
local
t
=
type
(
v
)
if
t
==
"userdata"
then
local
mt
=
getmetatable
(
v
)
if
mt
==
Group
then
return
"Group"
elseif
mt
==
Effect
then
return
"Effect"
else
return
"Card"
end
else
return
t
end
end
---如果g是Group的话,返回其第一张卡;如果g是Card的话,返回其本身;否则返回nil。
---@param g any 要操作的变量
---@return Card
function
VgF
.
ReturnCard
(
g
)
local
tc
=
nil
if
VgF
.
GetValueType
(
g
)
==
"Group"
then
tc
=
g
:
GetFirst
()
elseif
VgF
.
GetValueType
(
g
)
==
"Card"
then
tc
=
g
end
return
tc
end
function
VgF
.
ReturnGroup
(
tc
)
local
g
=
Group
.
CreateGroup
()
if
VgF
.
GetValueType
(
tc
)
==
"Group"
then
return
tc
elseif
VgF
.
GetValueType
(
g
)
==
"Card"
then
g
.
AddCard
(
tc
)
end
return
g
end
---返回g的前val张卡。
---@param g Group 要操作的卡片组
---@param val number 要获取的卡片数量
function
VgF
.
GetCardsFromGroup
(
g
,
val
)
if
VgF
.
GetValueType
(
g
)
==
"Group"
then
local
sg
=
Group
.
CreateGroup
()
for
tc
in
VgF
.
Next
(
g
)
do
if
sg
:
GetCount
()
>=
val
then
break
end
sg
:
AddCard
(
tc
)
end
return
sg
end
end
function
bit
.
ReturnCount
(
n
)
if
n
==
0
then
return
0
end
return
1
+
bit
.
ReturnCount
(
n
&
(
n
-
1
))
end
function
table
.
copy
(
copy
,
original
)
copy
=
{}
if
VgF
.
GetValueType
(
original
)
~=
"table"
then
return
end
for
i
=
1
,
#
original
do
table.insert
(
copy
,
original
[
i
])
end
end
---返回对a和b进行按位与运算的结果。
---@param a number 操作数1
---@param b number 操作数2
---@return number 运算结果
function
bit
.
band
(
a
,
b
)
return
a
&
b
end
---返回对a和b进行按位或运算的结果。
---@param a number 操作数1
---@param b number 操作数2
---@return number 运算结果
function
bit
.
bor
(
a
,
b
)
return
a
|
b
end
---返回对a和b进行按位异或运算的结果。
---@param a number 操作数1
---@param b number 操作数2
---@return number 运算结果
function
bit
.
bxor
(
a
,
b
)
return
a
~
b
end
---返回a按位左移b位后的结果。
---@param a number 操作数1
---@param b number 操作数2
---@return number 运算结果
function
bit
.
lshift
(
a
,
b
)
return
a
<<
b
end
---返回a按位右移b位后的结果。
---@param a number 操作数1
---@param b number 操作数2
---@return number 运算结果
function
bit
.
rshift
(
a
,
b
)
return
a
>>
b
end
---返回a按位非后的结果。
---@param a number 操作数
---@return number 运算结果
function
bit
.
bnot
(
a
)
return
~
a
end
---返回c是不是先导者。
---@param c Card 要判断的卡
---@return boolean 指示是否是先导者
function
VgF
.
VMonsterFilter
(
c
)
return
VgF
.
IsSequence
(
c
,
5
)
end
---返回c是不是后防者。
---@param c Card 要判断的卡
---@return boolean 指示是否是后防者
function
VgF
.
RMonsterFilter
(
c
)
return
c
:
GetSequence
()
<
5
end
---用于效果的Condition,判断e是否以后防者发动。
---@param e Effect
---@return boolean
function
VgF
.
RMonsterCondition
(
e
)
return
VgF
.
RMonsterFilter
(
e
:
GetHandler
())
end
---用于效果的Condition,判断e是否以先导者发动。
---@param e Effect
---@return boolean
function
VgF
.
VMonsterCondition
(
e
)
return
VgF
.
VMonsterFilter
(
e
:
GetHandler
())
end
function
VgF
.
VSummonCondition
(
e
)
local
c
=
e
:
GetHandler
()
return
VgF
.
IsSummonTypeV
(
c
)
end
function
VgF
.
RSummonCondition
(
e
)
return
not
VgF
.
VSummonCondition
(
e
)
end
function
VgF
.
IsSummonTypeV
(
c
)
return
c
:
IsSummonType
(
SUMMON_TYPE_RIDE
)
or
c
:
IsSummonType
(
SUMMON_TYPE_SELFRIDE
)
end
function
VgF
.
IsSummonTypeR
(
c
)
return
not
VgF
.
IsSummonTypeV
(
c
)
end
---判断c是否在当前区域的某(几)个编号上
---@param c Card 要判断的卡
---@param ... number 编号
---@return boolean 指示是否在给定编号上
function
VgF
.
IsSequence
(
c
,
...
)
for
i
,
v
in
ipairs
{
...
}
do
if
c
:
GetSequence
()
==
v
then
return
true
end
end
return
false
end
function
VgF
.
RuleCardCondtion
(
e
)
local
tp
=
e
:
GetHandlerPlayer
()
local
g
=
Duel
.
GetMatchingGroup
(
nil
,
tp
,
LOCATION_ALL
,
0
,
nil
)
return
e
:
GetHandler
()
==
g
:
GetFirst
()
end
function
VgF
.
RuleTurnCondtion
(
e
)
local
tp
=
e
:
GetHandlerPlayer
()
local
a
=
Duel
.
GetTurnCount
(
tp
)
local
b
=
Duel
.
GetTurnCount
(
1
-
tp
)
return
a
+
b
==
1
end
---返回函数,该函数与f的结果总是相反的。
---@param f 要操作的函数
---@return function 经过操作的函数
function
VgF
.
Not
(
f
)
return
function
(
...
)
return
not
f
(
...
)
end
end
---返回c所在列的所有单位。
---@param c Card 指示某一列的卡
---@return Group 这一列的所有单位
function
VgF
.
GetColumnGroup
(
c
)
local
tp
=
c
:
GetControler
()
local
g
=
Group
.
CreateGroup
()
if
c
:
GetSequence
()
==
0
then
local
sg1
=
VgF
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
1
)
local
sg2
=
VgF
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
0
,
LOCATION_MZONE
,
nil
,
3
,
4
)
if
sg1
:
GetCount
()
>
0
then
g
:
Merge
(
sg1
)
end
if
sg2
:
GetCount
()
>
0
then
g
:
Merge
(
sg2
)
end
end
if
c
:
GetSequence
()
==
1
then
local
sg1
=
VgF
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
0
)
local
sg2
=
VgF
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
0
,
LOCATION_MZONE
,
nil
,
3
,
4
)
if
sg1
:
GetCount
()
>
0
then
g
:
Merge
(
sg1
)
end
if
sg2
:
GetCount
()
>
0
then
g
:
Merge
(
sg2
)
end
end
if
c
:
GetSequence
()
==
2
then
local
sg1
=
VgF
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
5
)
local
sg2
=
VgF
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
0
,
LOCATION_MZONE
,
nil
,
2
,
5
)
if
sg1
:
GetCount
()
>
0
then
g
:
Merge
(
sg1
)
end
if
sg2
:
GetCount
()
>
0
then
g
:
Merge
(
sg2
)
end
end
if
c
:
GetSequence
()
==
3
then
local
sg1
=
VgF
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
4
)
local
sg2
=
VgF
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
0
,
LOCATION_MZONE
,
nil
,
0
,
1
)
if
sg1
:
GetCount
()
>
0
then
g
:
Merge
(
sg1
)
end
if
sg2
:
GetCount
()
>
0
then
g
:
Merge
(
sg2
)
end
end
if
c
:
GetSequence
()
==
4
then
local
sg1
=
VgF
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
3
)
local
sg2
=
VgF
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
0
,
LOCATION_MZONE
,
nil
,
0
,
1
)
if
sg1
:
GetCount
()
>
0
then
g
:
Merge
(
sg1
)
end
if
sg2
:
GetCount
()
>
0
then
g
:
Merge
(
sg2
)
end
end
if
c
:
GetSequence
()
==
5
then
local
sg1
=
VgF
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
2
)
local
sg2
=
VgF
.
GetMatchingGroup
(
VgF
.
IsSequence
,
tp
,
0
,
LOCATION_MZONE
,
nil
,
2
,
5
)
if
sg1
:
GetCount
()
>
0
then
g
:
Merge
(
sg1
)
end
if
sg2
:
GetCount
()
>
0
then
g
:
Merge
(
sg2
)
end
end
return
g
end
function
VgF
.
GetAvailableLocation
(
tp
,
zone
)
local
z
if
zone
then
z
=
zone
else
z
=
0x1f
end
local
rg
=
Duel
.
GetMatchingGroup
(
Card
.
IsPosition
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
POS_FACEDOWN_ATTACK
)
for
tc
in
VgF
.
Next
(
rg
)
do
local
szone
=
VgF
.
SequenceToGlobal
(
tp
,
tc
:
GetLocation
(),
tc
:
GetSequence
())
z
=
bit
.
bxor
(
z
,
szone
)
end
return
z
end
---将g(中的每一张卡)Call到单位区。返回Call成功的数量。
---@param g Card|Group 要Call的卡(片组)
---@param sumtype number Call的方式,默认填0
---@param tp number Call的玩家
---@param zone number|nil 指示要Call到的格子。<br>前列的R:17; 后列的R:14; 全部的R:31; V:32
---@param pos number|nil 表示形式
---@return number Call成功的数量
function
VgF
.
Call
(
g
,
sumtype
,
tp
,
zone
,
pos
)
if
(
VgF
.
GetValueType
(
g
)
~=
"Card"
and
VgF
.
GetValueType
(
g
)
~=
"Group"
)
or
(
VgF
.
GetValueType
(
g
)
==
"Group"
and
g
:
GetCount
()
==
0
)
then
return
0
end
if
VgF
.
GetValueType
(
pos
)
~=
"number"
then
pos
=
POS_FACEUP_ATTACK
end
if
VgF
.
GetValueType
(
zone
)
==
"string"
and
zone
==
"NoMonster"
then
return
Duel
.
SpecialSummon
(
g
,
sumtype
,
tp
,
tp
,
false
,
false
,
pos
)
elseif
VgF
.
GetValueType
(
zone
)
==
"string"
and
zone
==
"FromOverlayToV"
then
local
tc
=
VgF
.
ReturnCard
(
g
)
if
not
VgF
.
IsCanBeCalled
(
tc
,
nil
,
tp
,
sumtype
,
pos
,
"FromOverlayToV"
)
then
return
0
end
VgF
.
Sendto
(
0
,
tc
,
tp
,
POS_FACEUP
,
REASON_EFFECT
)
local
_
,
code
=
tc
:
GetOriginalCode
()
local
c
=
Duel
.
CreateToken
(
tp
,
code
)
return
VgF
.
Call
(
c
,
sumtype
,
tp
,
0x20
,
pos
)
elseif
VgF
.
GetValueType
(
zone
)
==
"number"
and
zone
>
0
then
local
sc
=
VgF
.
ReturnCard
(
g
)
local
z
=
VgF
.
GetAvailableLocation
(
tp
,
zone
)
local
ct
=
bit
.
ReturnCount
(
z
)
local
szone
if
ct
>
1
then
z
=
bit
.
bnot
(
z
)
z
=
bit
.
bor
(
z
,
0xffffff00
)
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_CallZONE
)
szone
=
Duel
.
SelectField
(
tp
,
1
,
LOCATION_MZONE
,
0
,
z
)
else
szone
=
z
end
if
szone
==
0x20
then
if
VgF
.
GetVMonster
(
tp
)
then
local
tc
=
VgF
.
GetVMonster
(
tp
)
local
mg
=
tc
:
GetOverlayGroup
()
if
mg
:
GetCount
()
~=
0
then
VgF
.
Sendto
(
LOCATION_OVERLAY
,
mg
,
sc
)
end
sc
:
SetMaterial
(
Group
.
FromCards
(
tc
))
VgF
.
Sendto
(
LOCATION_OVERLAY
,
Group
.
FromCards
(
tc
),
sc
)
end
elseif
VgF
.
IsExistingMatchingCard
(
VgD
.
CallFilter
,
tp
,
LOCATION_MZONE
,
0
,
1
,
nil
,
tp
,
szone
)
then
local
tc
=
Duel
.
GetMatchingGroup
(
VgD
.
CallFilter
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
tp
,
szone
):
GetFirst
()
if
bit
.
band
(
sumtype
,
SUMMON_VALUE_OverDress
)
>
0
then
VgF
.
Sendto
(
LOCATION_OVERLAY
,
Group
.
FromCards
(
tc
),
sc
)
else
VgF
.
Sendto
(
LOCATION_DROP
,
tc
,
REASON_COST
)
end
end
return
Duel
.
SpecialSummon
(
sc
,
sumtype
,
tp
,
tp
,
false
,
false
,
pos
,
szone
)
else
local
sg
local
z
=
bit
.
bnot
(
VgF
.
GetAvailableLocation
(
tp
))
z
=
bit
.
bor
(
z
,
0xffffff00
)
if
VgF
.
GetValueType
(
g
)
==
"Card"
then
sg
=
Group
.
FromCards
(
g
)
else
sg
=
Group
.
Clone
(
g
)
end
for
sc
in
VgF
.
Next
(
sg
)
do
if
sc
:
IsLocation
(
LOCATION_EXTRA
)
then
local
rc
=
Duel
.
GetMatchingGroup
(
VgF
.
VMonsterFilter
,
tp
,
LOCATION_MZONE
,
0
,
nil
):
GetFirst
()
local
mg
=
rc
:
GetOverlayGroup
()
if
mg
:
GetCount
()
~=
0
then
VgF
.
Sendto
(
LOCATION_OVERLAY
,
mg
,
sc
)
end
sc
:
SetMaterial
(
Group
.
FromCards
(
rc
))
VgF
.
Sendto
(
LOCATION_OVERLAY
,
Group
.
FromCards
(
rc
),
sc
)
Duel
.
SpecialSummonStep
(
sc
,
sumtype
,
tp
,
tp
,
false
,
false
,
pos
,
0x20
)
else
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_CallZONE
)
local
szone
=
Duel
.
SelectField
(
tp
,
1
,
LOCATION_MZONE
,
0
,
z
)
if
VgF
.
IsExistingMatchingCard
(
VgD
.
CallFilter
,
tp
,
LOCATION_MZONE
,
0
,
1
,
nil
,
tp
,
szone
)
then
local
tc
=
Duel
.
GetMatchingGroup
(
VgD
.
CallFilter
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
tp
,
szone
):
GetFirst
()
VgF
.
Sendto
(
LOCATION_DROP
,
tc
,
REASON_COST
)
end
Duel
.
SpecialSummonStep
(
sc
,
sumtype
,
tp
,
tp
,
false
,
false
,
pos
,
szone
)
z
=
bit
.
bor
(
z
,
szone
)
end
end
return
Duel
.
SpecialSummonComplete
()
end
end
function
VgF
.
LvCondition
(
e_or_c
)
local
c
=
VgF
.
GetValueType
(
e_or_c
)
==
"Effect"
and
e_or_c
:
GetHandler
()
or
e_or_c
local
tp
,
lv
=
c
:
GetControler
(),
c
:
GetLevel
()
return
VgF
.
IsExistingMatchingCard
(
VgF
.
LvConditionFilter
,
tp
,
LOCATION_MZONE
,
0
,
1
,
nil
,
lv
)
end
function
VgF
.
LvConditionFilter
(
c
,
lv
)
return
VgF
.
VMonsterFilter
(
c
)
and
c
:
IsLevelAbove
(
lv
)
end
---以c的名义,使g(中的每一张卡)的攻击力上升val,并在reset时重置。
---@param c Card 要使卡上升攻击力的卡
---@param g Card|Group 要被上升攻击力的卡
---@param val number|string 要上升的攻击力(可以为负)
---@param reset number|nil 指示重置的时点,默认为“回合结束时”。无论如何,都会在离场时重置。
function
VgF
.
AtkUp
(
c
,
g
,
val
,
reset
,
resetcount
)
if
not
c
or
not
g
then
return
end
if
not
resetcount
then
resetcount
=
1
end
if
not
reset
then
reset
=
RESET_PHASE
+
PHASE_END
end
if
not
val
or
(
VgF
.
GetValueType
(
val
)
==
"number"
and
val
==
0
)
then
return
end
if
VgF
.
GetValueType
(
g
)
==
"Group"
and
g
:
GetCount
()
>
0
then
local
e
=
{}
for
tc
in
VgF
.
Next
(
g
)
do
if
tc
:
IsLocation
(
LOCATION_MZONE
)
then
if
VgF
.
GetValueType
(
val
)
==
"string"
and
val
==
"DOUBLE"
then
val
=
tc
:
GetLeftScale
()
end
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
,
resetcount
)
tc
:
RegisterEffect
(
e1
)
table.insert
(
e
,
e1
)
end
end
return
e
elseif
VgF
.
GetValueType
(
g
)
==
"Card"
then
local
tc
=
g
if
tc
:
IsLocation
(
LOCATION_MZONE
)
then
local
tc
=
VgF
.
ReturnCard
(
g
)
if
VgF
.
GetValueType
(
val
)
==
"string"
and
val
==
"DOUBLE"
then
val
=
tc
:
GetLeftScale
()
end
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
,
resetcount
)
tc
:
RegisterEffect
(
e1
)
return
e1
end
end
end
---以c的名义,使g(中的每一张卡)的盾值上升val,并在reset时重置。
---@param c Card 要使卡上升盾值的卡
---@param g Card|Group 要被上升盾值的卡
---@param val number|string 要上升的盾值(可以为负)
---@param reset number|nil 指示重置的时点,默认为“回合结束时”。无论如何,都会在离场时重置。
function
VgF
.
DefUp
(
c
,
g
,
val
,
reset
,
resetcount
)
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
val
or
(
VgF
.
GetValueType
(
val
)
==
"number"
and
val
==
0
)
then
return
end
if
VgF
.
GetValueType
(
g
)
==
"Group"
and
g
:
GetCount
()
>
0
then
local
e
=
{}
for
tc
in
VgF
.
Next
(
g
)
do
if
tc
:
IsLocation
(
LOCATION_MZONE
)
then
if
VgF
.
GetValueType
(
val
)
==
"string"
and
val
==
"DOUBLE"
then
val
=
tc
:
GetLeftScale
()
end
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetCode
(
EFFECT_UPDATE_DEFENSE
)
e1
:
SetValue
(
val
)
e1
:
SetReset
(
RESET_EVENT
+
RESETS_STANDARD
+
reset
,
resetcount
)
tc
:
RegisterEffect
(
e1
)
table.insert
(
e
,
e1
)
end
end
return
e
elseif
VgF
.
GetValueType
(
g
)
==
"Card"
then
local
tc
=
g
if
tc
:
IsLocation
(
LOCATION_MZONE
)
then
if
VgF
.
GetValueType
(
val
)
==
"string"
and
val
==
"DOUBLE"
then
val
=
tc
:
GetLeftScale
()
end
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetCode
(
EFFECT_UPDATE_DEFENSE
)
e1
:
SetValue
(
val
)
e1
:
SetReset
(
RESET_EVENT
+
RESETS_STANDARD
+
reset
,
resetcount
)
tc
:
RegisterEffect
(
e1
)
return
e1
end
end
end
---以c的名义,使g(中的每一张卡)的☆上升val,并在reset时重置。
---@param c Card 要使卡上升☆的卡
---@param g Card|Group 要被上升☆的卡
---@param val number|string 要上升的☆(可以为负)
---@param reset number|nil 指示重置的时点,默认为“回合结束时”。无论如何,都会在离场时重置。
function
VgF
.
StarUp
(
c
,
g
,
val
,
reset
,
resetcount
)
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
val
or
(
VgF
.
GetValueType
(
val
)
==
"number"
and
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
if
tc
:
IsLocation
(
LOCATION_MZONE
)
then
if
VgF
.
GetValueType
(
val
)
==
"string"
and
val
==
"DOUBLE"
then
val
=
tc
:
GetLeftScale
()
end
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetCode
(
EFFECT_UPDATE_LSCALE
)
e1
:
SetProperty
(
EFFECT_FLAG_SINGLE_RANGE
)
e1
:
SetRange
(
LOCATION_MZONE
)
e1
:
SetValue
(
val
)
e1
:
SetReset
(
RESET_EVENT
+
RESETS_STANDARD
+
reset
,
resetcount
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
e1
:
Clone
()
e2
:
SetCode
(
EFFECT_UPDATE_RSCALE
)
tc
:
RegisterEffect
(
e2
)
table.insert
(
t1
,
e1
)
table.insert
(
t2
,
e2
)
end
end
return
t1
,
t2
elseif
VgF
.
GetValueType
(
g
)
==
"Card"
then
local
tc
=
VgF
.
ReturnCard
(
g
)
if
tc
:
IsLocation
(
LOCATION_MZONE
)
then
if
VgF
.
GetValueType
(
val
)
==
"string"
and
val
==
"DOUBLE"
then
val
=
tc
:
GetLeftScale
()
end
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetCode
(
EFFECT_UPDATE_LSCALE
)
e1
:
SetProperty
(
EFFECT_FLAG_SINGLE_RANGE
)
e1
:
SetRange
(
LOCATION_MZONE
)
e1
:
SetValue
(
val
)
e1
:
SetReset
(
RESET_EVENT
+
RESETS_STANDARD
+
reset
,
resetcount
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
e1
:
Clone
()
e2
:
SetCode
(
EFFECT_UPDATE_RSCALE
)
tc
:
RegisterEffect
(
e2
)
return
e1
,
e2
end
end
end
---判断c是否可以以规则的手段到G区域。
---@param c Card 要判断的卡
---@return boolean 指示c能否去到G区域。
function
VgF
.
IsAbleToGZone
(
c
)
if
c
:
IsLocation
(
LOCATION_HAND
)
then
if
Duel
.
IsPlayerAffectedByEffect
(
c
:
GetControler
(),
AFFECT_CODE_DEFENDER_CANNOT_TO_GZONE
)
and
c
:
GetBaseDefense
()
==
0
then
return
false
end
return
c
:
IsType
(
TYPE_MONSTER
)
elseif
c
:
IsLocation
(
LOCATION_MZONE
)
then
return
c
:
IsAttribute
(
SKILL_BLOCK
)
and
VgF
.
IsSequence
(
c
,
0
,
4
)
and
c
:
IsLocation
(
LOCATION_MZONE
)
and
c
:
IsFaceup
()
end
return
false
end
---用于效果的Operation。它返回一个执行“[计数回充val]”的函数。
---@param val number 计数回充的数量
---@return function 效果的Operation函数
function
VgF
.
DamageFill
(
val
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_POSCHANGE
)
local
g
=
Duel
.
SelectMatchingCard
(
tp
,
Card
.
IsFaceup
,
tp
,
LOCATION_DAMAGE
,
0
,
val
,
val
,
nil
)
Duel
.
ChangePosition
(
g
,
POS_FACEUP_ATTACK
)
return
Duel
.
GetOperatedGroup
():
GetCount
()
end
end
---用于多Cost。例如 VgF.CostAnd(vgf.DamageCost(1), vgf.DisCardCost(1))。
function
VgF
.
CostAnd
(
...
)
local
funcs
=
{
...
}
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
for
_
,
func
in
ipairs
(
funcs
)
do
if
chk
==
0
then
chk
=
chk
and
func
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
else
func
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
end
end
return
chk
end
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
Duel
.
ChangePosition
(
c
,
POS_FACEUP_ATTACK
)
end
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
Duel
.
ChangePosition
(
c
,
POS_FACEUP_DEFENCE
)
end
end
---用于效果的Cost。它返回一个执行“【费用】[将手牌中的val张卡舍弃]”的函数。
---@param val number 要舍弃的卡的数量
---@return function 效果的Cost函数
function
VgF
.
DisCardCost
(
val
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
if
VgF
.
GetValueType
(
val
)
~=
"number"
then
return
0
end
local
c
=
e
:
GetHandler
()
local
m
=
c
:
GetOriginalCode
()
if
chk
==
0
then
if
e
:
IsHasType
(
EFFECT_TYPE_ACTIVATE
)
then
VgF
.
AddMixCostGroupFrom
(
c
,
m
,
"LOCATION_HAND"
)
VgF
.
AddMixCostGroupTo
(
c
,
m
,
"LOCATION_DROP"
)
VgF
.
AddMixCostGroupFilter
(
c
,
m
,
nil
)
VgF
.
AddMixCostGroupCountMin
(
c
,
m
,
val
)
VgF
.
AddMixCostGroupCountMax
(
c
,
m
,
val
)
end
return
VgF
.
IsExistingMatchingCard
(
nil
,
tp
,
LOCATION_HAND
,
0
,
val
,
nil
)
end
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_DISCARD
)
local
g
=
Duel
.
SelectMatchingCard
(
tp
,
nil
,
tp
,
LOCATION_HAND
,
0
,
val
,
val
,
nil
)
return
VgF
.
Sendto
(
LOCATION_DROP
,
g
,
REASON_COST
)
end
end
---用于效果的Cost。它返回一个执行“【费用】[能量爆发val]”的函数。
---@param val number 能量爆发的数量
---@return function 效果的Cost函数
function
VgF
.
EnergyCost
(
val
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
if
VgF
.
GetValueType
(
val
)
~=
"number"
then
return
0
end
local
c
=
e
:
GetHandler
()
local
m
=
c
:
GetOriginalCode
()
if
chk
==
0
then
if
e
:
IsHasType
(
EFFECT_TYPE_ACTIVATE
)
then
VgF
.
AddMixCostGroupFrom
(
c
,
m
,
"LOCATION_EMBLEM"
)
VgF
.
AddMixCostGroupTo
(
c
,
m
,
"0"
)
VgF
.
AddMixCostGroupFilter
(
c
,
m
,
function
(
tc
)
tc
:
IsCode
(
CARD_ENERGY
)
end
)
VgF
.
AddMixCostGroupCountMin
(
c
,
m
,
val
)
VgF
.
AddMixCostGroupCountMax
(
c
,
m
,
val
)
end
return
VgF
.
IsExistingMatchingCard
(
Card
.
IsCode
,
tp
,
LOCATION_EMBLEM
,
0
,
val
,
nil
,
CARD_ENERGY
)
end
local
sg
=
Duel
.
GetMatchingGroup
(
Card
.
IsCode
,
tp
,
LOCATION_EMBLEM
,
0
,
nil
,
CARD_ENERGY
)
local
g
=
VgF
.
GetCardsFromGroup
(
sg
,
val
)
return
VgF
.
Sendto
(
0
,
g
,
tp
,
POS_FACEUP
,
REASON_COST
)
end
end
---用于效果的Cost。它返回一个执行“【费用】[灵魂爆发val]”的函数。
---@param val number 灵魂爆发的数量
---@return function 效果的Cost函数
function
VgF
.
OverlayCost
(
val
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
if
VgF
.
GetValueType
(
val
)
~=
"number"
then
return
0
end
local
c
=
e
:
GetHandler
()
local
m
=
c
:
GetOriginalCode
()
if
chk
==
0
then
if
e
:
IsHasType
(
EFFECT_TYPE_ACTIVATE
)
then
VgF
.
AddMixCostGroupFrom
(
c
,
m
,
"LOCATION_OVERLAY"
)
VgF
.
AddMixCostGroupTo
(
c
,
m
,
"LOCATION_DROP"
)
VgF
.
AddMixCostGroupFilter
(
c
,
m
,
nil
)
VgF
.
AddMixCostGroupCountMin
(
c
,
m
,
val
)
VgF
.
AddMixCostGroupCountMax
(
c
,
m
,
val
)
end
return
Duel
.
GetMatchingGroup
(
VgF
.
VMonsterFilter
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
nil
):
GetFirst
():
GetOverlayCount
()
>=
val
end
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_REMOVEXYZ
)
local
g
=
Duel
.
GetMatchingGroup
(
VgF
.
VMonsterFilter
,
tp
,
LOCATION_MZONE
,
0
,
nil
):
GetFirst
():
GetOverlayGroup
():
Select
(
tp
,
nil
,
val
,
val
,
nil
)
return
VgF
.
Sendto
(
LOCATION_DROP
,
g
,
REASON_COST
)
end
end
---用于效果的Cost或Operation。它返回一个执行“【费用】[灵魂填充val]”的函数。
---@param val number 灵魂填充的数量
---@return function 效果的Cost或Operation函数
function
VgF
.
OverlayFill
(
val
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
if
VgF
.
GetValueType
(
val
)
~=
"number"
then
return
0
end
local
c
=
e
:
GetHandler
()
local
m
=
c
:
GetOriginalCode
()
if
chk
==
0
then
if
e
:
IsHasType
(
EFFECT_TYPE_ACTIVATE
)
then
VgF
.
AddMixCostGroupFrom
(
c
,
m
,
"LOCATION_DECK"
)
VgF
.
AddMixCostGroupTo
(
c
,
m
,
"LOCATION_OVERLAY"
)
VgF
.
AddMixCostGroupFilter
(
c
,
m
,
nil
)
VgF
.
AddMixCostGroupCountMin
(
c
,
m
,
val
)
VgF
.
AddMixCostGroupCountMax
(
c
,
m
,
val
)
end
return
Duel
.
GetFieldGroupCount
(
tp
,
LOCATION_DECK
,
0
)
>=
val
end
local
rc
=
Duel
.
GetMatchingGroup
(
VgF
.
VMonsterFilter
,
tp
,
LOCATION_MZONE
,
0
,
nil
):
GetFirst
()
local
g
=
Duel
.
GetDecktopGroup
(
tp
,
val
)
Duel
.
DisableShuffleCheck
()
Duel
.
RaiseEvent
(
g
,
EVENT_CUSTOM
+
EVENT_OVERLAY_FILL
,
e
,
0
,
tp
,
tp
,
val
)
return
VgF
.
Sendto
(
LOCATION_OVERLAY
,
g
,
rc
)
end
end
---用于效果的Cost。它返回一个执行“【费用】[计数爆发val]”的函数。
---@param val number 计数爆发的数量
---@return function 效果的Cost函数
function
VgF
.
DamageCost
(
val
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
if
VgF
.
GetValueType
(
val
)
~=
"number"
then
return
0
end
local
c
=
e
:
GetHandler
()
local
m
=
c
:
GetOriginalCode
()
if
chk
==
0
then
if
e
:
IsHasType
(
EFFECT_TYPE_ACTIVATE
)
then
VgF
.
AddMixCostGroupFrom
(
c
,
m
,
"LOCATION_DAMAGE"
)
VgF
.
AddMixCostGroupTo
(
c
,
m
,
"POSCHANGE"
)
VgF
.
AddMixCostGroupFilter
(
c
,
m
,
Card
.
IsFaceup
)
VgF
.
AddMixCostGroupCountMin
(
c
,
m
,
val
)
VgF
.
AddMixCostGroupCountMax
(
c
,
m
,
val
)
end
return
VgF
.
IsExistingMatchingCard
(
Card
.
IsFaceup
,
tp
,
LOCATION_DAMAGE
,
0
,
val
,
nil
)
end
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_DAMAGE
)
local
g
=
Duel
.
SelectMatchingCard
(
tp
,
Card
.
IsFaceup
,
tp
,
LOCATION_DAMAGE
,
0
,
val
,
val
,
nil
)
Duel
.
ChangePosition
(
g
,
POS_FACEDOWN_ATTACK
)
return
Duel
.
GetOperatedGroup
():
GetCount
()
end
end
---用于效果的Cost。它返回一个执行“【费用】[将xxx退场]”的函数。
---@param card_code_func Card|integer|function 退场的卡的条件
---@param val_max number 退场的卡的最大数量
---@param val_min number 退场的卡的最小数量
---@param except Card
---@param ... any
---@return function 效果的Cost函数
function
VgF
.
LeaveFieldCost
(
card_code_func
,
val_max
,
val_min
,
except
,
...
)
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
))
elseif
VgF
.
GetValueType
(
card_code_func
)
==
"Group"
then
return
VgF
.
LeaveFieldCostGroup
(
card_code_func
)
end
local
ex_params
=
{
...
}
val_min
,
val_max
=
val_min
or
1
,
val_max
or
1
if
val_min
>
val_max
then
val_min
=
val_max
end
local
leave_filter
=
VgF
.
True
if
type
(
card_code_func
)
==
"function"
then
leave_filter
=
card_code_func
elseif
type
(
card_code_func
)
==
"number"
then
leave_filter
=
function
(
c
)
return
c
:
IsCode
(
card_code_func
)
end
end
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
leave_filter
=
function
(
c
)
return
leave_filter
(
c
,
table.unpack
(
ex_params
))
and
c
:
IsAbleToGraveAsCost
()
end
if
chk
==
0
then
return
VgF
.
IsExistingMatchingCard
(
leave_filter
,
tp
,
LOCATION_MZONE
,
0
,
val_min
,
except
)
end
local
g
=
vgf
.
SelectMatchingCard
(
HINTMSG_LEAVEFIELD
,
e
,
tp
,
leave_filter
,
tp
,
LOCATION_MZONE
,
0
,
val_min
,
val_max
,
except
)
VgF
.
Sendto
(
LOCATION_DROP
,
g
,
REASON_COST
)
end
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
VgF
.
Sendto
(
LOCATION_DROP
,
g
,
REASON_COST
)
end
end
function
VgF
.
IsCanBeCalled
(
c
,
e
,
tp
,
sumtype
,
pos
,
zone
)
local
z
=
0
if
VgF
.
GetValueType
(
zone
)
==
"number"
then
z
=
VgF
.
GetAvailableLocation
(
tp
,
zone
)
elseif
VgF
.
GetValueType
(
zone
)
==
"string"
and
zone
==
"NoMonster"
then
z
=
Duel
.
GetLocationCount
(
tp
,
LOCATION_MZONE
)
zone
=
0xff
else
z
=
VgF
.
GetAvailableLocation
(
tp
)
zone
=
0xff
end
if
VgF
.
GetValueType
(
sumtype
)
~=
"number"
then
sumtype
=
0
end
if
VgF
.
GetValueType
(
pos
)
~=
"number"
then
pos
=
POS_FACEUP_ATTACK
end
if
VgF
.
GetValueType
(
zone
)
==
"string"
and
zone
==
"FromOverlayToV"
then
local
_
,
code
=
c
:
GetOriginalCode
()
return
Duel
.
IsPlayerCanSpecialSummonMonster
(
tp
,
code
,
nil
,
TYPE_MONSTER
+
TYPE_EFFECT
,
c
:
GetBaseAttack
(),
c
:
GetBaseDefense
(),
c
:
GetOriginalLevel
(),
c
:
GetOriginalRace
(),
c
:
GetOriginalAttribute
())
end
return
z
>
0
and
c
:
IsCanBeSpecialSummoned
(
e
,
sumtype
,
tp
,
false
,
false
,
pos
,
tp
,
zone
)
end
---用于效果的Operation。执行“从loc_from中选取最少int_min,最多int_max张满足f的卡,送去loc_to。”。
---@param loc_to number 要送去的区域。不填则返回0。
---@param loc_from number 要选取的区域。不填则返回0。
---@param f function|nil 卡片过滤的条件
function
VgF
.
CardsFromTo
(
reason
,
loc_to
,
loc_from
,
f
,
int_max
,
int_min
,
...
)
local
ext_params
=
{
...
}
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
if
not
loc_to
or
not
loc_from
then
return
0
end
if
loc_from
==
LOCATION_RZONE
then
loc_from
=
LOCATION_MZONE
end
if
VgF
.
GetValueType
(
int_max
)
~=
"number"
then
int_max
=
1
end
if
VgF
.
GetValueType
(
int_min
)
~=
"number"
then
int_min
=
int_max
end
if
loc_to
==
LOCATION_HAND
then
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_ATOHAND
,
e
,
tp
,
function
(
c
)
return
VgF
.
GetValueType
(
f
)
~=
"function"
or
f
(
c
,
table.unpack
(
ext_params
))
end
,
tp
,
loc_from
,
0
,
int_min
,
int_max
,
nil
)
if
g
:
GetCount
()
>
0
then
return
VgF
.
Sendto
(
loc_to
,
g
,
nil
,
reason
)
end
elseif
loc_to
==
LOCATION_VZONE
then
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_CALL
,
e
,
tp
,
function
(
c
)
if
not
VgF
.
IsCanBeCalled
(
c
,
e
,
tp
)
then
return
false
end
return
VgF
.
GetValueType
(
f
)
~=
"function"
or
f
(
c
,
table.unpack
(
ext_params
))
end
,
tp
,
loc_from
,
0
,
int_min
,
int_max
,
nil
)
if
g
:
GetCount
()
>
0
then
if
loc_from
==
LOCATION_OVERLAY
then
return
VgF
.
Sendto
(
loc_to
,
g
,
0
,
tp
,
"FromOverlayToV"
)
else
return
VgF
.
Sendto
(
loc_to
,
g
,
0
,
tp
,
0x20
)
end
end
elseif
loc_to
==
LOCATION_MZONE
then
if
VgF
.
GetAvailableLocation
(
tp
)
<
int_min
then
return
0
end
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_CALL
,
e
,
tp
,
function
(
c
)
if
not
VgF
.
IsCanBeCalled
(
c
,
e
,
tp
)
then
return
false
end
return
VgF
.
GetValueType
(
f
)
~=
"function"
or
f
(
c
,
table.unpack
(
ext_params
))
end
,
tp
,
loc_from
,
0
,
int_min
,
int_max
,
nil
)
if
g
:
GetCount
()
>
0
then
return
VgF
.
Sendto
(
loc_to
,
g
,
0
,
tp
)
end
elseif
loc_to
==
LOCATION_DROP
then
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_CALL
,
e
,
tp
,
function
(
c
)
return
VgF
.
GetValueType
(
f
)
~=
"function"
or
f
(
c
,
table.unpack
(
ext_params
))
end
,
tp
,
loc_from
,
0
,
int_min
,
int_max
,
nil
)
if
g
:
GetCount
()
>
0
then
return
VgF
.
Sendto
(
loc_to
,
g
,
reason
)
end
elseif
loc_to
==
LOCATION_REMOVED
then
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_CALL
,
e
,
tp
,
function
(
c
)
return
VgF
.
GetValueType
(
f
)
~=
"function"
or
f
(
c
,
table.unpack
(
ext_params
))
end
,
tp
,
loc_from
,
0
,
int_min
,
int_max
,
nil
)
if
g
:
GetCount
()
>
0
then
return
VgF
.
Sendto
(
loc_to
,
g
,
POS_FACEUP
,
reason
)
end
elseif
loc_to
==
LOCATION_EXILE
then
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_CALL
,
e
,
tp
,
function
(
c
)
return
VgF
.
GetValueType
(
f
)
~=
"function"
or
f
(
c
,
table.unpack
(
ext_params
))
end
,
tp
,
loc_from
,
0
,
int_min
,
int_max
,
nil
)
if
g
:
GetCount
()
>
0
then
return
VgF
.
Sendto
(
loc_to
,
g
,
reason
)
end
elseif
loc_to
==
LOCATION_OVERLAY
then
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_CALL
,
e
,
tp
,
function
(
c
)
return
VgF
.
GetValueType
(
f
)
~=
"function"
or
f
(
c
,
table.unpack
(
ext_params
))
end
,
tp
,
loc_from
,
0
,
int_min
,
int_max
,
nil
)
if
g
:
GetCount
()
>
0
then
local
rc
=
VgF
.
GetVMonster
(
tp
)
return
VgF
.
Sendto
(
loc_to
,
g
,
rc
)
end
elseif
bit
.
band
(
loc_to
,
0xf800
)
>
0
then
local
g
=
VgF
.
SelectMatchingCard
(
HINTMSG_CALL
,
e
,
tp
,
function
(
c
)
return
VgF
.
GetValueType
(
f
)
~=
"function"
or
f
(
c
,
table.unpack
(
ext_params
))
end
,
tp
,
loc_from
,
0
,
int_min
,
int_max
,
nil
)
if
g
:
GetCount
()
>
0
then
return
VgF
.
Sendto
(
loc_to
,
g
,
tp
,
POS_FACEUP_ATTACK
,
reason
)
end
end
return
0
end
end
function
Group
.
CheckSubGroup
(
g
,
f
,
min
,
max
,
...
)
min
=
min
or
1
max
=
max
or
#
g
if
min
>
max
then
return
false
end
local
ext_params
=
{
...
}
-- selected group
local
sg
=
Group
.
CreateGroup
()
-- be select group
local
bg
=
g
:
Clone
()
for
c
in
VgF
.
Next
(
g
)
do
if
VgF
.
CheckGroupRecursiveCapture
(
c
,
sg
,
bg
,
f
,
min
,
max
,
ext_params
)
then
return
true
end
bg
:
RemoveCard
(
c
)
end
return
false
end
function
VgF
.
CheckGroupRecursiveCapture
(
c
,
sg
,
bg
,
f
,
min
,
max
,
ext_params
)
sg
=
sg
+
c
if
VgF
.
G_Add_Check
and
not
VgF
.
G_Add_Check
(
sg
,
c
,
bg
)
then
sg
=
sg
-
c
return
false
end
local
res
=
#
sg
>=
min
and
#
sg
<=
max
and
(
not
f
or
f
(
sg
,
table.unpack
(
ext_params
)))
if
not
res
and
#
sg
<
max
then
res
=
bg
:
IsExists
(
VgF
.
CheckGroupRecursiveCapture
,
1
,
sg
,
sg
,
bg
,
f
,
min
,
max
,
ext_params
)
end
sg
=
sg
-
c
return
res
end
function
Group
.
SelectSubGroup
(
g
,
tp
,
f
,
cancelable
,
min
,
max
,
...
)
VgF
.
SubGroupCaptured
=
Group
.
CreateGroup
()
min
=
min
or
1
max
=
max
or
#
g
local
ext_params
=
{
...
}
local
sg
=
Group
.
CreateGroup
()
local
fg
=
Duel
.
GrabSelectedCard
()
if
#
fg
>
max
or
min
>
max
or
#
(
g
+
fg
)
<
min
then
return
nil
end
for
tc
in
VgF
.
Next
(
fg
)
do
fg
:
SelectUnselect
(
sg
,
tp
,
false
,
false
,
min
,
max
)
end
sg
:
Merge
(
fg
)
local
finish
=
(
#
sg
>=
min
and
#
sg
<=
max
and
f
(
sg
,
...
))
while
#
sg
<
max
do
local
cg
=
Group
.
CreateGroup
()
local
eg
=
g
:
Clone
()
for
c
in
VgF
.
Next
(
g
-
sg
)
do
if
not
cg
:
IsContains
(
c
)
then
if
VgF
.
CheckGroupRecursiveCapture
(
c
,
sg
,
eg
,
f
,
min
,
max
,
ext_params
)
then
cg
:
Merge
(
VgF
.
SubGroupCaptured
)
else
eg
:
RemoveCard
(
c
)
end
end
end
cg
:
Sub
(
sg
)
finish
=
(
#
sg
>=
min
and
#
sg
<=
max
and
f
(
sg
,
...
))
if
#
cg
==
0
then
break
end
local
cancel
=
not
finish
and
cancelable
local
tc
=
cg
:
SelectUnselect
(
sg
,
tp
,
finish
,
cancel
,
min
,
max
)
if
not
tc
then
break
end
if
not
fg
:
IsContains
(
tc
)
then
if
not
sg
:
IsContains
(
tc
)
then
sg
:
AddCard
(
tc
)
if
#
sg
==
max
then
finish
=
true
end
else
sg
:
RemoveCard
(
tc
)
end
elseif
cancelable
then
return
nil
end
end
if
finish
then
return
sg
else
return
nil
end
end
function
Group
.
SelectDoubleSubGroup
(
g
,
p
,
f1
,
int_min1
,
int_max1
,
f2
,
int_min2
,
int_max2
,
except_g
,
...
)
if
VgF
.
GetValueType
(
f1
)
~=
"function"
then
f1
=
VgF
.
True
end
if
VgF
.
GetValueType
(
f2
)
~=
"function"
then
f2
=
VgF
.
True
end
local
result
=
Group
.
CreateGroup
()
local
g1
=
g
:
Filter
(
f1
,
except_g
,
...
)
local
g2
=
g
:
Filter
(
f2
,
except_g
,
...
)
local
g3
=
Group
.
__band
(
g1
,
g2
)
if
g
:
GetCount
()
<
int_min1
+
int_min2
or
g1
:
GetCount
()
<
int_min1
or
g2
:
GetCount
()
<
int_min2
then
return
result
end
if
g1
:
GetCount
()
<
int_max1
then
int_max1
=
g1
:
GetCount
()
end
if
g2
:
GetCount
()
<
int_max2
then
int_max2
=
g2
:
GetCount
()
end
if
g3
:
GetCount
()
==
g2
:
GetCount
()
and
g3
:
GetCount
()
==
g1
:
GetCount
()
then
local
min
=
int_min1
+
int_min2
local
max
=
int_max1
+
int_max2
return
g3
:
SelectSubGroup
(
p
,
vgf
.
True
,
false
,
min
,
max
)
end
local
result1
=
Group
.
CreateGroup
()
local
result2
=
Group
.
CreateGroup
()
while
result1
:
GetCount
()
<
int_max1
do
local
sg
=
Group
.
__sub
(
g1
,
result1
)
local
check_group
=
Group
.
__sub
(
g2
,
result1
)
for
tc
in
VgF
.
Next
(
Group
.
__sub
(
g1
,
result1
))
do
if
g3
:
IsContains
(
tc
)
and
not
check_group
:
IsExists
(
VgF
.
True
,
int_min2
,
tc
)
then
sg
:
RemoveCard
(
tc
)
end
end
local
btok
=
false
if
result1
:
GetCount
()
>=
int_min1
then
btok
=
true
end
local
tc
=
sg
:
SelectUnselect
(
result1
,
p
,
btok
,
false
,
int_min1
,
int_max1
)
if
not
tc
then
break
elseif
result1
:
IsContains
(
tc
)
then
result1
:
RemoveCard
(
tc
)
else
result1
:
AddCard
(
tc
)
end
end
g2
:
Sub
(
result1
)
while
result2
:
GetCount
()
<
int_max2
do
local
sg
=
Group
.
__sub
(
g2
,
result2
)
local
btok
=
false
if
result2
:
GetCount
()
>=
int_min2
then
btok
=
true
end
local
tc
=
sg
:
SelectUnselect
(
result2
,
p
,
btok
,
false
,
int_min2
,
int_max2
)
if
not
tc
then
break
elseif
result2
:
IsContains
(
tc
)
and
not
result1
:
IsContains
(
tc
)
then
result2
:
RemoveCard
(
tc
)
else
result2
:
AddCard
(
tc
)
end
end
result
=
Group
.
__add
(
result1
,
result2
)
return
result
end
---返回p场上的先导者。
---@param p number 要获取先导者的玩家。不合法则返回nil。
---@return Card|nil p场上的先导者
function
VgF
.
GetVMonster
(
p
)
if
p
~=
0
and
p
~=
1
then
return
end
return
Duel
.
GetMatchingGroup
(
VgF
.
VMonsterFilter
,
p
,
LOCATION_MZONE
,
0
,
nil
):
GetFirst
()
end
---判断c是否在前列。
---@param c Card 要判断的卡
---@return boolean 指示c是否是前列的单位
function
VgF
.
FrontFilter
(
c
)
return
vgf
.
IsSequence
(
c
,
0
,
4
,
5
)
and
c
:
IsLocation
(
LOCATION_MZONE
)
end
---判断c是否在后列。
---@param c Card 要判断的卡
---@return boolean 指示c是否是后列的单位
function
VgF
.
BackFilter
(
c
)
return
vgf
.
IsSequence
(
c
,
1
,
2
,
3
)
and
c
:
IsLocation
(
LOCATION_MZONE
)
end
function
VgF
.
PrisonFilter
(
c
,
ct
)
return
c
:
GetSequence
()
==
ct
-
1
end
---收容g(中的每一张卡)到p的监狱。没有监狱时,不操作。
---@param g Card|Group
---@param p number
function
VgF
.
SendtoPrison
(
g
,
p
)
if
not
VgF
.
CheckPrison
(
p
)
or
not
g
then
return
end
local
og
=
Duel
.
GetFieldGroup
(
p
,
LOCATION_ORDER
,
0
)
local
oc
=
og
:
Filter
(
VgF
.
PrisonFilter
,
nil
,
og
:
GetCount
()):
GetFirst
()
if
VgF
.
GetValueType
(
g
)
==
"Card"
then
VgF
.
Sendto
(
LOCATION_ORDER
,
g
,
p
,
POS_FACEUP_ATTACK
,
REASON_EFFECT
)
g
:
RegisterFlagEffect
(
FLAG_IMPRISON
,
RESET_EVENT
+
RESETS_STANDARD
,
EFFECT_FLAG_CLIENT_HINT
,
1
,
0
,
VgF
.
Stringid
(
10105015
,
0
))
elseif
VgF
.
GetValueType
(
g
)
==
"Group"
then
for
tc
in
VgF
.
Next
(
g
)
do
VgF
.
Sendto
(
LOCATION_ORDER
,
tc
,
p
,
POS_FACEUP_ATTACK
,
REASON_EFFECT
)
tc
:
RegisterFlagEffect
(
FLAG_IMPRISON
,
RESET_EVENT
+
RESETS_STANDARD
,
EFFECT_FLAG_CLIENT_HINT
,
1
,
0
,
VgF
.
Stringid
(
10105015
,
0
))
end
end
Duel
.
MoveSequence
(
oc
,
og
:
GetCount
()
-
1
)
end
--[[
function VgF.PrisonFilter(c, tp)
return c:IsSetCard(0x3040) and not VgF.IsExistingMatchingCard(function (tc)
return tc:GetSequence() < c:GetSequence()
end, tp, LOCATION_ORDER, 0, 1, c)
end
---收容g(中的每一张卡)到p的监狱。没有监狱时,不操作。
---@param g Card|Group
---@param p number
function VgF.SendtoPrison(g, p)
if not VgF.CheckPrison(p) or not g then return end
local og = Duel.GetFieldGroup(p, LOCATION_ORDER, 0)
local oc = og:Filter(VgF.PrisonFilter, nil, p):GetFirst()
if VgF.GetValueType(g) == "Card" then
Duel.Sendto(g, p, LOCATION_ORDER, POS_FACEUP_ATTACK, REASON_EFFECT, 1)
g:RegisterFlagEffect(FLAG_IMPRISON, RESET_EVENT + RESETS_STANDARD, EFFECT_FLAG_CLIENT_HINT, 1, 0, VgF.Stringid(10105015, 0))
elseif VgF.GetValueType(g) == "Group" then
for tc in VgF.Next(g) do
Duel.Sendto(tc, p, LOCATION_ORDER, POS_FACEUP_ATTACK, REASON_EFFECT, 1)
tc:RegisterFlagEffect(FLAG_IMPRISON, RESET_EVENT + RESETS_STANDARD, EFFECT_FLAG_CLIENT_HINT, 1, 0, VgF.Stringid(10105015, 0))
end
end
end]]
---检测p场上有没有监狱。
---@param p number
---@return boolean 指示p场上有没有监狱。
function
VgF
.
CheckPrison
(
p
)
local
og
=
Duel
.
GetFieldGroup
(
p
,
LOCATION_ORDER
,
0
)
return
og
:
IsExists
(
Card
.
IsSetCard
,
1
,
nil
,
0x3040
)
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
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
function
VgF
.
IsExistingMatchingCard
(
f
,
tp
,
loc_self
,
loc_op
,
int
,
except_g
,
...
)
return
VgF
.
GetMatchingGroupCount
(
f
,
tp
,
loc_self
,
loc_op
,
except_g
,
...
)
>=
int
end
function
VgF
.
SelectMatchingCard
(
hintmsg
,
e
,
select_tp
,
f
,
tp
,
loc_self
,
loc_op
,
int_min
,
int_max
,
except_g
,
...
)
local
a
=
false
if
((
select_tp
==
tp
and
bit
.
band
(
loc_self
,
LOCATION_DECK
)
>
0
)
or
(
select_tp
~=
tp
and
bit
.
band
(
loc_op
,
LOCATION_DECK
)
>
0
))
and
Duel
.
SelectYesNo
(
select_tp
,
VgF
.
Stringid
(
VgID
,
13
))
then
local
g
=
Duel
.
GetFieldGroup
(
select_tp
,
LOCATION_DECK
,
0
)
Duel
.
DisableShuffleCheck
()
Duel
.
ConfirmCards
(
select_tp
,
g
)
a
=
true
end
local
g
=
Group
.
CreateGroup
()
local
loc_self_f
=
VgF
.
True
local
loc_op_f
=
VgF
.
True
if
bit
.
band
(
loc_self
,
LOCATION_VZONE
)
>
0
and
bit
.
band
(
loc_self
,
LOCATION_RZONE
)
>
0
then
loc_self
=
loc_self
-
LOCATION_VZONE
-
LOCATION_RZONE
if
bit
.
band
(
loc_self
,
LOCATION_MZONE
)
==
0
then
loc_self
=
loc_self
+
LOCATION_MZONE
end
elseif
bit
.
band
(
loc_self
,
LOCATION_VZONE
)
>
0
then
loc_self
=
loc_self
-
LOCATION_VZONE
loc_self_f
=
VgF
.
VMonsterFilter
if
bit
.
band
(
loc_self
,
LOCATION_MZONE
)
==
0
then
loc_self
=
loc_self
+
LOCATION_MZONE
end
elseif
bit
.
band
(
loc_self
,
LOCATION_RZONE
)
>
0
then
loc_self
=
loc_self
-
LOCATION_RZONE
loc_self_f
=
VgF
.
RMonsterFilter
if
bit
.
band
(
loc_self
,
LOCATION_MZONE
)
==
0
then
loc_self
=
loc_self
+
LOCATION_MZONE
end
end
if
bit
.
band
(
loc_op
,
LOCATION_VZONE
)
>
0
and
bit
.
band
(
loc_op
,
LOCATION_RZONE
)
>
0
then
loc_op
=
loc_op
-
LOCATION_VZONE
-
LOCATION_RZONE
if
bit
.
band
(
loc_op
,
LOCATION_MZONE
)
==
0
then
loc_op
=
loc_op
+
LOCATION_MZONE
end
elseif
bit
.
band
(
loc_op
,
LOCATION_VZONE
)
>
0
then
loc_op
=
loc_op
-
LOCATION_VZONE
loc_op_f
=
VgF
.
VMonsterFilter
if
bit
.
band
(
loc_op
,
LOCATION_MZONE
)
==
0
then
loc_op
=
loc_op
+
LOCATION_MZONE
end
elseif
bit
.
band
(
loc_op
,
LOCATION_RZONE
)
>
0
then
loc_op
=
loc_op
-
LOCATION_RZONE
loc_op_f
=
VgF
.
RMonsterFilter
if
bit
.
band
(
loc_op
,
LOCATION_MZONE
)
==
0
then
loc_op
=
loc_op
+
LOCATION_MZONE
end
end
if
bit
.
band
(
loc_self
,
LOCATION_MZONE
)
>
0
then
local
g1
=
Duel
.
GetMatchingGroup
(
function
(
c
)
return
c
:
IsCanBeEffectTarget
(
e
)
and
c
:
IsFaceup
()
and
loc_self_f
(
c
)
end
,
tp
,
LOCATION_MZONE
,
0
,
nil
)
loc_self
=
loc_self
-
LOCATION_MZONE
if
g1
:
GetCount
()
>
0
then
g
:
Merge
(
g1
)
end
end
if
bit
.
band
(
loc_op
,
LOCATION_MZONE
)
>
0
then
local
g1
=
Duel
.
GetMatchingGroup
(
function
(
c
)
return
c
:
IsCanBeEffectTarget
(
e
)
and
c
:
IsFaceup
()
and
loc_op_f
(
c
)
end
,
tp
,
0
,
LOCATION_MZONE
,
nil
)
loc_op
=
loc_op
-
LOCATION_MZONE
if
g1
:
GetCount
()
>
0
then
g
:
Merge
(
g1
)
end
end
if
bit
.
band
(
loc_self
,
LOCATION_OVERLAY
)
>
0
then
local
g1
=
VgF
.
GetVMonster
(
tp
):
GetOverlayGroup
()
loc_self
=
loc_self
-
LOCATION_OVERLAY
if
g1
:
GetCount
()
>
0
then
g
:
Merge
(
g1
)
end
end
if
bit
.
band
(
loc_op
,
LOCATION_OVERLAY
)
>
0
then
local
g1
=
VgF
.
GetVMonster
(
1
-
tp
):
GetOverlayGroup
()
loc_op
=
loc_op
-
LOCATION_OVERLAY
if
g1
:
GetCount
()
>
0
then
g
:
Merge
(
g1
)
end
end
if
loc_self
>
0
or
loc_op
>
0
then
local
g1
=
Duel
.
GetMatchingGroup
(
nil
,
tp
,
loc_self
,
loc_op
,
nil
)
if
g1
:
GetCount
()
>
0
then
g
:
Merge
(
g1
)
end
end
if
g
:
GetCount
()
>
0
then
Duel
.
Hint
(
HINT_SELECTMSG
,
select_tp
,
hintmsg
)
if
VgF
.
GetValueType
(
f
)
==
"function"
then
g
=
g
:
FilterSelect
(
select_tp
,
f
,
int_min
,
int_max
,
except_g
,
...
)
else
g
=
g
:
Select
(
select_tp
,
int_min
,
int_max
,
except_g
)
end
end
local
cg
=
g
:
Filter
(
function
(
tc
)
return
not
tc
:
IsLocation
(
LOCATION_DECK
+
LOCATION_HAND
+
LOCATION_EXTRA
)
end
,
nil
)
if
cg
:
GetCount
()
>
0
then
Duel
.
HintSelection
(
cg
)
Duel
.
SetTargetCard
(
cg
)
end
if
a
then
Duel
.
ShuffleDeck
(
select_tp
)
end
return
g
end
function
VgF
.
GetMatchingGroupCount
(
f
,
tp
,
loc_self
,
loc_op
,
except_g
,
...
)
return
VgF
.
GetMatchingGroup
(
f
,
tp
,
loc_self
,
loc_op
,
except_g
,
...
):
GetCount
()
end
function
VgF
.
GetMatchingGroup
(
f
,
tp
,
loc_self
,
loc_op
,
except_g
,
...
)
local
loc_self_f
=
VgF
.
True
local
loc_op_f
=
VgF
.
True
if
bit
.
band
(
loc_self
,
LOCATION_VZONE
)
>
0
and
bit
.
band
(
loc_self
,
LOCATION_RZONE
)
>
0
then
loc_self
=
loc_self
-
LOCATION_VZONE
-
LOCATION_RZONE
if
bit
.
band
(
loc_self
,
LOCATION_MZONE
)
==
0
then
loc_self
=
loc_self
+
LOCATION_MZONE
end
elseif
bit
.
band
(
loc_self
,
LOCATION_VZONE
)
>
0
then
loc_self
=
loc_self
-
LOCATION_VZONE
loc_self_f
=
VgF
.
VMonsterFilter
if
bit
.
band
(
loc_self
,
LOCATION_MZONE
)
==
0
then
loc_self
=
loc_self
+
LOCATION_MZONE
end
elseif
bit
.
band
(
loc_self
,
LOCATION_RZONE
)
>
0
then
loc_self
=
loc_self
-
LOCATION_RZONE
loc_self_f
=
VgF
.
RMonsterFilter
if
bit
.
band
(
loc_self
,
LOCATION_MZONE
)
==
0
then
loc_self
=
loc_self
+
LOCATION_MZONE
end
end
if
bit
.
band
(
loc_op
,
LOCATION_VZONE
)
>
0
and
bit
.
band
(
loc_op
,
LOCATION_RZONE
)
>
0
then
loc_op
=
loc_op
-
LOCATION_VZONE
-
LOCATION_RZONE
if
bit
.
band
(
loc_op
,
LOCATION_MZONE
)
==
0
then
loc_op
=
loc_op
+
LOCATION_MZONE
end
elseif
bit
.
band
(
loc_op
,
LOCATION_VZONE
)
>
0
then
loc_op
=
loc_op
-
LOCATION_VZONE
loc_op_f
=
VgF
.
VMonsterFilter
if
bit
.
band
(
loc_op
,
LOCATION_MZONE
)
==
0
then
loc_op
=
loc_op
+
LOCATION_MZONE
end
elseif
bit
.
band
(
loc_op
,
LOCATION_RZONE
)
>
0
then
loc_op
=
loc_op
-
LOCATION_RZONE
loc_op_f
=
VgF
.
RMonsterFilter
if
bit
.
band
(
loc_op
,
LOCATION_MZONE
)
==
0
then
loc_op
=
loc_op
+
LOCATION_MZONE
end
end
local
g
=
Group
.
CreateGroup
()
if
bit
.
band
(
loc_self
,
LOCATION_MZONE
)
>
0
then
local
g1
=
Duel
.
GetMatchingGroup
(
function
(
c
)
return
c
:
IsFaceup
()
and
loc_self_f
(
c
)
end
,
tp
,
LOCATION_MZONE
,
0
,
nil
)
loc_self
=
loc_self
-
LOCATION_MZONE
if
g1
:
GetCount
()
>
0
then
g
:
Merge
(
g1
)
end
end
if
bit
.
band
(
loc_op
,
LOCATION_MZONE
)
>
0
then
local
g1
=
Duel
.
GetMatchingGroup
(
function
(
c
)
return
c
:
IsFaceup
()
and
loc_op_f
(
c
)
end
,
tp
,
0
,
LOCATION_MZONE
,
nil
)
loc_op
=
loc_op
-
LOCATION_MZONE
if
g1
:
GetCount
()
>
0
then
g
:
Merge
(
g1
)
end
end
if
bit
.
band
(
loc_self
,
LOCATION_OVERLAY
)
>
0
then
local
g1
=
VgF
.
GetVMonster
(
tp
):
GetOverlayGroup
()
loc_self
=
loc_self
-
LOCATION_OVERLAY
if
g1
:
GetCount
()
>
0
then
g
:
Merge
(
g1
)
end
end
if
bit
.
band
(
loc_op
,
LOCATION_OVERLAY
)
>
0
then
local
g1
=
VgF
.
GetVMonster
(
1
-
tp
):
GetOverlayGroup
()
loc_op
=
loc_op
-
LOCATION_OVERLAY
if
g1
:
GetCount
()
>
0
then
g
:
Merge
(
g1
)
end
end
if
loc_self
>
0
or
loc_op
>
0
then
local
g1
=
Duel
.
GetMatchingGroup
(
nil
,
tp
,
loc_self
,
loc_op
,
nil
)
if
g1
:
GetCount
()
>
0
then
g
:
Merge
(
g1
)
end
end
if
g
:
GetCount
()
>
0
and
VgF
.
GetValueType
(
f
)
==
"function"
then
g
=
g
:
Filter
(
f
,
except_g
,
...
)
end
return
g
end
---用于效果的Operation。执行“把卡sg,送去loc,第三个参数开始为额外参数,内容与原函数相同。”。
---@param loc number 要送去的区域。不填则返回0。
---@param sg Card|Group 要操作的卡|卡片组。
---@return number 具体操作的卡的数量
function
VgF
.
Sendto
(
loc
,
sg
,
...
)
local
ext_params
=
{
...
}
local
function
AddOverlayGroup
(
g
,
o_loc
)
for
tc
in
VgF
.
Next
(
g
)
do
if
tc
:
GetOverlayCount
()
>
0
then
local
mg
=
tc
:
GetOverlayGroup
()
VgF
.
Sendto
(
o_loc
,
mg
,
table.unpack
(
ext_params
))
end
end
end
local
g
=
nil
if
VgF
.
GetValueType
(
sg
)
==
"Group"
and
sg
:
GetCount
()
>
0
then
g
=
Group
.
Clone
(
sg
)
elseif
VgF
.
GetValueType
(
sg
)
==
"Card"
then
g
=
Group
.
FromCards
(
sg
)
else
return
0
end
if
loc
==
LOCATION_DROP
then
AddOverlayGroup
(
g
,
LOCATION_DROP
)
local
return_val
=
0
if
g
:
IsExists
(
Card
.
IsLocation
,
1
,
nil
,
LOCATION_HAND
)
then
local
g2
=
g
:
Filter
(
Card
.
IsLocation
,
nil
,
LOCATION_HAND
)
local
reason
=
ext_params
[
1
]
if
VgF
.
GetValueType
(
reason
)
~=
"number"
then
reason
=
0
end
if
bit
.
band
(
reason
,
REASON_DISCARD
)
==
0
then
reason
=
reason
+
REASON_DISCARD
end
return_val
=
return_val
+
Duel
.
SendtoGrave
(
g2
,
reason
)
g
:
Sub
(
g2
)
end
return_val
=
return_val
+
Duel
.
SendtoGrave
(
g
,
...
)
return
return_val
elseif
loc
==
LOCATION_DECK
then
return
Duel
.
SendtoDeck
(
g
,
...
)
elseif
loc
==
LOCATION_HAND
then
local
ct
=
Duel
.
SendtoHand
(
g
,
...
)
local
cg
=
Duel
.
GetOperatedGroup
()
for
tp
=
0
,
1
do
local
confirm_group
=
cg
:
Filter
(
Card
.
IsControler
,
nil
,
tp
)
if
confirm_group
:
GetCount
()
>
0
then
Duel
.
ConfirmCards
(
1
-
tp
,
confirm_group
)
Duel
.
ShuffleHand
(
tp
)
end
end
return
ct
elseif
loc
==
LOCATION_REMOVED
then
AddOverlayGroup
(
g
,
LOCATION_REMOVED
)
return
Duel
.
Remove
(
g
,
...
)
elseif
loc
==
LOCATION_EXILE
then
AddOverlayGroup
(
g
,
LOCATION_EXILE
)
return
Duel
.
Exile
(
g
,
...
)
elseif
loc
==
LOCATION_OVERLAY
then
AddOverlayGroup
(
g
,
LOCATION_OVERLAY
)
local
ct
=
0
if
#
ext_params
>
0
then
local
c
=
ext_params
[
1
]
Duel
.
Overlay
(
c
,
g
)
ct
=
Duel
.
GetOperatedGroup
():
GetCount
()
else
for
tp
=
0
,
1
do
local
c
=
VgF
.
GetVMonster
(
tp
)
local
og
=
g
:
Filter
(
Card
.
IsControler
,
nil
,
tp
)
if
og
:
GetCount
()
>
0
then
Duel
.
Overlay
(
c
,
og
)
ct
=
ct
+
Duel
.
GetOperatedGroup
():
GetCount
()
end
end
end
return
ct
elseif
loc
==
LOCATION_TRIGGER
then
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
elseif
loc
==
LOCATION_MZONE
then
return
VgF
.
Call
(
g
,
table.unpack
(
ext_params
))
elseif
bit
.
band
(
loc
,
0xf800
)
>
0
or
loc
==
0
then
AddOverlayGroup
(
g
,
loc
)
Duel
.
Sendto
(
g
,
ext_params
[
1
],
loc
,
ext_params
[
2
],
ext_params
[
3
],
ext_params
[
4
])
local
return_group
=
Duel
.
GetOperatedGroup
()
return
return_group
:
GetCount
()
end
return
0
end
-- 白翼能力在你的封锁区中的卡只有奇数的等级的场合有效
function
VgF
.
WhiteWing
(
e
)
local
tp
=
e
:
GetHandlerPlayer
()
local
a
=
vgf
.
IsExistingMatchingCard
(
function
(
c
)
return
c
:
GetLevel
()
%
2
==
1
end
,
tp
,
LOCATION_REMOVED
,
0
,
1
,
nil
)
local
b
=
vgf
.
IsExistingMatchingCard
(
function
(
c
)
return
c
:
GetLevel
()
%
2
==
0
end
,
tp
,
LOCATION_REMOVED
,
0
,
1
,
nil
)
return
(
a
and
not
b
)
or
Duel
.
IsPlayerAffectedByEffect
(
tp
,
AFFECT_CODE_BOTH_WING
)
end
-- 黑翼能力在你的封锁区中的卡只有偶数的等级的场合有效
function
VgF
.
DarkWing
(
e
)
local
tp
=
e
:
GetHandlerPlayer
()
local
a
=
vgf
.
IsExistingMatchingCard
(
function
(
c
)
return
c
:
GetLevel
()
%
2
==
1
end
,
tp
,
LOCATION_REMOVED
,
0
,
1
,
nil
)
local
b
=
vgf
.
IsExistingMatchingCard
(
function
(
c
)
return
c
:
GetLevel
()
%
2
==
0
end
,
tp
,
LOCATION_REMOVED
,
0
,
1
,
nil
)
return
(
not
a
and
b
)
or
Duel
.
IsPlayerAffectedByEffect
(
tp
,
AFFECT_CODE_BOTH_WING
)
end
function
VgF
.
AddRideMaterialSetCardCheck
(
c
,
m
,
...
)
local
cm
=
_G
[
"c"
..
m
]
if
VgF
.
GetValueType
(
cm
.
ride_material_setcard_chk
)
~=
"table"
then
cm
.
ride_material_setcard_chk
=
{}
end
for
i
,
v
in
ipairs
({
...
})
do
table.insert
(
cm
.
ride_material_setcard_chk
,
v
)
end
end
function
VgF
.
AddRideMaterialCodeCheck
(
c
,
m
,
...
)
local
cm
=
_G
[
"c"
..
m
]
if
VgF
.
GetValueType
(
cm
.
ride_material_code_chk
)
~=
"table"
then
cm
.
ride_material_code_chk
=
{}
end
for
i
,
v
in
ipairs
({
...
})
do
table.insert
(
cm
.
ride_material_code_chk
,
v
)
end
end
function
VgF
.
AddRideMaterialSetCard
(
c
,
m
,
...
)
local
cm
=
_G
[
"c"
..
m
]
if
VgF
.
GetValueType
(
cm
.
ride_setcard
)
~=
"table"
then
cm
.
ride_setcard
=
{}
end
for
i
,
v
in
ipairs
({
...
})
do
table.insert
(
cm
.
ride_setcard
,
v
)
end
end
function
VgF
.
AddRideMaterialCode
(
c
,
m
,
...
)
local
cm
=
_G
[
"c"
..
m
]
if
VgF
.
GetValueType
(
cm
.
ride_code
)
~=
"table"
then
cm
.
ride_code
=
{}
end
for
i
,
v
in
ipairs
({
...
})
do
table.insert
(
cm
.
ride_code
,
v
)
end
end
function
VgF
.
AddMixCostGroupFrom
(
c
,
m
,
...
)
local
cm
=
_G
[
"c"
..
m
]
if
VgF
.
GetValueType
(
cm
.
cos_from
)
~=
"table"
then
cm
.
cos_from
=
{}
end
for
i
,
v
in
ipairs
({
...
})
do
table.insert
(
cm
.
cos_from
,
v
)
end
end
function
VgF
.
AddMixCostGroupTo
(
c
,
m
,
...
)
local
cm
=
_G
[
"c"
..
m
]
if
VgF
.
GetValueType
(
cm
.
cos_to
)
~=
"table"
then
cm
.
cos_to
=
{}
end
for
i
,
v
in
ipairs
({
...
})
do
table.insert
(
cm
.
cos_to
,
v
)
end
end
function
VgF
.
AddMixCostGroupCountMin
(
c
,
m
,
...
)
local
cm
=
_G
[
"c"
..
m
]
if
VgF
.
GetValueType
(
cm
.
cos_val
)
~=
"table"
then
cm
.
cos_val
=
{}
end
for
i
,
v
in
ipairs
({
...
})
do
table.insert
(
cm
.
cos_val
,
v
)
end
end
function
VgF
.
AddMixCostGroupCountMax
(
c
,
m
,
...
)
local
cm
=
_G
[
"c"
..
m
]
if
VgF
.
GetValueType
(
cm
.
cos_val_max
)
~=
"table"
then
cm
.
cos_val_max
=
{}
end
for
i
,
v
in
ipairs
({
...
})
do
table.insert
(
cm
.
cos_val_max
,
v
)
end
end
function
VgF
.
AddMixCostGroupFilter
(
c
,
m
,
...
)
local
cm
=
_G
[
"c"
..
m
]
if
VgF
.
GetValueType
(
cm
.
cos_filter
)
~=
"table"
then
cm
.
cos_filter
=
{}
end
for
i
,
v
in
ipairs
({
...
})
do
table.insert
(
cm
.
cos_filter
,
v
)
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
function
VgF
.
ShiftLocationFromString
(
str
)
local
loc
=
0
if
str
==
"POSCHANGE"
then
return
str
end
for
i
=
1
,
13
do
if
str
==
LOCATION_LIST_STRING
[
i
]
then
loc
=
LOCATION_LIST
[
i
]
break
end
end
return
loc
end
function
VgF
.
PlayerEffect
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
return
true
end
---创建一个函数检查器 检查func是否为nil或函数
function
VgF
.
IllegalFunctionCheck
(
name
,
c
)
if
VgF
.
GetValueType
(
c
)
~=
"Card"
then
Debug
.
Message
(
"VgD."
..
name
..
" param c isn't Card"
)
end
local
m
=
c
:
GetOriginalCode
()
local
chk
=
function
(
key
)
return
function
(
func
)
local
ftyp
=
type
(
func
)
if
ftyp
==
"nil"
or
ftyp
==
"function"
then
return
false
end
Debug
.
Message
(
"c"
..
m
..
" VgD."
..
name
..
" param "
..
key
..
" isn't function | nil"
)
return
true
end
end
return
{
con
=
chk
(
"con"
),
cost
=
chk
(
"cost"
),
tg
=
chk
(
"tg"
),
op
=
chk
(
"op"
)}
end
---检查并转换 loc 以及 con 用于【起】等模板函数
function
VgF
.
GetLocCondition
(
loc
,
con
)
local
con_exf
=
VgF
.
True
if
loc
==
LOCATION_RZONE
then
loc
,
con_exf
=
LOCATION_MZONE
,
VgF
.
RMonsterCondition
elseif
loc
==
LOCATION_VZONE
then
loc
,
con_exf
=
LOCATION_MZONE
,
VgF
.
VMonsterCondition
end
loc
=
loc
or
LOCATION_MZONE
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
con_exf
(
e
)
end
return
loc
,
condition
end
VgF
.
EffectDamageE
=
nil
---效果伤害的operation函数
---@param val number 伤害的数值
---@param p number 受伤的玩家
function
VgF
.
EffectDamage
(
val
,
p
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
c
:
RegisterFlagEffect
(
FLAG_DAMAGE_TRIGGER
,
RESET_EVENT
+
RESETS_STANDARD
,
0
,
1
,
val
-
1
)
Duel
.
RegisterFlagEffect
(
p
,
FLAG_EFFECT_DAMAGE
,
0
,
0
,
1
)
VgD
.
TriggerCard
(
e
,
p
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_TRIGGER_F
)
e1
:
SetCode
(
EVENT_CUSTOM
+
EVENT_TRIGGER
)
e1
:
SetRange
(
LOCATION_ALL
)
e1
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e1
:
SetCondition
(
function
(
te
,
ttp
,
teg
,
tep
,
tev
,
tre
,
tr
,
trp
)
return
Duel
.
GetFlagEffect
(
p
,
FLAG_EFFECT_DAMAGE
)
>
0
end
)
e1
:
SetOperation
(
VgD
.
TriggerCard
)
c
:
RegisterEffect
(
e1
)
if
VgF
.
GetValueType
(
VgF
.
EffectDamageE
)
==
"Effect"
then
VgF
.
EffectDamageE
:
Reset
()
VgF
.
EffectDamageE
=
nil
end
VgF
.
EffectDamageE
=
e1
end
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment