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
d8c1c36b
Commit
d8c1c36b
authored
Nov 13, 2024
by
whenmo
Committed by
GitHub
Nov 13, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update VgD.Lua
parent
bdb09189
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1685 additions
and
1529 deletions
+1685
-1529
VgD.Lua
VgD.Lua
+1685
-1529
No files found.
VgD.Lua
View file @
d8c1c36b
--VgD库
VgD
=
{}
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
end
---使卡片具有骑升的功能,已包含在 vgd.VgCard(c) 内
---@param c Card 要注册骑升功能的卡
function
VgD
.
RideUp
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
...
...
@@ -176,141 +300,253 @@ function VgD.RideZeroOperation(e, tp, eg, ep, ev, re, r, rp)
end
VgF
.
Sendto
(
LOCATION_MZONE
,
g
,
SUMMON_TYPE_RIDE
,
tp
,
0x20
)
end
--Call到R位
function
VgD
.
CallToR
(
c
)
---使卡片具有触发卡的功能,已包含在 vgd.VgCard(c) 内
---@param c Card 要注册触发功能的卡
function
VgD
.
CardTrigger
(
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
)
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
(
0
))
e1
:
SetOperation
(
VgD
.
CardTriggerOperation
(
0
))
c
:
RegisterEffect
(
e1
)
local
e2
=
e1
:
Clone
()
e2
:
SetCondition
(
VgD
.
CardTriggerCondtion
(
1
))
e2
:
SetOperation
(
VgD
.
CardTriggerOperation
(
1
))
c
:
RegisterEffect
(
e2
)
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
)
function
VgD
.
CardTriggerCondtion
(
chkcon
)
return
function
(
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
)
local
cp
=
tp
if
chkcon
==
0
then
cp
=
1
-
tp
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
)
return
Duel
.
GetTurnPlayer
()
==
cp
and
c
:
IsLocation
(
LOCATION_TRIGGER
)
end
e
:
SetValue
(
function
()
return
SUMMON_VALUE_CALL
,
zone
end
)
end
--超限舞装
function
VgD
.
OverDress
(
c
,
f
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetDescription
(
VgF
.
Stringid
(
VgID
,
9
))
e2
:
SetType
(
EFFECT_TYPE_FIELD
)
e2
:
SetCode
(
EFFECT_SPSUMMON_PROC
)
e2
:
SetRange
(
LOCATION_HAND
)
e2
:
SetProperty
(
EFFECT_FLAG_SPSUM_PARAM
)
e2
:
SetTargetRange
(
POS_FACEUP_ATTACK
,
0
)
e2
:
SetCondition
(
VgD
.
OverDressCondition
(
f
))
e2
:
SetOperation
(
VgD
.
OverDressOperation
(
f
))
c
:
RegisterEffect
(
e2
)
local
e3
=
Effect
.
CreateEffect
(
c
)
e3
:
SetType
(
EFFECT_TYPE_SINGLE
+
EFFECT_TYPE_CONTINUOUS
)
e3
:
SetCode
(
EVENT_SPSUMMON_SUCCESS
)
e3
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e3
:
SetOperation
(
VgD
.
OverDressSum
)
c
:
RegisterEffect
(
e3
)
end
function
VgD
.
OverDressCondition
(
f
)
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
,
f
)
function
VgD
.
CardTriggerOperation
(
chkop
,
f
)
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
function
VgD
.
OverDressFilter
(
c
,
f
,
tp
,
zone
)
if
zone
and
zone
>
0
then
if
zone
~=
VgF
.
SequenceToGlobal
(
tp
,
c
:
GetLocation
(),
c
:
GetSequence
())
then
return
false
end
end
return
((
VgF
.
GetValueType
(
f
)
==
"function"
and
f
(
c
))
or
(
VgF
.
GetValueType
(
f
)
==
"number"
and
c
:
IsCode
(
f
)))
and
c
:
IsFaceup
()
end
function
VgD
.
OverDressOperation
(
f
)
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
,
f
,
tp
)
local
szone
local
zone
=
0x00
for
tc
in
VgF
.
Next
(
g
)
do
zone
=
bit
.
bor
(
zone
,
VgF
.
SequenceToGlobal
(
tp
,
tc
:
GetLocation
(),
tc
:
GetSequence
()))
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
zone
==
0x00
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
tc
=
Duel
.
GetMatchingGroup
(
VgD
.
OverDressFilter
,
tp
,
LOCATION_MZONE
,
0
,
nil
,
f
,
tp
,
szone
):
GetFirst
()
if
not
tc
then
return
end
local
mg
=
tc
:
GetOverlayGroup
()
if
mg
:
GetCount
()
~=
0
then
VgF
.
Sendto
(
LOCATION_OVERLAY
,
mg
,
c
)
if
chkop
==
0
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
c
:
SetMaterial
(
Group
.
FromCards
(
tc
))
VgF
.
Sendto
(
LOCATION_OVERLAY
,
Group
.
FromCards
(
tc
),
c
)
if
true
then
table.insert
(
ops
,
VgF
.
Stringid
(
VgID
+
5
,
4
))
table.insert
(
sel
,
function
()
Duel
.
Draw
(
tp
,
1
,
REASON_TRIGGER
)
end
)
end
end
function
VgD
.
OverDressSum
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
c
:
RegisterFlagEffect
(
FLAG_CONDITION
,
RESET_EVENT
+
RESETS_STANDARD
,
EFFECT_FLAG_CLIENT_HINT
,
1
,
201
,
VgF
.
Stringid
(
10101006
,
0
))
end
--交织超限舞装
function
VgD
.
XOverDress
(
c
,
f
)
end
---舞装加身-「code」(在游戏中,也当做与指定的卡同名的卡使用。)
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
)
end
--战斗阶段
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
)
--扣血
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
rc
=
VgF
.
GetVMonster
(
tp
)
local
bc
=
rc
:
GetBattleTarget
()
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
(
rc
,
EVENT_CUSTOM
+
EVENT_DAMAGE_TRIGGER
,
e
,
0
,
tp
,
tp
,
0
)
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
,
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
rc
=
VgF
.
GetVMonster
(
tp
)
local
label
=
rc
:
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
)
rc
:
ResetFlagEffect
(
FLAG_ATTACK_TRIGGER
)
rc
:
RegisterFlagEffect
(
FLAG_ATTACK_TRIGGER
,
RESET_EVENT
+
RESETS_STANDARD
,
0
,
1
,
label
)
elseif
label
==
1
then
rc
:
ResetFlagEffect
(
FLAG_ATTACK_TRIGGER
)
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
)
...
...
@@ -539,377 +775,139 @@ function VgD.MonsterCannotBeAttackedCondition(e, c)
return
VgF
.
IsSequence
(
e
:
GetHandler
(),
1
,
2
,
3
)
end
--送去g区
function
vgd
.
CardToG
(
c
,
m
,
cost
,
op
,
con
)
local
cm
=
_G
[
"c"
..
m
]
if
not
cm
.
is_has_trigger
then
cm
.
is_has_trigger
=
true
end
local
type
=
EFFECT_TYPE_TRIGGER_F
if
VgF
.
GetValueType
(
cost
)
==
"function"
then
type
=
EFFECT_TYPE_TRIGGER_O
end
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetDescription
(
VgF
.
Stringid
(
VgID
,
2
))
e1
:
SetType
(
EFFECT_TYPE_SINGLE
+
type
)
e1
:
SetProperty
(
EFFECT_FLAG_DELAY
+
EFFECT_FLAG_DAMAGE_STEP
)
e1
:
SetCode
(
EVENT_MOVE
)
if
VgF
.
GetValueType
(
con
)
==
"function"
then
e1
:
SetCondition
(
con
)
end
if
VgF
.
GetValueType
(
cost
)
==
"function"
then
e1
:
SetCost
(
cost
)
end
e1
:
SetCondition
(
VgD
.
CardToGCondition
)
if
VgF
.
GetValueType
(
op
)
~=
"function"
then
e1
:
SetOperation
(
VgD
.
CardToGOperation
)
else
e1
:
SetOperation
(
op
)
end
c
:
RegisterEffect
(
e1
)
end
function
VgD
.
CardToGCondition
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
return
c
:
IsLocation
(
LOCATION_GZONE
)
and
Duel
.
GetAttackTarget
()
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
--判定
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
(
0
))
e1
:
SetOperation
(
VgD
.
CardTriggerOperation
(
0
))
c
:
RegisterEffect
(
e1
)
local
e2
=
e1
:
Clone
()
e2
:
SetCondition
(
VgD
.
CardTriggerCondtion
(
1
))
e2
:
SetOperation
(
VgD
.
CardTriggerOperation
(
1
))
c
:
RegisterEffect
(
e2
)
end
function
VgD
.
CardTriggerCondtion
(
chkcon
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
cp
=
tp
if
chkcon
==
0
then
cp
=
1
-
tp
end
return
Duel
.
GetTurnPlayer
()
==
cp
and
c
:
IsLocation
(
LOCATION_TRIGGER
)
end
end
function
VgD
.
CardTriggerOperation
(
chkop
,
f
)
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
==
0
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
rc
=
VgF
.
GetVMonster
(
tp
)
local
bc
=
rc
:
GetBattleTarget
()
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
(
rc
,
EVENT_CUSTOM
+
EVENT_DAMAGE_TRIGGER
,
e
,
0
,
tp
,
tp
,
0
)
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
,
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
rc
=
VgF
.
GetVMonster
(
tp
)
local
label
=
rc
:
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
)
rc
:
ResetFlagEffect
(
FLAG_ATTACK_TRIGGER
)
rc
:
RegisterFlagEffect
(
FLAG_ATTACK_TRIGGER
,
RESET_EVENT
+
RESETS_STANDARD
,
0
,
1
,
label
)
elseif
label
==
1
then
rc
:
ResetFlagEffect
(
FLAG_ATTACK_TRIGGER
)
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
--起自永以外关键字----------------------------------------------------------------------------------------
--vg规则
function
VgD
.
Rule
(
c
)
---使卡片具有超限舞装的功能
---@param c Card 要注册超限舞装功能的卡
---@param filter number 卡名为 filter 的后防者,或符合 filter 的后防者等
---@return Effect 这个效果
function
VgD
.
OverDress
(
c
,
filter
)
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
)
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_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e2
:
SetCode
(
EVENT_BATTLED
)
e2
:
SetType
(
EFFECT_TYPE_SINGLE
+
EFFECT_TYPE_CONTINUOUS
)
e2
:
SetCode
(
EVENT_SPSUMMON_SUCCESS
)
e2
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e2
:
SetRange
(
LOCATION_MZONE
)
e2
:
SetOperation
(
VgD
.
ResetOperation
)
e2
:
SetOperation
(
VgD
.
OverDressSum
)
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
return
e1
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
)
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
.
RuelDrawCondition
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
return
VgF
.
RuleTurnCondtion
(
e
)
and
VgF
.
RuleCardCondtion
(
e
)
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
.
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
)
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
Duel
.
GetTurnPlayer
()
==
tp
then
Duel
.
Draw
(
tp
,
1
,
REASON_PHASEDRAW
)
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
.
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
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
--指令卡
---使c可以作为指令卡发动。
---@param c Card 要操作的卡
---@param m integer 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
--指令卡相关----------------------------------------------------------------------------------------
---使卡片可以作为指令卡发动
---@param c Card 要注册指令卡功能的卡
---@param m number|nil 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
---@param op function|nil 作为指令卡的效果
---@param con function|nil 作为指令卡的发动条件
---@param cost function|nil 作为指令卡的发动费用
---@param con function|nil 作为指令卡的发动条件
---@return Effect 这个效果
function
VgD
.
SpellActivate
(
c
,
m
,
op
,
cost
,
con
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetDescription
(
VgF
.
Stringid
(
m
,
0
))
e1
:
SetType
(
EFFECT_TYPE_ACTIVATE
)
e1
:
SetCode
(
EVENT_FREE_CHAIN
)
e1
:
SetCost
(
VgD
.
MixCost
(
cost
))
e1
:
SetCondition
(
VgD
.
SpellCondtion
(
con
))
e1
:
SetTarget
(
VgD
.
SpellTarget
)
e1
:
SetOperation
(
VgD
.
SpellOperation
(
op
))
c
:
RegisterEffect
(
e1
)
-- check func
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"SpellActivate"
)
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
()
if
chk
==
0
then
return
VgF
.
GetValueType
(
cost
)
~=
"function"
or
cost
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
0
)
or
(
Duel
.
IsPlayerAffectedByEffect
(
tp
,
AFFECT_CODE_MIX
)
and
VgF
.
IsExistingMatchingCard
(
VgD
.
MixCostFilter
,
tp
,
LOCATION_DROP
,
0
,
1
,
nil
,
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
))
end
if
Duel
.
IsPlayerAffectedByEffect
(
tp
,
AFFECT_CODE_MIX
)
and
VgF
.
IsExistingMatchingCard
(
VgD
.
MixCostFilter
,
tp
,
LOCATION_DROP
,
0
,
1
,
nil
,
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
)
then
local
a
=
false
if
VgF
.
GetValueType
(
cost
)
==
"function"
and
not
cost
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
0
)
then
a
=
true
end
if
not
a
then
a
=
Duel
.
SelectYesNo
(
tp
,
VgF
.
Stringid
(
VgID
,
6
))
end
if
a
then
local
bc
=
Duel
.
SelectMatchingCard
(
tp
,
VgD
.
MixCostFilter
,
tp
,
LOCATION_DROP
,
0
,
1
,
1
,
nil
,
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
c
):
GetFirst
()
if
bc
then
VgF
.
Sendto
(
LOCATION_LOCK
,
bc
,
POS_FACEUP
,
REASON_COST
)
e
:
SetLabelObject
(
bc
)
VgD
.
MixCostOperation
(
c
,
bc
,
tp
)
end
end
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
if
VgF
.
GetValueType
(
cost
)
==
"function"
then
cost
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
1
)
end
cost
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
1
)
end
end
end
...
...
@@ -1192,294 +1190,424 @@ function VgD.MixCostOperation(c, bc, tp)
::
continue
::
end
end
function
VgD
.
SpellCondtion
(
con
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
if
VgF
.
GetValueType
(
con
)
==
"function"
and
not
con
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
then
return
false
end
return
VgF
.
LvCondition
(
e
)
end
end
function
VgD
.
SpellTarget
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
local
ct1
=
Duel
.
GetFlagEffectLabel
(
tp
,
FLAG_SPELL_COUNT_LIMIT
)
local
ct2
=
Duel
.
GetFlagEffectLabel
(
tp
,
FLAG_SPELL_USED_COUNT
)
if
VgF
.
GetValueType
(
ct1
)
~=
"number"
then
ct1
=
1
end
if
VgF
.
GetValueType
(
ct2
)
~=
"number"
then
ct2
=
0
end
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
,
bool
)
if
op
then
op
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
1
)
end
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
bool
or
not
mc
then
return
end
local
te
=
mc
:
GetActivateEffect
()
local
op2
=
te
:
GetOperation
()
if
op2
then
op2
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
true
)
end
end
end
---当c被卡号为code的卡Ride时触发的效果。
---@param c Card 被Ride的卡
---@param m integer 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
---@param code integer|nil Ride的卡
---@param op function|nil 触发的效果
---@param cost function|nil 效果的费用
---@param con function|nil 效果的条件
---@param tg function|nil
function
VgD
.
BeRidedByCard
(
c
,
m
,
code
,
op
,
cost
,
con
,
tg
)
local
cm
=
_G
[
"c"
..
m
]
if
not
cm
.
is_has_trigger
then
cm
.
is_has_trigger
=
true
end
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
+
EFFECT_TYPE_CONTINUOUS
)
e1
:
SetCode
(
EVENT_BE_MATERIAL
)
e1
:
SetProperty
(
EFFECT_FLAG_EVENT_PLAYER
)
e1
:
SetCondition
(
VgD
.
BeRidedByCardCondition
(
code
,
con
))
e1
:
SetOperation
(
VgD
.
BeRidedByCardOperation
(
m
,
op
,
cost
,
tg
))
c
:
RegisterEffect
(
e1
)
end
function
VgD
.
BeRidedByCardCondition
(
code
,
f
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
if
VgF
.
GetValueType
(
code
)
==
"function"
and
not
code
(
c
:
GetReasonCard
())
then
return
false
elseif
VgF
.
GetValueType
(
code
)
==
"number"
and
not
c
:
GetReasonCard
():
IsCode
(
code
)
then
return
false
end
return
r
==
REASON_RIDEUP
and
(
VgF
.
GetValueType
(
f
)
==
"nil"
or
f
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
))
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
function
VgD
.
BeRidedByCardOperation
(
m
,
op
,
cost
,
tg
,
stringid
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
rc
=
c
:
GetReasonCard
()
local
type
=
EFFECT_TYPE_TRIGGER_F
if
not
stringid
then
stringid
=
2
end
if
VgF
.
GetValueType
(
cost
)
==
"function"
then
type
=
EFFECT_TYPE_TRIGGER_O
end
local
e1
=
Effect
.
CreateEffect
(
rc
)
e1
:
SetDescription
(
VgF
.
Stringid
(
m
,
stringid
))
e1
:
SetType
(
type
+
EFFECT_TYPE_FIELD
)
e1
:
SetProperty
(
EFFECT_FLAG_DELAY
)
e1
:
SetCode
(
EVENT_SPSUMMON_SUCCESS
)
e1
:
SetLabelObject
(
c
)
e1
:
SetRange
(
LOCATION_MZONE
)
e1
:
SetCondition
(
VgD
.
BeRidedByCardOpCondtion
)
if
VgF
.
GetValueType
(
cost
)
==
"function"
then
e1
:
SetCost
(
cost
)
end
if
VgF
.
GetValueType
(
tg
)
==
"function"
then
e1
:
SetTarget
(
tg
)
end
if
VgF
.
GetValueType
(
op
)
==
"function"
then
e1
:
SetOperation
(
op
)
end
e1
:
SetReset
(
RESET_EVENT
+
RESETS_STANDARD
)
rc
:
RegisterEffect
(
e1
,
true
)
---使卡片可以作为闪现指令卡发动
---@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"
)
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
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
)
-- 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
---当c在loc时,可以发动的【起】效果。
---@param c Card 要触发效果的卡
---@param m integer 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
---@param loc integer 发动时所处的位置
---@param op function|nil 触发的效果
---@param cost function|nil 效果的费用
---@param con function|nil 效果触发的条件
---@param tg function|nil
---@param count integer|nil 指示效果在同一回合内最多发动的次数
---@param property integer|nil 指示效果的特殊属性。
function
VgD
.
EffectTypeIgnition
(
c
,
m
,
loc
,
op
,
cost
,
con
,
tg
,
count
,
property
,
stringid
)
---使卡片可以作为设置指令卡发动
---@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
cm
=
_G
[
"c"
..
m
]
if
not
VgF
.
FunctionLegal
(
op
,
m
,
"op"
)
then
return
end
if
not
VgF
.
FunctionLegal
(
cost
,
m
,
"cost"
)
then
return
end
if
not
VgF
.
FunctionLegal
(
con
,
m
,
"con"
)
then
return
end
if
not
VgF
.
FunctionLegal
(
tg
,
m
,
"tg"
)
then
return
end
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"ContinuousSpell"
)
if
fchk
.
con
(
con
)
or
fchk
.
cost
(
cost
)
or
fchk
.
tg
(
tg
)
then
return
end
-- set param
cm
.
is_has_ignition
=
true
local
con_exf
=
VgF
.
True
loc
=
loc
or
LOCATION_MZONE
if
loc
==
LOCATION_RZONE
then
loc
,
con_exf
=
LOCATION_MZONE
,
VgF
.
RMonsterCondition
elseif
loc
==
LOCATION_VZONE
then
loc
,
con_exf
=
LOCATION_MZONE
,
VgF
.
VMonsterCondition
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
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetDescription
(
VgF
.
Stringid
(
VgID
+
2
,
stringid
or
1
))
e1
:
SetType
(
EFFECT_TYPE_IGNITION
)
e1
:
SetRange
(
loc
)
if
property
then
e1
:
SetProperty
(
property
)
end
if
count
then
e1
:
SetCountLimit
(
count
)
end
e1
:
SetCondition
(
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
)
if
cost
then
e1
:
SetCost
(
cost
)
end
e1
:
SetTarget
(
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
if
chk
==
0
then
return
not
tg
or
tg
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
0
)
end
Duel
.
SetTargetCard
(
e
:
GetLabelObject
())
tg
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
end
)
if
op
then
e1
:
SetOperation
(
op
)
end
c
:
RegisterEffect
(
e1
)
return
e1
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
---当c在loc时,code时点被触发时执行的效果。【自】效果模板
---@param c Card 要触发效果的卡
---@param m integer 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
---@param loc integer 发动时所处的位置
---@param typ integer 若是自己状态变化引发,则填EFFECT_TYPE_SINGLE;<br>若是场上任意一卡状态变化引发,则填EFFECT_TYPE_FIELD。
---@param code integer 触发的时点
---@param op function|nil 触发的效果
---@param cost function|nil 效果的费用
---@param con function|nil 效果触发的条件
---@param tg function|nil
---@param count integer|nil 指示效果在同一回合内最多发动的次数
---@param property integer|nil 指示效果的特殊属性。
function
VgD
.
EffectTypeTrigger
(
c
,
m
,
loc
,
typ
,
code
,
op
,
cost
,
con
,
tg
,
count
,
property
,
stringid
)
--自相关----------------------------------------------------------------------------------------
---【自】效果模板:当单位在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
cm
=
_G
[
"c"
..
m
]
if
not
VgF
.
FunctionLegal
(
op
,
m
,
"op"
)
then
return
end
if
not
VgF
.
FunctionLegal
(
cost
,
m
,
"cost"
)
then
return
end
if
not
VgF
.
FunctionLegal
(
con
,
m
,
"con"
)
then
return
end
if
not
VgF
.
FunctionLegal
(
tg
,
m
,
"tg"
)
then
return
end
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"EffectTypeTrigger"
)
if
fchk
.
con
(
con
)
or
fchk
.
cost
(
cost
)
or
fchk
.
tg
(
tg
)
or
fchk
.
op
(
op
)
then
return
end
-- set param
cm
.
is_has_trigger
=
true
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
)
local
con_exf
=
VgF
.
True
loc
=
loc
or
LOCATION_MZONE
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
,
con
=
VgF
.
GetLocCondition
(
loc
,
con
)
-- set effect
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetDescription
(
VgF
.
Stringid
(
VgID
+
1
,
stringid
or
1
))
e1
:
SetType
(
typ
)
e1
:
SetCode
(
code
)
e1
:
SetRange
(
loc
)
e1
:
SetProperty
((
property
or
1
)
+
EFFECT_FLAG_DAMAGE_STEP
+
EFFECT_FLAG_DELAY
)
if
count
then
e1
:
SetCountLimit
(
count
)
end
e1
:
SetCondition
(
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
)
if
cost
then
e1
:
SetCost
(
cost
)
end
if
tg
then
e1
:
SetTarget
(
tg
)
end
if
op
then
e1
:
SetOperation
(
op
)
end
c
:
RegisterEffect
(
e1
)
return
e1
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
function
VgD
.
EffectTypeTriggerWhenHitting
(
c
,
m
,
loc
,
typ
,
op
,
cost
,
con
,
tg
,
count
,
p
,
property
,
stringid
)
---【自】攻击击中时触发
---@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"
)
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
local
e1
=
VgD
.
EffectTypeTrigger
(
c
,
m
,
loc
,
typ
,
EVENT_BATTLE_DESTROYING
,
op
,
cost
,
con
,
tg
,
count
,
property
,
stringid
)
p
=
p
or
c
:
GetControler
(
)
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
,
string
id
)
-- 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
eg
:
GetFirst
():
GetControler
()
==
p
and
(
con
and
not
con
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
)
then
return
false
end
if
typ
==
EFFECT_TYPE_SINGLE
then
return
Duel
.
GetAttacker
()
==
e
:
GetHandler
()
end
return
true
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
function
VgD
.
QuickSpell
(
c
,
op
,
cost
,
con
,
tg
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_ACTIVATE
)
e1
:
SetCode
(
EVENT_BATTLE_START
)
e1
:
SetCondition
(
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
if
VgF
.
GetValueType
(
con
)
==
"function"
and
not
con
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
then
return
false
end
local
bc
=
Duel
.
GetAttackTarget
()
return
bc
and
bc
:
IsControler
(
tp
)
and
VgF
.
LvCondition
(
e
)
end
)
if
VgF
.
GetValueType
(
cost
)
==
"function"
then
e1
:
SetCost
(
cost
)
end
if
VgF
.
GetValueType
(
tg
)
==
"function"
then
e1
:
SetTarget
(
tg
)
end
if
VgF
.
GetValueType
(
op
)
==
"function"
then
e1
:
SetOperation
(
op
)
end
c
:
RegisterEffect
(
e1
)
return
e1
---【自】这个单位被放置到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"
)
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
.
ContinuousSpell
(
c
,
cost
,
con
,
tg
)
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_ACTIVATE
)
e1
:
SetCode
(
EVENT_FREE_CHAIN
)
e1
:
SetCountLimit
(
1
,
VgID
+
EFFECT_COUNT_CODE_OATH
)
e1
:
SetCondition
(
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
if
VgF
.
GetValueType
(
con
)
==
"function"
and
not
con
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
then
return
false
end
return
VgF
.
LvCondition
(
e
)
end
)
if
VgF
.
GetValueType
(
cost
)
==
"function"
then
e1
:
SetCost
(
cost
)
end
if
VgF
.
GetValueType
(
tg
)
==
"function"
then
e1
:
SetTarget
(
tg
)
end
e1
:
SetOperation
(
VgD
.
ContinuousSpellOperation
)
c
:
RegisterEffect
(
e1
)
return
e1
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"
)
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
.
ContinuousSpellOperation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
VgD
.
BeRidedByCardOperation
(
desc
,
op
,
cost
,
tg
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
VgF
.
Sendto
(
LOCATION_ORDER
,
c
,
tp
,
POS_FACEUP_ATTACK
,
REASON_RULE
)
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
--起相关----------------------------------------------------------------------------------------
---【起】效果模板:当单位在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"
)
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 integer 指示脚本的整数。cxxx的脚本应填入xxx。cm的脚本应填入m。
---@param loc integer 发动时所处的位置
---@param typ integer 只影响自己,则填EFFECT_TYPE_SINGLE;<br>影响场上,则填EFFECT_TYPE_FIELD。
---@param code integer 触发的效果
---@param val integer 触发的效果的数值
---@param con function|nil 效果触发的条件
---@param tg function|nil 效果的适用对象过滤
---@param loc_self integer|nil 效果的影响的自己区域
---@param loc_op integer|nil 效果的影响的对方区域
---@param reset integer|nil 效果的重置条件
---@param mc Card|nil 效果的拥有者, 没有则为 c
function
VgD
.
EffectTypeContinuous
(
c
,
m
,
loc
,
typ
,
code
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
mc
)
---@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
cm
=
_G
[
"c"
..
m
]
if
not
VgF
.
FunctionLegal
(
con
,
m
,
"con"
)
then
return
end
if
not
VgF
.
FunctionLegal
(
tg
,
m
,
"tg"
)
then
return
end
if
not
VgF
.
CardLegal
(
c
,
m
,
"c"
)
then
return
end
local
fchk
=
VgF
.
IllegalFunctionCheck
(
"EffectTypeContinuous"
)
if
fchk
.
con
(
con
)
or
fchk
.
tg
(
tg
)
then
return
end
-- set param
if
not
cm
.
is_has_continuous
and
not
reset
then
cm
.
is_has_continuous
=
true
end
local
con_exf
=
VgF
.
True
loc
=
loc
or
LOCATION_MZONE
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
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
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
typ
or
EFFECT_TYPE_SINGLE
)
e1
:
SetCode
(
code
)
e1
:
SetRange
(
loc
)
if
typ
==
EFFECT_TYPE_FIELD
then
e1
:
SetTargetRange
(
loc_self
or
0
,
loc_op
or
0
)
end
e1
:
SetCondition
(
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
)
e1
:
SetValue
(
val
)
if
tg
then
e1
:
SetTarget
(
tg
)
end
if
reset
then
e1
:
SetReset
(
RESET_EVENT
+
RESETS_STANDARD
+
reset
)
end
(
mc
or
c
):
RegisterEffect
(
e1
)
return
e1
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
function
VgD
.
EffectTypeContinuousChangeAttack
(
c
,
m
,
loc
,
typ
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
mc
)
return
VgD
.
EffectTypeContinuous
(
c
,
m
,
loc
,
typ
,
EFFECT_UPDATE_ATTACK
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
mc
)
---【永】力量数值变更
---@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
function
VgD
.
EffectTypeContinuousChangeDefense
(
c
,
m
,
typ
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
mc
)
return
VgD
.
EffectTypeContinuous
(
c
,
m
,
LOCATION_GZONE
,
typ
,
EFFECT_UPDATE_DEFENSE
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
mc
)
---【永】盾护数值变更
---@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
function
VgD
.
EffectTypeContinuousChangeStar
(
c
,
m
,
typ
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
mc
)
local
e1
=
VgD
.
EffectTypeContinuous
(
c
,
m
,
LOCATION_MZONE
,
typ
,
EFFECT_UPDATE_LSCALE
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
mc
)
local
e2
=
VgD
.
EffectTypeContinuous
(
c
,
m
,
LOCATION_MZONE
,
typ
,
EFFECT_UPDATE_RSCALE
,
val
,
con
,
tg
,
loc_self
,
loc_op
,
reset
,
mc
)
---【永】暴击数值变更
---@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
function
VgD
.
TriggerCountUp
(
c
,
m
,
num
,
reset
,
tc
)
local
cm
=
_G
[
"c"
..
m
]
if
not
cm
.
is_has_continuous
and
not
reset
then
cm
.
is_has_continuous
=
true
end
if
tc
then
tc
=
VgF
.
ReturnCard
(
tc
)
else
tc
=
c
end
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e1
:
SetRange
(
LOCATION_MZONE
)
e1
:
SetCode
(
EVENT_CUSTOM
+
EVENT_TRIGGERCOUNTUP
)
e1
:
SetProperty
(
EFFECT_FLAG_DELAY
)
e1
:
SetCondition
(
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
return
VgF
.
ReturnCard
(
eg
)
==
e
:
GetHandler
()
end
)
if
VgF
.
GetValueType
(
reset
)
==
"number"
then
e1
:
SetReset
(
RESET_EVENT
+
RESETS_STANDARD
+
reset
)
end
e1
:
SetOperation
(
VgD
.
TriggerCountUpOperation
(
num
))
tc
:
RegisterEffect
(
e1
)
return
e1
---【永】驱动数值变更
---@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"
).
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
)
...
...
@@ -1492,104 +1620,95 @@ function VgD.TriggerCountUpOperation(num)
c
:
RegisterFlagEffect
(
FLAG_ATTACK_TRIGGER
,
RESET_EVENT
+
RESETS_STANDARD
,
0
,
1
,
label
)
end
end
function
VgD
.
GlobalCheckEffect
(
c
,
m
,
code
,
con
,
op
)
local
typ
=
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
local
cm
=
_G
[
"c"
..
m
]
if
not
cm
.
global_check
then
cm
.
global_check
=
true
local
ge1
=
Effect
.
CreateEffect
(
c
)
ge1
:
SetType
(
typ
)
ge1
:
SetCode
(
code
)
if
VgF
.
GetValueType
(
con
)
==
"function"
then
ge1
:
SetCondition
(
con
)
end
if
VgF
.
GetValueType
(
op
)
==
"function"
then
ge1
:
SetOperation
(
op
)
else
ge1
:
SetOperation
(
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
Duel
.
RegisterFlagEffect
(
tp
,
m
,
RESET_PHASE
+
PHASE_END
,
0
,
1
)
end
)
end
Duel
.
RegisterEffect
(
ge1
,
0
)
end
end
function
VgD
.
CannotBeTarget
(
c
,
m
,
con
,
val
,
loc
,
tg
,
range
)
local
cm
=
_G
[
"c"
..
m
]
local
f
=
VgF
.
True
if
not
cm
.
is_has_continuous
then
cm
.
is_has_continuous
=
true
end
if
not
loc
then
loc
=
LOCATION_MZONE
end
if
loc
==
LOCATION_RZONE
then
loc
=
LOCATION_MZONE
f
=
VgF
.
RMonsterCondition
end
if
loc
==
LOCATION_VZONE
then
loc
=
LOCATION_MZONE
f
=
VgF
.
VMonsterCondition
end
if
VgF
.
GetValueType
(
tg
)
==
"function"
or
VgF
.
GetValueType
(
tg
)
==
"number"
then
if
VgF
.
GetValueType
(
range
)
~=
"tabel"
then
range
=
{}
end
if
#
range
==
0
then
range
=
{
LOCATION_MZONE
,
0
}
elseif
#
range
==
1
then
table.insert
(
range
,
0
)
end
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_FIELD
)
e1
:
SetRange
(
loc
)
e1
:
SetTargetRange
(
range
[
1
],
range
[
2
])
e1
:
SetCode
(
EFFECT_CANNOT_BE_EFFECT_TARGET
)
e1
:
SetCondition
(
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
return
(
VgF
.
GetValueType
(
con
)
~=
"function"
or
con
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
))
and
f
(
e
)
end
)
if
VgF
.
GetValueType
(
val
)
==
"function"
then
e1
:
SetValue
(
val
)
else
e1
:
SetValue
(
function
(
e
,
re
,
rp
)
---【永】这个单位不会被对手的卡片的效果选择
---@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"
)
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
)
end
if
VgF
.
GetValueType
(
tg
)
==
"function"
then
e1
:
SetTarget
(
tg
)
end
c
:
RegisterEffect
(
e1
)
return
e1
-- 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
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_SINGLE_RANGE
)
e1
:
SetRange
(
loc
)
e1
:
SetCode
(
EFFECT_CANNOT_BE_EFFECT_TARGET
)
if
VgF
.
GetValueType
(
con
)
==
"function"
then
e1
:
SetCondition
(
con
)
end
if
VgF
.
GetValueType
(
val
)
==
"function"
then
e1
:
SetValue
(
val
)
else
e1
:
SetValue
(
function
(
e
,
re
,
rp
)
return
rp
==
1
-
e
:
GetHandlerPlayer
()
end
)
end
c
:
RegisterEffect
(
e1
)
return
e1
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
)
local
cm
=
_G
[
"c"
..
m
]
if
not
cm
.
is_has_continuous
then
cm
.
is_has_continuous
=
true
end
-- 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
(
function
(
e
)
local
tp
=
e
:
GetHandlerPlayer
()
return
not
vgf
.
IsExistingMatchingCard
(
VgD
.
NightFilter
,
tp
,
LOCATION_ORDER
,
0
,
1
,
nil
)
and
vgf
.
GetMatchingGroupCount
(
nil
,
tp
,
LOCATION_ORDER
,
0
,
nil
)
==
1
end
)
c
:
RegisterEffect
(
e1
)
return
e1
end
function
VgD
.
DeepNightEffect
(
c
,
m
)
local
cm
=
_G
[
"c"
..
m
]
if
not
cm
.
is_has_continuous
then
cm
.
is_has_continuous
=
true
end
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_FIELD
)
e1
:
SetProperty
(
EFFECT_FLAG_PLAYER_TARGET
)
e1
:
SetCode
(
AFFECT_CODE_DEEP_NIGHT
)
e1
:
SetRange
(
LOCATION_ORDER
)
e1
:
SetTargetRange
(
1
,
0
)
e1
:
SetCondition
(
function
(
e
)
local
tp
=
e
:
GetHandlerPlayer
()
return
not
vgf
.
IsExistingMatchingCard
(
VgD
.
NightFilter
,
tp
,
LOCATION_ORDER
,
0
,
1
,
nil
)
and
vgf
.
GetMatchingGroupCount
(
nil
,
tp
,
LOCATION_ORDER
,
0
,
nil
)
>=
2
end
)
e1
:
SetCondition
(
condition
(
true
))
c
:
RegisterEffect
(
e1
)
return
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
)
local
cm
=
_G
[
"c"
..
m
]
if
not
cm
.
is_has_continuous
then
cm
.
is_has_continuous
=
true
end
-- 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
)
...
...
@@ -1648,3 +1767,40 @@ 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"
)
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
{}
local
code_tab
=
cm
.
global_check
[
code
]
or
{}
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
(
1
-
tp
,
m
,
RESET_PHASE
+
PHASE_END
,
0
,
1
)
Duel
.
RegisterFlagEffect
(
tp
,
m
,
RESET_PHASE
+
PHASE_END
,
0
,
1
)
end
-- set effect
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
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