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
30cdb7da
Commit
30cdb7da
authored
Oct 21, 2017
by
DailyShana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
add Duel.GetMZoneCount remove Card.CheckMZoneFromEx revert #104
parent
5582738e
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
73 additions
and
40 deletions
+73
-40
card.cpp
card.cpp
+2
-2
card.h
card.h
+1
-1
field.cpp
field.cpp
+9
-9
field.h
field.h
+4
-4
interpreter.cpp
interpreter.cpp
+1
-1
libcard.cpp
libcard.cpp
+1
-18
libduel.cpp
libduel.cpp
+54
-4
scriptlib.h
scriptlib.h
+1
-1
No files found.
card.cpp
View file @
30cdb7da
...
...
@@ -3028,7 +3028,7 @@ int32 card::is_special_summonable(uint8 playerid, uint32 summon_type) {
pduel
->
game_field
->
restore_lp_cost
();
return
eset
.
size
();
}
int32
card
::
is_can_be_special_summoned
(
effect
*
reason_effect
,
uint32
sumtype
,
uint8
sumpos
,
uint8
sumplayer
,
uint8
toplayer
,
uint8
nocheck
,
uint8
nolimit
,
uint32
zone
,
uint8
nozoneusedcheck
)
{
int32
card
::
is_can_be_special_summoned
(
effect
*
reason_effect
,
uint32
sumtype
,
uint8
sumpos
,
uint8
sumplayer
,
uint8
toplayer
,
uint8
nocheck
,
uint8
nolimit
,
uint32
zone
)
{
if
(
current
.
location
==
LOCATION_MZONE
)
return
FALSE
;
if
(
current
.
location
==
LOCATION_REMOVED
&&
(
current
.
position
&
POS_FACEDOWN
))
...
...
@@ -3052,7 +3052,7 @@ int32 card::is_can_be_special_summoned(effect* reason_effect, uint32 sumtype, ui
if
(
is_status
(
STATUS_FORBIDDEN
))
return
FALSE
;
if
(
zone
!=
0xff
)
{
if
(
pduel
->
game_field
->
get_useable_count
(
this
,
toplayer
,
LOCATION_MZONE
,
sumplayer
,
LOCATION_REASON_TOFIELD
,
zone
,
0
,
nozoneusedcheck
)
<=
0
)
if
(
pduel
->
game_field
->
get_useable_count
(
this
,
toplayer
,
LOCATION_MZONE
,
sumplayer
,
LOCATION_REASON_TOFIELD
,
zone
,
0
)
<=
0
)
return
FALSE
;
}
pduel
->
game_field
->
save_lp_cost
();
...
...
card.h
View file @
30cdb7da
...
...
@@ -302,7 +302,7 @@ public:
int32
get_set_tribute_count
();
int32
is_can_be_flip_summoned
(
uint8
playerid
);
int32
is_special_summonable
(
uint8
playerid
,
uint32
summon_type
);
int32
is_can_be_special_summoned
(
effect
*
reason_effect
,
uint32
sumtype
,
uint8
sumpos
,
uint8
sumplayer
,
uint8
toplayer
,
uint8
nocheck
,
uint8
nolimit
,
uint32
zone
,
uint8
nozoneusedcheck
=
0
);
int32
is_can_be_special_summoned
(
effect
*
reason_effect
,
uint32
sumtype
,
uint8
sumpos
,
uint8
sumplayer
,
uint8
toplayer
,
uint8
nocheck
,
uint8
nolimit
,
uint32
zone
);
int32
is_setable_mzone
(
uint8
playerid
,
uint8
ignore_count
,
effect
*
peffect
,
uint8
min_tribute
,
uint32
zone
=
0x1f
);
int32
is_setable_szone
(
uint8
playerid
,
uint8
ignore_fd
=
0
);
int32
is_affect_by_effect
(
effect
*
peffect
);
...
...
field.cpp
View file @
30cdb7da
...
...
@@ -531,13 +531,13 @@ card* field::get_field_card(uint32 playerid, uint32 location, uint32 sequence) {
return
0
;
}
// return: the given slot in LOCATION_MZONE or all LOCATION_SZONE is available or not
int32
field
::
is_location_useable
(
uint32
playerid
,
uint32
location
,
uint32
sequence
,
uint8
neglect_used
)
{
uint32
flag
=
player
[
playerid
].
disabled_location
|
(
neglect_used
?
0
:
player
[
playerid
].
used_location
)
;
int32
field
::
is_location_useable
(
uint32
playerid
,
uint32
location
,
uint32
sequence
)
{
uint32
flag
=
player
[
playerid
].
disabled_location
|
player
[
playerid
].
used_location
;
if
(
location
==
LOCATION_MZONE
)
{
if
(
flag
&
(
0x1u
<<
sequence
))
return
FALSE
;
if
(
sequence
>=
5
)
{
uint32
oppo
=
player
[
1
-
playerid
].
disabled_location
|
(
neglect_used
?
0
:
player
[
1
-
playerid
].
used_location
)
;
uint32
oppo
=
player
[
1
-
playerid
].
disabled_location
|
player
[
1
-
playerid
].
used_location
;
if
(
oppo
&
(
0x1u
<<
(
11
-
sequence
)))
return
FALSE
;
}
...
...
@@ -561,11 +561,11 @@ int32 field::is_location_useable(uint32 playerid, uint32 location, uint32 sequen
// uplayer: request player, PLAYER_NONE means ignoring EFFECT_MAX_MZONE, EFFECT_MAX_SZONE
// list: store local flag in list
// return: usable count of LOCATION_MZONE or real LOCATION_SZONE of playerid requested by uplayer (may be negative)
int32
field
::
get_useable_count
(
card
*
pcard
,
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
,
uint32
*
list
,
uint8
neglect_used
)
{
int32
field
::
get_useable_count
(
card
*
pcard
,
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
,
uint32
*
list
)
{
if
(
core
.
duel_rule
>=
4
&&
location
==
LOCATION_MZONE
&&
pcard
->
current
.
location
==
LOCATION_EXTRA
)
return
get_useable_count_fromex
(
pcard
,
playerid
,
uplayer
,
zone
,
list
);
else
return
get_useable_count
(
playerid
,
location
,
uplayer
,
reason
,
zone
,
list
,
neglect_used
);
return
get_useable_count
(
playerid
,
location
,
uplayer
,
reason
,
zone
,
list
);
}
int32
field
::
get_spsummonable_count
(
card
*
pcard
,
uint8
playerid
,
uint32
zone
,
uint32
*
list
)
{
if
(
core
.
duel_rule
>=
4
&&
pcard
->
current
.
location
==
LOCATION_EXTRA
)
...
...
@@ -573,8 +573,8 @@ int32 field::get_spsummonable_count(card* pcard, uint8 playerid, uint32 zone, ui
else
return
get_tofield_count
(
playerid
,
LOCATION_MZONE
,
zone
,
list
);
}
int32
field
::
get_useable_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
,
uint32
*
list
,
uint8
neglect_used
)
{
int32
count
=
get_tofield_count
(
playerid
,
location
,
zone
,
list
,
neglect_used
);
int32
field
::
get_useable_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
,
uint32
*
list
)
{
int32
count
=
get_tofield_count
(
playerid
,
location
,
zone
,
list
);
int32
limit
;
if
(
location
==
LOCATION_MZONE
)
limit
=
get_mzone_limit
(
playerid
,
uplayer
,
reason
);
...
...
@@ -584,10 +584,10 @@ int32 field::get_useable_count(uint8 playerid, uint8 location, uint8 uplayer, ui
count
=
limit
;
return
count
;
}
int32
field
::
get_tofield_count
(
uint8
playerid
,
uint8
location
,
uint32
zone
,
uint32
*
list
,
uint8
neglect_used
)
{
int32
field
::
get_tofield_count
(
uint8
playerid
,
uint8
location
,
uint32
zone
,
uint32
*
list
)
{
if
(
location
!=
LOCATION_MZONE
&&
location
!=
LOCATION_SZONE
)
return
0
;
uint32
flag
=
player
[
playerid
].
disabled_location
|
(
neglect_used
?
0
:
player
[
playerid
].
used_location
)
;
uint32
flag
=
player
[
playerid
].
disabled_location
|
player
[
playerid
].
used_location
;
if
(
location
==
LOCATION_MZONE
)
flag
=
(
flag
|
~
zone
)
&
0x1f
;
else
...
...
field.h
View file @
30cdb7da
...
...
@@ -352,11 +352,11 @@ public:
void
swap_card
(
card
*
pcard1
,
card
*
pcard2
);
void
set_control
(
card
*
pcard
,
uint8
playerid
,
uint16
reset_phase
,
uint8
reset_count
);
card
*
get_field_card
(
uint32
playerid
,
uint32
location
,
uint32
sequence
);
int32
is_location_useable
(
uint32
playerid
,
uint32
location
,
uint32
sequence
,
uint8
neglect_used
=
0
);
int32
get_useable_count
(
card
*
pcard
,
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
,
uint8
neglect_used
=
0
);
int32
is_location_useable
(
uint32
playerid
,
uint32
location
,
uint32
sequence
);
int32
get_useable_count
(
card
*
pcard
,
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_spsummonable_count
(
card
*
pcard
,
uint8
playerid
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_useable_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
,
uint8
neglect_used
=
0
);
int32
get_tofield_count
(
uint8
playerid
,
uint8
location
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
,
uint8
neglect_used
=
0
);
int32
get_useable_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_tofield_count
(
uint8
playerid
,
uint8
location
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_useable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_spsummonable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_mzone_limit
(
uint8
playerid
,
uint8
uplayer
,
uint32
reason
);
...
...
interpreter.cpp
View file @
30cdb7da
...
...
@@ -256,7 +256,6 @@ static const struct luaL_Reg cardlib[] = {
{
"ResetNegateEffect"
,
scriptlib
::
card_reset_negate_effect
},
{
"AssumeProperty"
,
scriptlib
::
card_assume_prop
},
{
"SetSPSummonOnce"
,
scriptlib
::
card_set_spsummon_once
},
{
"CheckMZoneFromEx"
,
scriptlib
::
card_check_mzone_from_ex
},
{
NULL
,
NULL
}
};
...
...
@@ -433,6 +432,7 @@ static const struct luaL_Reg duellib[] = {
{
"IncreaseSummonedCount"
,
scriptlib
::
duel_increase_summon_count
},
{
"CheckSummonedCount"
,
scriptlib
::
duel_check_summon_count
},
{
"GetLocationCount"
,
scriptlib
::
duel_get_location_count
},
{
"GetMZoneCount"
,
scriptlib
::
duel_get_mzone_count
},
{
"GetLocationCountFromEx"
,
scriptlib
::
duel_get_location_count_fromex
},
{
"GetUsableMZoneCount"
,
scriptlib
::
duel_get_usable_mzone_count
},
{
"GetLinkedGroup"
,
scriptlib
::
duel_get_linked_group
},
...
...
libcard.cpp
View file @
30cdb7da
...
...
@@ -1800,9 +1800,7 @@ int32 scriptlib::card_is_can_be_special_summoned(lua_State *L) {
toplayer
=
lua_tointeger
(
L
,
8
);
if
(
lua_gettop
(
L
)
>=
9
)
zone
=
lua_tointeger
(
L
,
9
);
if
(
lua_gettop
(
L
)
>=
10
)
nozoneusedcheck
=
lua_toboolean
(
L
,
10
);
if
(
pcard
->
is_can_be_special_summoned
(
peffect
,
sumtype
,
sumpos
,
sumplayer
,
toplayer
,
nocheck
,
nolimit
,
zone
,
nozoneusedcheck
))
if
(
pcard
->
is_can_be_special_summoned
(
peffect
,
sumtype
,
sumpos
,
sumplayer
,
toplayer
,
nocheck
,
nolimit
,
zone
))
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
...
...
@@ -2782,18 +2780,3 @@ int32 scriptlib::card_set_spsummon_once(lua_State *L) {
pcard
->
pduel
->
game_field
->
core
.
global_flag
|=
GLOBALFLAG_SPSUMMON_ONCE
;
return
0
;
}
int32
scriptlib
::
card_check_mzone_from_ex
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
playerid
=
lua_tointeger
(
L
,
2
);
duel
*
pduel
=
pcard
->
pduel
;
field
::
card_set
linked_cards
;
uint32
linked_zone
=
pduel
->
game_field
->
core
.
duel_rule
>=
4
?
pduel
->
game_field
->
get_linked_zone
(
playerid
)
|
(
1u
<<
5
)
|
(
1u
<<
6
)
:
0x1f
;
pduel
->
game_field
->
get_cards_in_zone
(
&
linked_cards
,
linked_zone
,
playerid
,
LOCATION_MZONE
);
if
(
linked_cards
.
find
(
pcard
)
!=
linked_cards
.
end
())
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
libduel.cpp
View file @
30cdb7da
...
...
@@ -1560,6 +1560,59 @@ int32 scriptlib::duel_get_location_count(lua_State *L) {
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_useable_count
(
playerid
,
location
,
uplayer
,
reason
,
zone
));
return
1
;
}
int32
scriptlib
::
duel_get_mzone_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
bool
swapped
=
false
;
card
*
mcard
=
0
;
group
*
mgroup
=
0
;
uint32
used_location
[
2
]
=
{
0
,
0
};
player_info
::
card_vector
list_mzone
[
2
];
if
(
lua_gettop
(
L
)
>=
2
&&
!
lua_isnil
(
L
,
2
))
{
if
(
check_param
(
L
,
PARAM_TYPE_CARD
,
2
,
TRUE
))
{
mcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
}
else
if
(
check_param
(
L
,
PARAM_TYPE_GROUP
,
2
,
TRUE
))
{
mgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
2
);
}
else
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
3
);
for
(
int32
p
=
0
;
p
<
2
;
p
++
)
{
uint32
digit
=
1
;
for
(
auto
cit
=
pduel
->
game_field
->
player
[
p
].
list_mzone
.
begin
();
cit
!=
pduel
->
game_field
->
player
[
p
].
list_mzone
.
end
();
++
cit
)
{
card
*
pcard
=
*
cit
;
if
(
pcard
&&
pcard
!=
mcard
&&
!
(
mgroup
&&
mgroup
->
container
.
find
(
pcard
)
!=
mgroup
->
container
.
end
()))
{
used_location
[
p
]
|=
digit
;
list_mzone
[
p
].
push_back
(
pcard
);
}
else
list_mzone
[
p
].
push_back
(
0
);
digit
<<=
1
;
}
used_location
[
p
]
|=
pduel
->
game_field
->
player
[
p
].
used_location
&
0xff00
;
std
::
swap
(
used_location
[
p
],
pduel
->
game_field
->
player
[
p
].
used_location
);
pduel
->
game_field
->
player
[
p
].
list_mzone
.
swap
(
list_mzone
[
p
]);
}
swapped
=
true
;
}
uint32
uplayer
=
pduel
->
game_field
->
core
.
reason_player
;
uint32
reason
=
LOCATION_REASON_TOFIELD
;
uint32
zone
=
0xff
;
if
(
lua_gettop
(
L
)
>=
3
)
uplayer
=
lua_tointeger
(
L
,
3
);
if
(
lua_gettop
(
L
)
>=
4
)
reason
=
lua_tointeger
(
L
,
4
);
if
(
lua_gettop
(
L
)
>=
5
)
zone
=
lua_tointeger
(
L
,
5
);
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_useable_count
(
playerid
,
LOCATION_MZONE
,
uplayer
,
reason
,
zone
));
if
(
swapped
)
{
pduel
->
game_field
->
player
[
0
].
used_location
=
used_location
[
0
];
pduel
->
game_field
->
player
[
1
].
used_location
=
used_location
[
1
];
pduel
->
game_field
->
player
[
0
].
list_mzone
.
swap
(
list_mzone
[
0
]);
pduel
->
game_field
->
player
[
1
].
list_mzone
.
swap
(
list_mzone
[
1
]);
}
return
1
;
}
int32
scriptlib
::
duel_get_location_count_fromex
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_tointeger
(
L
,
1
);
...
...
@@ -1695,13 +1748,10 @@ int32 scriptlib::duel_check_location(lua_State *L) {
uint32
playerid
=
lua_tointeger
(
L
,
1
);
uint32
location
=
lua_tointeger
(
L
,
2
);
uint32
sequence
=
lua_tointeger
(
L
,
3
);
uint32
neglect_used
=
0
;
if
(
lua_gettop
(
L
)
>=
4
)
neglect_used
=
lua_toboolean
(
L
,
4
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_location_useable
(
playerid
,
location
,
sequence
,
neglect_used
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_location_useable
(
playerid
,
location
,
sequence
));
return
1
;
}
int32
scriptlib
::
duel_get_current_chain
(
lua_State
*
L
)
{
...
...
scriptlib.h
View file @
30cdb7da
...
...
@@ -258,7 +258,6 @@ public:
static
int32
card_reset_negate_effect
(
lua_State
*
L
);
static
int32
card_assume_prop
(
lua_State
*
L
);
static
int32
card_set_spsummon_once
(
lua_State
*
L
);
static
int32
card_check_mzone_from_ex
(
lua_State
*
L
);
//Effect functions
static
int32
effect_new
(
lua_State
*
L
);
...
...
@@ -430,6 +429,7 @@ public:
static
int32
duel_increase_summon_count
(
lua_State
*
L
);
static
int32
duel_check_summon_count
(
lua_State
*
L
);
static
int32
duel_get_location_count
(
lua_State
*
L
);
static
int32
duel_get_mzone_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
);
...
...
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