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
d7dc36c5
Commit
d7dc36c5
authored
Jun 13, 2017
by
nekrozar
Committed by
mercury233
Jun 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function (#92)
parent
3865e448
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
78 additions
and
8 deletions
+78
-8
card.cpp
card.cpp
+18
-2
card.h
card.h
+1
-0
field.cpp
field.cpp
+18
-6
field.h
field.h
+1
-0
interpreter.cpp
interpreter.cpp
+3
-0
libcard.cpp
libcard.cpp
+7
-0
libduel.cpp
libduel.cpp
+27
-0
scriptlib.h
scriptlib.h
+3
-0
No files found.
card.cpp
View file @
d7dc36c5
...
...
@@ -1293,6 +1293,22 @@ uint32 card::get_mutual_linked_zone() {
}
return
zones
;
}
int32
card
::
is_link_state
()
{
if
(
!
(
get_type
()
&
TYPE_MONSTER
))
return
FALSE
;
card
::
card_set
cset1
;
this
->
get_linked_cards
(
&
cset1
);
if
(
cset1
.
size
()
>
0
)
return
TRUE
;
field
::
card_set
cset2
;
int32
p
=
current
.
controler
;
uint32
linked_zone
=
pduel
->
game_field
->
get_linked_zone
(
p
)
|
pduel
->
game_field
->
get_linked_zone
(
1
-
p
);
pduel
->
game_field
->
get_cards_in_zone
(
&
cset2
,
linked_zone
,
p
);
pduel
->
game_field
->
get_cards_in_zone
(
&
cset2
,
linked_zone
,
1
-
p
);
if
(
cset2
.
find
(
this
)
!=
cset2
.
end
())
return
TRUE
;
return
FALSE
;
}
int32
card
::
is_position
(
int32
pos
)
{
return
current
.
position
&
pos
;
}
...
...
card.h
View file @
d7dc36c5
...
...
@@ -199,6 +199,7 @@ public:
uint32
get_linked_zone
();
void
get_linked_cards
(
card_set
*
cset
);
uint32
get_mutual_linked_zone
();
int32
is_link_state
();
int32
is_position
(
int32
pos
);
void
set_status
(
uint32
status
,
int32
enabled
);
int32
get_status
(
uint32
status
);
...
...
field.cpp
View file @
d7dc36c5
...
...
@@ -704,6 +704,18 @@ uint32 field::get_linked_zone(int32 playerid) {
}
return
zones
;
}
void
field
::
get_linked_cards
(
uint8
self
,
uint8
s
,
uint8
o
,
card_set
*
cset
)
{
cset
->
clear
();
uint8
c
=
s
;
for
(
int32
p
=
0
;
p
<
2
;
++
p
)
{
if
(
c
)
{
uint32
linked_zone
=
get_linked_zone
(
self
);
get_cards_in_zone
(
cset
,
linked_zone
,
self
);
}
self
=
1
-
self
;
c
=
o
;
}
}
int32
field
::
check_extra_link
(
int32
playerid
)
{
if
(
!
player
[
playerid
].
list_mzone
[
5
]
||
!
player
[
playerid
].
list_mzone
[
6
])
return
FALSE
;
...
...
field.h
View file @
d7dc36c5
...
...
@@ -351,6 +351,7 @@ public:
int32
get_mzone_limit
(
uint8
playerid
,
uint8
uplayer
,
uint32
reason
);
int32
get_szone_limit
(
uint8
playerid
,
uint8
uplayer
,
uint32
reason
);
uint32
get_linked_zone
(
int32
playerid
);
void
get_linked_cards
(
uint8
self
,
uint8
s
,
uint8
o
,
card_set
*
cset
);
int32
check_extra_link
(
int32
playerid
);
int32
check_extra_link
(
int32
playerid
,
card
*
pcard
,
int32
sequence
);
void
get_cards_in_zone
(
card_set
*
cset
,
uint32
zone
,
int32
playerid
);
...
...
interpreter.cpp
View file @
d7dc36c5
...
...
@@ -45,6 +45,7 @@ static const struct luaL_Reg cardlib[] = {
{
"GetLinkedGroup"
,
scriptlib
::
card_get_linked_group
},
{
"GetLinkedGroupCount"
,
scriptlib
::
card_get_linked_group_count
},
{
"GetLinkedZone"
,
scriptlib
::
card_get_linked_zone
},
{
"IsLinkState"
,
scriptlib
::
card_is_link_state
},
{
"GetAttribute"
,
scriptlib
::
card_get_attribute
},
{
"GetOriginalAttribute"
,
scriptlib
::
card_get_origin_attribute
},
{
"GetFusionAttribute"
,
scriptlib
::
card_get_fusion_attribute
},
...
...
@@ -413,6 +414,8 @@ static const struct luaL_Reg duellib[] = {
{
"GetLocationCount"
,
scriptlib
::
duel_get_location_count
},
{
"GetLocationCountFromEx"
,
scriptlib
::
duel_get_location_count_fromex
},
{
"GetUsableMZoneCount"
,
scriptlib
::
duel_get_usable_mzone_count
},
{
"GetLinkedGroup"
,
scriptlib
::
duel_get_linked_group
},
{
"GetLinkedGroupCount"
,
scriptlib
::
duel_get_linked_group_count
},
{
"GetLinkedZone"
,
scriptlib
::
duel_get_linked_zone
},
{
"GetFieldCard"
,
scriptlib
::
duel_get_field_card
},
{
"CheckLocation"
,
scriptlib
::
duel_check_location
},
...
...
libcard.cpp
View file @
d7dc36c5
...
...
@@ -297,6 +297,13 @@ int32 scriptlib::card_get_linked_zone(lua_State *L) {
lua_pushinteger
(
L
,
pcard
->
get_linked_zone
());
return
1
;
}
int32
scriptlib
::
card_is_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_link_state
());
return
1
;
}
int32
scriptlib
::
card_get_attribute
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
libduel.cpp
View file @
d7dc36c5
...
...
@@ -1588,6 +1588,33 @@ int32 scriptlib::duel_get_usable_mzone_count(lua_State *L) {
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_useable_count
(
playerid
,
LOCATION_MZONE
,
uplayer
,
LOCATION_REASON_TOFIELD
,
zone
));
return
1
;
}
int32
scriptlib
::
duel_get_linked_group
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
uint32
rplayer
=
lua_tointeger
(
L
,
1
);
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
return
0
;
uint32
s
=
lua_tointeger
(
L
,
2
);
uint32
o
=
lua_tointeger
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
field
::
card_set
cset
;
pduel
->
game_field
->
get_linked_cards
(
rplayer
,
s
,
o
,
&
cset
);
group
*
pgroup
=
pduel
->
new_group
(
cset
);
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
}
int32
scriptlib
::
duel_get_linked_group_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
uint32
rplayer
=
lua_tointeger
(
L
,
1
);
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
return
0
;
uint32
s
=
lua_tointeger
(
L
,
2
);
uint32
o
=
lua_tointeger
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
field
::
card_set
cset
;
pduel
->
game_field
->
get_linked_cards
(
rplayer
,
s
,
o
,
&
cset
);
lua_pushinteger
(
L
,
cset
.
size
());
return
1
;
}
int32
scriptlib
::
duel_get_linked_zone
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_tointeger
(
L
,
1
);
...
...
scriptlib.h
View file @
d7dc36c5
...
...
@@ -47,6 +47,7 @@ public:
static
int32
card_get_linked_group
(
lua_State
*
L
);
static
int32
card_get_linked_group_count
(
lua_State
*
L
);
static
int32
card_get_linked_zone
(
lua_State
*
L
);
static
int32
card_is_link_state
(
lua_State
*
L
);
static
int32
card_get_attribute
(
lua_State
*
L
);
static
int32
card_get_origin_attribute
(
lua_State
*
L
);
static
int32
card_get_fusion_attribute
(
lua_State
*
L
);
...
...
@@ -410,6 +411,8 @@ public:
static
int32
duel_get_location_count
(
lua_State
*
L
);
static
int32
duel_get_location_count_fromex
(
lua_State
*
L
);
static
int32
duel_get_usable_mzone_count
(
lua_State
*
L
);
static
int32
duel_get_linked_group
(
lua_State
*
L
);
static
int32
duel_get_linked_group_count
(
lua_State
*
L
);
static
int32
duel_get_linked_zone
(
lua_State
*
L
);
static
int32
duel_get_field_card
(
lua_State
*
L
);
static
int32
duel_check_location
(
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