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
1dbc3dad
Commit
1dbc3dad
authored
Dec 20, 2016
by
DailyShana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert and update
parent
5e175c65
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
114 additions
and
177 deletions
+114
-177
card.cpp
card.cpp
+69
-143
card.h
card.h
+0
-1
field.cpp
field.cpp
+28
-19
field.h
field.h
+2
-2
libduel.cpp
libduel.cpp
+11
-8
operations.cpp
operations.cpp
+4
-4
No files found.
card.cpp
View file @
1dbc3dad
...
@@ -2001,28 +2001,29 @@ void card::filter_disable_related_cards() {
...
@@ -2001,28 +2001,29 @@ void card::filter_disable_related_cards() {
// 1 = no EFFECT_LIMIT_SUMMON_PROC, at least 1 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
;
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
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
filter_effect
(
EFFECT_SUMMON_PROC
,
&
eset
);
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SPSUM_PARAM
))
{
if
(
eset
[
i
]
->
o_range
==
0
)
toplayer
=
playerid
;
else
toplayer
=
1
-
playerid
;
}
else
toplayer
=
playerid
;
if
(
eset
[
i
]
->
check_count_limit
(
playerid
)
&&
is_summonable
(
eset
[
i
],
min_tribute
)
&&
!
pduel
->
game_field
->
check_unique_onfield
(
this
,
toplayer
,
LOCATION_MZONE
)
&&
pduel
->
game_field
->
is_player_can_summon
(
eset
[
i
]
->
get_value
(
this
),
playerid
,
this
))
peset
->
add_item
(
eset
[
i
]);
}
if
(
peset
->
size
())
return
-
1
;
return
-
2
;
}
}
eset
.
clear
();
filter_effect
(
EFFECT_SUMMON_PROC
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
int32
val
=
eset
[
i
]
->
get_value
(
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
]
->
is_flag
(
EFFECT_FLAG_SPSUM_PARAM
))
{
if
(
eset
[
i
]
->
o_range
==
0
)
if
(
eset
[
i
]
->
o_range
==
0
)
toplayer
=
playerid
;
toplayer
=
playerid
;
...
@@ -2031,75 +2032,57 @@ int32 card::filter_summon_procedure(uint8 playerid, effect_set* peset, uint8 ign
...
@@ -2031,75 +2032,57 @@ int32 card::filter_summon_procedure(uint8 playerid, effect_set* peset, uint8 ign
}
}
else
else
toplayer
=
playerid
;
toplayer
=
playerid
;
// uniqueness
if
(
eset
[
i
]
->
check_count_limit
(
playerid
)
&&
is_summonable
(
eset
[
i
],
min_tribute
)
if
(
pduel
->
game_field
->
check_unique_onfield
(
this
,
toplayer
,
LOCATION_MZONE
))
&&
!
pduel
->
game_field
->
check_unique_onfield
(
this
,
toplayer
,
LOCATION_MZONE
)
continue
;
&&
pduel
->
game_field
->
is_player_can_summon
(
eset
[
i
]
->
get_value
(
this
),
playerid
,
this
))
// the script will check the usable count, the # of tributes
if
(
is_summonable
(
eset
[
i
],
min_tribute
))
peset
->
add_item
(
eset
[
i
]);
peset
->
add_item
(
eset
[
i
]);
}
}
if
(
lim
){
if
(
!
pduel
->
game_field
->
is_player_can_summon
(
SUMMON_TYPE_NORMAL
,
playerid
,
this
))
if
(
peset
->
size
())
return
FALSE
;
return
-
1
;
if
(
pduel
->
game_field
->
check_unique_onfield
(
this
,
playerid
,
LOCATION_MZONE
))
else
return
FALSE
;
return
-
2
;
int32
rcount
=
get_summon_tribute_count
();
}
int32
min
=
rcount
&
0xffff
,
max
=
(
rcount
>>
16
)
&
0xffff
;
else
{
if
(
min
>
0
&&
!
pduel
->
game_field
->
is_player_can_summon
(
SUMMON_TYPE_ADVANCE
,
playerid
,
this
))
if
(
peset
->
size
())
return
FALSE
;
return
1
;
if
(
max
<
min_tribute
)
else
return
FALSE
;
return
0
;
if
(
min
<
min_tribute
)
}
min
=
min_tribute
;
return
pduel
->
game_field
->
check_tribute
(
this
,
min
,
max
,
0
,
current
.
controler
);
}
}
// put all set procedures except ordinay set in peset (see is_can_be_summoned())
// put all set procedures except ordinay set in peset (see is_can_be_summoned())
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
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
filter_effect
(
EFFECT_SET_PROC
,
&
eset
);
if
(
eset
[
i
]
->
check_count_limit
(
playerid
)
&&
is_summonable
(
eset
[
i
],
min_tribute
)
}
&&
pduel
->
game_field
->
is_player_can_mset
(
eset
[
i
]
->
get_value
(
this
),
playerid
,
this
))
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
peset
->
add_item
(
eset
[
i
]);
int32
val
=
eset
[
i
]
->
get_value
(
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
;
// the script will check the usable count, the # of tributes
if
(
is_summonable
(
eset
[
i
],
min_tribute
))
peset
->
add_item
(
eset
[
i
]);
}
if
(
lim
){
if
(
peset
->
size
())
if
(
peset
->
size
())
return
-
1
;
return
-
1
;
else
return
-
2
;
return
-
2
;
}
}
else
{
eset
.
clear
();
if
(
peset
->
size
())
filter_effect
(
EFFECT_SET_PROC
,
&
eset
);
return
1
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
else
if
(
eset
[
i
]
->
check_count_limit
(
playerid
)
&&
is_summonable
(
eset
[
i
],
min_tribute
)
return
0
;
&&
pduel
->
game_field
->
is_player_can_mset
(
eset
[
i
]
->
get_value
(
this
),
playerid
,
this
))
peset
->
add_item
(
eset
[
i
]);
}
}
if
(
!
pduel
->
game_field
->
is_player_can_mset
(
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_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
);
...
@@ -2355,43 +2338,6 @@ int32 card::is_summonable(effect* peffect, uint8 min_tribute) {
...
@@ -2355,43 +2338,6 @@ 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
;
}
}
// check if the ordinary summon/set of this is available
int32
card
::
check_ordinary_procedure
(
uint8
playerid
,
uint8
min_tribute
,
bool
is_summon
)
{
if
(
!
pduel
->
game_field
->
is_player_can_summon
(
SUMMON_TYPE_NORMAL
,
playerid
,
this
))
return
FALSE
;
// uniqueness
if
(
is_summon
&&
pduel
->
game_field
->
check_unique_onfield
(
this
,
playerid
,
LOCATION_MZONE
))
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
)
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
);
int32
res
=
pduel
->
game_field
->
is_player_can_summon
(
SUMMON_TYPE_ADVANCE
,
playerid
,
this
);
for
(
int32
i
=
min
;
i
<=
max
;
++
i
)
{
if
(
i
>
0
&&
!
res
)
continue
;
// check if the usable count is enough
int32
self_max
=
i
-
(
int32
)
exset
.
size
();
if
(
self_max
<
0
)
self_max
=
0
;
if
(
self_max
>
(
int32
)
test
.
size
())
self_max
=
(
int32
)
test
.
size
();
if
(
fcount
+
self_max
-
1
>=
0
)
return
TRUE
;
}
return
FALSE
;
}
// if this does not have a summon procedure, it will check ordinary summon
// if this does not have a summon procedure, it will check ordinary summon
// ignore_count: ignore the summon count in this turn or not
// ignore_count: ignore the summon count in this turn or not
// peffect: effects that changes the ordinary summon procedure (c80921533)
// peffect: effects that changes the ordinary summon procedure (c80921533)
...
@@ -2426,8 +2372,7 @@ int32 card::is_can_be_summoned(uint8 playerid, uint8 ignore_count, effect* peffe
...
@@ -2426,8 +2372,7 @@ 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
;
...
@@ -2443,24 +2388,12 @@ int32 card::is_can_be_summoned(uint8 playerid, uint8 ignore_count, effect* peffe
...
@@ -2443,24 +2388,12 @@ int32 card::is_can_be_summoned(uint8 playerid, uint8 ignore_count, effect* peffe
}
}
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
)
{
if
((
peffect
&&
res
<
0
)
||
(
!
peffect
&&
(
!
res
||
res
==
-
2
)
&&
!
proc
.
size
())
if
(
res
<
0
||
!
pduel
->
game_field
->
is_player_can_summon
(
peffect
->
get_value
(),
playerid
,
this
)){
||
(
peffect
&&
(
proc
.
size
()
==
0
)
&&
!
pduel
->
game_field
->
is_player_can_summon
(
peffect
->
get_value
(),
playerid
,
this
)))
{
pduel
->
game_field
->
restore_lp_cost
();
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
return
FALSE
;
}
}
else
{
// ordinary summon
if
(
!
proc
.
size
()
&&
!
check_ordinary_procedure
(
playerid
,
min_tribute
,
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
;
}
}
...
@@ -2674,19 +2607,12 @@ int32 card::is_setable_mzone(uint8 playerid, uint8 ignore_count, effect* peffect
...
@@ -2674,19 +2607,12 @@ int32 card::is_setable_mzone(uint8 playerid, uint8 ignore_count, effect* peffect
min_tribute
=
count
;
min_tribute
=
count
;
}
}
}
}
effect_set
proc
;
eset
.
clear
();
int32
res
=
filter_set_procedure
(
playerid
,
&
proc
,
ignore_count
,
min_tribute
);
int32
res
=
filter_set_procedure
(
playerid
,
&
eset
,
ignore_count
,
min_tribute
);
if
(
peffect
)
{
if
((
peffect
&&
res
<
0
)
||
(
!
peffect
&&
(
!
res
||
res
==
-
2
)
&&
!
eset
.
size
())
if
(
res
<
0
||
!
pduel
->
game_field
->
is_player_can_mset
(
peffect
->
get_value
(),
playerid
,
this
)){
||
(
peffect
&&
(
eset
.
size
()
==
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
()
&&
!
check_ordinary_procedure
(
playerid
,
min_tribute
,
false
))
{
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 @
1dbc3dad
...
@@ -235,7 +235,6 @@ public:
...
@@ -235,7 +235,6 @@ public:
void
filter_single_continuous_effect
(
int32
code
,
effect_set
*
eset
,
uint8
sort
=
TRUE
);
void
filter_single_continuous_effect
(
int32
code
,
effect_set
*
eset
,
uint8
sort
=
TRUE
);
void
filter_immune_effect
();
void
filter_immune_effect
();
void
filter_disable_related_cards
();
void
filter_disable_related_cards
();
int32
check_ordinary_procedure
(
uint8
playerid
,
uint8
min_tribute
,
bool
summon
);
int32
filter_summon_procedure
(
uint8
playerid
,
effect_set
*
eset
,
uint8
ignore_count
,
uint8
min_tribute
);
int32
filter_summon_procedure
(
uint8
playerid
,
effect_set
*
eset
,
uint8
ignore_count
,
uint8
min_tribute
);
int32
filter_set_procedure
(
uint8
playerid
,
effect_set
*
eset
,
uint8
ignore_count
,
uint8
min_tribute
);
int32
filter_set_procedure
(
uint8
playerid
,
effect_set
*
eset
,
uint8
ignore_count
,
uint8
min_tribute
);
void
filter_spsummon_procedure
(
uint8
playerid
,
effect_set
*
eset
,
uint32
summon_type
);
void
filter_spsummon_procedure
(
uint8
playerid
,
effect_set
*
eset
,
uint32
summon_type
);
...
...
field.cpp
View file @
1dbc3dad
...
@@ -1320,7 +1320,7 @@ int32 field::get_summon_release_olist(card* target, card_set* ex_list, card_set*
...
@@ -1320,7 +1320,7 @@ int32 field::get_summon_release_olist(card* target, card_set* ex_list, card_set*
return
rcount
+
ex_sum_max
;
return
rcount
+
ex_sum_max
;
}
}
// put the monsters of 1-p affected by EFFECT_EXTRA_RELEASE
// put the monsters of 1-p affected by EFFECT_EXTRA_RELEASE
void
field
::
get_summon_release_exlist
(
card
*
target
,
card_set
*
ex_list
,
group
*
mg
)
{
int32
field
::
get_summon_release_exlist
(
card
*
target
,
card_set
*
ex_list
,
group
*
mg
)
{
uint8
p
=
target
->
current
.
controler
;
uint8
p
=
target
->
current
.
controler
;
card
*
pcard
;
card
*
pcard
;
uint32
rcount
=
0
;
uint32
rcount
=
0
;
...
@@ -1332,8 +1332,14 @@ void field::get_summon_release_exlist(card* target, card_set* ex_list, group* mg
...
@@ -1332,8 +1332,14 @@ void field::get_summon_release_exlist(card* target, card_set* ex_list, group* mg
continue
;
continue
;
if
(
pcard
->
is_affected_by_effect
(
EFFECT_EXTRA_RELEASE
))
{
if
(
pcard
->
is_affected_by_effect
(
EFFECT_EXTRA_RELEASE
))
{
ex_list
->
insert
(
pcard
);
ex_list
->
insert
(
pcard
);
if
(
pcard
->
is_affected_by_effect
(
EFFECT_DOUBLE_TRIBUTE
,
target
))
pcard
->
release_param
=
2
;
else
pcard
->
release_param
=
1
;
rcount
+=
pcard
->
release_param
;
}
}
}
}
return
rcount
;
}
}
int32
field
::
get_summon_count_limit
(
uint8
playerid
)
{
int32
field
::
get_summon_count_limit
(
uint8
playerid
)
{
effect_set
eset
;
effect_set
eset
;
...
@@ -2219,32 +2225,35 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
...
@@ -2219,32 +2225,35 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
pduel
->
restore_assumes
();
pduel
->
restore_assumes
();
return
FALSE
;
return
FALSE
;
}
}
// check if the # of tributes and the usable count are enough when releasing rcount tributes
int32
field
::
check_tribute
(
card
*
pcard
,
int32
min
,
int32
max
,
group
*
mg
,
uint8
toplayer
)
{
int32
field
::
check_tribute
(
card
*
pcard
,
int32
rcount
,
group
*
mg
,
uint8
toplayer
)
{
card_set
test
,
exset
;
card_set
test
,
exset
;
int32
m1
=
0
,
m2
=
0
,
self_max
=
0
;
int32
m1
=
0
,
m2
=
0
;
if
(
toplayer
==
pcard
->
current
.
controler
)
{
if
(
toplayer
==
pcard
->
current
.
controler
)
{
m1
=
get_summon_release_slist
(
pcard
,
&
test
,
mg
);
m1
=
get_summon_release_slist
(
pcard
,
&
test
,
mg
);
m2
=
get_summon_release_olist
(
pcard
,
NULL
,
NULL
,
mg
,
0
);
m2
=
get_summon_release_olist
(
pcard
,
NULL
,
NULL
,
mg
,
0
);
get_summon_release_exlist
(
pcard
,
&
exset
,
mg
);
}
else
{
self_max
=
rcount
-
(
int32
)
exset
.
size
();
if
(
self_max
<
0
)
self_max
=
0
;
}
else
{
m1
=
get_summon_release_olist
(
pcard
,
&
test
,
NULL
,
mg
,
1
);
m1
=
get_summon_release_olist
(
pcard
,
&
test
,
NULL
,
mg
,
1
);
m2
=
get_summon_release_slist
(
pcard
,
NULL
,
mg
);
m2
=
get_summon_release_slist
(
pcard
,
NULL
,
mg
);
self_max
=
rcount
;
}
}
// check if the # of tributes is enough
// sum of release count is the real upper bound
if
(
m1
+
m2
<
rcount
)
if
(
max
>
m1
+
m2
)
return
FALSE
;
max
=
m1
+
m2
;
// check if the usable count is enough
if
(
min
>
max
)
int32
fcount
=
pduel
->
game_field
->
get_useable_count
(
toplayer
,
LOCATION_MZONE
,
pcard
->
current
.
controler
,
LOCATION_REASON_TOFIELD
);
if
(
self_max
>
(
int32
)
test
.
size
())
self_max
=
(
int32
)
test
.
size
();
if
(
fcount
+
self_max
-
1
<
0
)
return
FALSE
;
return
FALSE
;
int32
fcount
=
get_useable_count
(
toplayer
,
LOCATION_MZONE
,
pcard
->
current
.
controler
,
LOCATION_REASON_TOFIELD
);
if
(
toplayer
==
pcard
->
current
.
controler
)
{
uint32
rmax
=
get_summon_release_exlist
(
pcard
,
&
exset
,
mg
);
uint32
rmin
=
exset
.
size
();
min
-=
rmax
;
max
-=
rmin
;
}
if
(
min
<=
0
&&
max
<=
0
)
{
if
(
fcount
<=
0
)
return
FALSE
;
}
else
{
if
((
int32
)
test
.
size
()
<
-
fcount
+
1
)
return
FALSE
;
}
return
TRUE
;
return
TRUE
;
}
}
int32
field
::
check_with_sum_limit
(
const
card_vector
&
mats
,
int32
acc
,
int32
index
,
int32
count
,
int32
min
,
int32
max
)
{
int32
field
::
check_with_sum_limit
(
const
card_vector
&
mats
,
int32
acc
,
int32
index
,
int32
count
,
int32
min
,
int32
max
)
{
...
...
field.h
View file @
1dbc3dad
...
@@ -366,7 +366,7 @@ public:
...
@@ -366,7 +366,7 @@ public:
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_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_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
);
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
,
group
*
mg
=
NULL
);
int32
get_summon_release_exlist
(
card
*
target
,
card_set
*
ex_list
,
group
*
mg
=
NULL
);
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
);
...
@@ -400,7 +400,7 @@ public:
...
@@ -400,7 +400,7 @@ public:
void
attack_all_target_check
();
void
attack_all_target_check
();
int32
check_synchro_material
(
card
*
pcard
,
int32
findex1
,
int32
findex2
,
int32
min
,
int32
max
,
card
*
smat
,
group
*
mg
);
int32
check_synchro_material
(
card
*
pcard
,
int32
findex1
,
int32
findex2
,
int32
min
,
int32
max
,
card
*
smat
,
group
*
mg
);
int32
check_tuner_material
(
card
*
pcard
,
card
*
tuner
,
int32
findex1
,
int32
findex2
,
int32
min
,
int32
max
,
card
*
smat
,
group
*
mg
);
int32
check_tuner_material
(
card
*
pcard
,
card
*
tuner
,
int32
findex1
,
int32
findex2
,
int32
min
,
int32
max
,
card
*
smat
,
group
*
mg
);
int32
check_tribute
(
card
*
pcard
,
int32
rcount
,
group
*
mg
,
uint8
toplayer
);
int32
check_tribute
(
card
*
pcard
,
int32
min
,
int32
max
,
group
*
mg
,
uint8
toplayer
);
static
int32
check_with_sum_limit
(
const
card_vector
&
mats
,
int32
acc
,
int32
index
,
int32
count
,
int32
min
,
int32
max
);
static
int32
check_with_sum_limit
(
const
card_vector
&
mats
,
int32
acc
,
int32
index
,
int32
count
,
int32
min
,
int32
max
);
static
int32
check_with_sum_limit_m
(
const
card_vector
&
mats
,
int32
acc
,
int32
index
,
int32
min
,
int32
max
,
int32
must_count
);
static
int32
check_with_sum_limit_m
(
const
card_vector
&
mats
,
int32
acc
,
int32
index
,
int32
min
,
int32
max
,
int32
must_count
);
static
int32
check_with_sum_greater_limit
(
const
card_vector
&
mats
,
int32
acc
,
int32
index
,
int32
opmin
);
static
int32
check_with_sum_greater_limit
(
const
card_vector
&
mats
,
int32
acc
,
int32
index
,
int32
opmin
);
...
...
libduel.cpp
View file @
1dbc3dad
...
@@ -2018,17 +2018,20 @@ int32 scriptlib::duel_check_tribute(lua_State *L) {
...
@@ -2018,17 +2018,20 @@ int32 scriptlib::duel_check_tribute(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
*
target
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
target
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
rcount
=
lua_tointeger
(
L
,
2
);
uint32
min
=
lua_tointeger
(
L
,
2
);
group
*
mg
=
NULL
;
uint32
max
=
min
;
if
(
lua_gettop
(
L
)
>=
3
&&
!
lua_isnil
(
L
,
3
))
{
if
(
lua_gettop
(
L
)
>=
3
&&
!
lua_isnil
(
L
,
3
))
check_param
(
L
,
PARAM_TYPE_GROUP
,
3
);
max
=
lua_tointeger
(
L
,
3
);
mg
=
*
(
group
**
)
lua_touserdata
(
L
,
3
);
group
*
mg
=
0
;
if
(
lua_gettop
(
L
)
>=
4
&&
!
lua_isnil
(
L
,
4
))
{
check_param
(
L
,
PARAM_TYPE_GROUP
,
4
);
mg
=
*
(
group
**
)
lua_touserdata
(
L
,
4
);
}
}
uint8
toplayer
=
target
->
current
.
controler
;
uint8
toplayer
=
target
->
current
.
controler
;
if
(
lua_gettop
(
L
)
>=
4
&&
!
lua_isnil
(
L
,
4
))
if
(
lua_gettop
(
L
)
>=
5
&&
!
lua_isnil
(
L
,
5
))
toplayer
=
lua_tointeger
(
L
,
4
);
toplayer
=
lua_tointeger
(
L
,
5
);
duel
*
pduel
=
target
->
pduel
;
duel
*
pduel
=
target
->
pduel
;
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_tribute
(
target
,
rcount
,
mg
,
toplayer
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_tribute
(
target
,
min
,
max
,
mg
,
toplayer
));
return
1
;
return
1
;
}
}
int32
scriptlib
::
duel_select_tribute
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_select_tribute
(
lua_State
*
L
)
{
...
...
operations.cpp
View file @
1dbc3dad
...
@@ -1350,10 +1350,10 @@ int32 field::summon(uint16 step, uint8 sumplayer, card * target, effect * proc,
...
@@ -1350,10 +1350,10 @@ int32 field::summon(uint16 step, uint8 sumplayer, card * target, effect * proc,
return
FALSE
;
return
FALSE
;
}
}
effect_set
eset
;
effect_set
eset
;
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
(
target
->
check_ordinary_procedure
(
sumplayer
,
min_tribute
,
true
)
)
{
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
);
}
}
...
@@ -1848,10 +1848,10 @@ int32 field::mset(uint16 step, uint8 setplayer, card * target, effect * proc, ui
...
@@ -1848,10 +1848,10 @@ int32 field::mset(uint16 step, uint8 setplayer, card * target, effect * proc, ui
return
FALSE
;
return
FALSE
;
}
}
effect_set
eset
;
effect_set
eset
;
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
(
target
->
check_ordinary_procedure
(
setplayer
,
min_tribute
,
false
)
)
{
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