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
514a7d8f
Commit
514a7d8f
authored
Apr 27, 2018
by
nekrozar
Committed by
nanahira
Apr 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Card.IsExtraLinkState (#139)
parent
c5fac431
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
0 deletions
+54
-0
card.cpp
card.cpp
+43
-0
card.h
card.h
+2
-0
interpreter.cpp
interpreter.cpp
+1
-0
libcard.cpp
libcard.cpp
+7
-0
scriptlib.h
scriptlib.h
+1
-0
No files found.
card.cpp
View file @
514a7d8f
...
...
@@ -1368,6 +1368,49 @@ int32 card::is_link_state() {
return TRUE;
return FALSE;
}
int32 card::is_extra_link_state() {
if(current.location != LOCATION_MZONE)
return FALSE;
card_set cset;
card_set excset;
for(int32 p = 0; p < 2; ++p) {
card* pcard1 = pduel->game_field->player[p].list_mzone[5];
if(pcard1)
excset.insert(pcard1);
card* pcard2 = pduel->game_field->player[p].list_mzone[6];
if(pcard2)
excset.insert(pcard2);
}
if(excset.size() < 2)
return FALSE;
auto cit = excset.begin();
card* pcard = *cit;
excset.erase(pcard);
card_set linked_group1;
pcard->get_mutual_linked_cards(&linked_group1);
if(!linked_group1.size())
return FALSE;
cset.insert(pcard);
return check_extra_link(this, &cset, &excset, &linked_group1);
}
int32 card::check_extra_link(card* scard, card_set* cset, card_set* excset, card_set* linked_group1) {
for(auto cit = linked_group1->begin(); cit != linked_group1->end(); ++cit) {
card* pcard = *cit;
if(excset->find(pcard) != cset->end())
if(cset->find(scard) != cset->end())
return TRUE;
if(cset->find(pcard) != cset->end())
continue;
card_set linked_group2;
pcard->get_mutual_linked_cards(&linked_group2);
if(!linked_group2.size())
continue;
cset->insert(pcard);
if(check_extra_link(scard, cset, excset, &linked_group2))
return TRUE;
}
return FALSE;
}
int32 card::is_position(int32 pos) {
return current.position & pos;
}
...
...
card.h
View file @
514a7d8f
...
...
@@ -227,6 +227,8 @@ public:
uint32
get_mutual_linked_zone
();
void
get_mutual_linked_cards
(
card_set
*
cset
);
int32
is_link_state
();
int32
is_extra_link_state
();
int32
check_extra_link
(
card
*
scard
,
card_set
*
cset
,
card_set
*
excset
,
card_set
*
linked_group1
);
int32
is_position
(
int32
pos
);
void
set_status
(
uint32
status
,
int32
enabled
);
int32
get_status
(
uint32
status
);
...
...
interpreter.cpp
View file @
514a7d8f
...
...
@@ -54,6 +54,7 @@ static const struct luaL_Reg cardlib[] = {
{
"GetMutualLinkedGroupCount"
,
scriptlib
::
card_get_mutual_linked_group_count
},
{
"GetMutualLinkedZone"
,
scriptlib
::
card_get_mutual_linked_zone
},
{
"IsLinkState"
,
scriptlib
::
card_is_link_state
},
{
"IsExtraLinkState"
,
scriptlib
::
card_is_extra_link_state
},
{
"GetColumnGroup"
,
scriptlib
::
card_get_column_group
},
{
"GetColumnGroupCount"
,
scriptlib
::
card_get_column_group_count
},
{
"GetColumnZone"
,
scriptlib
::
card_get_column_zone
},
...
...
libcard.cpp
View file @
514a7d8f
...
...
@@ -413,6 +413,13 @@ int32 scriptlib::card_is_link_state(lua_State *L) {
lua_pushboolean
(
L
,
pcard
->
is_link_state
());
return
1
;
}
int32
scriptlib
::
card_is_extra_link_state
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
lua_pushboolean
(
L
,
pcard
->
is_extra_link_state
());
return
1
;
}
int32
scriptlib
::
card_get_column_group
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
scriptlib.h
View file @
514a7d8f
...
...
@@ -56,6 +56,7 @@ public:
static
int32
card_get_mutual_linked_group_count
(
lua_State
*
L
);
static
int32
card_get_mutual_linked_zone
(
lua_State
*
L
);
static
int32
card_is_link_state
(
lua_State
*
L
);
static
int32
card_is_extra_link_state
(
lua_State
*
L
);
static
int32
card_get_column_group
(
lua_State
*
L
);
static
int32
card_get_column_group_count
(
lua_State
*
L
);
static
int32
card_get_column_zone
(
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