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
a785e260
Commit
a785e260
authored
Dec 24, 2015
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add GetFusionCode
parent
130de2f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
11 deletions
+34
-11
interpreter.cpp
interpreter.cpp
+1
-0
libcard.cpp
libcard.cpp
+32
-11
scriptlib.h
scriptlib.h
+1
-0
No files found.
interpreter.cpp
View file @
a785e260
...
@@ -19,6 +19,7 @@ static const struct luaL_Reg cardlib[] = {
...
@@ -19,6 +19,7 @@ static const struct luaL_Reg cardlib[] = {
{
"GetCode"
,
scriptlib
::
card_get_code
},
{
"GetCode"
,
scriptlib
::
card_get_code
},
{
"GetOriginalCode"
,
scriptlib
::
card_get_origin_code
},
{
"GetOriginalCode"
,
scriptlib
::
card_get_origin_code
},
{
"GetOriginalCodeRule"
,
scriptlib
::
card_get_origin_code_rule
},
{
"GetOriginalCodeRule"
,
scriptlib
::
card_get_origin_code_rule
},
{
"GetFusionCode"
,
scriptlib
::
card_get_fusion_code
},
{
"IsFusionCode"
,
scriptlib
::
card_is_fusion_code
},
{
"IsFusionCode"
,
scriptlib
::
card_is_fusion_code
},
{
"IsSetCard"
,
scriptlib
::
card_is_set_card
},
{
"IsSetCard"
,
scriptlib
::
card_is_set_card
},
{
"IsPreviousSetCard"
,
scriptlib
::
card_is_pre_set_card
},
{
"IsPreviousSetCard"
,
scriptlib
::
card_is_pre_set_card
},
...
...
libcard.cpp
View file @
a785e260
...
@@ -61,24 +61,45 @@ int32 scriptlib::card_get_origin_code_rule(lua_State *L) {
...
@@ -61,24 +61,45 @@ int32 scriptlib::card_get_origin_code_rule(lua_State *L) {
}
}
return
1
;
return
1
;
}
}
int32
scriptlib
::
card_get_fusion_code
(
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_code
());
int32
count
=
1
;
uint32
otcode
=
pcard
->
get_another_code
();
if
(
otcode
)
{
lua_pushinteger
(
L
,
otcode
);
count
++
;
}
effect_set
eset
;
pcard
->
filter_effect
(
EFFECT_ADD_FUSION_CODE
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
lua_pushinteger
(
L
,
eset
[
i
]
->
get_value
(
pcard
));
return
count
+
eset
.
size
();
}
int32
scriptlib
::
card_is_fusion_code
(
lua_State
*
L
)
{
int32
scriptlib
::
card_is_fusion_code
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
tcode
=
lua_tointeger
(
L
,
2
);
effect_set
eset
;
pcard
->
filter_effect
(
EFFECT_ADD_FUSION_CODE
,
&
eset
);
if
(
!
eset
.
size
())
return
card_is_code
(
L
);
uint32
code1
=
pcard
->
get_code
();
uint32
code1
=
pcard
->
get_code
();
uint32
code2
=
pcard
->
get_another_code
();
uint32
code2
=
pcard
->
get_another_code
();
std
::
unordered_set
<
uint32
>
fcode
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
fcode
.
insert
(
eset
[
i
]
->
get_value
(
pcard
));
uint32
count
=
lua_gettop
(
L
)
-
1
;
uint32
result
=
FALSE
;
uint32
result
=
FALSE
;
if
(
code1
==
tcode
||
(
code2
&&
code2
==
tcode
))
{
for
(
uint32
i
=
0
;
i
<
count
;
++
i
)
{
result
=
TRUE
;
if
(
lua_isnil
(
L
,
i
+
2
))
}
else
{
continue
;
effect_set
eset
;
uint32
tcode
=
lua_tointeger
(
L
,
i
+
2
);
pcard
->
filter_effect
(
EFFECT_ADD_FUSION_CODE
,
&
eset
);
if
(
code1
==
tcode
||
(
code2
&&
code2
==
tcode
)
||
fcode
.
find
(
tcode
)
!=
fcode
.
end
())
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
result
=
TRUE
;
if
(
tcode
==
eset
[
i
]
->
get_value
(
pcard
))
{
break
;
result
=
TRUE
;
break
;
}
}
}
}
}
lua_pushboolean
(
L
,
result
);
lua_pushboolean
(
L
,
result
);
...
...
scriptlib.h
View file @
a785e260
...
@@ -21,6 +21,7 @@ public:
...
@@ -21,6 +21,7 @@ public:
static
int32
card_get_code
(
lua_State
*
L
);
static
int32
card_get_code
(
lua_State
*
L
);
static
int32
card_get_origin_code
(
lua_State
*
L
);
static
int32
card_get_origin_code
(
lua_State
*
L
);
static
int32
card_get_origin_code_rule
(
lua_State
*
L
);
static
int32
card_get_origin_code_rule
(
lua_State
*
L
);
static
int32
card_get_fusion_code
(
lua_State
*
L
);
static
int32
card_is_fusion_code
(
lua_State
*
L
);
static
int32
card_is_fusion_code
(
lua_State
*
L
);
static
int32
card_is_set_card
(
lua_State
*
L
);
static
int32
card_is_set_card
(
lua_State
*
L
);
static
int32
card_is_pre_set_card
(
lua_State
*
L
);
static
int32
card_is_pre_set_card
(
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