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
0631e6b0
Commit
0631e6b0
authored
Jun 20, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch-select-chain-forced' of github.com:mercury233/ygopro-core into develop
parents
3e2bd68e
66500bcc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
18 deletions
+35
-18
field.h
field.h
+2
-2
playerop.cpp
playerop.cpp
+13
-9
processor.cpp
processor.cpp
+20
-7
No files found.
field.h
View file @
0631e6b0
...
...
@@ -631,7 +631,7 @@ public:
int32_t
select_option
(
uint16_t
step
,
uint8_t
playerid
);
int32_t
select_card
(
uint16_t
step
,
uint8_t
playerid
,
uint8_t
cancelable
,
uint8_t
min
,
uint8_t
max
);
int32_t
select_unselect_card
(
uint16_t
step
,
uint8_t
playerid
,
uint8_t
cancelable
,
uint8_t
min
,
uint8_t
max
,
uint8_t
finishable
);
int32_t
select_chain
(
uint16_t
step
,
uint8_t
playerid
,
uint8_t
spe_count
,
uint8_t
forced
);
int32_t
select_chain
(
uint16_t
step
,
uint8_t
playerid
,
uint8_t
spe_count
);
int32_t
select_place
(
uint16_t
step
,
uint8_t
playerid
,
uint32_t
flag
,
uint8_t
count
);
int32_t
select_position
(
uint16_t
step
,
uint8_t
playerid
,
uint32_t
code
,
uint8_t
positions
);
int32_t
select_tribute
(
uint16_t
step
,
uint8_t
playerid
,
uint8_t
cancelable
,
uint8_t
min
,
uint8_t
max
);
...
...
@@ -654,7 +654,7 @@ public:
#define CHAIN_CONTINUOUS_CARD 0x08
#define CHAIN_ACTIVATING 0x10
#define CHAIN_HAND_TRIGGER 0x20
//#define CHAIN_DECK_EFFECT
0x40
#define CHAIN_FORCED
0x40
#define CHAININFO_CHAIN_COUNT 0x01
#define CHAININFO_TRIGGERING_EFFECT 0x02
#define CHAININFO_TRIGGERING_PLAYER 0x04
...
...
playerop.cpp
View file @
0631e6b0
...
...
@@ -330,14 +330,12 @@ int32_t field::select_unselect_card(uint16_t step, uint8_t playerid, uint8_t can
return
TRUE
;
}
}
int32_t
field
::
select_chain
(
uint16_t
step
,
uint8_t
playerid
,
uint8_t
spe_count
,
uint8_t
forced
)
{
int32_t
field
::
select_chain
(
uint16_t
step
,
uint8_t
playerid
,
uint8_t
spe_count
)
{
if
(
step
==
0
)
{
returns
.
ivalue
[
0
]
=
-
1
;
if
((
playerid
==
1
)
&&
(
core
.
duel_options
&
DUEL_SIMPLE_AI
))
{
if
(
core
.
select_chains
.
size
()
==
0
)
returns
.
ivalue
[
0
]
=
-
1
;
else
if
(
forced
)
returns
.
ivalue
[
0
]
=
0
;
else
{
bool
act
=
true
;
for
(
const
auto
&
ch
:
core
.
current_chain
)
...
...
@@ -354,7 +352,6 @@ int32_t field::select_chain(uint16_t step, uint8_t playerid, uint8_t spe_count,
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_chains
.
size
());
pduel
->
write_buffer8
(
spe_count
);
pduel
->
write_buffer8
(
forced
);
pduel
->
write_buffer32
(
pduel
->
game_field
->
core
.
hint_timing
[
playerid
]);
pduel
->
write_buffer32
(
pduel
->
game_field
->
core
.
hint_timing
[
1
-
playerid
]);
std
::
sort
(
core
.
select_chains
.
begin
(),
core
.
select_chains
.
end
(),
chain
::
chain_operation_sort
);
...
...
@@ -367,17 +364,24 @@ int32_t field::select_chain(uint16_t step, uint8_t playerid, uint8_t spe_count,
pduel
->
write_buffer8
(
EDESC_RESET
);
else
pduel
->
write_buffer8
(
0
);
if
(
ch
.
flag
&
CHAIN_FORCED
)
pduel
->
write_buffer8
(
1
);
else
pduel
->
write_buffer8
(
0
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
pduel
->
write_buffer32
(
peffect
->
description
);
}
return
FALSE
;
}
else
{
if
(
returns
.
ivalue
[
0
]
==
-
1
)
{
if
(
!
forced
)
return
TRUE
;
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
if
(
returns
.
ivalue
[
0
]
==
-
1
)
{
for
(
const
auto
&
ch
:
core
.
select_chains
)
{
if
(
ch
.
flag
&
CHAIN_FORCED
)
{
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
}
}
return
TRUE
;
}
if
(
returns
.
ivalue
[
0
]
<
0
||
returns
.
ivalue
[
0
]
>=
(
int32_t
)
core
.
select_chains
.
size
())
{
pduel
->
write_buffer8
(
MSG_RETRY
);
...
...
processor.cpp
View file @
0631e6b0
...
...
@@ -129,7 +129,7 @@ uint32_t field::process() {
}
}
case
PROCESSOR_SELECT_CHAIN
:
{
if
(
select_chain
(
it
->
step
,
it
->
arg1
,
(
it
->
arg2
&
0xffff
),
it
->
arg2
>>
16
))
{
if
(
select_chain
(
it
->
step
,
it
->
arg1
,
it
->
arg2
&
0xffff
))
{
core
.
units
.
pop_front
();
return
pduel
->
buffer_size
();
}
else
{
...
...
@@ -1008,7 +1008,6 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
int32_t
check_player
=
infos
.
turn_player
;
if
(
core
.
units
.
begin
()
->
arg2
&
0x2
)
check_player
=
1
-
infos
.
turn_player
;
chain
newchain
;
core
.
select_chains
.
clear
();
int32_t
tf_count
=
0
,
to_count
=
0
,
fc_count
=
0
,
cn_count
=
0
;
auto
pr
=
effects
.
trigger_f_effect
.
equal_range
(
phase_event
);
...
...
@@ -1019,7 +1018,9 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
if
(
!
peffect
->
is_activateable
(
check_player
,
test_event
))
continue
;
peffect
->
id
=
infos
.
field_id
++
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
flag
|=
CHAIN_FORCED
;
core
.
select_chains
.
push_back
(
newchain
);
++
tf_count
;
}
...
...
@@ -1031,7 +1032,9 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
if
(
peffect
->
get_handler_player
()
!=
check_player
||
!
peffect
->
is_activateable
(
check_player
,
test_event
))
continue
;
peffect
->
id
=
infos
.
field_id
++
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
flag
|=
CHAIN_FORCED
;
core
.
select_chains
.
push_back
(
newchain
);
++
cn_count
;
}
...
...
@@ -1052,7 +1055,9 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
card
*
phandler
=
peffect
->
get_handler
();
if
(
peffect
->
get_value
(
phandler
)
!=
phandler
->
current
.
controler
)
continue
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
flag
|=
CHAIN_FORCED
;
core
.
select_chains
.
push_back
(
newchain
);
++
cn_count
;
}
...
...
@@ -1066,6 +1071,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
if
(
!
peffect
->
is_activateable
(
check_player
,
test_event
))
continue
;
peffect
->
id
=
infos
.
field_id
++
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
core
.
select_chains
.
push_back
(
newchain
);
++
to_count
;
...
...
@@ -1089,6 +1095,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
if
(
!
peffect
->
is_chainable
(
check_player
)
||
!
peffect
->
is_activateable
(
check_player
,
test_event
))
continue
;
peffect
->
id
=
infos
.
field_id
++
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
if
(
check_hint_timing
(
peffect
)
||
check_cteffect_hint
(
peffect
,
check_player
))
++
core
.
spe_effect
[
check_player
];
...
...
@@ -1103,6 +1110,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
if
(
!
peffect
->
is_chainable
(
check_player
)
||
!
peffect
->
is_activateable
(
check_player
,
test_event
))
continue
;
peffect
->
id
=
infos
.
field_id
++
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
if
(
check_hint_timing
(
peffect
))
++
core
.
spe_effect
[
check_player
];
...
...
@@ -1116,6 +1124,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
if
(
peffect
->
get_handler_player
()
!=
check_player
||
!
peffect
->
is_activateable
(
check_player
,
test_event
))
continue
;
peffect
->
id
=
infos
.
field_id
++
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
core
.
select_chains
.
push_back
(
newchain
);
++
fc_count
;
...
...
@@ -1147,7 +1156,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
add_process
(
PROCESSOR_SELECT_EFFECTYN
,
0
,
0
,
(
group
*
)
core
.
select_chains
[
0
].
triggering_effect
->
get_handler
(),
check_player
,
0
);
return
FALSE
;
}
else
{
add_process
(
PROCESSOR_SELECT_CHAIN
,
0
,
0
,
0
,
check_player
,
core
.
spe_effect
[
check_player
]
|
(
tf_count
+
cn_count
?
0x10000
:
0
)
);
add_process
(
PROCESSOR_SELECT_CHAIN
,
0
,
0
,
0
,
check_player
,
core
.
spe_effect
[
check_player
]);
core
.
units
.
begin
()
->
step
=
1
;
return
FALSE
;
}
...
...
@@ -1316,8 +1325,10 @@ int32_t field::process_point_event(int16_t step, int32_t skip_trigger, int32_t s
uint8_t
tp
=
clit
->
triggering_player
;
if
(
check_trigger_effect
(
*
clit
)
&&
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
!
peffect
->
is_flag
(
EFFECT_FLAG_ACTIVATE_CONDITION
)))
{
if
(
tp
==
core
.
current_player
)
if
(
tp
==
core
.
current_player
)
{
clit
->
flag
|=
CHAIN_FORCED
;
core
.
select_chains
.
push_back
(
*
clit
);
}
}
else
{
peffect
->
active_type
=
0
;
clit
=
core
.
new_fchain_s
.
erase
(
clit
);
...
...
@@ -1330,7 +1341,7 @@ int32_t field::process_point_event(int16_t step, int32_t skip_trigger, int32_t s
}
else
if
(
core
.
select_chains
.
size
()
==
1
)
{
returns
.
ivalue
[
0
]
=
0
;
}
else
{
add_process
(
PROCESSOR_SELECT_CHAIN
,
0
,
0
,
0
,
core
.
current_player
,
0x7f
|
0x10000
);
add_process
(
PROCESSOR_SELECT_CHAIN
,
0
,
0
,
0
,
core
.
current_player
,
0x7f
);
}
return
FALSE
;
}
...
...
@@ -1594,8 +1605,10 @@ int32_t field::process_quick_effect(int16_t step, int32_t skip_freechain, uint8_
card
*
phandler
=
peffect
->
get_handler
();
if
(
peffect
->
is_chainable
(
ifit
->
second
.
triggering_player
)
&&
peffect
->
check_count_limit
(
ifit
->
second
.
triggering_player
)
&&
phandler
->
is_has_relation
(
ifit
->
second
))
{
if
(
ifit
->
second
.
triggering_player
==
check_player
)
if
(
ifit
->
second
.
triggering_player
==
check_player
)
{
ifit
->
second
.
flag
|=
CHAIN_FORCED
;
core
.
select_chains
.
push_back
(
ifit
->
second
);
}
}
else
{
ifit
=
core
.
quick_f_chain
.
erase
(
ifit
);
continue
;
...
...
@@ -1607,7 +1620,7 @@ int32_t field::process_quick_effect(int16_t step, int32_t skip_freechain, uint8_
else
if
(
core
.
select_chains
.
size
()
==
1
)
returns
.
ivalue
[
0
]
=
0
;
else
add_process
(
PROCESSOR_SELECT_CHAIN
,
0
,
0
,
0
,
check_player
,
0
x10000
);
add_process
(
PROCESSOR_SELECT_CHAIN
,
0
,
0
,
0
,
check_player
,
0
);
return
FALSE
;
}
case
1
:
{
...
...
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