Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-core
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
nanahira
ygopro-core
Commits
16be11ad
Commit
16be11ad
authored
Nov 01, 2021
by
mercury233
Committed by
GitHub
Nov 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Duel.CheckLPCost, Duel.PayLPCost (#410)
parent
60484c53
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
23 deletions
+40
-23
field.cpp
field.cpp
+16
-11
field.h
field.h
+2
-2
libduel.cpp
libduel.cpp
+8
-2
operations.cpp
operations.cpp
+13
-7
processor.cpp
processor.cpp
+1
-1
No files found.
field.cpp
View file @
16be11ad
...
@@ -2271,7 +2271,7 @@ int32 field::check_spsummon_counter(uint8 playerid, uint8 ct) {
...
@@ -2271,7 +2271,7 @@ int32 field::check_spsummon_counter(uint8 playerid, uint8 ct) {
}
}
return
TRUE
;
return
TRUE
;
}
}
int32
field
::
check_lp_cost
(
uint8
playerid
,
uint32
lp
)
{
int32
field
::
check_lp_cost
(
uint8
playerid
,
uint32
lp
,
uint32
must_pay
)
{
effect_set
eset
;
effect_set
eset
;
int32
val
=
lp
;
int32
val
=
lp
;
filter_player_effect
(
playerid
,
EFFECT_LPCOST_CHANGE
,
&
eset
);
filter_player_effect
(
playerid
,
EFFECT_LPCOST_CHANGE
,
&
eset
);
...
@@ -2281,17 +2281,22 @@ int32 field::check_lp_cost(uint8 playerid, uint32 lp) {
...
@@ -2281,17 +2281,22 @@ int32 field::check_lp_cost(uint8 playerid, uint32 lp) {
pduel
->
lua
->
add_param
(
val
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
val
,
PARAM_TYPE_INT
);
val
=
eset
[
i
]
->
get_value
(
3
);
val
=
eset
[
i
]
->
get_value
(
3
);
}
}
if
(
val
<=
0
)
if
(
val
<=
0
)
{
return
TRUE
;
if
(
must_pay
)
tevent
e
;
return
FALSE
;
e
.
event_cards
=
0
;
e
.
event_player
=
playerid
;
e
.
event_value
=
lp
;
e
.
reason
=
0
;
e
.
reason_effect
=
core
.
reason_effect
;
e
.
reason_player
=
playerid
;
if
(
effect_replace_check
(
EFFECT_LPCOST_REPLACE
,
e
))
return
TRUE
;
return
TRUE
;
}
if
(
!
must_pay
)
{
tevent
e
;
e
.
event_cards
=
0
;
e
.
event_player
=
playerid
;
e
.
event_value
=
lp
;
e
.
reason
=
0
;
e
.
reason_effect
=
core
.
reason_effect
;
e
.
reason_player
=
playerid
;
if
(
effect_replace_check
(
EFFECT_LPCOST_REPLACE
,
e
))
return
TRUE
;
}
//cost[playerid].amount += val;
//cost[playerid].amount += val;
if
(
val
<=
player
[
playerid
].
lp
)
if
(
val
<=
player
[
playerid
].
lp
)
return
TRUE
;
return
TRUE
;
...
...
field.h
View file @
16be11ad
...
@@ -468,10 +468,10 @@ public:
...
@@ -468,10 +468,10 @@ public:
void
set_spsummon_counter
(
uint8
playerid
);
void
set_spsummon_counter
(
uint8
playerid
);
int32
check_spsummon_counter
(
uint8
playerid
,
uint8
ct
=
1
);
int32
check_spsummon_counter
(
uint8
playerid
,
uint8
ct
=
1
);
int32
check_lp_cost
(
uint8
playerid
,
uint32
cost
);
int32
check_lp_cost
(
uint8
playerid
,
uint32
cost
,
uint32
must_pay
);
void
save_lp_cost
()
{}
void
save_lp_cost
()
{}
void
restore_lp_cost
()
{}
void
restore_lp_cost
()
{}
int32
pay_lp_cost
(
uint32
step
,
uint8
playerid
,
uint32
cost
);
int32
pay_lp_cost
(
uint32
step
,
uint8
playerid
,
uint32
cost
,
uint32
must_pay
);
uint32
get_field_counter
(
uint8
self
,
uint8
s
,
uint8
o
,
uint16
countertype
);
uint32
get_field_counter
(
uint8
self
,
uint8
s
,
uint8
o
,
uint16
countertype
);
int32
effect_replace_check
(
uint32
code
,
const
tevent
&
e
);
int32
effect_replace_check
(
uint32
code
,
const
tevent
&
e
);
...
...
libduel.cpp
View file @
16be11ad
...
@@ -1433,7 +1433,10 @@ int32 scriptlib::duel_check_lp_cost(lua_State *L) {
...
@@ -1433,7 +1433,10 @@ int32 scriptlib::duel_check_lp_cost(lua_State *L) {
return
0
;
return
0
;
uint32
cost
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint32
cost
=
(
uint32
)
lua_tointeger
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_lp_cost
(
playerid
,
cost
));
uint32
must_pay
=
FALSE
;
if
(
lua_gettop
(
L
)
>
2
)
must_pay
=
lua_toboolean
(
L
,
3
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_lp_cost
(
playerid
,
cost
,
must_pay
));
return
1
;
return
1
;
}
}
int32
scriptlib
::
duel_pay_lp_cost
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_pay_lp_cost
(
lua_State
*
L
)
{
...
@@ -1444,7 +1447,10 @@ int32 scriptlib::duel_pay_lp_cost(lua_State *L) {
...
@@ -1444,7 +1447,10 @@ int32 scriptlib::duel_pay_lp_cost(lua_State *L) {
return
0
;
return
0
;
uint32
cost
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint32
cost
=
(
uint32
)
lua_tointeger
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
add_process
(
PROCESSOR_PAY_LPCOST
,
0
,
0
,
0
,
playerid
,
cost
);
uint32
must_pay
=
FALSE
;
if
(
lua_gettop
(
L
)
>
2
)
must_pay
=
lua_toboolean
(
L
,
3
);
pduel
->
game_field
->
add_process
(
PROCESSOR_PAY_LPCOST
,
0
,
0
,
0
,
playerid
,
cost
,
must_pay
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
}
}
int32
scriptlib
::
duel_discard_deck
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_discard_deck
(
lua_State
*
L
)
{
...
...
operations.cpp
View file @
16be11ad
...
@@ -594,7 +594,7 @@ int32 field::recover(uint16 step, effect* reason_effect, uint32 reason, uint8 re
...
@@ -594,7 +594,7 @@ int32 field::recover(uint16 step, effect* reason_effect, uint32 reason, uint8 re
}
}
return
TRUE
;
return
TRUE
;
}
}
int32
field
::
pay_lp_cost
(
uint32
step
,
uint8
playerid
,
uint32
cost
)
{
int32
field
::
pay_lp_cost
(
uint32
step
,
uint8
playerid
,
uint32
cost
,
uint32
must_pay
)
{
switch
(
step
)
{
switch
(
step
)
{
case
0
:
{
case
0
:
{
effect_set
eset
;
effect_set
eset
;
...
@@ -609,6 +609,18 @@ int32 field::pay_lp_cost(uint32 step, uint8 playerid, uint32 cost) {
...
@@ -609,6 +609,18 @@ int32 field::pay_lp_cost(uint32 step, uint8 playerid, uint32 cost) {
if
(
val
<=
0
)
if
(
val
<=
0
)
return
TRUE
;
return
TRUE
;
core
.
units
.
begin
()
->
arg2
=
val
;
core
.
units
.
begin
()
->
arg2
=
val
;
core
.
select_options
.
clear
();
core
.
select_effects
.
clear
();
if
(
val
<=
player
[
playerid
].
lp
)
{
core
.
select_options
.
push_back
(
11
);
core
.
select_effects
.
push_back
(
0
);
}
if
(
must_pay
)
{
if
(
core
.
select_options
.
size
()
==
0
)
return
TRUE
;
returns
.
ivalue
[
0
]
=
0
;
return
FALSE
;
}
tevent
e
;
tevent
e
;
e
.
event_cards
=
0
;
e
.
event_cards
=
0
;
e
.
event_player
=
playerid
;
e
.
event_player
=
playerid
;
...
@@ -616,12 +628,6 @@ int32 field::pay_lp_cost(uint32 step, uint8 playerid, uint32 cost) {
...
@@ -616,12 +628,6 @@ int32 field::pay_lp_cost(uint32 step, uint8 playerid, uint32 cost) {
e
.
reason
=
0
;
e
.
reason
=
0
;
e
.
reason_effect
=
core
.
reason_effect
;
e
.
reason_effect
=
core
.
reason_effect
;
e
.
reason_player
=
playerid
;
e
.
reason_player
=
playerid
;
core
.
select_options
.
clear
();
core
.
select_effects
.
clear
();
if
(
val
<=
player
[
playerid
].
lp
)
{
core
.
select_options
.
push_back
(
11
);
core
.
select_effects
.
push_back
(
0
);
}
auto
pr
=
effects
.
continuous_effect
.
equal_range
(
EFFECT_LPCOST_REPLACE
);
auto
pr
=
effects
.
continuous_effect
.
equal_range
(
EFFECT_LPCOST_REPLACE
);
for
(
auto
eit
=
pr
.
first
;
eit
!=
pr
.
second
;)
{
for
(
auto
eit
=
pr
.
first
;
eit
!=
pr
.
second
;)
{
effect
*
peffect
=
eit
->
second
;
effect
*
peffect
=
eit
->
second
;
...
...
processor.cpp
View file @
16be11ad
...
@@ -491,7 +491,7 @@ int32 field::process() {
...
@@ -491,7 +491,7 @@ int32 field::process() {
return
pduel
->
bufferlen
;
return
pduel
->
bufferlen
;
}
}
case
PROCESSOR_PAY_LPCOST
:
{
case
PROCESSOR_PAY_LPCOST
:
{
if
(
pay_lp_cost
(
it
->
step
,
it
->
arg1
,
it
->
arg2
))
if
(
pay_lp_cost
(
it
->
step
,
it
->
arg1
,
it
->
arg2
,
it
->
arg3
))
core
.
units
.
pop_front
();
core
.
units
.
pop_front
();
else
else
it
->
step
++
;
it
->
step
++
;
...
...
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