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
39de7818
Commit
39de7818
authored
Mar 17, 2025
by
今晚有宵夜吗
Committed by
GitHub
Mar 17, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Card.GetCardRegistered
Card.GetCardRegistered
parent
cefcf266
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
0 deletions
+92
-0
common.h
common.h
+7
-0
effect.h
effect.h
+2
-0
field.cpp
field.cpp
+1
-0
interpreter.cpp
interpreter.cpp
+30
-0
interpreter.h
interpreter.h
+1
-0
libcard.cpp
libcard.cpp
+50
-0
scriptlib.h
scriptlib.h
+1
-0
No files found.
common.h
View file @
39de7818
...
...
@@ -442,4 +442,11 @@ inline bool check_playerid(int32_t playerid) {
#define CARDDATA_RSCALE 11
#define CARDDATA_LINK_MARKER 12
//get effects for Card.GetCardRegistered
#define GETEFFECT_INITIAL 0x1
#define GETEFFECT_GAIN 0x2
#define GETEFFECT_COPY 0x4
#define GETEFFECT_GRANT 0x8
#define GETEFFECT_ALL 0xf
#endif
/* COMMON_H_ */
effect.h
View file @
39de7818
...
...
@@ -62,6 +62,8 @@ public:
int32_t
value
{
0
};
int32_t
operation
{
0
};
uint8_t
cost_checked
{
FALSE
};
uint8_t
is_granted
{
0
};
effect_set
required_handorset_effects
;
LuaParamType
object_type
{
PARAM_TYPE_INT
};
...
...
field.cpp
View file @
39de7818
...
...
@@ -2171,6 +2171,7 @@ int32_t field::adjust_grant_effect() {
for
(
auto
&
pcard
:
add_set
)
{
effect
*
ceffect
=
geffect
->
clone
();
ceffect
->
owner
=
pcard
;
ceffect
->
is_granted
=
1
;
pcard
->
add_effect
(
ceffect
);
eit
.
second
.
emplace
(
pcard
,
ceffect
);
}
...
...
interpreter.cpp
View file @
39de7818
...
...
@@ -113,6 +113,18 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_setglobal
(
lua_state
,
"EFFECT_CHANGE_SUMMON_LOCATION_KOISHI"
);
lua_pushinteger
(
lua_state
,
EFFECT_LINK_SPELL_KOISHI
);
lua_setglobal
(
lua_state
,
"EFFECT_LINK_SPELL_KOISHI"
);
lua_pushinteger
(
lua_state
,
GETEFFECT_ALL
);
lua_setglobal
(
lua_state
,
"GETEFFECT_ALL"
);
lua_pushinteger
(
lua_state
,
GETEFFECT_INITIAL
);
lua_setglobal
(
lua_state
,
"GETEFFECT_INITIAL"
);
lua_pushinteger
(
lua_state
,
GETEFFECT_COPY
);
lua_setglobal
(
lua_state
,
"GETEFFECT_COPY"
);
lua_pushinteger
(
lua_state
,
GETEFFECT_GAIN
);
lua_setglobal
(
lua_state
,
"GETEFFECT_GAIN"
);
lua_pushinteger
(
lua_state
,
GETEFFECT_GRANT
);
lua_setglobal
(
lua_state
,
"GETEFFECT_GRANT"
);
// lua_pushinteger(lua_state, EFFECT_SEA_PULSE);
// lua_setglobal(lua_state, "EFFECT_SEA_PULSE");
lua_pushinteger
(
lua_state
,
EFFECT_MAP_OF_HEAVEN
);
...
...
@@ -209,6 +221,24 @@ void interpreter::unregister_group(group *pgroup) {
luaL_unref
(
lua_state
,
LUA_REGISTRYINDEX
,
pgroup
->
ref_handle
);
pgroup
->
ref_handle
=
0
;
}
int32_t
interpreter
::
is_effect_check
(
lua_State
*
L
,
effect
*
peffect
,
int32_t
findex
,
int32_t
extraargs
)
{
if
(
!
findex
||
lua_isnil
(
L
,
findex
))
return
TRUE
;
luaL_checkstack
(
L
,
1
+
extraargs
,
nullptr
);
lua_pushvalue
(
L
,
findex
);
interpreter
::
effect2value
(
L
,
peffect
);
for
(
int32_t
i
=
0
;
i
<
extraargs
;
++
i
)
lua_pushvalue
(
L
,
(
int32_t
)(
-
extraargs
-
2
));
if
(
lua_pcall
(
L
,
1
+
extraargs
,
1
,
0
))
{
sprintf
(
pduel
->
strbuffer
,
"%s"
,
lua_tostring
(
L
,
-
1
));
handle_message
(
pduel
,
1
);
lua_pop
(
L
,
1
);
return
OPERATION_FAIL
;
}
int32_t
result
=
lua_toboolean
(
L
,
-
1
);
lua_pop
(
L
,
1
);
return
result
;
}
int32_t
interpreter
::
load_script
(
const
char
*
script_name
)
{
int
len
=
0
;
byte
*
buffer
=
::
read_script
(
script_name
,
&
len
);
...
...
interpreter.h
View file @
39de7818
...
...
@@ -64,6 +64,7 @@ public:
void
register_group
(
group
*
pgroup
);
void
unregister_group
(
group
*
pgroup
);
int32_t
is_effect_check
(
lua_State
*
L
,
effect
*
peffect
,
int32_t
findex
,
int32_t
extraargs
);
int32_t
load_script
(
const
char
*
script_name
);
int32_t
load_card_script
(
uint32_t
code
);
void
add_param
(
void
*
param
,
LuaParamType
type
,
bool
front
=
false
);
...
...
libcard.cpp
View file @
39de7818
...
...
@@ -12,6 +12,55 @@
#include "effect.h"
#include "group.h"
int32_t
scriptlib
::
card_get_card_registered
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
if
(
!
lua_isnil
(
L
,
2
))
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int
type
=
GETEFFECT_ALL
;
if
(
!
pcard
)
{
lua_pushnil
(
L
);
return
1
;
}
if
(
lua_gettop
(
L
)
>
2
)
{
check_param
(
L
,
PARAM_TYPE_INT
,
3
);
type
=
lua_tointeger
(
L
,
3
);
}
effect_set
eset
;
duel
*
pduel
=
pcard
->
pduel
;
int32_t
extraargs
=
lua_gettop
(
L
)
-
3
;
for
(
auto
&
eit
:
pcard
->
single_effect
)
{
if
(
pduel
->
lua
->
is_effect_check
(
L
,
eit
.
second
,
2
,
extraargs
))
{
eset
.
push_back
(
eit
.
second
);
}
}
for
(
auto
&
eit
:
pcard
->
field_effect
)
{
if
(
pduel
->
lua
->
is_effect_check
(
L
,
eit
.
second
,
2
,
extraargs
))
{
eset
.
push_back
(
eit
.
second
);
}
}
int
size
=
0
;
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
is_granted
)
{
if
(
type
&
GETEFFECT_GRANT
)
{
interpreter
::
effect2value
(
L
,
eset
[
i
]);
++
size
;
}
}
else
if
((
type
&
GETEFFECT_COPY
&&
eset
[
i
]
->
copy_id
!=
0
)
||
(
type
&
GETEFFECT_INITIAL
&&
eset
[
i
]
->
reset_flag
==
0
&&
eset
[
i
]
->
copy_id
==
0
)
||
(
type
&
GETEFFECT_GAIN
&&
eset
[
i
]
->
reset_flag
!=
0
&&
eset
[
i
]
->
copy_id
==
0
))
{
interpreter
::
effect2value
(
L
,
eset
[
i
]);
++
size
;
}
}
if
(
!
size
)
{
lua_pushnil
(
L
);
return
1
;
}
return
size
;
}
int32_t
scriptlib
::
card_is_ritual_type
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -3588,6 +3637,7 @@ int32_t scriptlib::card_set_spsummon_once(lua_State *L) {
static
const
struct
luaL_Reg
cardlib
[]
=
{
//millux
{
"GetCardRegistered"
,
scriptlib
::
card_get_card_registered
},
{
"IsRitualType"
,
scriptlib
::
card_is_ritual_type
},
{
"SetEntityCode"
,
scriptlib
::
card_set_entity_code
},
{
"SetCardData"
,
scriptlib
::
card_set_card_data
},
...
...
scriptlib.h
View file @
39de7818
...
...
@@ -29,6 +29,7 @@ public:
static
int32_t
check_param_count
(
lua_State
*
L
,
int32_t
count
);
static
int32_t
check_action_permission
(
lua_State
*
L
);
//millux
static
int32_t
card_get_card_registered
(
lua_State
*
L
);
static
int32_t
card_is_ritual_type
(
lua_State
*
L
);
static
int32_t
card_set_entity_code
(
lua_State
*
L
);
static
int32_t
card_set_card_data
(
lua_State
*
L
);
...
...
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