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
ca70b4da
Commit
ca70b4da
authored
Nov 17, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into blind
parents
64080ec8
2d486e69
Pipeline
#41639
passed with stages
in 6 minutes and 10 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
123 additions
and
82 deletions
+123
-82
.gitlab-ci.yml
.gitlab-ci.yml
+53
-10
libcard.cpp
libcard.cpp
+13
-50
libduel.cpp
libduel.cpp
+6
-6
libgroup.cpp
libgroup.cpp
+9
-8
premake/dll.lua
premake/dll.lua
+28
-2
premake/lua.lua
premake/lua.lua
+0
-2
premake5.lua
premake5.lua
+11
-1
processor.cpp
processor.cpp
+3
-3
No files found.
.gitlab-ci.yml
View file @
ca70b4da
...
...
@@ -7,6 +7,10 @@ stages:
variables
:
GIT_DEPTH
:
"
1"
.no_888
:
except
:
-
'
888'
mat_common
:
stage
:
prepare
tags
:
...
...
@@ -24,6 +28,7 @@ mat_common:
-
sqlite3
mat_windows
:
extends
:
.no_888
stage
:
prepare
tags
:
-
linux
...
...
@@ -36,6 +41,7 @@ mat_windows:
-
premake5.exe
mat_macos
:
extends
:
.no_888
stage
:
prepare
tags
:
-
linux
...
...
@@ -46,13 +52,20 @@ mat_macos:
paths
:
-
premake5
.build_unix
:
.build
:
extends
:
.no_888
stage
:
build
dependencies
:
-
mat_common
artifacts
:
paths
:
-
dist
.build_unix
:
extends
:
.build
tags
:
-
noavx2
image
:
git-registry.moenext.com/mycard/docker-ygopro-builder:debian11
dependencies
:
-
mat_common
variables
:
PREMAKE_OS
:
linux
BUILD_TYPE
:
x64
...
...
@@ -66,13 +79,18 @@ mat_macos:
-
mkdir -p dist/$BUILD_TYPE
-
cp build/bin/$BUILD_TYPE/Release/libocgcore.* dist/$BUILD_TYPE/
-
cp build/bin/$BUILD_TYPE/Release/libsqlite3.* dist/$BUILD_TYPE/ ||
true
artifacts
:
paths
:
-
dist
build_linux_x64
:
extends
:
.build_unix
build_linux_x64_no_longjmp
:
extends
:
.build_unix
except
:
[]
only
:
-
'
888'
variables
:
NO_LONGJMP
:
'
1'
build_linux_x32
:
extends
:
.build_unix
variables
:
...
...
@@ -88,7 +106,7 @@ build_wasm:
image
:
git-registry.moenext.com/mycard/docker-ygopro-builder:debian12
.build_windows
:
stage
:
build
extends
:
.
build
dependencies
:
-
mat_common
-
mat_windows
...
...
@@ -98,9 +116,6 @@ build_wasm:
-
copy premake\dll.lua dll.lua
-
'
.\premake5.exe
vs2019
--file=dll.lua
--sqlite3-dir=sqlite3'
-
mkdir dist
artifacts
:
paths
:
-
dist
build_windows_x32
:
extends
:
.build_windows
...
...
@@ -144,6 +159,7 @@ build_macos_m1:
BUILD_TYPE
:
arm64
build_macos
:
extends
:
.no_888
stage
:
combine
dependencies
:
-
build_macos_x64
...
...
@@ -174,3 +190,30 @@ upload_to_minio:
-
aws s3 --endpoint=https://minio.moenext.com:9000 sync --delete dist/ s3://mycard/libocgcore-koishi
only
:
-
master
.deploy_to_server
:
stage
:
deploy
tags
:
-
linux
dependencies
:
-
build_linux_x64_no_longjmp
variables
:
SERVER_USER
:
nanahira
SERVER_HOST
:
koishi.momobako.com
FROM_PATH
:
'
dist/x64/libocgcore.so'
SERVER_PATH
:
'
'
script
:
-
apt update && apt -y install openssh-client rsync coreutils
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
-
ssh-keyscan $SERVER_HOST >> ~/.ssh/known_hosts
-
echo $NANAHIRA_SSH_KEY | base64 --decode > ~/.ssh/id_rsa
-
chmod 600 ~/.ssh/*
-
rsync -4cavzP $FROM_PATH $SERVER_USER@$SERVER_HOST:$SERVER_PATH
deploy_888
:
extends
:
.deploy_to_server
variables
:
SERVER_PATH
:
'
~/ygopro-super-pre/bin/release/'
only
:
-
'
888'
libcard.cpp
View file @
ca70b4da
...
...
@@ -3425,69 +3425,32 @@ int32_t scriptlib::card_add_monster_attribute(lua_State *L) {
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pcard
->
pduel
;
pcard
->
set_status
(
STATUS_NO_LEVEL
,
FALSE
);
// pre-monster
effect
*
peffect
=
pduel
->
new_effect
();
peffect
->
owner
=
pcard
;
peffect
->
type
=
EFFECT_TYPE_SINGLE
;
peffect
->
code
=
EFFECT_PRE_MONSTER
;
peffect
->
flag
[
0
]
=
EFFECT_FLAG_CANNOT_DISABLE
;
peffect
->
reset_flag
=
RESET_CHAIN
+
RESET_EVENT
+
0x47e0000
;
peffect
->
value
=
type
;
pcard
->
add_effect
(
peffect
);
//attribute
if
(
attribute
)
{
effect
*
peffect
;
auto
add_temp_effect
=
[
&
](
uint32_t
code
,
int32_t
value
,
uint32_t
extra_reset_flag
=
0
)
{
peffect
=
pduel
->
new_effect
();
peffect
->
owner
=
pcard
;
peffect
->
type
=
EFFECT_TYPE_SINGLE
;
peffect
->
code
=
EFFECT_ADD_ATTRIBUTE
;
peffect
->
code
=
code
;
peffect
->
flag
[
0
]
=
EFFECT_FLAG_CANNOT_DISABLE
;
peffect
->
reset_flag
=
RESET_EVENT
+
0x47e0000
;
peffect
->
value
=
attribut
e
;
peffect
->
reset_flag
=
RESET_EVENT
|
0x47e0000
|
extra_reset_flag
;
peffect
->
value
=
valu
e
;
pcard
->
add_effect
(
peffect
);
};
add_temp_effect
(
EFFECT_PRE_MONSTER
,
type
,
RESET_CHAIN
);
if
(
attribute
)
{
add_temp_effect
(
EFFECT_CHANGE_ATTRIBUTE
,
attribute
);
}
//race
if
(
race
)
{
peffect
=
pduel
->
new_effect
();
peffect
->
owner
=
pcard
;
peffect
->
type
=
EFFECT_TYPE_SINGLE
;
peffect
->
code
=
EFFECT_ADD_RACE
;
peffect
->
flag
[
0
]
=
EFFECT_FLAG_CANNOT_DISABLE
;
peffect
->
reset_flag
=
RESET_EVENT
+
0x47e0000
;
peffect
->
value
=
race
;
pcard
->
add_effect
(
peffect
);
add_temp_effect
(
EFFECT_CHANGE_RACE
,
race
);
}
//level
if
(
level
)
{
peffect
=
pduel
->
new_effect
();
peffect
->
owner
=
pcard
;
peffect
->
type
=
EFFECT_TYPE_SINGLE
;
peffect
->
code
=
EFFECT_CHANGE_LEVEL
;
peffect
->
flag
[
0
]
=
EFFECT_FLAG_CANNOT_DISABLE
;
peffect
->
reset_flag
=
RESET_EVENT
+
0x47e0000
;
peffect
->
value
=
level
;
pcard
->
add_effect
(
peffect
);
add_temp_effect
(
EFFECT_CHANGE_LEVEL
,
level
);
}
//atk
if
(
atk
)
{
peffect
=
pduel
->
new_effect
();
peffect
->
owner
=
pcard
;
peffect
->
type
=
EFFECT_TYPE_SINGLE
;
peffect
->
code
=
EFFECT_SET_BASE_ATTACK
;
peffect
->
flag
[
0
]
=
EFFECT_FLAG_CANNOT_DISABLE
;
peffect
->
reset_flag
=
RESET_EVENT
+
0x47e0000
;
peffect
->
value
=
atk
;
pcard
->
add_effect
(
peffect
);
add_temp_effect
(
EFFECT_SET_BASE_ATTACK
,
atk
);
}
//def
if
(
def
)
{
peffect
=
pduel
->
new_effect
();
peffect
->
owner
=
pcard
;
peffect
->
type
=
EFFECT_TYPE_SINGLE
;
peffect
->
code
=
EFFECT_SET_BASE_DEFENSE
;
peffect
->
flag
[
0
]
=
EFFECT_FLAG_CANNOT_DISABLE
;
peffect
->
reset_flag
=
RESET_EVENT
+
0x47e0000
;
peffect
->
value
=
def
;
pcard
->
add_effect
(
peffect
);
add_temp_effect
(
EFFECT_SET_BASE_DEFENSE
,
def
);
}
return
0
;
}
...
...
libduel.cpp
View file @
ca70b4da
...
...
@@ -1465,14 +1465,14 @@ int32_t scriptlib::duel_confirm_cards(lua_State *L) {
int32_t
scriptlib
::
duel_sort_decktop
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
uint32_t
sort_player
=
(
u
int32_t
)
lua_tointeger
(
L
,
1
);
uint32_t
target_player
=
(
u
int32_t
)
lua_tointeger
(
L
,
2
);
uint32_t
count
=
(
u
int32_t
)
lua_tointeger
(
L
,
3
);
if
(
sort_player
!=
0
&&
sort_player
!=
1
)
int32_t
sort_player
=
(
int32_t
)
lua_tointeger
(
L
,
1
);
int32_t
target_player
=
(
int32_t
)
lua_tointeger
(
L
,
2
);
int32_t
count
=
(
int32_t
)
lua_tointeger
(
L
,
3
);
if
(
!
check_playerid
(
sort_player
)
)
return
0
;
if
(
target_player
!=
0
&&
target_player
!=
1
)
if
(
!
check_playerid
(
target_player
)
)
return
0
;
if
(
count
<
1
||
count
>
16
)
if
(
count
<
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
add_process
(
PROCESSOR_SORT_DECK
,
0
,
0
,
0
,
sort_player
+
(
target_player
<<
16
),
count
);
...
...
libgroup.cpp
View file @
ca70b4da
...
...
@@ -368,12 +368,12 @@ int32_t scriptlib::group_random_select(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
int32_t
playerid
=
(
int32_t
)
lua_tointeger
(
L
,
2
);
uint32_t
count
=
(
u
int32_t
)
lua_tointeger
(
L
,
3
);
int32_t
count
=
(
int32_t
)
lua_tointeger
(
L
,
3
);
int32_t
no_hint
=
lua_toboolean
(
L
,
4
);
duel
*
pduel
=
pgroup
->
pduel
;
group
*
newgroup
=
pduel
->
new_group
();
if
(
count
>
pgroup
->
container
.
size
())
count
=
(
u
int32_t
)
pgroup
->
container
.
size
();
if
(
count
>
(
int32_t
)
pgroup
->
container
.
size
())
count
=
(
int32_t
)
pgroup
->
container
.
size
();
if
(
count
==
0
)
{
interpreter
::
group2value
(
L
,
newgroup
);
return
1
;
...
...
@@ -381,12 +381,13 @@ int32_t scriptlib::group_random_select(lua_State *L) {
if
(
count
==
pgroup
->
container
.
size
())
newgroup
->
container
=
pgroup
->
container
;
else
{
while
(
newgroup
->
container
.
size
()
<
count
)
{
int32_t
i
=
pduel
->
get_next_integer
(
0
,
(
int32_t
)
pgroup
->
container
.
size
()
-
1
)
;
auto
cit
=
pgroup
->
container
.
begin
();
std
::
advance
(
cit
,
i
);
newgroup
->
container
.
insert
(
*
cit
);
card_vector
cv
(
pgroup
->
container
.
begin
(),
pgroup
->
container
.
end
());
int32_t
back
=
(
int32_t
)
cv
.
size
()
-
1
;
for
(
int32_t
i
=
0
;
i
<
count
;
++
i
)
{
int32_t
r
=
pduel
->
get_next_integer
(
i
,
back
);
std
::
swap
(
cv
[
i
],
cv
[
r
]
);
}
newgroup
->
container
.
insert
(
cv
.
begin
(),
cv
.
begin
()
+
count
);
}
if
(
no_hint
)
{
interpreter
::
group2value
(
L
,
newgroup
);
...
...
premake/dll.lua
View file @
ca70b4da
newoption
{
trigger
=
"lua-dir"
,
description
=
""
,
value
=
"PATH"
,
default
=
"./lua"
}
newoption
{
trigger
=
"sqlite3-dir"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"no-longjmp"
,
description
=
"Disable use of longjmp for error handling in Lua"
}
boolOptions
=
{
"no-lua-safe"
,
}
for
_
,
boolOption
in
ipairs
(
boolOptions
)
do
newoption
{
trigger
=
boolOption
,
category
=
"YGOPro - options"
,
description
=
""
}
end
function
GetParam
(
param
)
return
_OPTIONS
[
param
]
or
os.getenv
(
string.upper
(
string.gsub
(
param
,
"-"
,
"_"
)))
...
...
@@ -11,6 +20,13 @@ if not os.isdir(LUA_DIR) then
end
SQLITE3_DIR
=
GetParam
(
"sqlite3-dir"
)
USE_LONGJMP
=
not
GetParam
(
"no-longjmp"
)
function
ApplyBoolean
(
param
)
if
GetParam
(
param
)
then
defines
{
"YGOPRO_"
..
string.upper
(
string.gsub
(
param
,
"-"
,
"_"
))
}
end
end
workspace
"ocgcoredll"
location
"build"
...
...
@@ -18,6 +34,14 @@ workspace "ocgcoredll"
cppdialect
"C++14"
configurations
{
"Release"
,
"Debug"
}
platforms
{
"x64"
,
"x32"
,
"arm64"
,
"wasm"
}
if
USE_LONGJMP
then
defines
{
"LUA_USE_LONGJMP"
}
end
for
_
,
boolOption
in
ipairs
(
boolOptions
)
do
ApplyBoolean
(
boolOption
)
end
filter
"platforms:x32"
architecture
"x32"
...
...
@@ -59,11 +83,13 @@ workspace "ocgcoredll"
filter
"system:linux"
defines
{
"LUA_USE_LINUX"
}
pic
"On"
linkoptions
{
"-static-libstdc++"
,
"-static-libgcc"
}
if
USE_LONGJMP
then
linkoptions
{
"-static-libstdc++"
,
"-static-libgcc"
}
end
filter
"platforms:wasm"
toolset
"emcc"
defines
{
"LUA_USE_C89"
,
"LUA_USE_LONGJMP"
}
defines
{
"LUA_USE_C89"
}
pic
"On"
filter
{}
...
...
premake/lua.lua
View file @
ca70b4da
...
...
@@ -5,8 +5,6 @@ project "lua"
files
{
"src/*.c"
,
"src/*.h"
}
removefiles
{
"src/lua.c"
,
"src/luac.c"
,
"src/onelua.c"
}
defines
{
"LUA_USE_LONGJMP"
}
if
not
GetParam
(
"no-lua-safe"
)
then
removefiles
{
"src/linit.c"
}
end
...
...
premake5.lua
View file @
ca70b4da
project
"ocgcore"
kind
"StaticLib"
if
OCGCORE_DYNAMIC
then
kind
"SharedLib"
links
{
LUA_LIB_NAME
}
libdirs
{
LUA_LIB_DIR
}
else
kind
"StaticLib"
end
files
{
"*.cpp"
,
"*.h"
}
...
...
@@ -20,3 +26,7 @@ project "ocgcore"
filter
"system:linux"
defines
{
"LUA_USE_LINUX"
}
if
OCGCORE_DYNAMIC
then
pic
"On"
-- linkoptions { "-static-libstdc++", "-static-libgcc" }
end
processor.cpp
View file @
ca70b4da
...
...
@@ -675,15 +675,15 @@ uint32_t field::process() {
++
it
->
step
;
}
else
{
if
(
returns
.
bvalue
[
0
]
!=
0xff
)
{
card
*
tc
[
1
6
];
card
*
tc
[
25
6
];
for
(
i
=
0
;
i
<
count
;
++
i
)
player
[
target_player
].
list_main
.
pop_back
();
for
(
i
=
0
;
i
<
count
;
++
i
)
tc
[
returns
.
bvalue
[
i
]]
=
core
.
select_cards
[
i
];
for
(
i
=
0
;
i
<
count
;
++
i
)
{
player
[
target_player
].
list_main
.
push_back
(
tc
[
count
-
i
-
1
]);
tc
[
count
-
i
-
1
]
->
current
.
sequence
=
(
uint8_t
)
player
[
target_player
].
list_main
.
size
()
-
1
;
player
[
target_player
].
list_main
.
push_back
(
tc
[
count
-
1
-
i
]);
}
reset_sequence
(
target_player
,
LOCATION_DECK
);
auto
clit
=
player
[
target_player
].
list_main
.
rbegin
();
for
(
i
=
0
;
i
<
count
;
++
i
,
++
clit
)
{
card
*
pcard
=
*
clit
;
...
...
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