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
e8927ec5
Commit
e8927ec5
authored
Nov 27, 2025
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/patch-tosscoin' into develop
parents
5e8a57fe
4d95c45d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
17 deletions
+26
-17
field.h
field.h
+1
-1
libduel.cpp
libduel.cpp
+9
-4
operations.cpp
operations.cpp
+16
-12
No files found.
field.h
View file @
e8927ec5
...
...
@@ -311,7 +311,7 @@ struct processor {
uint32_t
set_group_used_zones
{
0
};
uint8_t
set_group_seq
[
7
]{};
uint8_t
dice_result
[
5
]{};
uint
8_t
coin_result
[
MAX_COIN_COUNT
]{
};
uint
32_t
coin_result
{
0
};
int32_t
coin_count
{
0
};
bool
is_target_ready
{
false
};
bool
is_gemini_summoning
{
false
};
...
...
libduel.cpp
View file @
e8927ec5
...
...
@@ -4203,7 +4203,7 @@ int32_t scriptlib::duel_toss_coin(lua_State * L) {
duel
*
pduel
=
(
duel
*
)
ctx
;
int32_t
count
=
pduel
->
game_field
->
core
.
coin_count
;
for
(
int32_t
i
=
0
;
i
<
count
;
++
i
)
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
coin_result
[
i
]
);
lua_pushinteger
(
L
,
(
pduel
->
game_field
->
core
.
coin_result
>>
i
)
&
1u
);
return
count
;
});
}
...
...
@@ -4249,7 +4249,7 @@ int32_t scriptlib::duel_rock_paper_scissors(lua_State * L) {
int32_t
scriptlib
::
duel_get_coin_result
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
for
(
int32_t
i
=
0
;
i
<
pduel
->
game_field
->
core
.
coin_count
;
++
i
)
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
coin_result
[
i
]
);
lua_pushinteger
(
L
,
(
pduel
->
game_field
->
core
.
coin_result
>>
i
)
&
1u
);
return
pduel
->
game_field
->
core
.
coin_count
;
}
int32_t
scriptlib
::
duel_get_dice_result
(
lua_State
*
L
)
{
...
...
@@ -4261,11 +4261,16 @@ int32_t scriptlib::duel_get_dice_result(lua_State * L) {
int32_t
scriptlib
::
duel_set_coin_result
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32_t
res
;
for
(
int32_t
i
=
0
;
i
<
MAX_COIN_COUNT
;
++
i
)
{
auto
coin_count
=
lua_gettop
(
L
);
pduel
->
game_field
->
core
.
coin_result
=
0
;
if
(
coin_count
>
MAX_COIN_COUNT
)
coin_count
=
MAX_COIN_COUNT
;
for
(
int32_t
i
=
0
;
i
<
coin_count
;
++
i
)
{
res
=
(
int32_t
)
lua_tointeger
(
L
,
i
+
1
);
if
(
res
!=
0
&&
res
!=
1
)
res
=
0
;
pduel
->
game_field
->
core
.
coin_result
[
i
]
=
res
;
if
(
res
)
pduel
->
game_field
->
core
.
coin_result
|=
(
1u
<<
i
);
}
return
0
;
}
...
...
operations.cpp
View file @
e8927ec5
...
...
@@ -6402,8 +6402,7 @@ int32_t field::toss_coin(uint16_t step, effect * reason_effect, uint8_t reason_p
e
.
reason
=
0
;
e
.
reason_effect
=
reason_effect
;
e
.
reason_player
=
reason_player
;
for
(
int32_t
i
=
0
;
i
<
MAX_COIN_COUNT
;
++
i
)
core
.
coin_result
[
i
]
=
0
;
core
.
coin_result
=
0
;
auto
pr
=
effects
.
continuous_effect
.
equal_range
(
EFFECT_TOSS_COIN_REPLACE
);
for
(
auto
eit
=
pr
.
first
;
eit
!=
pr
.
second
;)
{
effect
*
pe
=
eit
->
second
;
...
...
@@ -6414,32 +6413,38 @@ int32_t field::toss_coin(uint16_t step, effect * reason_effect, uint8_t reason_p
}
}
if
(
!
peffect
)
{
auto
gen_bits
=
[
&
](
int32_t
n
)
->
uint32_t
{
uint32_t
mask
=
(
1u
<<
n
)
-
1u
;
return
(
uint32_t
)
pduel
->
get_next_integer
(
0
,
(
int32_t
)
mask
);
};
if
(
count
>
0
)
{
pduel
->
write_buffer8
(
MSG_TOSS_COIN
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
((
uint8_t
)
count
);
core
.
coin_count
=
count
;
core
.
coin_result
=
gen_bits
(
count
);
for
(
int32_t
i
=
0
;
i
<
count
;
++
i
)
{
core
.
coin_result
[
i
]
=
pduel
->
get_next_integer
(
0
,
1
);
pduel
->
write_buffer8
(
core
.
coin_result
[
i
]);
pduel
->
write_buffer8
((
uint8_t
)((
core
.
coin_result
>>
i
)
&
1u
));
}
}
else
if
(
count
==
-
1
)
{
core
.
coin_count
=
0
;
uint32_t
bits
=
gen_bits
(
MAX_COIN_COUNT
);
int32_t
first_zero
=
-
1
;
for
(
int32_t
i
=
0
;
i
<
MAX_COIN_COUNT
;
++
i
)
{
core
.
coin_result
[
i
]
=
pduel
->
get_next_integer
(
0
,
1
);
if
(
!
core
.
coin_result
[
i
])
{
core
.
coin_count
=
i
+
1
;
if
(((
bits
>>
i
)
&
1u
)
==
0u
)
{
first_zero
=
i
;
break
;
}
}
if
(
!
core
.
coin_count
)
core
.
coin_count
=
MAX_COIN_COUNT
;
core
.
coin_count
=
(
first_zero
==
-
1
)
?
MAX_COIN_COUNT
:
(
first_zero
+
1
);
core
.
coin_result
=
bits
;
pduel
->
write_buffer8
(
MSG_TOSS_COIN
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
coin_count
);
for
(
int32_t
i
=
0
;
i
<
core
.
coin_count
;
++
i
)
{
pduel
->
write_buffer8
(
core
.
coin_result
[
i
]
);
pduel
->
write_buffer8
(
(
uint8_t
)((
core
.
coin_result
>>
i
)
&
1u
)
);
}
}
raise_event
(
nullptr
,
EVENT_TOSS_COIN_NEGATE
,
reason_effect
,
0
,
reason_player
,
playerid
,
count
);
...
...
@@ -6471,8 +6476,7 @@ int32_t field::toss_dice(uint16_t step, effect * reason_effect, uint8_t reason_p
e
.
reason
=
0
;
e
.
reason_effect
=
reason_effect
;
e
.
reason_player
=
reason_player
;
for
(
int32_t
i
=
0
;
i
<
5
;
++
i
)
core
.
dice_result
[
i
]
=
0
;
memset
(
core
.
dice_result
,
0
,
sizeof
(
core
.
dice_result
));
auto
pr
=
effects
.
continuous_effect
.
equal_range
(
EFFECT_TOSS_DICE_REPLACE
);
for
(
auto
eit
=
pr
.
first
;
eit
!=
pr
.
second
;)
{
effect
*
pe
=
eit
->
second
;
...
...
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