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
8caee9dc
Commit
8caee9dc
authored
Jul 23, 2017
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update chain_limit
parent
07ca5517
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
64 deletions
+51
-64
effect.cpp
effect.cpp
+6
-6
field.cpp
field.cpp
+2
-2
field.h
field.h
+8
-4
libduel.cpp
libduel.cpp
+2
-8
operations.cpp
operations.cpp
+3
-4
processor.cpp
processor.cpp
+30
-40
No files found.
effect.cpp
View file @
8caee9dc
...
...
@@ -515,18 +515,18 @@ int32 effect::is_chainable(uint8 tp) {
}
else
if
(
sp
<
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
triggering_effect
->
get_speed
())
return
FALSE
;
}
if
(
pduel
->
game_field
->
core
.
chain_lim
it
)
{
for
(
auto
it
=
pduel
->
game_field
->
core
.
chain_limit
.
begin
();
it
!=
pduel
->
game_field
->
core
.
chain_limit
.
end
();
++
it
)
{
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
pduel
->
game_field
->
core
.
chain_limp
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
it
->
player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
tp
,
PARAM_TYPE_INT
);
if
(
!
pduel
->
lua
->
check_condition
(
pduel
->
game_field
->
core
.
chain_limit
,
3
))
if
(
!
pduel
->
lua
->
check_condition
(
it
->
function
,
3
))
return
FALSE
;
}
if
(
pduel
->
game_field
->
core
.
chain_limit_p
)
{
for
(
auto
it
=
pduel
->
game_field
->
core
.
chain_limit_p
.
begin
();
it
!=
pduel
->
game_field
->
core
.
chain_limit_p
.
end
();
++
it
)
{
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
pduel
->
game_field
->
core
.
chain_limp_p
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
it
->
player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
tp
,
PARAM_TYPE_INT
);
if
(
!
pduel
->
lua
->
check_condition
(
pduel
->
game_field
->
core
.
chain_limit_p
,
3
))
if
(
!
pduel
->
lua
->
check_condition
(
it
->
function
,
3
))
return
FALSE
;
}
return
TRUE
;
...
...
field.cpp
View file @
8caee9dc
...
...
@@ -72,8 +72,8 @@ field::field(duel* pduel) {
core
.
summoning_card
=
0
;
core
.
summon_depth
=
0
;
core
.
summon_cancelable
=
FALSE
;
core
.
chain_limit
=
0
;
core
.
chain_limit_p
=
0
;
core
.
chain_limit
.
clear
()
;
core
.
chain_limit_p
.
clear
()
;
core
.
chain_solving
=
FALSE
;
core
.
conti_solving
=
FALSE
;
core
.
conti_player
=
PLAYER_NONE
;
...
...
field.h
View file @
8caee9dc
...
...
@@ -155,6 +155,12 @@ struct processor {
typedef
std
::
list
<
processor_unit
>
processor_list
;
typedef
std
::
set
<
card
*
,
card_sort
>
card_set
;
typedef
std
::
set
<
std
::
pair
<
effect
*
,
tevent
>
>
delayed_effect_collection
;
struct
chain_limit_t
{
chain_limit_t
(
int32
f
,
int32
p
)
:
function
(
f
),
player
(
p
)
{}
int32
function
;
int32
player
;
};
typedef
std
::
vector
<
chain_limit_t
>
chain_limit_list
;
processor_list
units
;
processor_list
subunits
;
...
...
@@ -233,10 +239,8 @@ struct processor {
uint32
global_flag
;
uint16
pre_field
[
2
];
uint16
opp_mzone
[
7
];
int32
chain_limit
;
uint8
chain_limp
;
int32
chain_limit_p
;
uint8
chain_limp_p
;
chain_limit_list
chain_limit
;
chain_limit_list
chain_limit_p
;
uint8
chain_solving
;
uint8
conti_solving
;
uint8
win_player
;
...
...
libduel.cpp
View file @
8caee9dc
...
...
@@ -708,22 +708,16 @@ int32 scriptlib::duel_set_chain_limit(lua_State *L) {
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
pduel
->
game_field
->
core
.
chain_limit
)
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
pduel
->
game_field
->
core
.
chain_limit
);
int32
f
=
interpreter
::
get_function_handle
(
L
,
1
);
pduel
->
game_field
->
core
.
chain_limit
=
f
;
pduel
->
game_field
->
core
.
chain_limp
=
pduel
->
game_field
->
core
.
reason_player
;
pduel
->
game_field
->
core
.
chain_limit
.
push_back
(
processor
::
chain_limit_t
(
f
,
pduel
->
game_field
->
core
.
reason_player
));
return
0
;
}
int32
scriptlib
::
duel_set_chain_limit_p
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
pduel
->
game_field
->
core
.
chain_limit_p
)
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
pduel
->
game_field
->
core
.
chain_limit_p
);
int32
f
=
interpreter
::
get_function_handle
(
L
,
1
);
pduel
->
game_field
->
core
.
chain_limit_p
=
f
;
pduel
->
game_field
->
core
.
chain_limp_p
=
pduel
->
game_field
->
core
.
reason_player
;
pduel
->
game_field
->
core
.
chain_limit_p
.
push_back
(
processor
::
chain_limit_t
(
f
,
pduel
->
game_field
->
core
.
reason_player
));
return
0
;
}
int32
scriptlib
::
duel_get_chain_material
(
lua_State
*
L
)
{
...
...
operations.cpp
View file @
8caee9dc
...
...
@@ -4637,10 +4637,9 @@ int32 field::activate_effect(uint16 step, effect* peffect) {
return
FALSE
;
}
case
1
:
{
if
(
core
.
chain_limit
)
{
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
core
.
chain_limit
);
core
.
chain_limit
=
0
;
}
for
(
auto
it
=
core
.
chain_limit
.
begin
();
it
!=
core
.
chain_limit
.
end
();
++
it
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
it
->
function
);
core
.
chain_limit
.
clear
();
for
(
auto
cait
=
core
.
current_chain
.
begin
();
cait
!=
core
.
current_chain
.
end
();
++
cait
)
cait
->
triggering_effect
->
get_handler
()
->
set_status
(
STATUS_CHAINING
,
FALSE
);
add_process
(
PROCESSOR_SOLVE_CHAIN
,
0
,
0
,
0
,
FALSE
,
0
);
...
...
processor.cpp
View file @
8caee9dc
...
...
@@ -1551,10 +1551,9 @@ int32 field::process_phase_event(int16 step, int32 phase) {
return
FALSE
;
}
case
3
:
{
if
(
core
.
chain_limit
)
{
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
core
.
chain_limit
);
core
.
chain_limit
=
0
;
}
for
(
auto
it
=
core
.
chain_limit
.
begin
();
it
!=
core
.
chain_limit
.
end
();
++
it
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
it
->
function
);
core
.
chain_limit
.
clear
();
for
(
auto
cait
=
core
.
current_chain
.
begin
();
cait
!=
core
.
current_chain
.
end
();
++
cait
)
cait
->
triggering_effect
->
get_handler
()
->
set_status
(
STATUS_CHAINING
,
FALSE
);
add_process
(
PROCESSOR_SOLVE_CHAIN
,
0
,
0
,
0
,
FALSE
,
0
);
...
...
@@ -1937,20 +1936,18 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
case
10
:
{
core
.
new_ochain_h
.
clear
();
core
.
full_event
.
clear
();
if
(
core
.
chain_limit
)
{
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
core
.
chain_limit
);
core
.
chain_limit
=
0
;
}
for
(
auto
it
=
core
.
chain_limit
.
begin
();
it
!=
core
.
chain_limit
.
end
();
++
it
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
it
->
function
);
core
.
chain_limit
.
clear
();
if
(
core
.
current_chain
.
size
())
{
for
(
auto
cait
=
core
.
current_chain
.
begin
();
cait
!=
core
.
current_chain
.
end
();
++
cait
)
cait
->
triggering_effect
->
get_handler
()
->
set_status
(
STATUS_CHAINING
,
FALSE
);
add_process
(
PROCESSOR_SOLVE_CHAIN
,
0
,
0
,
0
,
skip_trigger
|
((
skip_freechain
|
skip_new
)
<<
8
),
skip_new
);
}
else
{
core
.
used_event
.
splice
(
core
.
used_event
.
end
(),
core
.
point_event
);
if
(
core
.
chain_limit_p
)
{
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
core
.
chain_limit_p
);
core
.
chain_limit_p
=
0
;
}
for
(
auto
it
=
core
.
chain_limit_p
.
begin
();
it
!=
core
.
chain_limit_p
.
end
();
++
it
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
it
->
function
);
core
.
chain_limit_p
.
clear
();
reset_chain
();
returns
.
ivalue
[
0
]
=
FALSE
;
}
...
...
@@ -2668,10 +2665,9 @@ int32 field::process_idle_command(uint16 step) {
return
TRUE
;
}
case
2
:
{
if
(
core
.
chain_limit
)
{
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
core
.
chain_limit
);
core
.
chain_limit
=
0
;
}
for
(
auto
it
=
core
.
chain_limit
.
begin
();
it
!=
core
.
chain_limit
.
end
();
++
it
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
it
->
function
);
core
.
chain_limit
.
clear
();
for
(
auto
cait
=
core
.
current_chain
.
begin
();
cait
!=
core
.
current_chain
.
end
();
++
cait
)
cait
->
triggering_effect
->
get_handler
()
->
set_status
(
STATUS_CHAINING
,
FALSE
);
add_process
(
PROCESSOR_SOLVE_CHAIN
,
0
,
0
,
0
,
FALSE
,
0
);
...
...
@@ -2735,10 +2731,9 @@ int32 field::process_idle_command(uint16 step) {
}
case
10
:
{
//end announce
if
(
core
.
chain_limit
)
{
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
core
.
chain_limit
);
core
.
chain_limit
=
0
;
}
for
(
auto
it
=
core
.
chain_limit
.
begin
();
it
!=
core
.
chain_limit
.
end
();
++
it
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
it
->
function
);
core
.
chain_limit
.
clear
();
if
(
core
.
current_chain
.
size
())
{
for
(
auto
cait
=
core
.
current_chain
.
begin
();
cait
!=
core
.
current_chain
.
end
();
++
cait
)
cait
->
triggering_effect
->
get_handler
()
->
set_status
(
STATUS_CHAINING
,
FALSE
);
...
...
@@ -2935,10 +2930,9 @@ int32 field::process_battle_command(uint16 step) {
return
TRUE
;
}
case
2
:
{
if
(
core
.
chain_limit
)
{
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
core
.
chain_limit
);
core
.
chain_limit
=
0
;
}
for
(
auto
it
=
core
.
chain_limit
.
begin
();
it
!=
core
.
chain_limit
.
end
();
++
it
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
it
->
function
);
core
.
chain_limit
.
clear
();
for
(
auto
cait
=
core
.
current_chain
.
begin
();
cait
!=
core
.
current_chain
.
end
();
++
cait
)
cait
->
triggering_effect
->
get_handler
()
->
set_status
(
STATUS_CHAINING
,
FALSE
);
add_process
(
PROCESSOR_SOLVE_CHAIN
,
0
,
0
,
0
,
FALSE
,
0
);
...
...
@@ -3628,10 +3622,9 @@ int32 field::process_battle_command(uint16 step) {
return
FALSE
;
}
case
40
:
{
if
(
core
.
chain_limit
)
{
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
core
.
chain_limit
);
core
.
chain_limit
=
0
;
}
for
(
auto
it
=
core
.
chain_limit
.
begin
();
it
!=
core
.
chain_limit
.
end
();
++
it
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
it
->
function
);
core
.
chain_limit
.
clear
();
if
(
core
.
current_chain
.
size
())
{
for
(
auto
cait
=
core
.
current_chain
.
begin
();
cait
!=
core
.
current_chain
.
end
();
++
cait
)
cait
->
triggering_effect
->
get_handler
()
->
set_status
(
STATUS_CHAINING
,
FALSE
);
...
...
@@ -4290,10 +4283,9 @@ int32 field::add_chain(uint16 step) {
pduel
->
write_buffer32
(
peffect
->
description
);
pduel
->
write_buffer8
(
core
.
current_chain
.
size
()
+
1
);
break_effect
();
if
(
core
.
chain_limit
)
{
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
core
.
chain_limit
);
core
.
chain_limit
=
0
;
}
for
(
auto
it
=
core
.
chain_limit
.
begin
();
it
!=
core
.
chain_limit
.
end
();
++
it
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
it
->
function
);
core
.
chain_limit
.
clear
();
peffect
->
card_type
=
phandler
->
get_type
();
if
((
peffect
->
card_type
&
0x5
)
==
0x5
)
peffect
->
card_type
-=
TYPE_TRAP
;
...
...
@@ -4746,10 +4738,9 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
adjust_all
();
core
.
current_chain
.
pop_back
();
if
(
!
core
.
current_chain
.
size
())
{
if
(
core
.
chain_limit
)
{
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
core
.
chain_limit
);
core
.
chain_limit
=
0
;
}
for
(
auto
it
=
core
.
chain_limit
.
begin
();
it
!=
core
.
chain_limit
.
end
();
++
it
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
it
->
function
);
core
.
chain_limit
.
clear
();
return
FALSE
;
}
core
.
units
.
begin
()
->
step
=
-
1
;
...
...
@@ -4768,10 +4759,9 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
case
12
:
{
core
.
used_event
.
splice
(
core
.
used_event
.
end
(),
core
.
point_event
);
pduel
->
write_buffer8
(
MSG_CHAIN_END
);
if
(
core
.
chain_limit_p
)
{
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
core
.
chain_limit_p
);
core
.
chain_limit_p
=
0
;
}
for
(
auto
it
=
core
.
chain_limit_p
.
begin
();
it
!=
core
.
chain_limit_p
.
end
();
++
it
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
it
->
function
);
core
.
chain_limit_p
.
clear
();
reset_chain
();
if
(
core
.
summoning_card
||
core
.
effect_damage_step
==
1
)
core
.
subunits
.
push_back
(
core
.
reserved
);
...
...
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