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
ab403b97
Commit
ab403b97
authored
Dec 20, 2016
by
salix5
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Revert"
This reverts commit
573b7589
. This is a slightly revised version.
parent
388e593f
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
291 additions
and
94 deletions
+291
-94
card.cpp
card.cpp
+238
-71
card.h
card.h
+2
-2
effect.h
effect.h
+1
-1
field.cpp
field.cpp
+41
-14
field.h
field.h
+4
-1
libcard.cpp
libcard.cpp
+1
-1
libduel.cpp
libduel.cpp
+2
-2
operations.cpp
operations.cpp
+2
-2
No files found.
card.cpp
View file @
ab403b97
...
@@ -1993,69 +1993,132 @@ void card::filter_disable_related_cards() {
...
@@ -1993,69 +1993,132 @@ void card::filter_disable_related_cards() {
}
}
}
}
}
}
// put all summon procedures in peset (see is_can_be_summoned())
// return value:
// -2 = this has EFFECT_LIMIT_SUMMON_PROC, 0 available
// -1 = this has EFFECT_LIMIT_SUMMON_PROC, at least 1 available
// 0 = no EFFECT_LIMIT_SUMMON_PROC, no available EFFECT_SUMMON_PROC
// 1 = no EFFECT_LIMIT_SUMMON_PROC, at least 1 available EFFECT_SUMMON_PROC
int32
card
::
filter_summon_procedure
(
uint8
playerid
,
effect_set
*
peset
,
uint8
ignore_count
,
uint8
min_tribute
)
{
int32
card
::
filter_summon_procedure
(
uint8
playerid
,
effect_set
*
peset
,
uint8
ignore_count
,
uint8
min_tribute
)
{
effect_set
eset
;
effect_set
eset
;
bool
lim
=
true
;
uint8
toplayer
;
int32
rcount
=
0
;
filter_effect
(
EFFECT_LIMIT_SUMMON_PROC
,
&
eset
);
filter_effect
(
EFFECT_LIMIT_SUMMON_PROC
,
&
eset
);
if
(
eset
.
size
())
{
if
(
!
eset
.
size
())
{
lim
=
false
;
filter_effect
(
EFFECT_SUMMON_PROC
,
&
eset
);
}
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
check_count_limit
(
playerid
)
&&
is_summonable
(
eset
[
i
],
min_tribute
)
int32
val
=
eset
[
i
]
->
get_value
(
this
);
&&
pduel
->
game_field
->
is_player_can_summon
(
eset
[
i
]
->
get_value
(
this
),
playerid
,
this
))
if
(
!
eset
[
i
]
->
check_count_limit
(
playerid
))
continue
;
if
(
!
pduel
->
game_field
->
is_player_can_summon
(
val
,
playerid
,
this
))
continue
;
if
((
val
&
SUMMON_TYPE_ADVANCE
)
==
SUMMON_TYPE_ADVANCE
)
rcount
=
val
&
0xf
;
else
rcount
=
0
;
// check min_tribute
if
(
rcount
<
min_tribute
)
continue
;
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SPSUM_PARAM
))
{
if
(
eset
[
i
]
->
o_range
==
0
)
toplayer
=
playerid
;
else
toplayer
=
1
-
playerid
;
}
else
toplayer
=
playerid
;
// uniqueness
if
(
pduel
->
game_field
->
check_unique_onfield
(
this
,
toplayer
,
LOCATION_MZONE
))
continue
;
int32
m
=
0
;
if
(
toplayer
==
playerid
)
{
m
=
pduel
->
game_field
->
get_summon_release_list
(
this
,
NULL
,
NULL
,
NULL
,
NULL
,
0
);
}
else
{
m
=
pduel
->
game_field
->
get_summon_release_list
(
this
,
NULL
,
NULL
,
NULL
,
NULL
,
1
);
}
// check if the # of tributes is enough
if
(
m
<
rcount
)
continue
;
// the script will check the usable count according to the card effect
if
(
is_summonable
(
eset
[
i
],
min_tribute
))
peset
->
add_item
(
eset
[
i
]);
peset
->
add_item
(
eset
[
i
]);
}
}
if
(
lim
){
if
(
peset
->
size
())
if
(
peset
->
size
())
return
-
1
;
return
-
1
;
else
return
-
2
;
return
-
2
;
}
}
eset
.
clear
();
else
{
filter_effect
(
EFFECT_SUMMON_PROC
,
&
eset
);
if
(
peset
->
size
())
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
return
1
;
if
(
eset
[
i
]
->
check_count_limit
(
playerid
)
&&
is_summonable
(
eset
[
i
],
min_tribute
)
else
&&
pduel
->
game_field
->
is_player_can_summon
(
eset
[
i
]
->
get_value
(
this
),
playerid
,
this
))
return
0
;
peset
->
add_item
(
eset
[
i
]);
}
}
if
(
!
pduel
->
game_field
->
is_player_can_summon
(
SUMMON_TYPE_NORMAL
,
playerid
,
this
))
return
FALSE
;
int32
rcount
=
get_summon_tribute_count
();
int32
min
=
rcount
&
0xffff
,
max
=
(
rcount
>>
16
)
&
0xffff
;
if
(
min
>
0
&&
!
pduel
->
game_field
->
is_player_can_summon
(
SUMMON_TYPE_ADVANCE
,
playerid
,
this
))
return
FALSE
;
if
(
max
<
min_tribute
)
return
FALSE
;
if
(
min
<
min_tribute
)
min
=
min_tribute
;
return
pduel
->
game_field
->
check_tribute
(
this
,
min
,
max
,
0
,
current
.
controler
);
}
}
int32
card
::
filter_set_procedure
(
uint8
playerid
,
effect_set
*
peset
,
uint8
ignore_count
,
uint8
min_tribute
)
{
int32
card
::
filter_set_procedure
(
uint8
playerid
,
effect_set
*
peset
,
uint8
ignore_count
,
uint8
min_tribute
)
{
effect_set
eset
;
effect_set
eset
;
bool
lim
=
true
;
uint8
toplayer
;
int32
rcount
=
0
;
filter_effect
(
EFFECT_LIMIT_SET_PROC
,
&
eset
);
filter_effect
(
EFFECT_LIMIT_SET_PROC
,
&
eset
);
if
(
eset
.
size
())
{
if
(
!
eset
.
size
())
{
lim
=
false
;
filter_effect
(
EFFECT_SET_PROC
,
&
eset
);
}
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
check_count_limit
(
playerid
)
&&
is_summonable
(
eset
[
i
],
min_tribute
)
int32
val
=
eset
[
i
]
->
get_value
(
this
);
&&
pduel
->
game_field
->
is_player_can_mset
(
eset
[
i
]
->
get_value
(
this
),
playerid
,
this
))
if
(
!
eset
[
i
]
->
check_count_limit
(
playerid
))
continue
;
if
(
!
pduel
->
game_field
->
is_player_can_mset
(
val
,
playerid
,
this
))
continue
;
if
((
val
&
SUMMON_TYPE_ADVANCE
)
==
SUMMON_TYPE_ADVANCE
)
rcount
=
val
&
0xf
;
else
rcount
=
0
;
// check min_tribute
if
(
rcount
<
min_tribute
)
continue
;
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SPSUM_PARAM
))
{
if
(
eset
[
i
]
->
o_range
==
0
)
toplayer
=
playerid
;
else
toplayer
=
1
-
playerid
;
}
else
toplayer
=
playerid
;
int32
m
=
0
;
if
(
toplayer
==
playerid
)
{
m
=
pduel
->
game_field
->
get_summon_release_list
(
this
,
NULL
,
NULL
,
NULL
,
NULL
,
0
);
}
else
{
m
=
pduel
->
game_field
->
get_summon_release_list
(
this
,
NULL
,
NULL
,
NULL
,
NULL
,
1
);
}
// check if the # of tributes is enough
if
(
m
<
rcount
)
continue
;
// the script will check the usable count according to the card effect
if
(
is_summonable
(
eset
[
i
],
min_tribute
))
peset
->
add_item
(
eset
[
i
]);
peset
->
add_item
(
eset
[
i
]);
}
}
if
(
lim
){
if
(
peset
->
size
())
if
(
peset
->
size
())
return
-
1
;
return
-
1
;
else
return
-
2
;
return
-
2
;
}
}
eset
.
clear
();
else
{
filter_effect
(
EFFECT_SET_PROC
,
&
eset
);
if
(
peset
->
size
())
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
return
1
;
if
(
eset
[
i
]
->
check_count_limit
(
playerid
)
&&
is_summonable
(
eset
[
i
],
min_tribute
)
else
&&
pduel
->
game_field
->
is_player_can_mset
(
eset
[
i
]
->
get_value
(
this
),
playerid
,
this
))
return
0
;
peset
->
add_item
(
eset
[
i
]);
}
}
if
(
!
pduel
->
game_field
->
is_player_can_mset
(
SUMMON_TYPE_NORMAL
,
playerid
,
this
))
return
FALSE
;
int32
rcount
=
get_set_tribute_count
();
int32
min
=
rcount
&
0xffff
,
max
=
(
rcount
>>
16
)
&
0xffff
;
if
(
min
>
0
&&
!
pduel
->
game_field
->
is_player_can_mset
(
SUMMON_TYPE_ADVANCE
,
playerid
,
this
))
return
FALSE
;
if
(
max
<
min_tribute
)
return
FALSE
;
if
(
min
<
min_tribute
)
min
=
min_tribute
;
return
pduel
->
game_field
->
check_tribute
(
this
,
min
,
max
,
0
,
current
.
controler
);
}
}
void
card
::
filter_spsummon_procedure
(
uint8
playerid
,
effect_set
*
peset
,
uint32
summon_type
)
{
void
card
::
filter_spsummon_procedure
(
uint8
playerid
,
effect_set
*
peset
,
uint32
summon_type
)
{
auto
pr
=
field_effect
.
equal_range
(
EFFECT_SPSUMMON_PROC
);
auto
pr
=
field_effect
.
equal_range
(
EFFECT_SPSUMMON_PROC
);
...
@@ -2074,7 +2137,7 @@ void card::filter_spsummon_procedure(uint8 playerid, effect_set* peset, uint32 s
...
@@ -2074,7 +2137,7 @@ void card::filter_spsummon_procedure(uint8 playerid, effect_set* peset, uint32 s
topos
=
POS_FACEUP
;
topos
=
POS_FACEUP
;
toplayer
=
playerid
;
toplayer
=
playerid
;
}
}
if
(
peffect
->
is_available
()
&&
peffect
->
check_count_limit
(
playerid
)
&&
is_summonable
(
peffect
)
if
(
peffect
->
is_available
()
&&
peffect
->
check_count_limit
(
playerid
)
&&
is_s
ps
ummonable
(
peffect
)
&&
!
pduel
->
game_field
->
check_unique_onfield
(
this
,
toplayer
,
LOCATION_MZONE
))
{
&&
!
pduel
->
game_field
->
check_unique_onfield
(
this
,
toplayer
,
LOCATION_MZONE
))
{
effect
*
sumeffect
=
pduel
->
game_field
->
core
.
reason_effect
;
effect
*
sumeffect
=
pduel
->
game_field
->
core
.
reason_effect
;
if
(
!
sumeffect
)
if
(
!
sumeffect
)
...
@@ -2253,15 +2316,14 @@ int32 card::is_equipable(card* pcard) {
...
@@ -2253,15 +2316,14 @@ int32 card::is_equipable(card* pcard) {
return
TRUE
;
return
TRUE
;
return
FALSE
;
return
FALSE
;
}
}
// check
EFFECT_UNSUMMONABLE_CARD
// check
if this is a normal summonable card
int32
card
::
is_summonable
()
{
int32
card
::
is_summonable
_card
()
{
if
(
!
(
data
.
type
&
TYPE_MONSTER
))
if
(
!
(
data
.
type
&
TYPE_MONSTER
))
return
FALSE
;
return
FALSE
;
return
!
is_affected_by_effect
(
EFFECT_UNSUMMONABLE_CARD
);
return
!
is_affected_by_effect
(
EFFECT_UNSUMMONABLE_CARD
);
}
}
// check if this can be summoned/sp_summoned by procedure peffect
// check the condition of sp_summon procedure peffect
// check the condition of peffect
int32
card
::
is_spsummonable
(
effect
*
peffect
)
{
int32
card
::
is_summonable
(
effect
*
peffect
)
{
effect
*
oreason
=
pduel
->
game_field
->
core
.
reason_effect
;
effect
*
oreason
=
pduel
->
game_field
->
core
.
reason_effect
;
uint8
op
=
pduel
->
game_field
->
core
.
reason_player
;
uint8
op
=
pduel
->
game_field
->
core
.
reason_player
;
pduel
->
game_field
->
core
.
reason_effect
=
peffect
;
pduel
->
game_field
->
core
.
reason_effect
=
peffect
;
...
@@ -2294,6 +2356,7 @@ int32 card::is_summonable(effect* peffect) {
...
@@ -2294,6 +2356,7 @@ int32 card::is_summonable(effect* peffect) {
pduel
->
game_field
->
core
.
reason_player
=
op
;
pduel
->
game_field
->
core
.
reason_player
=
op
;
return
result
;
return
result
;
}
}
// check the condition of summon/set procedure peffect
int32
card
::
is_summonable
(
effect
*
peffect
,
uint8
min_tribute
)
{
int32
card
::
is_summonable
(
effect
*
peffect
,
uint8
min_tribute
)
{
effect
*
oreason
=
pduel
->
game_field
->
core
.
reason_effect
;
effect
*
oreason
=
pduel
->
game_field
->
core
.
reason_effect
;
uint8
op
=
pduel
->
game_field
->
core
.
reason_player
;
uint8
op
=
pduel
->
game_field
->
core
.
reason_player
;
...
@@ -2311,10 +2374,12 @@ int32 card::is_summonable(effect* peffect, uint8 min_tribute) {
...
@@ -2311,10 +2374,12 @@ int32 card::is_summonable(effect* peffect, uint8 min_tribute) {
pduel
->
game_field
->
core
.
reason_player
=
op
;
pduel
->
game_field
->
core
.
reason_player
=
op
;
return
result
;
return
result
;
}
}
// ignore_count: ignore the summon count in this turn or not
// peffect: effects that changes the ordinary summon procedure (c80921533)
// min_tribute: the limit of min tribute number by EFFECT_EXTRA_SUMMON_COUNT
// return: whether playerid can summon this or not
int32
card
::
is_can_be_summoned
(
uint8
playerid
,
uint8
ignore_count
,
effect
*
peffect
,
uint8
min_tribute
)
{
int32
card
::
is_can_be_summoned
(
uint8
playerid
,
uint8
ignore_count
,
effect
*
peffect
,
uint8
min_tribute
)
{
if
(
!
is_summonable
())
if
(
!
is_summonable_card
())
return
FALSE
;
if
(
pduel
->
game_field
->
check_unique_onfield
(
this
,
playerid
,
LOCATION_MZONE
))
return
FALSE
;
return
FALSE
;
if
(
!
ignore_count
&&
(
pduel
->
game_field
->
core
.
extra_summon
[
playerid
]
||
!
is_affected_by_effect
(
EFFECT_EXTRA_SUMMON_COUNT
))
if
(
!
ignore_count
&&
(
pduel
->
game_field
->
core
.
extra_summon
[
playerid
]
||
!
is_affected_by_effect
(
EFFECT_EXTRA_SUMMON_COUNT
))
&&
pduel
->
game_field
->
core
.
summon_count
[
playerid
]
>=
pduel
->
game_field
->
get_summon_count_limit
(
playerid
))
&&
pduel
->
game_field
->
core
.
summon_count
[
playerid
]
>=
pduel
->
game_field
->
get_summon_count_limit
(
playerid
))
...
@@ -2342,7 +2407,8 @@ int32 card::is_can_be_summoned(uint8 playerid, uint8 ignore_count, effect* peffe
...
@@ -2342,7 +2407,8 @@ int32 card::is_can_be_summoned(uint8 playerid, uint8 ignore_count, effect* peffe
pduel
->
game_field
->
restore_lp_cost
();
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
return
FALSE
;
}
}
}
else
if
(
current
.
location
==
LOCATION_HAND
)
{
}
else
if
(
current
.
location
==
LOCATION_HAND
)
{
if
(
is_affected_by_effect
(
EFFECT_CANNOT_SUMMON
))
{
if
(
is_affected_by_effect
(
EFFECT_CANNOT_SUMMON
))
{
pduel
->
game_field
->
restore_lp_cost
();
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
return
FALSE
;
...
@@ -2352,22 +2418,78 @@ int32 card::is_can_be_summoned(uint8 playerid, uint8 ignore_count, effect* peffe
...
@@ -2352,22 +2418,78 @@ int32 card::is_can_be_summoned(uint8 playerid, uint8 ignore_count, effect* peffe
effect
*
pextra
=
is_affected_by_effect
(
EFFECT_EXTRA_SUMMON_COUNT
);
effect
*
pextra
=
is_affected_by_effect
(
EFFECT_EXTRA_SUMMON_COUNT
);
if
(
pextra
&&
!
pextra
->
is_flag
(
EFFECT_FLAG_FUNC_VALUE
))
{
if
(
pextra
&&
!
pextra
->
is_flag
(
EFFECT_FLAG_FUNC_VALUE
))
{
int32
count
=
pextra
->
get_value
();
int32
count
=
pextra
->
get_value
();
if
(
min_tribute
<
count
)
if
(
(
int32
)
min_tribute
<
count
)
min_tribute
=
count
;
min_tribute
=
count
;
}
}
}
}
effect_set
proc
;
effect_set
proc
;
int32
res
=
filter_summon_procedure
(
playerid
,
&
proc
,
ignore_count
,
min_tribute
);
int32
res
=
filter_summon_procedure
(
playerid
,
&
proc
,
ignore_count
,
min_tribute
);
if
((
peffect
&&
res
<
0
)
||
(
!
peffect
&&
(
!
res
||
res
==
-
2
)
&&
!
proc
.
size
())
if
(
peffect
)
{
||
(
peffect
&&
(
proc
.
size
()
==
0
)
&&
!
pduel
->
game_field
->
is_player_can_summon
(
peffect
->
get_value
(),
playerid
,
this
)))
{
if
(
res
<
0
||
!
pduel
->
game_field
->
is_player_can_summon
(
peffect
->
get_value
(),
playerid
,
this
)){
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
}
}
else
{
// ordinary summon
if
(
!
proc
.
size
())
{
// uniqueness
if
(
pduel
->
game_field
->
check_unique_onfield
(
this
,
playerid
,
LOCATION_MZONE
)){
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
}
card_set
test
,
exset
;
int32
rcount
=
get_summon_tribute_count
();
int32
min
=
rcount
&
0xffff
,
max
=
(
rcount
>>
16
)
&
0xffff
;
int32
m1
=
pduel
->
game_field
->
get_summon_release_slist
(
this
,
&
test
,
NULL
);
int32
m2
=
pduel
->
game_field
->
get_summon_release_olist
(
this
,
NULL
,
NULL
,
NULL
);
// min_tribute is the real lower bound
if
(
min
<
(
int32
)
min_tribute
)
min
=
min_tribute
;
// sum of release count is the real upper bound
if
(
max
>
m1
+
m2
)
max
=
m1
+
m2
;
if
(
min
>
max
)
{
pduel
->
game_field
->
restore_lp_cost
();
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
return
FALSE
;
}
}
int32
fcount
=
pduel
->
game_field
->
get_useable_count
(
playerid
,
LOCATION_MZONE
,
current
.
controler
,
LOCATION_REASON_TOFIELD
);
pduel
->
game_field
->
get_summon_release_exlist
(
this
,
&
exset
);
for
(
int32
i
=
min
;
i
<=
max
;
++
i
)
{
if
(
i
==
0
){
if
(
!
pduel
->
game_field
->
is_player_can_summon
(
SUMMON_TYPE_NORMAL
,
playerid
,
this
))
continue
;
}
else
{
if
(
!
pduel
->
game_field
->
is_player_can_summon
(
SUMMON_TYPE_ADVANCE
,
playerid
,
this
))
continue
;
}
// check if the usable count is enough
int32
self_max
=
0
;
if
(
i
<
(
int32
)
exset
.
size
())
self_max
=
0
;
else
self_max
=
i
-
exset
.
size
();
if
(
self_max
>
(
int32
)
test
.
size
())
self_max
=
test
.
size
();
if
(
fcount
+
self_max
-
1
>=
0
)
{
pduel
->
game_field
->
restore_lp_cost
();
return
TRUE
;
}
}
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
}
}
}
else
{
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
}
}
pduel
->
game_field
->
restore_lp_cost
();
pduel
->
game_field
->
restore_lp_cost
();
return
TRUE
;
return
TRUE
;
}
}
// return: the
tribute count for ordinary advance summon
// return: the
min/max number of tribute for an ordinary advance summon of this
int32
card
::
get_summon_tribute_count
()
{
int32
card
::
get_summon_tribute_count
()
{
int32
min
=
0
,
max
=
0
;
int32
min
=
0
,
max
=
0
;
int32
minul
=
0
,
maxul
=
0
;
int32
minul
=
0
,
maxul
=
0
;
...
@@ -2543,10 +2665,9 @@ int32 card::is_can_be_special_summoned(effect * reason_effect, uint32 sumtype, u
...
@@ -2543,10 +2665,9 @@ int32 card::is_can_be_special_summoned(effect * reason_effect, uint32 sumtype, u
pduel
->
game_field
->
restore_lp_cost
();
pduel
->
game_field
->
restore_lp_cost
();
return
TRUE
;
return
TRUE
;
}
}
// see is_can_be_summoned()
int32
card
::
is_setable_mzone
(
uint8
playerid
,
uint8
ignore_count
,
effect
*
peffect
,
uint8
min_tribute
)
{
int32
card
::
is_setable_mzone
(
uint8
playerid
,
uint8
ignore_count
,
effect
*
peffect
,
uint8
min_tribute
)
{
if
(
!
(
data
.
type
&
TYPE_MONSTER
))
if
(
!
is_summonable_card
())
return
FALSE
;
if
(
is_affected_by_effect
(
EFFECT_UNSUMMONABLE_CARD
))
return
FALSE
;
return
FALSE
;
if
(
current
.
location
!=
LOCATION_HAND
)
if
(
current
.
location
!=
LOCATION_HAND
)
return
FALSE
;
return
FALSE
;
...
@@ -2578,13 +2699,59 @@ int32 card::is_setable_mzone(uint8 playerid, uint8 ignore_count, effect* peffect
...
@@ -2578,13 +2699,59 @@ int32 card::is_setable_mzone(uint8 playerid, uint8 ignore_count, effect* peffect
min_tribute
=
count
;
min_tribute
=
count
;
}
}
}
}
e
set
.
clear
()
;
e
ffect_set
proc
;
int32
res
=
filter_set_procedure
(
playerid
,
&
eset
,
ignore_count
,
min_tribute
);
int32
res
=
filter_set_procedure
(
playerid
,
&
proc
,
ignore_count
,
min_tribute
);
if
(
(
peffect
&&
res
<
0
)
||
(
!
peffect
&&
(
!
res
||
res
==
-
2
)
&&
!
eset
.
size
())
if
(
peffect
)
{
||
(
peffect
&&
(
eset
.
size
()
==
0
)
&&
!
pduel
->
game_field
->
is_player_can_mset
(
peffect
->
get_value
(),
playerid
,
this
)))
{
if
(
res
<
0
||
!
pduel
->
game_field
->
is_player_can_mset
(
peffect
->
get_value
(),
playerid
,
this
))
{
pduel
->
game_field
->
restore_lp_cost
();
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
return
FALSE
;
}
}
}
else
{
if
(
!
proc
.
size
())
{
card_set
test
,
exset
;
int32
rcount
=
get_summon_tribute_count
();
int32
min
=
rcount
&
0xffff
,
max
=
(
rcount
>>
16
)
&
0xffff
;
int32
m1
=
pduel
->
game_field
->
get_summon_release_slist
(
this
,
&
test
,
NULL
);
int32
m2
=
pduel
->
game_field
->
get_summon_release_olist
(
this
,
NULL
,
NULL
,
NULL
);
// min_tribute is the real lower bound
if
(
min
<
(
int32
)
min_tribute
)
min
=
min_tribute
;
// sum of release count is the real upper bound
if
(
max
>
m1
+
m2
)
max
=
m1
+
m2
;
if
(
min
>
max
)
{
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
}
int32
fcount
=
pduel
->
game_field
->
get_useable_count
(
playerid
,
LOCATION_MZONE
,
current
.
controler
,
LOCATION_REASON_TOFIELD
);
pduel
->
game_field
->
get_summon_release_exlist
(
this
,
&
exset
);
for
(
int32
i
=
min
;
i
<=
max
;
++
i
)
{
if
(
i
==
0
){
if
(
!
pduel
->
game_field
->
is_player_can_mset
(
SUMMON_TYPE_NORMAL
,
playerid
,
this
))
continue
;
}
else
{
if
(
!
pduel
->
game_field
->
is_player_can_mset
(
SUMMON_TYPE_ADVANCE
,
playerid
,
this
))
continue
;
}
// check if the usable count is enough
int32
self_max
=
0
;
if
(
i
<
(
int32
)
exset
.
size
())
self_max
=
0
;
else
self_max
=
i
-
exset
.
size
();
if
(
self_max
>
(
int32
)
test
.
size
())
self_max
=
test
.
size
();
if
(
fcount
+
self_max
-
1
>=
0
)
{
pduel
->
game_field
->
restore_lp_cost
();
return
TRUE
;
}
}
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
}
}
pduel
->
game_field
->
restore_lp_cost
();
pduel
->
game_field
->
restore_lp_cost
();
return
TRUE
;
return
TRUE
;
}
}
...
...
card.h
View file @
ab403b97
...
@@ -247,8 +247,8 @@ public:
...
@@ -247,8 +247,8 @@ public:
int32
check_fusion_substitute
(
card
*
fcard
);
int32
check_fusion_substitute
(
card
*
fcard
);
int32
is_equipable
(
card
*
pcard
);
int32
is_equipable
(
card
*
pcard
);
int32
is_summonable
();
int32
is_summonable
_card
();
int32
is_summonable
(
effect
*
peffect
);
int32
is_s
ps
ummonable
(
effect
*
peffect
);
int32
is_summonable
(
effect
*
peffect
,
uint8
min_tribute
);
int32
is_summonable
(
effect
*
peffect
,
uint8
min_tribute
);
int32
is_can_be_summoned
(
uint8
playerid
,
uint8
ingore_count
,
effect
*
peffect
,
uint8
min_tribute
);
int32
is_can_be_summoned
(
uint8
playerid
,
uint8
ingore_count
,
effect
*
peffect
,
uint8
min_tribute
);
int32
get_summon_tribute_count
();
int32
get_summon_tribute_count
();
...
...
effect.h
View file @
ab403b97
...
@@ -315,7 +315,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
...
@@ -315,7 +315,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_EXTRA_RELEASE 153
#define EFFECT_EXTRA_RELEASE 153
#define EFFECT_TRIBUTE_LIMIT 154
#define EFFECT_TRIBUTE_LIMIT 154
#define EFFECT_EXTRA_RELEASE_SUM 155
#define EFFECT_EXTRA_RELEASE_SUM 155
#define EFFECT_TRIPLE_TRIBUTE 156
//
#define EFFECT_TRIPLE_TRIBUTE 156
#define EFFECT_PUBLIC 160
#define EFFECT_PUBLIC 160
#define EFFECT_COUNTER_PERMIT 0x10000
#define EFFECT_COUNTER_PERMIT 0x10000
#define EFFECT_COUNTER_LIMIT 0x20000
#define EFFECT_COUNTER_LIMIT 0x20000
...
...
field.cpp
View file @
ab403b97
...
@@ -491,8 +491,9 @@ int32 field::is_location_useable(uint8 playerid, uint8 location, uint8 sequence)
...
@@ -491,8 +491,9 @@ int32 field::is_location_useable(uint8 playerid, uint8 location, uint8 sequence)
return
FALSE
;
return
FALSE
;
return
TRUE
;
return
TRUE
;
}
}
// return: usable count of LOCATION_MZONE or real LOCATION_SZONE
// uplayer: request player, PLAYER_NONE means ignoring EFFECT_MAX_MZONE, EFFECT_MAX_SZONE
// store local flag in list
// list: store local flag in list
// return: usable count of LOCATION_MZONE or real LOCATION_SZONE of plaerid requested by uplayer (may be negative)
int32
field
::
get_useable_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
*
list
)
{
int32
field
::
get_useable_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
*
list
)
{
if
(
location
!=
LOCATION_MZONE
&&
location
!=
LOCATION_SZONE
)
if
(
location
!=
LOCATION_MZONE
&&
location
!=
LOCATION_SZONE
)
return
0
;
return
0
;
...
@@ -1251,7 +1252,15 @@ int32 field::check_release_list(uint8 playerid, int32 count, int32 use_con, int3
...
@@ -1251,7 +1252,15 @@ int32 field::check_release_list(uint8 playerid, int32 count, int32 use_con, int3
}
}
return
FALSE
;
return
FALSE
;
}
}
// return: the max release count of mg or all monsters on field
int32
field
::
get_summon_release_list
(
card
*
target
,
card_set
*
release_list
,
card_set
*
ex_list
,
card_set
*
ex_list_sum
,
group
*
mg
,
uint32
ex
)
{
int32
field
::
get_summon_release_list
(
card
*
target
,
card_set
*
release_list
,
card_set
*
ex_list
,
card_set
*
ex_list_sum
,
group
*
mg
,
uint32
ex
)
{
int32
m1
=
get_summon_release_slist
(
target
,
release_list
,
mg
);
int32
m2
=
get_summon_release_olist
(
target
,
ex_list
,
ex_list_sum
,
mg
,
ex
);
return
m1
+
m2
;
}
// let the controller of target be p
// search in mg or mzone of p, and put the tribute monsters in release_list
int32
field
::
get_summon_release_slist
(
card
*
target
,
card_set
*
release_list
,
group
*
mg
)
{
uint8
p
=
target
->
current
.
controler
;
uint8
p
=
target
->
current
.
controler
;
card
*
pcard
;
card
*
pcard
;
uint32
rcount
=
0
;
uint32
rcount
=
0
;
...
@@ -1262,28 +1271,34 @@ int32 field::get_summon_release_list(card* target, card_set* release_list, card_
...
@@ -1262,28 +1271,34 @@ int32 field::get_summon_release_list(card* target, card_set* release_list, card_
continue
;
continue
;
if
(
release_list
)
if
(
release_list
)
release_list
->
insert
(
pcard
);
release_list
->
insert
(
pcard
);
if
(
pcard
->
is_affected_by_effect
(
EFFECT_TRIPLE_TRIBUTE
,
target
))
if
(
pcard
->
is_affected_by_effect
(
EFFECT_DOUBLE_TRIBUTE
,
target
))
pcard
->
release_param
=
3
;
else
if
(
pcard
->
is_affected_by_effect
(
EFFECT_DOUBLE_TRIBUTE
,
target
))
pcard
->
release_param
=
2
;
pcard
->
release_param
=
2
;
else
else
pcard
->
release_param
=
1
;
pcard
->
release_param
=
1
;
rcount
+=
pcard
->
release_param
;
rcount
+=
pcard
->
release_param
;
}
}
}
}
return
rcount
;
}
// ex: the procedure of target can release opponent monster
// ex_list: the tribute monsters controlled by 1-p
// ex_list_sum: the opponent monsters affected by EFFECT_EXTRA_RELEASE_SUM
// search in mg or mzone of 1-p, and maintain ex_list, ex_list_sum
int32
field
::
get_summon_release_olist
(
card
*
target
,
card_set
*
ex_list
,
card_set
*
ex_list_sum
,
group
*
mg
,
uint32
ex
)
{
uint8
p
=
target
->
current
.
controler
;
card
*
pcard
;
uint32
rcount
=
0
;
uint32
ex_sum_max
=
0
;
uint32
ex_sum_max
=
0
;
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
pcard
=
player
[
1
-
p
].
list_mzone
[
i
];
pcard
=
player
[
1
-
p
].
list_mzone
[
i
];
if
(
!
(
pcard
&&
pcard
->
is_releasable_by_summon
(
p
,
target
)
))
if
(
!
pcard
||
pcard
->
is_releasable_by_summon
(
p
,
target
))
continue
;
continue
;
if
(
mg
&&
!
mg
->
has_card
(
pcard
))
if
(
mg
&&
!
mg
->
has_card
(
pcard
))
continue
;
continue
;
if
(
ex
||
pcard
->
is_affected_by_effect
(
EFFECT_EXTRA_RELEASE
))
{
if
(
ex
||
pcard
->
is_affected_by_effect
(
EFFECT_EXTRA_RELEASE
))
{
if
(
ex_list
)
if
(
ex_list
)
ex_list
->
insert
(
pcard
);
ex_list
->
insert
(
pcard
);
if
(
pcard
->
is_affected_by_effect
(
EFFECT_TRIPLE_TRIBUTE
,
target
))
if
(
pcard
->
is_affected_by_effect
(
EFFECT_DOUBLE_TRIBUTE
,
target
))
pcard
->
release_param
=
3
;
else
if
(
pcard
->
is_affected_by_effect
(
EFFECT_DOUBLE_TRIBUTE
,
target
))
pcard
->
release_param
=
2
;
pcard
->
release_param
=
2
;
else
else
pcard
->
release_param
=
1
;
pcard
->
release_param
=
1
;
...
@@ -1294,9 +1309,7 @@ int32 field::get_summon_release_list(card* target, card_set* release_list, card_
...
@@ -1294,9 +1309,7 @@ int32 field::get_summon_release_list(card* target, card_set* release_list, card_
continue
;
continue
;
if
(
ex_list_sum
)
if
(
ex_list_sum
)
ex_list_sum
->
insert
(
pcard
);
ex_list_sum
->
insert
(
pcard
);
if
(
pcard
->
is_affected_by_effect
(
EFFECT_TRIPLE_TRIBUTE
,
target
))
if
(
pcard
->
is_affected_by_effect
(
EFFECT_DOUBLE_TRIBUTE
,
target
))
pcard
->
release_param
=
3
;
else
if
(
pcard
->
is_affected_by_effect
(
EFFECT_DOUBLE_TRIBUTE
,
target
))
pcard
->
release_param
=
2
;
pcard
->
release_param
=
2
;
else
else
pcard
->
release_param
=
1
;
pcard
->
release_param
=
1
;
...
@@ -1306,6 +1319,20 @@ int32 field::get_summon_release_list(card* target, card_set* release_list, card_
...
@@ -1306,6 +1319,20 @@ int32 field::get_summon_release_list(card* target, card_set* release_list, card_
}
}
return
rcount
+
ex_sum_max
;
return
rcount
+
ex_sum_max
;
}
}
// put the monsters of 1-p affected by EFFECT_EXTRA_RELEASE
void
field
::
get_summon_release_exlist
(
card
*
target
,
card_set
*
ex_list
)
{
uint8
p
=
target
->
current
.
controler
;
card
*
pcard
;
uint32
rcount
=
0
;
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
pcard
=
player
[
1
-
p
].
list_mzone
[
i
];
if
(
!
pcard
||
pcard
->
is_releasable_by_summon
(
p
,
target
))
continue
;
if
(
pcard
->
is_affected_by_effect
(
EFFECT_EXTRA_RELEASE
))
{
ex_list
->
insert
(
pcard
);
}
}
}
int32
field
::
get_summon_count_limit
(
uint8
playerid
)
{
int32
field
::
get_summon_count_limit
(
uint8
playerid
)
{
effect_set
eset
;
effect_set
eset
;
filter_player_effect
(
playerid
,
EFFECT_SET_SUMMON_COUNT_LIMIT
,
&
eset
);
filter_player_effect
(
playerid
,
EFFECT_SET_SUMMON_COUNT_LIMIT
,
&
eset
);
...
@@ -1545,7 +1572,7 @@ void field::remove_unique_card(card* pcard) {
...
@@ -1545,7 +1572,7 @@ void field::remove_unique_card(card* pcard) {
if
(
pcard
->
unique_pos
[
1
])
if
(
pcard
->
unique_pos
[
1
])
core
.
unique_cards
[
1
-
con
].
erase
(
pcard
);
core
.
unique_cards
[
1
-
con
].
erase
(
pcard
);
}
}
// return: pcard->unique_effect or 0
effect
*
field
::
check_unique_onfield
(
card
*
pcard
,
uint8
controler
,
uint8
location
)
{
effect
*
field
::
check_unique_onfield
(
card
*
pcard
,
uint8
controler
,
uint8
location
)
{
if
(
!
pcard
->
unique_code
)
if
(
!
pcard
->
unique_code
)
return
0
;
return
0
;
...
@@ -2337,7 +2364,7 @@ int32 field::is_player_can_summon(uint32 sumtype, uint8 playerid, card * pcard)
...
@@ -2337,7 +2364,7 @@ int32 field::is_player_can_summon(uint32 sumtype, uint8 playerid, card * pcard)
pduel
->
lua
->
add_param
(
pcard
,
PARAM_TYPE_CARD
);
pduel
->
lua
->
add_param
(
pcard
,
PARAM_TYPE_CARD
);
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
sumtype
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
sumtype
,
PARAM_TYPE_INT
);
if
(
pduel
->
lua
->
check_condition
(
eset
[
i
]
->
target
,
4
))
if
(
pduel
->
lua
->
check_condition
(
eset
[
i
]
->
target
,
4
))
return
FALSE
;
return
FALSE
;
}
}
return
TRUE
;
return
TRUE
;
...
...
field.h
View file @
ab403b97
...
@@ -363,7 +363,10 @@ public:
...
@@ -363,7 +363,10 @@ public:
int32
get_release_list
(
uint8
playerid
,
card_set
*
release_list
,
card_set
*
ex_list
,
int32
use_con
,
int32
use_hand
,
int32
fun
,
int32
exarg
,
card
*
exp
);
int32
get_release_list
(
uint8
playerid
,
card_set
*
release_list
,
card_set
*
ex_list
,
int32
use_con
,
int32
use_hand
,
int32
fun
,
int32
exarg
,
card
*
exp
);
int32
check_release_list
(
uint8
playerid
,
int32
count
,
int32
use_con
,
int32
use_hand
,
int32
fun
,
int32
exarg
,
card
*
exp
);
int32
check_release_list
(
uint8
playerid
,
int32
count
,
int32
use_con
,
int32
use_hand
,
int32
fun
,
int32
exarg
,
card
*
exp
);
int32
get_summon_release_list
(
card
*
target
,
card_set
*
release_list
,
card_set
*
ex_list
,
card_set
*
ex_list_sum
,
group
*
mg
=
0
,
uint32
ex
=
0
);
int32
get_summon_release_list
(
card
*
target
,
card_set
*
release_list
,
card_set
*
ex_list
,
card_set
*
ex_list_sum
,
group
*
mg
=
NULL
,
uint32
ex
=
0
);
int32
get_summon_release_slist
(
card
*
target
,
card_set
*
release_list
,
group
*
mg
=
NULL
);
int32
get_summon_release_olist
(
card
*
target
,
card_set
*
ex_list
,
card_set
*
ex_list_sum
,
group
*
mg
=
NULL
,
uint32
ex
=
0
);
void
get_summon_release_exlist
(
card
*
target
,
card_set
*
ex_list
);
int32
get_summon_count_limit
(
uint8
playerid
);
int32
get_summon_count_limit
(
uint8
playerid
);
int32
get_draw_count
(
uint8
playerid
);
int32
get_draw_count
(
uint8
playerid
);
void
get_ritual_material
(
uint8
playerid
,
effect
*
peffect
,
card_set
*
material
);
void
get_ritual_material
(
uint8
playerid
,
effect
*
peffect
,
card_set
*
material
);
...
...
libcard.cpp
View file @
ab403b97
...
@@ -1343,7 +1343,7 @@ int32 scriptlib::card_is_summonable(lua_State *L) {
...
@@ -1343,7 +1343,7 @@ int32 scriptlib::card_is_summonable(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
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
lua_pushboolean
(
L
,
pcard
->
is_summonable
());
lua_pushboolean
(
L
,
pcard
->
is_summonable
_card
());
return
1
;
return
1
;
}
}
int32
scriptlib
::
card_is_msetable
(
lua_State
*
L
)
{
int32
scriptlib
::
card_is_msetable
(
lua_State
*
L
)
{
...
...
libduel.cpp
View file @
ab403b97
...
@@ -1989,7 +1989,7 @@ int32 scriptlib::duel_get_tribute_group(lua_State *L) {
...
@@ -1989,7 +1989,7 @@ int32 scriptlib::duel_get_tribute_group(lua_State *L) {
card
*
target
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
target
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
pgroup
=
pduel
->
new_group
();
group
*
pgroup
=
pduel
->
new_group
();
pduel
->
game_field
->
get_summon_release_list
(
target
,
&
(
pgroup
->
container
),
&
(
pgroup
->
container
),
0
);
pduel
->
game_field
->
get_summon_release_list
(
target
,
&
(
pgroup
->
container
),
&
(
pgroup
->
container
),
NULL
);
interpreter
::
group2value
(
L
,
pgroup
);
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
return
1
;
}
}
...
@@ -2011,7 +2011,7 @@ int32 scriptlib::duel_get_tribute_count(lua_State *L) {
...
@@ -2011,7 +2011,7 @@ int32 scriptlib::duel_get_tribute_count(lua_State *L) {
if
(
lua_gettop
(
L
)
>=
3
)
if
(
lua_gettop
(
L
)
>=
3
)
ex
=
lua_toboolean
(
L
,
3
);
ex
=
lua_toboolean
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_summon_release_list
(
target
,
0
,
0
,
0
,
mg
,
ex
));
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_summon_release_list
(
target
,
NULL
,
NULL
,
NULL
,
mg
,
ex
));
return
1
;
return
1
;
}
}
int32
scriptlib
::
duel_check_tribute
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_check_tribute
(
lua_State
*
L
)
{
...
...
operations.cpp
View file @
ab403b97
...
@@ -1353,7 +1353,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card * target, effect * proc,
...
@@ -1353,7 +1353,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card * target, effect * proc,
int32
res
=
target
->
filter_summon_procedure
(
sumplayer
,
&
eset
,
ignore_count
,
min_tribute
);
int32
res
=
target
->
filter_summon_procedure
(
sumplayer
,
&
eset
,
ignore_count
,
min_tribute
);
core
.
select_effects
.
clear
();
core
.
select_effects
.
clear
();
core
.
select_options
.
clear
();
core
.
select_options
.
clear
();
if
(
res
>
0
)
{
if
(
res
>
=
0
)
{
core
.
select_effects
.
push_back
(
0
);
core
.
select_effects
.
push_back
(
0
);
core
.
select_options
.
push_back
(
1
);
core
.
select_options
.
push_back
(
1
);
}
}
...
@@ -1851,7 +1851,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card * target, effect * proc, ui
...
@@ -1851,7 +1851,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card * target, effect * proc, ui
int32
res
=
target
->
filter_set_procedure
(
setplayer
,
&
eset
,
ignore_count
,
min_tribute
);
int32
res
=
target
->
filter_set_procedure
(
setplayer
,
&
eset
,
ignore_count
,
min_tribute
);
core
.
select_effects
.
clear
();
core
.
select_effects
.
clear
();
core
.
select_options
.
clear
();
core
.
select_options
.
clear
();
if
(
res
>
0
)
{
if
(
res
>
=
0
)
{
core
.
select_effects
.
push_back
(
0
);
core
.
select_effects
.
push_back
(
0
);
core
.
select_options
.
push_back
(
1
);
core
.
select_options
.
push_back
(
1
);
}
}
...
...
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