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
2cf52b1a
Commit
2cf52b1a
authored
Nov 07, 2024
by
jwyxym
Committed by
GitHub
Nov 07, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #26 from whenmo/main
rewrite and updata
parents
8a82b82a
005b66cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1436 additions
and
1408 deletions
+1436
-1408
VgD.Lua
VgD.Lua
+1391
-1376
VgFuncLib.lua
VgFuncLib.lua
+45
-32
No files found.
VgD.Lua
View file @
2cf52b1a
This source diff could not be displayed because it is too large. You can
view the blob
instead.
VgFuncLib.lua
View file @
2cf52b1a
...
@@ -573,13 +573,19 @@ function VgF.DamageFill(val)
...
@@ -573,13 +573,19 @@ function VgF.DamageFill(val)
end
end
end
end
function
VgF
.
CostAnd
(
f1
,
f2
)
---用于多Cost。例如 VgF.CostAnd(vgf.DamageCost(1), vgf.DisCardCost(1))。
function
VgF
.
CostAnd
(
...
)
funcs
=
{
...
}
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
if
chk
==
0
then
if
chk
==
0
then
return
f1
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
and
f2
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
for
_
,
func
in
ipairs
(
funcs
)
do
chk
=
chk
and
func
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
end
return
chk
end
for
_
,
func
in
ipairs
(
funcs
)
do
func
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
end
end
f1
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
f2
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
end
end
end
end
...
@@ -717,34 +723,41 @@ function VgF.DamageCost(val)
...
@@ -717,34 +723,41 @@ function VgF.DamageCost(val)
return
Duel
.
GetOperatedGroup
():
GetCount
()
return
Duel
.
GetOperatedGroup
():
GetCount
()
end
end
end
end
function
VgF
.
LeaveFieldCost
(
card_or_code_or_func
,
val_max
,
val_min
,
except
,
...
)
---用于效果的Cost。它返回一个执行“【费用】[将xxx退场]”的函数。
local
ext_params
=
{
...
}
---@param card_code_func Card|integer|function 退场的卡的条件
if
VgF
.
GetValueType
(
val_max
)
~=
"number"
then
val_max
=
1
end
---@param val_max integer 退场的卡的最大数量
if
VgF
.
GetValueType
(
val_min
)
~=
"number"
or
val_min
>
val_max
then
val_min
=
val_max
end
---@param val_min integer 退场的卡的最小数量
---@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
)
return
function
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
local
filter
=
VgF
.
True
g
=
g
or
Group
.
FromCards
(
e
:
GetHandler
())
if
VgF
.
GetValueType
(
card_or_code_or_func
)
==
"function"
then
filter
=
card_or_code_or_func
if
chk
==
0
then
return
not
g
:
IsExists
(
VgF
.
NOT
(
Card
.
IsAbleToGraveAsCost
),
1
,
nil
)
end
elseif
VgF
.
GetValueType
(
card_or_code_or_func
)
==
"number"
then
filter
=
function
(
tc
)
return
tc
:
IsCode
(
card_or_code_or_func
)
end
elseif
VgF
.
GetValueType
(
card_or_code_or_func
)
==
"Card"
then
if
chk
==
0
then
return
card_or_code_or_func
:
IsAbleToGraveAsCost
()
end
VgF
.
Sendto
(
LOCATION_DROP
,
card_or_code_or_func
,
REASON_COST
)
elseif
VgF
.
GetValueType
(
card_or_code_or_func
)
==
"Group"
then
if
chk
==
0
then
return
not
card_or_code_or_func
:
IsExists
(
function
(
tc
)
return
not
tc
:
IsAbleToGraveAsCost
()
end
,
1
,
nil
)
end
VgF
.
Sendto
(
LOCATION_DROP
,
card_or_code_or_func
,
REASON_COST
)
end
if
chk
==
0
then
return
VgF
.
IsExistingMatchingCard
(
function
(
tc
)
return
filter
(
tc
,
table.unpack
(
ext_params
))
and
tc
:
IsAbleToGraveAsCost
()
end
,
tp
,
LOCATION_MZONE
,
0
,
val_min
,
except
)
end
local
g
=
vgf
.
SelectMatchingCard
(
HINTMSG_LEAVEFIELD
,
e
,
tp
,
function
(
tc
)
return
filter
(
tc
,
table.unpack
(
ext_params
))
and
tc
:
IsAbleToGraveAsCost
()
end
,
tp
,
LOCATION_MZONE
,
0
,
val_min
,
val_max
,
except
)
VgF
.
Sendto
(
LOCATION_DROP
,
g
,
REASON_COST
)
VgF
.
Sendto
(
LOCATION_DROP
,
g
,
REASON_COST
)
end
end
end
end
...
@@ -1385,4 +1398,4 @@ end
...
@@ -1385,4 +1398,4 @@ end
function
VgF
.
PlayerEffect
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
VgF
.
PlayerEffect
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
return
true
return
true
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