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
3e2bd68e
Commit
3e2bd68e
authored
Jun 20, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch-sum-param' of github.com:mercury233/ygopro-core into develop
parents
51893c5c
c4c87b0b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
17 deletions
+27
-17
field.cpp
field.cpp
+19
-8
field.h
field.h
+1
-0
playerop.cpp
playerop.cpp
+7
-9
No files found.
field.cpp
View file @
3e2bd68e
...
@@ -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
))
...
...
field.h
View file @
3e2bd68e
...
@@ -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
);
...
...
playerop.cpp
View file @
3e2bd68e
...
@@ -633,8 +633,8 @@ int32_t field::select_counter(uint16_t step, uint8_t playerid, uint16_t countert
...
@@ -633,8 +633,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 +659,7 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
...
@@ -659,7 +659,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 +711,8 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
...
@@ -711,9 +711,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 +727,8 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
...
@@ -728,9 +727,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
);
...
...
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