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
bf2339ce
Commit
bf2339ce
authored
Apr 15, 2023
by
Chrono-Genex
Committed by
GitHub
Apr 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add EFFECT_COUNT_CODE_CHAIN (#485)
parent
a42373cd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
12 deletions
+31
-12
effect.cpp
effect.cpp
+2
-2
effect.h
effect.h
+4
-2
field.cpp
field.cpp
+20
-8
field.h
field.h
+1
-0
libeffect.cpp
libeffect.cpp
+2
-0
processor.cpp
processor.cpp
+2
-0
No files found.
effect.cpp
View file @
bf2339ce
...
@@ -201,7 +201,7 @@ int32 effect::check_count_limit(uint8 playerid) {
...
@@ -201,7 +201,7 @@ int32 effect::check_count_limit(uint8 playerid) {
if
(
count_code
)
{
if
(
count_code
)
{
uint32
code
=
count_code
&
0xfffffff
;
uint32
code
=
count_code
&
0xfffffff
;
uint32
count
=
count_limit_max
;
uint32
count
=
count_limit_max
;
if
(
code
==
1
)
{
if
(
code
==
EFFECT_COUNT_CODE_SINGLE
)
{
if
(
pduel
->
game_field
->
get_effect_code
((
count_code
&
0xf0000000
)
|
get_handler
()
->
fieldid
,
PLAYER_NONE
)
>=
count
)
if
(
pduel
->
game_field
->
get_effect_code
((
count_code
&
0xf0000000
)
|
get_handler
()
->
fieldid
,
PLAYER_NONE
)
>=
count
)
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
...
@@ -666,7 +666,7 @@ void effect::dec_count(uint32 playerid) {
...
@@ -666,7 +666,7 @@ void effect::dec_count(uint32 playerid) {
count_limit
-=
1
;
count_limit
-=
1
;
if
(
count_code
)
{
if
(
count_code
)
{
uint32
code
=
count_code
&
0xfffffff
;
uint32
code
=
count_code
&
0xfffffff
;
if
(
code
==
1
)
if
(
code
==
EFFECT_COUNT_CODE_SINGLE
)
pduel
->
game_field
->
add_effect_code
((
count_code
&
0xf0000000
)
|
get_handler
()
->
fieldid
,
PLAYER_NONE
);
pduel
->
game_field
->
add_effect_code
((
count_code
&
0xf0000000
)
|
get_handler
()
->
fieldid
,
PLAYER_NONE
);
else
else
pduel
->
game_field
->
add_effect_code
(
count_code
,
playerid
);
pduel
->
game_field
->
add_effect_code
(
count_code
,
playerid
);
...
...
effect.h
View file @
bf2339ce
...
@@ -123,8 +123,10 @@ public:
...
@@ -123,8 +123,10 @@ public:
//#define EFFECT_STATUS_ACTIVATED 0x0002
//#define EFFECT_STATUS_ACTIVATED 0x0002
#define EFFECT_STATUS_SPSELF 0x0004
#define EFFECT_STATUS_SPSELF 0x0004
#define EFFECT_COUNT_CODE_OATH 0x10000000
#define EFFECT_COUNT_CODE_OATH 0x10000000
#define EFFECT_COUNT_CODE_DUEL 0x20000000
#define EFFECT_COUNT_CODE_DUEL 0x20000000
#define EFFECT_COUNT_CODE_CHAIN 0x40000000
#define EFFECT_COUNT_CODE_SINGLE 0x1
//========== Reset ==========
//========== Reset ==========
#define RESET_SELF_TURN 0x10000000
#define RESET_SELF_TURN 0x10000000
...
...
field.cpp
View file @
bf2339ce
...
@@ -1316,20 +1316,32 @@ void field::reset_chain() {
...
@@ -1316,20 +1316,32 @@ void field::reset_chain() {
}
}
}
}
void
field
::
add_effect_code
(
uint32
code
,
uint32
playerid
)
{
void
field
::
add_effect_code
(
uint32
code
,
uint32
playerid
)
{
auto
&
count_map
=
(
code
&
EFFECT_COUNT_CODE_DUEL
)
?
core
.
effect_count_code_duel
:
core
.
effect_count_code
;
auto
*
count_map
=
&
core
.
effect_count_code
;
count_map
[
code
+
(
playerid
<<
30
)]
++
;
if
(
code
&
EFFECT_COUNT_CODE_DUEL
)
count_map
=
&
core
.
effect_count_code_duel
;
else
if
(
code
&
EFFECT_COUNT_CODE_CHAIN
)
count_map
=
&
core
.
effect_count_code_chain
;
(
*
count_map
)[
code
+
(
playerid
<<
30
)]
++
;
}
}
uint32
field
::
get_effect_code
(
uint32
code
,
uint32
playerid
)
{
uint32
field
::
get_effect_code
(
uint32
code
,
uint32
playerid
)
{
auto
&
count_map
=
(
code
&
EFFECT_COUNT_CODE_DUEL
)
?
core
.
effect_count_code_duel
:
core
.
effect_count_code
;
auto
*
count_map
=
&
core
.
effect_count_code
;
auto
iter
=
count_map
.
find
(
code
+
(
playerid
<<
30
));
if
(
code
&
EFFECT_COUNT_CODE_DUEL
)
if
(
iter
==
count_map
.
end
())
count_map
=
&
core
.
effect_count_code_duel
;
else
if
(
code
&
EFFECT_COUNT_CODE_CHAIN
)
count_map
=
&
core
.
effect_count_code_chain
;
auto
iter
=
count_map
->
find
(
code
+
(
playerid
<<
30
));
if
(
iter
==
count_map
->
end
())
return
0
;
return
0
;
return
iter
->
second
;
return
iter
->
second
;
}
}
void
field
::
dec_effect_code
(
uint32
code
,
uint32
playerid
)
{
void
field
::
dec_effect_code
(
uint32
code
,
uint32
playerid
)
{
auto
&
count_map
=
(
code
&
EFFECT_COUNT_CODE_DUEL
)
?
core
.
effect_count_code_duel
:
core
.
effect_count_code
;
auto
*
count_map
=
&
core
.
effect_count_code
;
auto
iter
=
count_map
.
find
(
code
+
(
playerid
<<
30
));
if
(
code
&
EFFECT_COUNT_CODE_DUEL
)
if
(
iter
==
count_map
.
end
())
count_map
=
&
core
.
effect_count_code_duel
;
else
if
(
code
&
EFFECT_COUNT_CODE_CHAIN
)
count_map
=
&
core
.
effect_count_code_chain
;
auto
iter
=
count_map
->
find
(
code
+
(
playerid
<<
30
));
if
(
iter
==
count_map
->
end
())
return
;
return
;
if
(
iter
->
second
>
0
)
if
(
iter
->
second
>
0
)
iter
->
second
--
;
iter
->
second
--
;
...
...
field.h
View file @
bf2339ce
...
@@ -263,6 +263,7 @@ struct processor {
...
@@ -263,6 +263,7 @@ struct processor {
std
::
unordered_set
<
card
*>
unique_cards
[
2
];
std
::
unordered_set
<
card
*>
unique_cards
[
2
];
std
::
unordered_map
<
uint32
,
uint32
>
effect_count_code
;
std
::
unordered_map
<
uint32
,
uint32
>
effect_count_code
;
std
::
unordered_map
<
uint32
,
uint32
>
effect_count_code_duel
;
std
::
unordered_map
<
uint32
,
uint32
>
effect_count_code_duel
;
std
::
unordered_map
<
uint32
,
uint32
>
effect_count_code_chain
;
std
::
unordered_map
<
uint32
,
uint32
>
spsummon_once_map
[
2
];
std
::
unordered_map
<
uint32
,
uint32
>
spsummon_once_map
[
2
];
std
::
multimap
<
int32
,
card
*
,
std
::
greater
<
int32
>>
xmaterial_lst
;
std
::
multimap
<
int32
,
card
*
,
std
::
greater
<
int32
>>
xmaterial_lst
;
...
...
libeffect.cpp
View file @
bf2339ce
...
@@ -120,6 +120,8 @@ int32 scriptlib::effect_set_count_limit(lua_State *L) {
...
@@ -120,6 +120,8 @@ int32 scriptlib::effect_set_count_limit(lua_State *L) {
code
=
(
uint32
)
lua_tointeger
(
L
,
3
);
code
=
(
uint32
)
lua_tointeger
(
L
,
3
);
if
(
v
==
0
)
if
(
v
==
0
)
v
=
1
;
v
=
1
;
if
(
code
==
EFFECT_COUNT_CODE_CHAIN
)
code
=
EFFECT_COUNT_CODE_CHAIN
+
EFFECT_COUNT_CODE_SINGLE
;
peffect
->
flag
[
0
]
|=
EFFECT_FLAG_COUNT_LIMIT
;
peffect
->
flag
[
0
]
|=
EFFECT_FLAG_COUNT_LIMIT
;
peffect
->
count_limit
=
v
;
peffect
->
count_limit
=
v
;
peffect
->
count_limit_max
=
v
;
peffect
->
count_limit_max
=
v
;
...
...
processor.cpp
View file @
bf2339ce
...
@@ -1492,6 +1492,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
...
@@ -1492,6 +1492,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
for
(
auto
&
ch_lim_p
:
core
.
chain_limit_p
)
for
(
auto
&
ch_lim_p
:
core
.
chain_limit_p
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
ch_lim_p
.
function
);
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
ch_lim_p
.
function
);
core
.
chain_limit_p
.
clear
();
core
.
chain_limit_p
.
clear
();
core
.
effect_count_code_chain
.
clear
();
reset_chain
();
reset_chain
();
returns
.
ivalue
[
0
]
=
FALSE
;
returns
.
ivalue
[
0
]
=
FALSE
;
}
}
...
@@ -4485,6 +4486,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
...
@@ -4485,6 +4486,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
for
(
auto
&
ch_lim_p
:
core
.
chain_limit_p
)
for
(
auto
&
ch_lim_p
:
core
.
chain_limit_p
)
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
ch_lim_p
.
function
);
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
ch_lim_p
.
function
);
core
.
chain_limit_p
.
clear
();
core
.
chain_limit_p
.
clear
();
core
.
effect_count_code_chain
.
clear
();
reset_chain
();
reset_chain
();
if
(
core
.
summoning_card
||
core
.
effect_damage_step
==
1
)
if
(
core
.
summoning_card
||
core
.
effect_damage_step
==
1
)
core
.
subunits
.
push_back
(
core
.
reserved
);
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