Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
fallenstardust
YGOMobile
Commits
2e7bd145
Commit
2e7bd145
authored
Jun 29, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
4ebd4cf4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
36 deletions
+69
-36
Classes/ocgcore/field.cpp
Classes/ocgcore/field.cpp
+19
-8
Classes/ocgcore/field.h
Classes/ocgcore/field.h
+3
-2
Classes/ocgcore/libduel.cpp
Classes/ocgcore/libduel.cpp
+4
-0
Classes/ocgcore/mtrandom.h
Classes/ocgcore/mtrandom.h
+1
-1
Classes/ocgcore/operations.cpp
Classes/ocgcore/operations.cpp
+2
-0
Classes/ocgcore/playerop.cpp
Classes/ocgcore/playerop.cpp
+20
-18
Classes/ocgcore/processor.cpp
Classes/ocgcore/processor.cpp
+20
-7
No files found.
Classes/ocgcore/field.cpp
View file @
2e7bd145
...
@@ -2887,12 +2887,20 @@ int32_t field::check_tribute(card* pcard, int32_t min, int32_t max, group* mg, u
...
@@ -2887,12 +2887,20 @@ int32_t field::check_tribute(card* pcard, int32_t min, int32_t max, group* mg, u
return
FALSE
;
return
FALSE
;
return
TRUE
;
return
TRUE
;
}
}
void
field
::
get_sum_params
(
uint32_t
sum_param
,
int32_t
&
op1
,
int32_t
&
op2
)
{
op1
=
sum_param
&
0xffff
;
op2
=
(
sum_param
>>
16
)
&
0xffff
;
if
(
op2
&
0x8000
)
{
op1
=
sum_param
&
0x7fffffff
;
op2
=
0
;
}
}
int32_t
field
::
check_with_sum_limit
(
const
card_vector
&
mats
,
int32_t
acc
,
int32_t
index
,
int32_t
count
,
int32_t
min
,
int32_t
max
,
int32_t
opmin
)
{
int32_t
field
::
check_with_sum_limit
(
const
card_vector
&
mats
,
int32_t
acc
,
int32_t
index
,
int32_t
count
,
int32_t
min
,
int32_t
max
,
int32_t
opmin
)
{
if
(
count
>
max
)
if
(
count
>
max
)
return
FALSE
;
return
FALSE
;
while
(
index
<
(
int32_t
)
mats
.
size
())
{
while
(
index
<
(
int32_t
)
mats
.
size
())
{
int32_t
op1
=
mats
[
index
]
->
sum_param
&
0xffff
;
int32_t
op1
,
op2
;
int32_t
op2
=
(
mats
[
index
]
->
sum_param
>>
16
)
&
0xffff
;
get_sum_params
(
mats
[
index
]
->
sum_param
,
op1
,
op2
)
;
if
(((
op1
==
acc
&&
acc
+
opmin
>
op1
)
||
(
op2
&&
op2
==
acc
&&
acc
+
opmin
>
op2
))
&&
count
>=
min
)
if
(((
op1
==
acc
&&
acc
+
opmin
>
op1
)
||
(
op2
&&
op2
==
acc
&&
acc
+
opmin
>
op2
))
&&
count
>=
min
)
return
TRUE
;
return
TRUE
;
++
index
;
++
index
;
...
@@ -2910,8 +2918,9 @@ int32_t field::check_with_sum_limit_m(const card_vector& mats, int32_t acc, int3
...
@@ -2910,8 +2918,9 @@ int32_t field::check_with_sum_limit_m(const card_vector& mats, int32_t acc, int3
return
check_with_sum_limit
(
mats
,
acc
,
index
,
1
,
min
,
max
,
opmin
);
return
check_with_sum_limit
(
mats
,
acc
,
index
,
1
,
min
,
max
,
opmin
);
if
(
index
>=
(
int32_t
)
mats
.
size
())
if
(
index
>=
(
int32_t
)
mats
.
size
())
return
FALSE
;
return
FALSE
;
int32_t
op1
=
mats
[
index
]
->
sum_param
&
0xffff
;
int32_t
op1
;
int32_t
op2
=
(
mats
[
index
]
->
sum_param
>>
16
)
&
0xffff
;
int32_t
op2
;
get_sum_params
(
mats
[
index
]
->
sum_param
,
op1
,
op2
);
if
(
acc
>=
op1
&&
check_with_sum_limit_m
(
mats
,
acc
-
op1
,
index
+
1
,
min
,
max
,
std
::
min
(
opmin
,
op1
),
must_count
))
if
(
acc
>=
op1
&&
check_with_sum_limit_m
(
mats
,
acc
-
op1
,
index
+
1
,
min
,
max
,
std
::
min
(
opmin
,
op1
),
must_count
))
return
TRUE
;
return
TRUE
;
if
(
op2
&&
acc
>=
op2
&&
check_with_sum_limit_m
(
mats
,
acc
-
op2
,
index
+
1
,
min
,
max
,
std
::
min
(
opmin
,
op2
),
must_count
))
if
(
op2
&&
acc
>=
op2
&&
check_with_sum_limit_m
(
mats
,
acc
-
op2
,
index
+
1
,
min
,
max
,
std
::
min
(
opmin
,
op2
),
must_count
))
...
@@ -2920,8 +2929,9 @@ int32_t field::check_with_sum_limit_m(const card_vector& mats, int32_t acc, int3
...
@@ -2920,8 +2929,9 @@ int32_t field::check_with_sum_limit_m(const card_vector& mats, int32_t acc, int3
}
}
int32_t
field
::
check_with_sum_greater_limit
(
const
card_vector
&
mats
,
int32_t
acc
,
int32_t
index
,
int32_t
opmin
)
{
int32_t
field
::
check_with_sum_greater_limit
(
const
card_vector
&
mats
,
int32_t
acc
,
int32_t
index
,
int32_t
opmin
)
{
while
(
index
<
(
int32_t
)
mats
.
size
())
{
while
(
index
<
(
int32_t
)
mats
.
size
())
{
int32_t
op1
=
mats
[
index
]
->
sum_param
&
0xffff
;
int32_t
op1
;
int32_t
op2
=
(
mats
[
index
]
->
sum_param
>>
16
)
&
0xffff
;
int32_t
op2
;
get_sum_params
(
mats
[
index
]
->
sum_param
,
op1
,
op2
);
if
((
acc
<=
op1
&&
acc
+
opmin
>
op1
)
||
(
op2
&&
acc
<=
op2
&&
acc
+
opmin
>
op2
))
if
((
acc
<=
op1
&&
acc
+
opmin
>
op1
)
||
(
op2
&&
acc
<=
op2
&&
acc
+
opmin
>
op2
))
return
TRUE
;
return
TRUE
;
++
index
;
++
index
;
...
@@ -2939,8 +2949,9 @@ int32_t field::check_with_sum_greater_limit_m(const card_vector& mats, int32_t a
...
@@ -2939,8 +2949,9 @@ int32_t field::check_with_sum_greater_limit_m(const card_vector& mats, int32_t a
return
check_with_sum_greater_limit
(
mats
,
acc
,
index
,
opmin
);
return
check_with_sum_greater_limit
(
mats
,
acc
,
index
,
opmin
);
if
(
index
>=
(
int32_t
)
mats
.
size
())
if
(
index
>=
(
int32_t
)
mats
.
size
())
return
FALSE
;
return
FALSE
;
int32_t
op1
=
mats
[
index
]
->
sum_param
&
0xffff
;
int32_t
op1
;
int32_t
op2
=
(
mats
[
index
]
->
sum_param
>>
16
)
&
0xffff
;
int32_t
op2
;
get_sum_params
(
mats
[
index
]
->
sum_param
,
op1
,
op2
);
if
(
check_with_sum_greater_limit_m
(
mats
,
acc
-
op1
,
index
+
1
,
std
::
min
(
opmin
,
op1
),
must_count
))
if
(
check_with_sum_greater_limit_m
(
mats
,
acc
-
op1
,
index
+
1
,
std
::
min
(
opmin
,
op1
),
must_count
))
return
TRUE
;
return
TRUE
;
if
(
op2
&&
check_with_sum_greater_limit_m
(
mats
,
acc
-
op2
,
index
+
1
,
std
::
min
(
opmin
,
op2
),
must_count
))
if
(
op2
&&
check_with_sum_greater_limit_m
(
mats
,
acc
-
op2
,
index
+
1
,
std
::
min
(
opmin
,
op2
),
must_count
))
...
...
Classes/ocgcore/field.h
View file @
2e7bd145
...
@@ -474,6 +474,7 @@ public:
...
@@ -474,6 +474,7 @@ public:
int32_t
check_tuner_material
(
lua_State
*
L
,
card
*
pcard
,
card
*
tuner
,
int32_t
findex1
,
int32_t
findex2
,
int32_t
min
,
int32_t
max
,
card
*
smat
,
group
*
mg
);
int32_t
check_tuner_material
(
lua_State
*
L
,
card
*
pcard
,
card
*
tuner
,
int32_t
findex1
,
int32_t
findex2
,
int32_t
min
,
int32_t
max
,
card
*
smat
,
group
*
mg
);
int32_t
check_other_synchro_material
(
const
card_vector
&
nsyn
,
int32_t
lv
,
int32_t
min
,
int32_t
max
,
int32_t
mcount
);
int32_t
check_other_synchro_material
(
const
card_vector
&
nsyn
,
int32_t
lv
,
int32_t
min
,
int32_t
max
,
int32_t
mcount
);
int32_t
check_tribute
(
card
*
pcard
,
int32_t
min
,
int32_t
max
,
group
*
mg
,
uint8_t
toplayer
,
uint32_t
zone
=
0x1f
,
uint32_t
releasable
=
0xff00ff
,
uint32_t
pos
=
0x1
);
int32_t
check_tribute
(
card
*
pcard
,
int32_t
min
,
int32_t
max
,
group
*
mg
,
uint8_t
toplayer
,
uint32_t
zone
=
0x1f
,
uint32_t
releasable
=
0xff00ff
,
uint32_t
pos
=
0x1
);
static
void
get_sum_params
(
uint32_t
sum_param
,
int32_t
&
op1
,
int32_t
&
op2
);
static
int32_t
check_with_sum_limit
(
const
card_vector
&
mats
,
int32_t
acc
,
int32_t
index
,
int32_t
count
,
int32_t
min
,
int32_t
max
,
int32_t
opmin
);
static
int32_t
check_with_sum_limit
(
const
card_vector
&
mats
,
int32_t
acc
,
int32_t
index
,
int32_t
count
,
int32_t
min
,
int32_t
max
,
int32_t
opmin
);
static
int32_t
check_with_sum_limit_m
(
const
card_vector
&
mats
,
int32_t
acc
,
int32_t
index
,
int32_t
min
,
int32_t
max
,
int32_t
opmin
,
int32_t
must_count
);
static
int32_t
check_with_sum_limit_m
(
const
card_vector
&
mats
,
int32_t
acc
,
int32_t
index
,
int32_t
min
,
int32_t
max
,
int32_t
opmin
,
int32_t
must_count
);
static
int32_t
check_with_sum_greater_limit
(
const
card_vector
&
mats
,
int32_t
acc
,
int32_t
index
,
int32_t
opmin
);
static
int32_t
check_with_sum_greater_limit
(
const
card_vector
&
mats
,
int32_t
acc
,
int32_t
index
,
int32_t
opmin
);
...
@@ -630,7 +631,7 @@ public:
...
@@ -630,7 +631,7 @@ public:
int32_t
select_option
(
uint16_t
step
,
uint8_t
playerid
);
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_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_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_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_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
);
int32_t
select_tribute
(
uint16_t
step
,
uint8_t
playerid
,
uint8_t
cancelable
,
uint8_t
min
,
uint8_t
max
);
...
@@ -653,7 +654,7 @@ public:
...
@@ -653,7 +654,7 @@ public:
#define CHAIN_CONTINUOUS_CARD 0x08
#define CHAIN_CONTINUOUS_CARD 0x08
#define CHAIN_ACTIVATING 0x10
#define CHAIN_ACTIVATING 0x10
#define CHAIN_HAND_TRIGGER 0x20
#define CHAIN_HAND_TRIGGER 0x20
//#define CHAIN_DECK_EFFECT
0x40
#define CHAIN_FORCED
0x40
#define CHAININFO_CHAIN_COUNT 0x01
#define CHAININFO_CHAIN_COUNT 0x01
#define CHAININFO_TRIGGERING_EFFECT 0x02
#define CHAININFO_TRIGGERING_EFFECT 0x02
#define CHAININFO_TRIGGERING_PLAYER 0x04
#define CHAININFO_TRIGGERING_PLAYER 0x04
...
...
Classes/ocgcore/libduel.cpp
View file @
2e7bd145
...
@@ -1070,8 +1070,12 @@ int32_t scriptlib::duel_confirm_cards(lua_State *L) {
...
@@ -1070,8 +1070,12 @@ int32_t scriptlib::duel_confirm_cards(lua_State *L) {
pduel
=
pgroup
->
pduel
;
pduel
=
pgroup
->
pduel
;
}
else
}
else
return
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
2
);
return
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
2
);
uint8_t
skip_panel
=
0
;
if
(
lua_gettop
(
L
)
>=
3
)
skip_panel
=
lua_toboolean
(
L
,
3
);
pduel
->
write_buffer8
(
MSG_CONFIRM_CARDS
);
pduel
->
write_buffer8
(
MSG_CONFIRM_CARDS
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
skip_panel
);
if
(
pcard
)
{
if
(
pcard
)
{
pduel
->
write_buffer8
(
1
);
pduel
->
write_buffer8
(
1
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
...
...
Classes/ocgcore/mtrandom.h
View file @
2e7bd145
...
@@ -77,7 +77,7 @@ public:
...
@@ -77,7 +77,7 @@ public:
template
<
typename
T
>
template
<
typename
T
>
void
shuffle_vector
(
std
::
vector
<
T
>&
v
,
int
first
=
0
,
int
last
=
INT32_MAX
,
int
version
=
2
)
{
void
shuffle_vector
(
std
::
vector
<
T
>&
v
,
int
first
=
0
,
int
last
=
INT32_MAX
,
int
version
=
2
)
{
if
((
size_t
)
last
>
v
.
size
())
if
((
size_t
)
last
>
v
.
size
())
last
=
v
.
size
();
last
=
(
int
)
v
.
size
();
auto
distribution
=
&
mtrandom
::
get_random_integer_v2
;
auto
distribution
=
&
mtrandom
::
get_random_integer_v2
;
if
(
version
==
1
)
if
(
version
==
1
)
distribution
=
&
mtrandom
::
get_random_integer_v1
;
distribution
=
&
mtrandom
::
get_random_integer_v1
;
...
...
Classes/ocgcore/operations.cpp
View file @
2e7bd145
...
@@ -406,6 +406,7 @@ int32_t field::draw(uint16_t step, effect* reason_effect, uint32_t reason, uint8
...
@@ -406,6 +406,7 @@ int32_t field::draw(uint16_t step, effect* reason_effect, uint32_t reason, uint8
if
(
core
.
deck_reversed
&&
(
public_count
<
cv
.
size
()))
{
if
(
core
.
deck_reversed
&&
(
public_count
<
cv
.
size
()))
{
pduel
->
write_buffer8
(
MSG_CONFIRM_CARDS
);
pduel
->
write_buffer8
(
MSG_CONFIRM_CARDS
);
pduel
->
write_buffer8
(
1
-
playerid
);
pduel
->
write_buffer8
(
1
-
playerid
);
pduel
->
write_buffer8
(
0
);
pduel
->
write_buffer8
((
uint8_t
)
drawed_set
->
size
());
pduel
->
write_buffer8
((
uint8_t
)
drawed_set
->
size
());
for
(
auto
&
pcard
:
*
drawed_set
)
{
for
(
auto
&
pcard
:
*
drawed_set
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
...
@@ -2632,6 +2633,7 @@ int32_t field::sset_g(uint16_t step, uint8_t setplayer, uint8_t toplayer, group*
...
@@ -2632,6 +2633,7 @@ int32_t field::sset_g(uint16_t step, uint8_t setplayer, uint8_t toplayer, group*
if
(
confirm
)
{
if
(
confirm
)
{
pduel
->
write_buffer8
(
MSG_CONFIRM_CARDS
);
pduel
->
write_buffer8
(
MSG_CONFIRM_CARDS
);
pduel
->
write_buffer8
(
toplayer
);
pduel
->
write_buffer8
(
toplayer
);
pduel
->
write_buffer8
(
0
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
set_group_set
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
set_group_set
.
size
());
for
(
auto
&
pcard
:
core
.
set_group_set
)
{
for
(
auto
&
pcard
:
core
.
set_group_set
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
...
...
Classes/ocgcore/playerop.cpp
View file @
2e7bd145
...
@@ -330,14 +330,12 @@ int32_t field::select_unselect_card(uint16_t step, uint8_t playerid, uint8_t can
...
@@ -330,14 +330,12 @@ int32_t field::select_unselect_card(uint16_t step, uint8_t playerid, uint8_t can
return
TRUE
;
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
)
{
if
(
step
==
0
)
{
returns
.
ivalue
[
0
]
=
-
1
;
returns
.
ivalue
[
0
]
=
-
1
;
if
((
playerid
==
1
)
&&
(
core
.
duel_options
&
DUEL_SIMPLE_AI
))
{
if
((
playerid
==
1
)
&&
(
core
.
duel_options
&
DUEL_SIMPLE_AI
))
{
if
(
core
.
select_chains
.
size
()
==
0
)
if
(
core
.
select_chains
.
size
()
==
0
)
returns
.
ivalue
[
0
]
=
-
1
;
returns
.
ivalue
[
0
]
=
-
1
;
else
if
(
forced
)
returns
.
ivalue
[
0
]
=
0
;
else
{
else
{
bool
act
=
true
;
bool
act
=
true
;
for
(
const
auto
&
ch
:
core
.
current_chain
)
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,
...
@@ -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
(
playerid
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_chains
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_chains
.
size
());
pduel
->
write_buffer8
(
spe_count
);
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
[
playerid
]);
pduel
->
write_buffer32
(
pduel
->
game_field
->
core
.
hint_timing
[
1
-
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
);
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,
...
@@ -367,17 +364,24 @@ int32_t field::select_chain(uint16_t step, uint8_t playerid, uint8_t spe_count,
pduel
->
write_buffer8
(
EDESC_RESET
);
pduel
->
write_buffer8
(
EDESC_RESET
);
else
else
pduel
->
write_buffer8
(
0
);
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
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
pduel
->
write_buffer32
(
peffect
->
description
);
pduel
->
write_buffer32
(
peffect
->
description
);
}
}
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
if
(
returns
.
ivalue
[
0
]
==
-
1
)
{
if
(
returns
.
ivalue
[
0
]
==
-
1
)
{
if
(
!
forced
)
for
(
const
auto
&
ch
:
core
.
select_chains
)
{
return
TRUE
;
if
(
ch
.
flag
&
CHAIN_FORCED
)
{
pduel
->
write_buffer8
(
MSG_RETRY
);
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
return
FALSE
;
}
}
return
TRUE
;
}
}
if
(
returns
.
ivalue
[
0
]
<
0
||
returns
.
ivalue
[
0
]
>=
(
int32_t
)
core
.
select_chains
.
size
())
{
if
(
returns
.
ivalue
[
0
]
<
0
||
returns
.
ivalue
[
0
]
>=
(
int32_t
)
core
.
select_chains
.
size
())
{
pduel
->
write_buffer8
(
MSG_RETRY
);
pduel
->
write_buffer8
(
MSG_RETRY
);
...
@@ -633,8 +637,8 @@ int32_t field::select_counter(uint16_t step, uint8_t playerid, uint16_t countert
...
@@ -633,8 +637,8 @@ int32_t field::select_counter(uint16_t step, uint8_t playerid, uint16_t countert
static
int32_t
select_sum_check1
(
const
uint32_t
*
oparam
,
int32_t
size
,
int32_t
index
,
int32_t
acc
,
int32_t
opmin
)
{
static
int32_t
select_sum_check1
(
const
uint32_t
*
oparam
,
int32_t
size
,
int32_t
index
,
int32_t
acc
,
int32_t
opmin
)
{
if
(
acc
==
0
||
index
==
size
)
if
(
acc
==
0
||
index
==
size
)
return
FALSE
;
return
FALSE
;
int32_t
o1
=
oparam
[
index
]
&
0xffff
;
int32_t
o1
,
o2
;
int32_t
o2
=
oparam
[
index
]
>>
16
;
field
::
get_sum_params
(
oparam
[
index
],
o1
,
o2
)
;
if
(
index
==
size
-
1
)
if
(
index
==
size
-
1
)
return
(
acc
==
o1
&&
acc
+
opmin
>
o1
)
||
(
o2
&&
acc
==
o2
&&
acc
+
opmin
>
o2
);
return
(
acc
==
o1
&&
acc
+
opmin
>
o1
)
||
(
o2
&&
acc
==
o2
&&
acc
+
opmin
>
o2
);
return
(
acc
>
o1
&&
select_sum_check1
(
oparam
,
size
,
index
+
1
,
acc
-
o1
,
std
::
min
(
o1
,
opmin
)))
return
(
acc
>
o1
&&
select_sum_check1
(
oparam
,
size
,
index
+
1
,
acc
-
o1
,
std
::
min
(
o1
,
opmin
)))
...
@@ -659,7 +663,7 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
...
@@ -659,7 +663,7 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
if
(
max
<
min
)
if
(
max
<
min
)
max
=
min
;
max
=
min
;
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer32
(
(
uint32_t
)
acc
&
0xffff
);
pduel
->
write_buffer32
(
acc
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
must_select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
must_select_cards
.
size
());
...
@@ -711,9 +715,8 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
...
@@ -711,9 +715,8 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
}
else
{
}
else
{
int32_t
sum
=
0
,
mx
=
0
,
mn
=
0x7fffffff
;
int32_t
sum
=
0
,
mx
=
0
,
mn
=
0x7fffffff
;
for
(
int32_t
i
=
0
;
i
<
mcount
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
mcount
;
++
i
)
{
uint32_t
op
=
core
.
must_select_cards
[
i
]
->
sum_param
;
int32_t
o1
,
o2
;
int32_t
o1
=
op
&
0xffff
;
field
::
get_sum_params
(
core
.
must_select_cards
[
i
]
->
sum_param
,
o1
,
o2
);
int32_t
o2
=
op
>>
16
;
int32_t
ms
=
(
o2
&&
o2
<
o1
)
?
o2
:
o1
;
int32_t
ms
=
(
o2
&&
o2
<
o1
)
?
o2
:
o1
;
sum
+=
ms
;
sum
+=
ms
;
mx
+=
std
::
max
(
o1
,
o2
);
mx
+=
std
::
max
(
o1
,
o2
);
...
@@ -728,9 +731,8 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
...
@@ -728,9 +731,8 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
return
FALSE
;
return
FALSE
;
}
}
c
.
insert
(
v
);
c
.
insert
(
v
);
uint32_t
op
=
core
.
select_cards
[
v
]
->
sum_param
;
int32_t
o1
,
o2
;
int32_t
o1
=
op
&
0xffff
;
field
::
get_sum_params
(
core
.
select_cards
[
v
]
->
sum_param
,
o1
,
o2
);
int32_t
o2
=
op
>>
16
;
int32_t
ms
=
(
o2
&&
o2
<
o1
)
?
o2
:
o1
;
int32_t
ms
=
(
o2
&&
o2
<
o1
)
?
o2
:
o1
;
sum
+=
ms
;
sum
+=
ms
;
mx
+=
std
::
max
(
o1
,
o2
);
mx
+=
std
::
max
(
o1
,
o2
);
...
...
Classes/ocgcore/processor.cpp
View file @
2e7bd145
...
@@ -129,7 +129,7 @@ uint32_t field::process() {
...
@@ -129,7 +129,7 @@ uint32_t field::process() {
}
}
}
}
case
PROCESSOR_SELECT_CHAIN
:
{
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
();
core
.
units
.
pop_front
();
return
pduel
->
buffer_size
();
return
pduel
->
buffer_size
();
}
else
{
}
else
{
...
@@ -1008,7 +1008,6 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
...
@@ -1008,7 +1008,6 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
int32_t
check_player
=
infos
.
turn_player
;
int32_t
check_player
=
infos
.
turn_player
;
if
(
core
.
units
.
begin
()
->
arg2
&
0x2
)
if
(
core
.
units
.
begin
()
->
arg2
&
0x2
)
check_player
=
1
-
infos
.
turn_player
;
check_player
=
1
-
infos
.
turn_player
;
chain
newchain
;
core
.
select_chains
.
clear
();
core
.
select_chains
.
clear
();
int32_t
tf_count
=
0
,
to_count
=
0
,
fc_count
=
0
,
cn_count
=
0
;
int32_t
tf_count
=
0
,
to_count
=
0
,
fc_count
=
0
,
cn_count
=
0
;
auto
pr
=
effects
.
trigger_f_effect
.
equal_range
(
phase_event
);
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) {
...
@@ -1019,7 +1018,9 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
if
(
!
peffect
->
is_activateable
(
check_player
,
test_event
))
if
(
!
peffect
->
is_activateable
(
check_player
,
test_event
))
continue
;
continue
;
peffect
->
id
=
infos
.
field_id
++
;
peffect
->
id
=
infos
.
field_id
++
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
flag
|=
CHAIN_FORCED
;
core
.
select_chains
.
push_back
(
newchain
);
core
.
select_chains
.
push_back
(
newchain
);
++
tf_count
;
++
tf_count
;
}
}
...
@@ -1031,7 +1032,9 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
...
@@ -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
))
if
(
peffect
->
get_handler_player
()
!=
check_player
||
!
peffect
->
is_activateable
(
check_player
,
test_event
))
continue
;
continue
;
peffect
->
id
=
infos
.
field_id
++
;
peffect
->
id
=
infos
.
field_id
++
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
flag
|=
CHAIN_FORCED
;
core
.
select_chains
.
push_back
(
newchain
);
core
.
select_chains
.
push_back
(
newchain
);
++
cn_count
;
++
cn_count
;
}
}
...
@@ -1052,7 +1055,9 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
...
@@ -1052,7 +1055,9 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
card
*
phandler
=
peffect
->
get_handler
();
card
*
phandler
=
peffect
->
get_handler
();
if
(
peffect
->
get_value
(
phandler
)
!=
phandler
->
current
.
controler
)
if
(
peffect
->
get_value
(
phandler
)
!=
phandler
->
current
.
controler
)
continue
;
continue
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
flag
|=
CHAIN_FORCED
;
core
.
select_chains
.
push_back
(
newchain
);
core
.
select_chains
.
push_back
(
newchain
);
++
cn_count
;
++
cn_count
;
}
}
...
@@ -1066,6 +1071,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
...
@@ -1066,6 +1071,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
if
(
!
peffect
->
is_activateable
(
check_player
,
test_event
))
if
(
!
peffect
->
is_activateable
(
check_player
,
test_event
))
continue
;
continue
;
peffect
->
id
=
infos
.
field_id
++
;
peffect
->
id
=
infos
.
field_id
++
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
triggering_effect
=
peffect
;
core
.
select_chains
.
push_back
(
newchain
);
core
.
select_chains
.
push_back
(
newchain
);
++
to_count
;
++
to_count
;
...
@@ -1089,6 +1095,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
...
@@ -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
))
if
(
!
peffect
->
is_chainable
(
check_player
)
||
!
peffect
->
is_activateable
(
check_player
,
test_event
))
continue
;
continue
;
peffect
->
id
=
infos
.
field_id
++
;
peffect
->
id
=
infos
.
field_id
++
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
triggering_effect
=
peffect
;
if
(
check_hint_timing
(
peffect
)
||
check_cteffect_hint
(
peffect
,
check_player
))
if
(
check_hint_timing
(
peffect
)
||
check_cteffect_hint
(
peffect
,
check_player
))
++
core
.
spe_effect
[
check_player
];
++
core
.
spe_effect
[
check_player
];
...
@@ -1103,6 +1110,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
...
@@ -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
))
if
(
!
peffect
->
is_chainable
(
check_player
)
||
!
peffect
->
is_activateable
(
check_player
,
test_event
))
continue
;
continue
;
peffect
->
id
=
infos
.
field_id
++
;
peffect
->
id
=
infos
.
field_id
++
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
triggering_effect
=
peffect
;
if
(
check_hint_timing
(
peffect
))
if
(
check_hint_timing
(
peffect
))
++
core
.
spe_effect
[
check_player
];
++
core
.
spe_effect
[
check_player
];
...
@@ -1116,6 +1124,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
...
@@ -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
))
if
(
peffect
->
get_handler_player
()
!=
check_player
||
!
peffect
->
is_activateable
(
check_player
,
test_event
))
continue
;
continue
;
peffect
->
id
=
infos
.
field_id
++
;
peffect
->
id
=
infos
.
field_id
++
;
chain
newchain
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
triggering_effect
=
peffect
;
core
.
select_chains
.
push_back
(
newchain
);
core
.
select_chains
.
push_back
(
newchain
);
++
fc_count
;
++
fc_count
;
...
@@ -1147,7 +1156,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
...
@@ -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
);
add_process
(
PROCESSOR_SELECT_EFFECTYN
,
0
,
0
,
(
group
*
)
core
.
select_chains
[
0
].
triggering_effect
->
get_handler
(),
check_player
,
0
);
return
FALSE
;
return
FALSE
;
}
else
{
}
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
;
core
.
units
.
begin
()
->
step
=
1
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1316,8 +1325,10 @@ int32_t field::process_point_event(int16_t step, int32_t skip_trigger, int32_t s
...
@@ -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
;
uint8_t
tp
=
clit
->
triggering_player
;
if
(
check_trigger_effect
(
*
clit
)
&&
peffect
->
is_chainable
(
tp
)
if
(
check_trigger_effect
(
*
clit
)
&&
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
!
peffect
->
is_flag
(
EFFECT_FLAG_ACTIVATE_CONDITION
)))
{
&&
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
);
core
.
select_chains
.
push_back
(
*
clit
);
}
}
else
{
}
else
{
peffect
->
active_type
=
0
;
peffect
->
active_type
=
0
;
clit
=
core
.
new_fchain_s
.
erase
(
clit
);
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
...
@@ -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
)
{
}
else
if
(
core
.
select_chains
.
size
()
==
1
)
{
returns
.
ivalue
[
0
]
=
0
;
returns
.
ivalue
[
0
]
=
0
;
}
else
{
}
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
;
return
FALSE
;
}
}
...
@@ -1594,8 +1605,10 @@ int32_t field::process_quick_effect(int16_t step, int32_t skip_freechain, uint8_
...
@@ -1594,8 +1605,10 @@ int32_t field::process_quick_effect(int16_t step, int32_t skip_freechain, uint8_
card
*
phandler
=
peffect
->
get_handler
();
card
*
phandler
=
peffect
->
get_handler
();
if
(
peffect
->
is_chainable
(
ifit
->
second
.
triggering_player
)
&&
peffect
->
check_count_limit
(
ifit
->
second
.
triggering_player
)
if
(
peffect
->
is_chainable
(
ifit
->
second
.
triggering_player
)
&&
peffect
->
check_count_limit
(
ifit
->
second
.
triggering_player
)
&&
phandler
->
is_has_relation
(
ifit
->
second
))
{
&&
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
);
core
.
select_chains
.
push_back
(
ifit
->
second
);
}
}
else
{
}
else
{
ifit
=
core
.
quick_f_chain
.
erase
(
ifit
);
ifit
=
core
.
quick_f_chain
.
erase
(
ifit
);
continue
;
continue
;
...
@@ -1607,7 +1620,7 @@ int32_t field::process_quick_effect(int16_t step, int32_t skip_freechain, uint8_
...
@@ -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
)
else
if
(
core
.
select_chains
.
size
()
==
1
)
returns
.
ivalue
[
0
]
=
0
;
returns
.
ivalue
[
0
]
=
0
;
else
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
;
return
FALSE
;
}
}
case
1
:
{
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