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
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
MyCard
ygopro-core
Commits
f7212e86
Commit
f7212e86
authored
Mar 25, 2017
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function
parent
0ac8029c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
17 deletions
+77
-17
card.cpp
card.cpp
+10
-6
card.h
card.h
+11
-9
interpreter.cpp
interpreter.cpp
+4
-0
libcard.cpp
libcard.cpp
+34
-0
operations.cpp
operations.cpp
+14
-2
scriptlib.h
scriptlib.h
+4
-0
No files found.
card.cpp
View file @
f7212e86
...
@@ -209,12 +209,16 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
...
@@ -209,12 +209,16 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
q_cache
.
rscale
=
tdata
;
q_cache
.
rscale
=
tdata
;
*
p
++
=
tdata
;
*
p
++
=
tdata
;
}
else
query_flag
&=
~
QUERY_RSCALE
;
}
else
query_flag
&=
~
QUERY_RSCALE
;
if
((
query_flag
&
QUERY_LINK
)
&&
((
get_link
()
!=
q_cache
.
link
)
||
(
get_link_marker
()
!=
q_cache
.
link_marker
)))
{
if
(
query_flag
&
QUERY_LINK
)
{
q_cache
.
link
=
get_link
();
uint32
link
=
get_link
();
*
p
++
=
tdata
;
uint32
link_marker
=
get_link_marker
();
q_cache
.
link_marker
=
get_link_marker
();
if
((
link
!=
q_cache
.
link
)
||
(
link_marker
!=
q_cache
.
link_marker
))
{
*
p
++
=
tdata
;
q_cache
.
link
=
link
;
}
else
query_flag
&=
~
QUERY_LINK
;
*
p
++
=
(
int32
)
link
;
q_cache
.
link_marker
=
link_marker
;
*
p
++
=
(
int32
)
link_marker
;
}
else
query_flag
&=
~
QUERY_LINK
;
}
}
}
*
(
uint32
*
)
buf
=
(
byte
*
)
p
-
buf
;
*
(
uint32
*
)
buf
=
(
byte
*
)
p
-
buf
;
*
(
uint32
*
)(
buf
+
4
)
=
query_flag
;
*
(
uint32
*
)(
buf
+
4
)
=
query_flag
;
...
...
card.h
View file @
f7212e86
...
@@ -414,17 +414,19 @@ public:
...
@@ -414,17 +414,19 @@ public:
#define REASON_REPLACE 0x1000000 //
#define REASON_REPLACE 0x1000000 //
#define REASON_DRAW 0x2000000 //
#define REASON_DRAW 0x2000000 //
#define REASON_REDIRECT 0x4000000 //
#define REASON_REDIRECT 0x4000000 //
#define REASON_LINK 0x8000000 //
//Summon Type
//Summon Type
#define SUMMON_TYPE_NORMAL 0x10000000
#define SUMMON_TYPE_NORMAL
0x10000000
#define SUMMON_TYPE_ADVANCE 0x11000000
#define SUMMON_TYPE_ADVANCE
0x11000000
#define SUMMON_TYPE_DUAL 0x12000000
#define SUMMON_TYPE_DUAL
0x12000000
#define SUMMON_TYPE_FLIP 0x20000000
#define SUMMON_TYPE_FLIP
0x20000000
#define SUMMON_TYPE_SPECIAL 0x40000000
#define SUMMON_TYPE_SPECIAL
0x40000000
#define SUMMON_TYPE_FUSION 0x43000000
#define SUMMON_TYPE_FUSION
0x43000000
#define SUMMON_TYPE_RITUAL 0x45000000
#define SUMMON_TYPE_RITUAL
0x45000000
#define SUMMON_TYPE_SYNCHRO 0x46000000
#define SUMMON_TYPE_SYNCHRO
0x46000000
#define SUMMON_TYPE_XYZ 0x49000000
#define SUMMON_TYPE_XYZ
0x49000000
#define SUMMON_TYPE_PENDULUM 0x4a000000
#define SUMMON_TYPE_PENDULUM 0x4a000000
#define SUMMON_TYPE_LINK 0x4c000000
//Status
//Status
#define STATUS_DISABLED 0x0001 //
#define STATUS_DISABLED 0x0001 //
#define STATUS_TO_ENABLE 0x0002 //
#define STATUS_TO_ENABLE 0x0002 //
...
...
interpreter.cpp
View file @
f7212e86
...
@@ -30,6 +30,7 @@ static const struct luaL_Reg cardlib[] = {
...
@@ -30,6 +30,7 @@ static const struct luaL_Reg cardlib[] = {
{
"GetFusionType"
,
scriptlib
::
card_get_fusion_type
},
{
"GetFusionType"
,
scriptlib
::
card_get_fusion_type
},
{
"GetLevel"
,
scriptlib
::
card_get_level
},
{
"GetLevel"
,
scriptlib
::
card_get_level
},
{
"GetRank"
,
scriptlib
::
card_get_rank
},
{
"GetRank"
,
scriptlib
::
card_get_rank
},
{
"GetLink"
,
scriptlib
::
card_get_link
},
{
"GetSynchroLevel"
,
scriptlib
::
card_get_synchro_level
},
{
"GetSynchroLevel"
,
scriptlib
::
card_get_synchro_level
},
{
"GetRitualLevel"
,
scriptlib
::
card_get_ritual_level
},
{
"GetRitualLevel"
,
scriptlib
::
card_get_ritual_level
},
{
"GetOriginalLevel"
,
scriptlib
::
card_get_origin_level
},
{
"GetOriginalLevel"
,
scriptlib
::
card_get_origin_level
},
...
@@ -39,6 +40,9 @@ static const struct luaL_Reg cardlib[] = {
...
@@ -39,6 +40,9 @@ static const struct luaL_Reg cardlib[] = {
{
"GetOriginalLeftScale"
,
scriptlib
::
card_get_origin_lscale
},
{
"GetOriginalLeftScale"
,
scriptlib
::
card_get_origin_lscale
},
{
"GetRightScale"
,
scriptlib
::
card_get_rscale
},
{
"GetRightScale"
,
scriptlib
::
card_get_rscale
},
{
"GetOriginalRightScale"
,
scriptlib
::
card_get_origin_rscale
},
{
"GetOriginalRightScale"
,
scriptlib
::
card_get_origin_rscale
},
{
"IsLinkMarker"
,
scriptlib
::
card_is_link_marker
},
{
"GetLinkedGroup"
,
scriptlib
::
card_get_linked_group
},
{
"GetLinkedGroupCount"
,
scriptlib
::
card_get_linked_group_count
},
{
"GetAttribute"
,
scriptlib
::
card_get_attribute
},
{
"GetAttribute"
,
scriptlib
::
card_get_attribute
},
{
"GetOriginalAttribute"
,
scriptlib
::
card_get_origin_attribute
},
{
"GetOriginalAttribute"
,
scriptlib
::
card_get_origin_attribute
},
{
"GetFusionAttribute"
,
scriptlib
::
card_get_fusion_attribute
},
{
"GetFusionAttribute"
,
scriptlib
::
card_get_fusion_attribute
},
...
...
libcard.cpp
View file @
f7212e86
...
@@ -175,6 +175,13 @@ int32 scriptlib::card_get_rank(lua_State *L) {
...
@@ -175,6 +175,13 @@ int32 scriptlib::card_get_rank(lua_State *L) {
lua_pushinteger
(
L
,
pcard
->
get_rank
());
lua_pushinteger
(
L
,
pcard
->
get_rank
());
return
1
;
return
1
;
}
}
int32
scriptlib
::
card_get_link
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
lua_pushinteger
(
L
,
pcard
->
get_link
());
return
1
;
}
int32
scriptlib
::
card_get_synchro_level
(
lua_State
*
L
)
{
int32
scriptlib
::
card_get_synchro_level
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
...
@@ -249,6 +256,33 @@ int32 scriptlib::card_get_origin_rscale(lua_State *L) {
...
@@ -249,6 +256,33 @@ int32 scriptlib::card_get_origin_rscale(lua_State *L) {
lua_pushinteger
(
L
,
pcard
->
data
.
rscale
);
lua_pushinteger
(
L
,
pcard
->
data
.
rscale
);
return
1
;
return
1
;
}
}
int32
scriptlib
::
card_is_link_marker
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
dir
=
lua_tointeger
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
is_link_marker
(
dir
));
return
1
;
}
int32
scriptlib
::
card_get_linked_group
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
::
card_set
cset
;
pcard
->
get_linked_cards
(
&
cset
);
group
*
pgroup
=
pcard
->
pduel
->
new_group
(
cset
);
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
}
int32
scriptlib
::
card_get_linked_group_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
::
card_set
cset
;
pcard
->
get_linked_cards
(
&
cset
);
lua_pushinteger
(
L
,
cset
.
size
());
return
1
;
}
int32
scriptlib
::
card_get_attribute
(
lua_State
*
L
)
{
int32
scriptlib
::
card_get_attribute
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
operations.cpp
View file @
f7212e86
...
@@ -2300,7 +2300,13 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target, ui
...
@@ -2300,7 +2300,13 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target, ui
}
}
case
6
:
{
case
6
:
{
effect
*
proc
=
core
.
units
.
begin
()
->
peffect
;
effect
*
proc
=
core
.
units
.
begin
()
->
peffect
;
int32
matreason
=
proc
->
value
==
SUMMON_TYPE_SYNCHRO
?
REASON_SYNCHRO
:
proc
->
value
==
SUMMON_TYPE_XYZ
?
REASON_XYZ
:
REASON_SPSUMMON
;
int32
matreason
=
REASON_SPSUMMON
;
if
(
proc
->
value
==
SUMMON_TYPE_SYNCHRO
)
matreason
=
REASON_SYNCHRO
;
else
if
(
proc
->
value
==
SUMMON_TYPE_XYZ
)
matreason
=
SUMMON_TYPE_XYZ
;
else
if
(
proc
->
value
==
SUMMON_TYPE_LINK
)
matreason
=
REASON_LINK
;
if
(
target
->
material_cards
.
size
())
{
if
(
target
->
material_cards
.
size
())
{
for
(
auto
mit
=
target
->
material_cards
.
begin
();
mit
!=
target
->
material_cards
.
end
();
++
mit
)
for
(
auto
mit
=
target
->
material_cards
.
begin
();
mit
!=
target
->
material_cards
.
end
();
++
mit
)
raise_single_event
(
*
mit
,
0
,
EVENT_BE_PRE_MATERIAL
,
proc
,
matreason
,
sumplayer
,
sumplayer
,
0
);
raise_single_event
(
*
mit
,
0
,
EVENT_BE_PRE_MATERIAL
,
proc
,
matreason
,
sumplayer
,
sumplayer
,
0
);
...
@@ -2366,7 +2372,13 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target, ui
...
@@ -2366,7 +2372,13 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target, ui
pduel
->
write_buffer8
(
MSG_SPSUMMONED
);
pduel
->
write_buffer8
(
MSG_SPSUMMONED
);
adjust_instant
();
adjust_instant
();
effect
*
proc
=
core
.
units
.
begin
()
->
peffect
;
effect
*
proc
=
core
.
units
.
begin
()
->
peffect
;
int32
matreason
=
proc
->
value
==
SUMMON_TYPE_SYNCHRO
?
REASON_SYNCHRO
:
proc
->
value
==
SUMMON_TYPE_XYZ
?
REASON_XYZ
:
REASON_SPSUMMON
;
int32
matreason
=
REASON_SPSUMMON
;
if
(
proc
->
value
==
SUMMON_TYPE_SYNCHRO
)
matreason
=
REASON_SYNCHRO
;
else
if
(
proc
->
value
==
SUMMON_TYPE_XYZ
)
matreason
=
SUMMON_TYPE_XYZ
;
else
if
(
proc
->
value
==
SUMMON_TYPE_LINK
)
matreason
=
REASON_LINK
;
if
(
target
->
material_cards
.
size
())
{
if
(
target
->
material_cards
.
size
())
{
for
(
auto
mit
=
target
->
material_cards
.
begin
();
mit
!=
target
->
material_cards
.
end
();
++
mit
)
for
(
auto
mit
=
target
->
material_cards
.
begin
();
mit
!=
target
->
material_cards
.
end
();
++
mit
)
raise_single_event
(
*
mit
,
0
,
EVENT_BE_MATERIAL
,
proc
,
matreason
,
sumplayer
,
sumplayer
,
0
);
raise_single_event
(
*
mit
,
0
,
EVENT_BE_MATERIAL
,
proc
,
matreason
,
sumplayer
,
sumplayer
,
0
);
...
...
scriptlib.h
View file @
f7212e86
...
@@ -32,6 +32,7 @@ public:
...
@@ -32,6 +32,7 @@ public:
static
int32
card_get_fusion_type
(
lua_State
*
L
);
static
int32
card_get_fusion_type
(
lua_State
*
L
);
static
int32
card_get_level
(
lua_State
*
L
);
static
int32
card_get_level
(
lua_State
*
L
);
static
int32
card_get_rank
(
lua_State
*
L
);
static
int32
card_get_rank
(
lua_State
*
L
);
static
int32
card_get_link
(
lua_State
*
L
);
static
int32
card_get_synchro_level
(
lua_State
*
L
);
static
int32
card_get_synchro_level
(
lua_State
*
L
);
static
int32
card_get_ritual_level
(
lua_State
*
L
);
static
int32
card_get_ritual_level
(
lua_State
*
L
);
static
int32
card_get_origin_level
(
lua_State
*
L
);
static
int32
card_get_origin_level
(
lua_State
*
L
);
...
@@ -41,6 +42,9 @@ public:
...
@@ -41,6 +42,9 @@ public:
static
int32
card_get_origin_lscale
(
lua_State
*
L
);
static
int32
card_get_origin_lscale
(
lua_State
*
L
);
static
int32
card_get_rscale
(
lua_State
*
L
);
static
int32
card_get_rscale
(
lua_State
*
L
);
static
int32
card_get_origin_rscale
(
lua_State
*
L
);
static
int32
card_get_origin_rscale
(
lua_State
*
L
);
static
int32
card_is_link_marker
(
lua_State
*
L
);
static
int32
card_get_linked_group
(
lua_State
*
L
);
static
int32
card_get_linked_group_count
(
lua_State
*
L
);
static
int32
card_get_attribute
(
lua_State
*
L
);
static
int32
card_get_attribute
(
lua_State
*
L
);
static
int32
card_get_origin_attribute
(
lua_State
*
L
);
static
int32
card_get_origin_attribute
(
lua_State
*
L
);
static
int32
card_get_fusion_attribute
(
lua_State
*
L
);
static
int32
card_get_fusion_attribute
(
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