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
xiaoye
ygopro-core
Commits
90baf203
Commit
90baf203
authored
Apr 15, 2023
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update sum_param
parent
bf2339ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
17 deletions
+34
-17
field.cpp
field.cpp
+19
-8
playerop.cpp
playerop.cpp
+15
-9
No files found.
field.cpp
View file @
90baf203
...
...
@@ -2864,12 +2864,20 @@ int32 field::check_tribute(card* pcard, int32 min, int32 max, group* mg, uint8 t
return
FALSE
;
return
TRUE
;
}
static
void
get_sum_params
(
uint32
sum_param
,
int32
&
op1
,
int32
&
op2
)
{
op1
=
sum_param
&
0xffff
;
op2
=
(
sum_param
>>
16
)
&
0xffff
;
if
(
op2
&
0x8000
)
{
op1
=
sum_param
&
0x7fffffff
;
op2
=
0
;
}
}
int32
field
::
check_with_sum_limit
(
const
card_vector
&
mats
,
int32
acc
,
int32
index
,
int32
count
,
int32
min
,
int32
max
,
int32
opmin
)
{
if
(
count
>
max
)
return
FALSE
;
while
(
index
<
(
int32
)
mats
.
size
())
{
int32
op1
=
mats
[
index
]
->
sum_param
&
0xffff
;
int32
op2
=
(
mats
[
index
]
->
sum_param
>>
16
)
&
0xffff
;
int32
op1
,
op2
;
get_sum_params
(
mats
[
index
]
->
sum_param
,
op1
,
op2
)
;
if
(((
op1
==
acc
&&
acc
+
opmin
>
op1
)
||
(
op2
&&
op2
==
acc
&&
acc
+
opmin
>
op2
))
&&
count
>=
min
)
return
TRUE
;
index
++
;
...
...
@@ -2887,8 +2895,9 @@ int32 field::check_with_sum_limit_m(const card_vector& mats, int32 acc, int32 in
return
check_with_sum_limit
(
mats
,
acc
,
index
,
1
,
min
,
max
,
opmin
);
if
(
index
>=
(
int32
)
mats
.
size
())
return
FALSE
;
int32
op1
=
mats
[
index
]
->
sum_param
&
0xffff
;
int32
op2
=
(
mats
[
index
]
->
sum_param
>>
16
)
&
0xffff
;
int32
op1
;
int32
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
))
return
TRUE
;
if
(
op2
&&
acc
>=
op2
&&
check_with_sum_limit_m
(
mats
,
acc
-
op2
,
index
+
1
,
min
,
max
,
std
::
min
(
opmin
,
op2
),
must_count
))
...
...
@@ -2897,8 +2906,9 @@ int32 field::check_with_sum_limit_m(const card_vector& mats, int32 acc, int32 in
}
int32
field
::
check_with_sum_greater_limit
(
const
card_vector
&
mats
,
int32
acc
,
int32
index
,
int32
opmin
)
{
while
(
index
<
(
int32
)
mats
.
size
())
{
int32
op1
=
mats
[
index
]
->
sum_param
&
0xffff
;
int32
op2
=
(
mats
[
index
]
->
sum_param
>>
16
)
&
0xffff
;
int32
op1
;
int32
op2
;
get_sum_params
(
mats
[
index
]
->
sum_param
,
op1
,
op2
);
if
((
acc
<=
op1
&&
acc
+
opmin
>
op1
)
||
(
op2
&&
acc
<=
op2
&&
acc
+
opmin
>
op2
))
return
TRUE
;
index
++
;
...
...
@@ -2916,8 +2926,9 @@ int32 field::check_with_sum_greater_limit_m(const card_vector& mats, int32 acc,
return
check_with_sum_greater_limit
(
mats
,
acc
,
index
,
opmin
);
if
(
index
>=
(
int32
)
mats
.
size
())
return
FALSE
;
int32
op1
=
mats
[
index
]
->
sum_param
&
0xffff
;
int32
op2
=
(
mats
[
index
]
->
sum_param
>>
16
)
&
0xffff
;
int32
op1
;
int32
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
))
return
TRUE
;
if
(
op2
&&
check_with_sum_greater_limit_m
(
mats
,
acc
-
op2
,
index
+
1
,
std
::
min
(
opmin
,
op2
),
must_count
))
...
...
playerop.cpp
View file @
90baf203
...
...
@@ -605,11 +605,19 @@ int32 field::select_counter(uint16 step, uint8 playerid, uint16 countertype, uin
}
return
TRUE
;
}
static
void
get_sum_params
(
int32
sum_param
,
int32
&
op1
,
int32
&
op2
)
{
op1
=
sum_param
&
0xffff
;
op2
=
(
sum_param
>>
16
)
&
0xffff
;
if
(
op2
&
0x8000
)
{
op1
=
sum_param
&
0x7fffffff
;
op2
=
0
;
}
}
static
int32
select_sum_check1
(
const
int32
*
oparam
,
int32
size
,
int32
index
,
int32
acc
,
int32
opmin
)
{
if
(
acc
==
0
||
index
==
size
)
return
FALSE
;
int32
o1
=
oparam
[
index
]
&
0xffff
;
int32
o2
=
oparam
[
index
]
>>
16
;
int32
o1
,
o2
;
get_sum_params
(
oparam
[
index
],
o1
,
o2
)
;
if
(
index
==
size
-
1
)
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
)))
...
...
@@ -628,7 +636,7 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
if
(
max
<
min
)
max
=
min
;
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer32
(
acc
&
0xffff
);
pduel
->
write_buffer32
(
acc
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8
)
core
.
must_select_cards
.
size
());
...
...
@@ -679,9 +687,8 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
int32
mcount
=
(
int32
)
core
.
must_select_cards
.
size
();
int32
sum
=
0
,
mx
=
0
,
mn
=
0x7fffffff
;
for
(
int32
i
=
0
;
i
<
mcount
;
++
i
)
{
int32
op
=
core
.
must_select_cards
[
i
]
->
sum_param
;
int32
o1
=
op
&
0xffff
;
int32
o2
=
op
>>
16
;
int32
o1
,
o2
;
get_sum_params
(
core
.
must_select_cards
[
i
]
->
sum_param
,
o1
,
o2
);
int32
ms
=
(
o2
&&
o2
<
o1
)
?
o2
:
o1
;
sum
+=
ms
;
mx
+=
(
o2
>
o1
)
?
o2
:
o1
;
...
...
@@ -696,9 +703,8 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
return
FALSE
;
}
c
.
insert
(
v
);
int32
op
=
core
.
select_cards
[
v
]
->
sum_param
;
int32
o1
=
op
&
0xffff
;
int32
o2
=
op
>>
16
;
int32
o1
,
o2
;
get_sum_params
(
core
.
select_cards
[
v
]
->
sum_param
,
o1
,
o2
);
int32
ms
=
(
o2
&&
o2
<
o1
)
?
o2
:
o1
;
sum
+=
ms
;
mx
+=
(
o2
>
o1
)
?
o2
:
o1
;
...
...
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