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
xiaoye
ygopro-core
Commits
e7572c70
Commit
e7572c70
authored
Jun 28, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Fluorohydride/ygopro-core
parents
5af3f8ab
dcfb08ce
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
90 additions
and
97 deletions
+90
-97
card.cpp
card.cpp
+17
-29
effect.cpp
effect.cpp
+3
-3
effect.h
effect.h
+1
-0
effectset.h
effectset.h
+9
-0
field.cpp
field.cpp
+11
-14
libcard.cpp
libcard.cpp
+15
-0
operations.cpp
operations.cpp
+33
-51
scriptlib.h
scriptlib.h
+1
-0
No files found.
card.cpp
View file @
e7572c70
...
@@ -1690,7 +1690,6 @@ void card::enable_field_effect(bool enabled) {
...
@@ -1690,7 +1690,6 @@ void card::enable_field_effect(bool enabled) {
reset
(
RESET_DISABLE
,
RESET_EVENT
);
reset
(
RESET_DISABLE
,
RESET_EVENT
);
}
else
}
else
set_status
(
STATUS_EFFECT_ENABLED
,
FALSE
);
set_status
(
STATUS_EFFECT_ENABLED
,
FALSE
);
filter_immune_effect
();
if
(
get_status
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
))
if
(
get_status
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
))
return
;
return
;
filter_disable_related_cards
();
filter_disable_related_cards
();
...
@@ -2081,26 +2080,17 @@ void card::reset_effect_count() {
...
@@ -2081,26 +2080,17 @@ void card::reset_effect_count() {
// refresh STATUS_DISABLED based on EFFECT_DISABLE and EFFECT_CANNOT_DISABLE
// refresh STATUS_DISABLED based on EFFECT_DISABLE and EFFECT_CANNOT_DISABLE
// refresh STATUS_FORBIDDEN based on EFFECT_FORBIDDEN
// refresh STATUS_FORBIDDEN based on EFFECT_FORBIDDEN
void
card
::
refresh_disable_status
()
{
void
card
::
refresh_disable_status
()
{
// forbidden
int32
pre_fb
=
is_status
(
STATUS_FORBIDDEN
);
filter_immune_effect
();
filter_immune_effect
();
// forbidden
if
(
is_affected_by_effect
(
EFFECT_FORBIDDEN
))
if
(
is_affected_by_effect
(
EFFECT_FORBIDDEN
))
set_status
(
STATUS_FORBIDDEN
,
TRUE
);
set_status
(
STATUS_FORBIDDEN
,
TRUE
);
else
else
set_status
(
STATUS_FORBIDDEN
,
FALSE
);
set_status
(
STATUS_FORBIDDEN
,
FALSE
);
int32
cur_fb
=
is_status
(
STATUS_FORBIDDEN
);
if
(
pre_fb
!=
cur_fb
)
filter_immune_effect
();
// disabled
// disabled
int32
pre_dis
=
is_status
(
STATUS_DISABLED
);
filter_immune_effect
();
if
(
!
is_affected_by_effect
(
EFFECT_CANNOT_DISABLE
)
&&
is_affected_by_effect
(
EFFECT_DISABLE
))
if
(
!
is_affected_by_effect
(
EFFECT_CANNOT_DISABLE
)
&&
is_affected_by_effect
(
EFFECT_DISABLE
))
set_status
(
STATUS_DISABLED
,
TRUE
);
set_status
(
STATUS_DISABLED
,
TRUE
);
else
else
set_status
(
STATUS_DISABLED
,
FALSE
);
set_status
(
STATUS_DISABLED
,
FALSE
);
int32
cur_dis
=
is_status
(
STATUS_DISABLED
);
if
(
pre_dis
!=
cur_dis
)
filter_immune_effect
();
}
}
std
::
tuple
<
uint8
,
effect
*>
card
::
refresh_control_status
()
{
std
::
tuple
<
uint8
,
effect
*>
card
::
refresh_control_status
()
{
uint8
final
=
owner
;
uint8
final
=
owner
;
...
@@ -2488,44 +2478,40 @@ void card::filter_single_continuous_effect(int32 code, effect_set* eset, uint8 s
...
@@ -2488,44 +2478,40 @@ void card::filter_single_continuous_effect(int32 code, effect_set* eset, uint8 s
}
}
// refresh this->immune_effect
// refresh this->immune_effect
void
card
::
filter_immune_effect
()
{
void
card
::
filter_immune_effect
()
{
effect
*
peffect
;
immune_effect
.
clear
();
immune_effect
.
clear
();
auto
rg
=
single_effect
.
equal_range
(
EFFECT_IMMUNE_EFFECT
);
auto
rg
=
single_effect
.
equal_range
(
EFFECT_IMMUNE_EFFECT
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
peffect
=
rg
.
first
->
second
;
effect
*
peffect
=
rg
.
first
->
second
;
if
(
peffect
->
is_available
())
immune_effect
.
add_item
(
peffect
);
immune_effect
.
add_item
(
peffect
);
}
}
for
(
auto
&
pcard
:
equiping_cards
)
{
for
(
auto
&
pcard
:
equiping_cards
)
{
rg
=
pcard
->
equip_effect
.
equal_range
(
EFFECT_IMMUNE_EFFECT
);
rg
=
pcard
->
equip_effect
.
equal_range
(
EFFECT_IMMUNE_EFFECT
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
peffect
=
rg
.
first
->
second
;
effect
*
peffect
=
rg
.
first
->
second
;
if
(
peffect
->
is_available
())
immune_effect
.
add_item
(
peffect
);
immune_effect
.
add_item
(
peffect
);
}
}
}
}
for
(
auto
&
pcard
:
effect_target_owner
)
{
for
(
auto
&
pcard
:
effect_target_owner
)
{
rg
=
pcard
->
target_effect
.
equal_range
(
EFFECT_IMMUNE_EFFECT
);
rg
=
pcard
->
target_effect
.
equal_range
(
EFFECT_IMMUNE_EFFECT
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
peffect
=
rg
.
first
->
second
;
effect
*
peffect
=
rg
.
first
->
second
;
if
(
peffect
->
is_target
(
this
)
&&
peffect
->
is_available
()
)
if
(
peffect
->
is_target
(
this
))
immune_effect
.
add_item
(
peffect
);
immune_effect
.
add_item
(
peffect
);
}
}
}
}
for
(
auto
&
pcard
:
xyz_materials
)
{
for
(
auto
&
pcard
:
xyz_materials
)
{
rg
=
pcard
->
xmaterial_effect
.
equal_range
(
EFFECT_IMMUNE_EFFECT
);
rg
=
pcard
->
xmaterial_effect
.
equal_range
(
EFFECT_IMMUNE_EFFECT
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
peffect
=
rg
.
first
->
second
;
effect
*
peffect
=
rg
.
first
->
second
;
if
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
if
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
continue
;
continue
;
if
(
peffect
->
is_available
())
immune_effect
.
add_item
(
peffect
);
immune_effect
.
add_item
(
peffect
);
}
}
}
}
rg
=
pduel
->
game_field
->
effects
.
aura_effect
.
equal_range
(
EFFECT_IMMUNE_EFFECT
);
rg
=
pduel
->
game_field
->
effects
.
aura_effect
.
equal_range
(
EFFECT_IMMUNE_EFFECT
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
peffect
=
rg
.
first
->
second
;
effect
*
peffect
=
rg
.
first
->
second
;
if
(
peffect
->
is_target
(
this
)
&&
peffect
->
is_available
()
)
if
(
peffect
->
is_target
(
this
))
immune_effect
.
add_item
(
peffect
);
immune_effect
.
add_item
(
peffect
);
}
}
immune_effect
.
sort
();
immune_effect
.
sort
();
...
@@ -2740,7 +2726,7 @@ void card::filter_spsummon_procedure(uint8 playerid, effect_set* peset, uint32 s
...
@@ -2740,7 +2726,7 @@ void card::filter_spsummon_procedure(uint8 playerid, effect_set* peset, uint32 s
toplayer
=
playerid
;
toplayer
=
playerid
;
}
}
if
(
peffect
->
is_available
()
&&
peffect
->
check_count_limit
(
playerid
)
&&
is_spsummonable
(
peffect
)
if
(
peffect
->
is_available
()
&&
peffect
->
check_count_limit
(
playerid
)
&&
is_spsummonable
(
peffect
)
&&
!
pduel
->
game_field
->
check_unique_onfield
(
this
,
toplayer
,
LOCATION_MZONE
))
{
&&
((
topos
&
POS_FACEDOWN
)
||
!
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
)
sumeffect
=
peffect
;
sumeffect
=
peffect
;
...
@@ -3141,7 +3127,7 @@ int32 card::is_can_be_summoned(uint8 playerid, uint8 ignore_count, effect* peffe
...
@@ -3141,7 +3127,7 @@ 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
,
zone
);
int32
res
=
filter_summon_procedure
(
playerid
,
&
proc
,
ignore_count
,
min_tribute
,
zone
);
if
(
peffect
)
{
if
(
peffect
)
{
if
(
res
<
0
||
!
pduel
->
game_field
->
is_player_can_summon
(
peffect
->
get_value
(),
playerid
,
this
,
playerid
))
{
if
(
res
<
0
||
!
check_summon_procedure
(
peffect
,
playerid
,
ignore_count
,
min_tribute
,
zone
))
{
pduel
->
game_field
->
restore_lp_cost
();
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
return
FALSE
;
}
}
...
@@ -3279,7 +3265,9 @@ int32 card::is_can_be_special_summoned(effect* reason_effect, uint32 sumtype, ui
...
@@ -3279,7 +3265,9 @@ int32 card::is_can_be_special_summoned(effect* reason_effect, uint32 sumtype, ui
if
((
data
.
type
&
TYPE_PENDULUM
)
&&
current
.
location
==
LOCATION_EXTRA
&&
(
current
.
position
&
POS_FACEUP
)
if
((
data
.
type
&
TYPE_PENDULUM
)
&&
current
.
location
==
LOCATION_EXTRA
&&
(
current
.
position
&
POS_FACEUP
)
&&
(
sumtype
==
SUMMON_TYPE_FUSION
||
sumtype
==
SUMMON_TYPE_SYNCHRO
||
sumtype
==
SUMMON_TYPE_XYZ
))
&&
(
sumtype
==
SUMMON_TYPE_FUSION
||
sumtype
==
SUMMON_TYPE_SYNCHRO
||
sumtype
==
SUMMON_TYPE_XYZ
))
return
FALSE
;
return
FALSE
;
if
(((
sumpos
&
POS_FACEDOWN
)
==
0
)
&&
pduel
->
game_field
->
check_unique_onfield
(
this
,
toplayer
,
LOCATION_MZONE
))
if
((
sumpos
&
POS_FACEDOWN
)
&&
pduel
->
game_field
->
is_player_affected_by_effect
(
sumplayer
,
EFFECT_DEVINE_LIGHT
))
sumpos
=
(
sumpos
&
POS_FACEUP
)
|
((
sumpos
&
POS_FACEDOWN
)
>>
1
);
if
(
!
(
sumpos
&
POS_FACEDOWN
)
&&
pduel
->
game_field
->
check_unique_onfield
(
this
,
toplayer
,
LOCATION_MZONE
))
return
FALSE
;
return
FALSE
;
sumtype
|=
SUMMON_TYPE_SPECIAL
;
sumtype
|=
SUMMON_TYPE_SPECIAL
;
if
((
sumplayer
==
0
||
sumplayer
==
1
)
&&
!
pduel
->
game_field
->
is_player_can_spsummon
(
reason_effect
,
sumtype
,
sumpos
,
sumplayer
,
toplayer
,
this
))
if
((
sumplayer
==
0
||
sumplayer
==
1
)
&&
!
pduel
->
game_field
->
is_player_can_spsummon
(
reason_effect
,
sumtype
,
sumpos
,
sumplayer
,
toplayer
,
this
))
...
@@ -3339,7 +3327,7 @@ int32 card::is_setable_mzone(uint8 playerid, uint8 ignore_count, effect* peffect
...
@@ -3339,7 +3327,7 @@ int32 card::is_setable_mzone(uint8 playerid, uint8 ignore_count, effect* peffect
effect_set
eset
;
effect_set
eset
;
int32
res
=
filter_set_procedure
(
playerid
,
&
eset
,
ignore_count
,
min_tribute
,
zone
);
int32
res
=
filter_set_procedure
(
playerid
,
&
eset
,
ignore_count
,
min_tribute
,
zone
);
if
(
peffect
)
{
if
(
peffect
)
{
if
(
res
<
0
||
!
pduel
->
game_field
->
is_player_can_mset
(
peffect
->
get_value
(),
playerid
,
this
,
playerid
))
{
if
(
res
<
0
||
!
check_set_procedure
(
peffect
,
playerid
,
ignore_count
,
min_tribute
,
zone
))
{
pduel
->
game_field
->
restore_lp_cost
();
pduel
->
game_field
->
restore_lp_cost
();
return
FALSE
;
return
FALSE
;
}
}
...
...
effect.cpp
View file @
e7572c70
...
@@ -514,10 +514,10 @@ int32 effect::is_player_effect_target(card* pcard) {
...
@@ -514,10 +514,10 @@ int32 effect::is_player_effect_target(card* pcard) {
return
TRUE
;
return
TRUE
;
}
}
int32
effect
::
is_immuned
(
card
*
pcard
)
{
int32
effect
::
is_immuned
(
card
*
pcard
)
{
effect_set_v
effects
=
pcard
->
immune_effect
;
const
effect_set_v
&
effects
=
pcard
->
immune_effect
;
for
(
int32
i
=
0
;
i
<
effects
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
effects
.
size
();
++
i
)
{
effect
*
peffect
=
effects
.
at
(
i
)
;
effect
*
peffect
=
effects
[
i
]
;
if
(
peffect
->
value
)
{
if
(
peffect
->
is_available
()
&&
peffect
->
value
)
{
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
pcard
,
PARAM_TYPE_CARD
);
pduel
->
lua
->
add_param
(
pcard
,
PARAM_TYPE_CARD
);
if
(
peffect
->
check_value_condition
(
2
))
if
(
peffect
->
check_value_condition
(
2
))
...
...
effect.h
View file @
e7572c70
...
@@ -294,6 +294,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
...
@@ -294,6 +294,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_DUAL_STATUS 75 //
#define EFFECT_DUAL_STATUS 75 //
#define EFFECT_EQUIP_LIMIT 76 //
#define EFFECT_EQUIP_LIMIT 76 //
#define EFFECT_DUAL_SUMMONABLE 77 //
#define EFFECT_DUAL_SUMMONABLE 77 //
#define EFFECT_UNION_LIMIT 78 //
#define EFFECT_REVERSE_DAMAGE 80 //
#define EFFECT_REVERSE_DAMAGE 80 //
#define EFFECT_REVERSE_RECOVER 81 //
#define EFFECT_REVERSE_RECOVER 81 //
#define EFFECT_CHANGE_DAMAGE 82 //
#define EFFECT_CHANGE_DAMAGE 82 //
...
...
effectset.h
View file @
e7572c70
...
@@ -92,12 +92,21 @@ struct effect_set_v {
...
@@ -92,12 +92,21 @@ struct effect_set_v {
return
;
return
;
std
::
sort
(
container
.
begin
(),
container
.
begin
()
+
count
,
effect_sort_id
);
std
::
sort
(
container
.
begin
(),
container
.
begin
()
+
count
,
effect_sort_id
);
}
}
effect
*
const
&
get_last
()
const
{
return
container
[
count
-
1
];
}
effect
*&
get_last
()
{
effect
*&
get_last
()
{
return
container
[
count
-
1
];
return
container
[
count
-
1
];
}
}
effect
*
const
&
operator
[]
(
int
index
)
const
{
return
container
[
index
];
}
effect
*&
operator
[]
(
int
index
)
{
effect
*&
operator
[]
(
int
index
)
{
return
container
[
index
];
return
container
[
index
];
}
}
effect
*
const
&
at
(
int
index
)
const
{
return
container
[
index
];
}
effect
*&
at
(
int
index
)
{
effect
*&
at
(
int
index
)
{
return
container
[
index
];
return
container
[
index
];
}
}
...
...
field.cpp
View file @
e7572c70
...
@@ -1949,38 +1949,35 @@ void field::update_disable_check_list(effect* peffect) {
...
@@ -1949,38 +1949,35 @@ void field::update_disable_check_list(effect* peffect) {
add_to_disable_check_list
(
pcard
);
add_to_disable_check_list
(
pcard
);
}
}
void
field
::
add_to_disable_check_list
(
card
*
pcard
)
{
void
field
::
add_to_disable_check_list
(
card
*
pcard
)
{
auto
result
=
effects
.
disable_check_set
.
insert
(
pcard
);
auto
result
=
effects
.
disable_check_set
.
insert
(
pcard
);
if
(
!
result
.
second
)
if
(
!
result
.
second
)
return
;
return
;
effects
.
disable_check_list
.
push_back
(
pcard
);
effects
.
disable_check_list
.
push_back
(
pcard
);
}
}
void
field
::
adjust_disable_check_list
()
{
void
field
::
adjust_disable_check_list
()
{
card
*
checking
;
if
(
!
effects
.
disable_check_list
.
size
())
int32
pre_disable
,
new_disable
;
if
(
!
effects
.
disable_check_list
.
size
())
return
;
return
;
card_set
checked
;
do
{
do
{
c
hecked
.
clear
()
;
c
ard_set
checked
;
while
(
effects
.
disable_check_list
.
size
())
{
while
(
effects
.
disable_check_list
.
size
())
{
checking
=
effects
.
disable_check_list
.
front
();
c
ard
*
c
hecking
=
effects
.
disable_check_list
.
front
();
effects
.
disable_check_list
.
pop_front
();
effects
.
disable_check_list
.
pop_front
();
effects
.
disable_check_set
.
erase
(
checking
);
effects
.
disable_check_set
.
erase
(
checking
);
checked
.
insert
(
checking
);
checked
.
insert
(
checking
);
if
(
checking
->
is_status
(
STATUS_TO_ENABLE
|
STATUS_TO_DISABLE
))
if
(
checking
->
is_status
(
STATUS_TO_ENABLE
|
STATUS_TO_DISABLE
))
continue
;
continue
;
pre_disable
=
checking
->
get_status
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
);
int32
pre_disable
=
checking
->
get_status
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
);
checking
->
refresh_disable_status
();
checking
->
refresh_disable_status
();
new_disable
=
checking
->
get_status
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
);
int32
new_disable
=
checking
->
get_status
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
);
if
(
pre_disable
!=
new_disable
&&
checking
->
is_status
(
STATUS_EFFECT_ENABLED
))
{
if
(
pre_disable
!=
new_disable
&&
checking
->
is_status
(
STATUS_EFFECT_ENABLED
))
{
checking
->
filter_disable_related_cards
();
checking
->
filter_disable_related_cards
();
if
(
pre_disable
)
if
(
pre_disable
)
checking
->
set_status
(
STATUS_TO_ENABLE
,
TRUE
);
checking
->
set_status
(
STATUS_TO_ENABLE
,
TRUE
);
else
else
checking
->
set_status
(
STATUS_TO_DISABLE
,
TRUE
);
checking
->
set_status
(
STATUS_TO_DISABLE
,
TRUE
);
}
}
}
}
for
(
auto
&
pcard
:
checked
)
{
for
(
auto
&
pcard
:
checked
)
{
if
(
pcard
->
is_status
(
STATUS_DISABLED
)
&&
pcard
->
is_status
(
STATUS_TO_DISABLE
)
&&
!
pcard
->
is_status
(
STATUS_TO_ENABLE
))
if
(
pcard
->
is_status
(
STATUS_DISABLED
)
&&
pcard
->
is_status
(
STATUS_TO_DISABLE
)
&&
!
pcard
->
is_status
(
STATUS_TO_ENABLE
))
pcard
->
reset
(
RESET_DISABLE
,
RESET_EVENT
);
pcard
->
reset
(
RESET_DISABLE
,
RESET_EVENT
);
pcard
->
set_status
(
STATUS_TO_ENABLE
|
STATUS_TO_DISABLE
,
FALSE
);
pcard
->
set_status
(
STATUS_TO_ENABLE
|
STATUS_TO_DISABLE
,
FALSE
);
...
...
libcard.cpp
View file @
e7572c70
...
@@ -1426,6 +1426,20 @@ int32 scriptlib::card_check_equip_target(lua_State *L) {
...
@@ -1426,6 +1426,20 @@ int32 scriptlib::card_check_equip_target(lua_State *L) {
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
return
1
;
return
1
;
}
}
int32
scriptlib
::
card_check_union_target
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
target
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
if
(
pcard
->
is_affected_by_effect
(
EFFECT_UNION_LIMIT
,
target
)
&&
((
!
pcard
->
is_affected_by_effect
(
EFFECT_OLDUNION_STATUS
)
||
target
->
get_union_count
()
==
0
)
&&
(
!
pcard
->
is_affected_by_effect
(
EFFECT_UNION_STATUS
)
||
target
->
get_old_union_count
()
==
0
)))
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
card_get_union_count
(
lua_State
*
L
)
{
int32
scriptlib
::
card_get_union_count
(
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
);
...
@@ -3389,6 +3403,7 @@ static const struct luaL_Reg cardlib[] = {
...
@@ -3389,6 +3403,7 @@ static const struct luaL_Reg cardlib[] = {
{
"GetEquipTarget"
,
scriptlib
::
card_get_equip_target
},
{
"GetEquipTarget"
,
scriptlib
::
card_get_equip_target
},
{
"GetPreviousEquipTarget"
,
scriptlib
::
card_get_pre_equip_target
},
{
"GetPreviousEquipTarget"
,
scriptlib
::
card_get_pre_equip_target
},
{
"CheckEquipTarget"
,
scriptlib
::
card_check_equip_target
},
{
"CheckEquipTarget"
,
scriptlib
::
card_check_equip_target
},
{
"CheckUnionTarget"
,
scriptlib
::
card_check_union_target
},
{
"GetUnionCount"
,
scriptlib
::
card_get_union_count
},
{
"GetUnionCount"
,
scriptlib
::
card_get_union_count
},
{
"GetOverlayGroup"
,
scriptlib
::
card_get_overlay_group
},
{
"GetOverlayGroup"
,
scriptlib
::
card_get_overlay_group
},
{
"GetOverlayCount"
,
scriptlib
::
card_get_overlay_count
},
{
"GetOverlayCount"
,
scriptlib
::
card_get_overlay_count
},
...
...
operations.cpp
View file @
e7572c70
...
@@ -467,32 +467,33 @@ int32 field::damage(uint16 step, effect* reason_effect, uint32 reason, uint8 rea
...
@@ -467,32 +467,33 @@ int32 field::damage(uint16 step, effect* reason_effect, uint32 reason, uint8 rea
}
}
}
}
}
}
uint32
val
=
amount
;
eset
.
clear
();
eset
.
clear
();
filter_player_effect
(
playerid
,
EFFECT_
CHANGE
_DAMAGE
,
&
eset
);
filter_player_effect
(
playerid
,
EFFECT_
REFLECT
_DAMAGE
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
reason_effect
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
reason_effect
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
amount
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
amount
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason_player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason_player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason_card
,
PARAM_TYPE_CARD
);
pduel
->
lua
->
add_param
(
reason_card
,
PARAM_TYPE_CARD
);
val
=
eset
[
i
]
->
get_value
(
5
);
if
(
eset
[
i
]
->
check_value_condition
(
5
))
{
returns
.
ivalue
[
0
]
=
val
;
playerid
=
1
-
playerid
;
if
(
val
==
0
)
core
.
units
.
begin
()
->
arg2
|=
1
<<
29
;
return
TRUE
;
break
;
}
}
}
uint32
val
=
amount
;
eset
.
clear
();
eset
.
clear
();
filter_player_effect
(
playerid
,
EFFECT_
REFLECT
_DAMAGE
,
&
eset
);
filter_player_effect
(
playerid
,
EFFECT_
CHANGE
_DAMAGE
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
reason_effect
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
reason_effect
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
val
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
val
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason_player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason_player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason_card
,
PARAM_TYPE_CARD
);
pduel
->
lua
->
add_param
(
reason_card
,
PARAM_TYPE_CARD
);
if
(
eset
[
i
]
->
check_value_condition
(
5
))
{
val
=
eset
[
i
]
->
get_value
(
5
);
core
.
units
.
begin
()
->
arg2
|=
1
<<
29
;
returns
.
ivalue
[
0
]
=
val
;
break
;
if
(
val
==
0
)
}
return
TRUE
;
}
}
core
.
units
.
begin
()
->
arg2
=
(
core
.
units
.
begin
()
->
arg2
&
0xff000000
)
|
(
val
&
0xffffff
);
core
.
units
.
begin
()
->
arg2
=
(
core
.
units
.
begin
()
->
arg2
&
0xff000000
)
|
(
val
&
0xffffff
);
if
(
is_step
)
{
if
(
is_step
)
{
...
@@ -1390,6 +1391,10 @@ int32 field::self_destroy(uint16 step, card* ucard, int32 p) {
...
@@ -1390,6 +1391,10 @@ int32 field::self_destroy(uint16 step, card* ucard, int32 p) {
int32
field
::
trap_monster_adjust
(
uint16
step
)
{
int32
field
::
trap_monster_adjust
(
uint16
step
)
{
switch
(
step
)
{
switch
(
step
)
{
case
0
:
{
case
0
:
{
if
(
core
.
duel_rule
<=
4
)
{
core
.
units
.
begin
()
->
step
=
3
;
return
FALSE
;
}
card_set
*
to_grave_set
=
new
card_set
;
card_set
*
to_grave_set
=
new
card_set
;
core
.
units
.
begin
()
->
ptr1
=
to_grave_set
;
core
.
units
.
begin
()
->
ptr1
=
to_grave_set
;
return
FALSE
;
return
FALSE
;
...
@@ -1444,14 +1449,17 @@ int32 field::trap_monster_adjust(uint16 step) {
...
@@ -1444,14 +1449,17 @@ int32 field::trap_monster_adjust(uint16 step) {
for
(
uint8
p
=
0
;
p
<
2
;
++
p
)
{
for
(
uint8
p
=
0
;
p
<
2
;
++
p
)
{
for
(
auto
&
pcard
:
core
.
trap_monster_adjust_set
[
tp
])
{
for
(
auto
&
pcard
:
core
.
trap_monster_adjust_set
[
tp
])
{
pcard
->
reset
(
RESET_TURN_SET
,
RESET_EVENT
);
pcard
->
reset
(
RESET_TURN_SET
,
RESET_EVENT
);
if
(
core
.
duel_rule
<=
4
)
refresh_location_info_instant
();
move_to_field
(
pcard
,
tp
,
tp
,
LOCATION_SZONE
,
pcard
->
current
.
position
,
FALSE
,
2
);
move_to_field
(
pcard
,
tp
,
tp
,
LOCATION_SZONE
,
pcard
->
current
.
position
,
FALSE
,
2
);
}
}
tp
=
1
-
tp
;
tp
=
1
-
tp
;
}
}
card_set
*
to_grave_set
=
(
card_set
*
)
core
.
units
.
begin
()
->
ptr1
;
if
(
card_set
*
to_grave_set
=
(
card_set
*
)
core
.
units
.
begin
()
->
ptr1
)
{
if
(
to_grave_set
->
size
())
if
(
to_grave_set
->
size
())
send_to
(
to_grave_set
,
0
,
REASON_RULE
,
PLAYER_NONE
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
POS_FACEUP
);
send_to
(
to_grave_set
,
0
,
REASON_RULE
,
PLAYER_NONE
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
POS_FACEUP
);
delete
to_grave_set
;
delete
to_grave_set
;
}
return
TRUE
;
return
TRUE
;
}
}
}
}
...
@@ -1572,7 +1580,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
...
@@ -1572,7 +1580,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
effect_set
eset
;
effect_set
eset
;
int32
res
=
target
->
filter_summon_procedure
(
sumplayer
,
&
eset
,
ignore_count
,
min_tribute
,
zone
);
int32
res
=
target
->
filter_summon_procedure
(
sumplayer
,
&
eset
,
ignore_count
,
min_tribute
,
zone
);
if
(
proc
)
{
if
(
proc
)
{
if
(
res
<
0
)
if
(
res
<
0
||
!
target
->
check_summon_procedure
(
proc
,
sumplayer
,
ignore_count
,
min_tribute
,
zone
)
)
return
TRUE
;
return
TRUE
;
}
else
{
}
else
{
if
(
res
==
-
2
)
if
(
res
==
-
2
)
...
@@ -1613,23 +1621,10 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
...
@@ -1613,23 +1621,10 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
core
.
units
.
begin
()
->
ptr1
=
0
;
core
.
units
.
begin
()
->
ptr1
=
0
;
return
FALSE
;
return
FALSE
;
}
}
if
(
proc
)
{
if
(
!
proc
)
{
core
.
units
.
begin
()
->
step
=
3
;
proc
=
core
.
select_effects
[
returns
.
ivalue
[
0
]];
if
(
!
ignore_count
&&
!
core
.
extra_summon
[
sumplayer
])
{
core
.
units
.
begin
()
->
peffect
=
proc
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
std
::
vector
<
int32
>
retval
;
eset
[
i
]
->
get_value
(
target
,
0
,
&
retval
);
if
(
retval
.
size
()
<
2
)
{
core
.
units
.
begin
()
->
ptr1
=
eset
[
i
];
return
FALSE
;
}
}
}
core
.
units
.
begin
()
->
ptr1
=
0
;
return
FALSE
;
}
}
effect
*
proc
=
core
.
select_effects
[
returns
.
ivalue
[
0
]];
core
.
units
.
begin
()
->
peffect
=
proc
;
core
.
select_effects
.
clear
();
core
.
select_effects
.
clear
();
core
.
select_options
.
clear
();
core
.
select_options
.
clear
();
if
(
ignore_count
||
core
.
summon_count
[
sumplayer
]
<
get_summon_count_limit
(
sumplayer
))
{
if
(
ignore_count
||
core
.
summon_count
[
sumplayer
]
<
get_summon_count_limit
(
sumplayer
))
{
...
@@ -2155,7 +2150,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
...
@@ -2155,7 +2150,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
effect_set
eset
;
effect_set
eset
;
int32
res
=
target
->
filter_set_procedure
(
setplayer
,
&
eset
,
ignore_count
,
min_tribute
,
zone
);
int32
res
=
target
->
filter_set_procedure
(
setplayer
,
&
eset
,
ignore_count
,
min_tribute
,
zone
);
if
(
proc
)
{
if
(
proc
)
{
if
(
res
<
0
)
if
(
res
<
0
||
!
target
->
check_set_procedure
(
proc
,
setplayer
,
ignore_count
,
min_tribute
,
zone
)
)
return
TRUE
;
return
TRUE
;
}
else
{
}
else
{
if
(
res
==
-
2
)
if
(
res
==
-
2
)
...
@@ -2181,23 +2176,10 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
...
@@ -2181,23 +2176,10 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
case
1
:
{
case
1
:
{
effect_set
eset
;
effect_set
eset
;
target
->
filter_effect
(
EFFECT_EXTRA_SET_COUNT
,
&
eset
);
target
->
filter_effect
(
EFFECT_EXTRA_SET_COUNT
,
&
eset
);
if
(
proc
)
{
if
(
!
proc
)
{
core
.
units
.
begin
()
->
step
=
3
;
proc
=
core
.
select_effects
[
returns
.
ivalue
[
0
]];
if
(
!
ignore_count
&&
!
core
.
extra_summon
[
setplayer
])
{
core
.
units
.
begin
()
->
peffect
=
proc
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
std
::
vector
<
int32
>
retval
;
eset
[
i
]
->
get_value
(
target
,
0
,
&
retval
);
if
(
retval
.
size
()
<
2
)
{
core
.
units
.
begin
()
->
ptr1
=
eset
[
i
];
return
FALSE
;
}
}
}
core
.
units
.
begin
()
->
ptr1
=
0
;
return
FALSE
;
}
}
effect
*
proc
=
core
.
select_effects
[
returns
.
ivalue
[
0
]];
core
.
units
.
begin
()
->
peffect
=
proc
;
core
.
select_effects
.
clear
();
core
.
select_effects
.
clear
();
core
.
select_options
.
clear
();
core
.
select_options
.
clear
();
if
(
ignore_count
||
core
.
summon_count
[
setplayer
]
<
get_summon_count_limit
(
setplayer
))
{
if
(
ignore_count
||
core
.
summon_count
[
setplayer
]
<
get_summon_count_limit
(
setplayer
))
{
...
@@ -3155,7 +3137,7 @@ int32 field::special_summon_step(uint16 step, group* targets, card* target, uint
...
@@ -3155,7 +3137,7 @@ int32 field::special_summon_step(uint16 step, group* targets, card* target, uint
}
}
}
}
if
((
target
->
current
.
location
==
LOCATION_MZONE
)
if
((
target
->
current
.
location
==
LOCATION_MZONE
)
||
check_unique_onfield
(
target
,
playerid
,
LOCATION_MZONE
)
||
!
(
positions
&
POS_FACEDOWN
)
&&
check_unique_onfield
(
target
,
playerid
,
LOCATION_MZONE
)
||
!
is_player_can_spsummon
(
core
.
reason_effect
,
target
->
summon_info
&
0xff00ffff
,
positions
,
target
->
summon_player
,
playerid
,
target
)
||
!
is_player_can_spsummon
(
core
.
reason_effect
,
target
->
summon_info
&
0xff00ffff
,
positions
,
target
->
summon_player
,
playerid
,
target
)
||
(
!
nocheck
&&
!
(
target
->
data
.
type
&
TYPE_MONSTER
)))
{
||
(
!
nocheck
&&
!
(
target
->
data
.
type
&
TYPE_MONSTER
)))
{
core
.
units
.
begin
()
->
step
=
4
;
core
.
units
.
begin
()
->
step
=
4
;
...
@@ -4525,7 +4507,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
...
@@ -4525,7 +4507,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
uint32
flag
;
uint32
flag
;
uint32
lreason
=
(
target
->
current
.
location
==
LOCATION_MZONE
)
?
LOCATION_REASON_CONTROL
:
LOCATION_REASON_TOFIELD
;
uint32
lreason
=
(
target
->
current
.
location
==
LOCATION_MZONE
)
?
LOCATION_REASON_CONTROL
:
LOCATION_REASON_TOFIELD
;
int32
ct
=
get_useable_count
(
target
,
playerid
,
location
,
move_player
,
lreason
,
zone
,
&
flag
);
int32
ct
=
get_useable_count
(
target
,
playerid
,
location
,
move_player
,
lreason
,
zone
,
&
flag
);
if
((
ret
==
1
)
&&
(
ct
<=
0
||
target
->
is_status
(
STATUS_FORBIDDEN
)
||
check_unique_onfield
(
target
,
playerid
,
location
)))
{
if
((
ret
==
1
)
&&
(
ct
<=
0
||
target
->
is_status
(
STATUS_FORBIDDEN
)
||
!
(
positions
&
POS_FACEDOWN
)
&&
check_unique_onfield
(
target
,
playerid
,
location
)))
{
core
.
units
.
begin
()
->
step
=
3
;
core
.
units
.
begin
()
->
step
=
3
;
send_to
(
target
,
core
.
reason_effect
,
REASON_RULE
,
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
0
);
send_to
(
target
,
core
.
reason_effect
,
REASON_RULE
,
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
0
);
return
FALSE
;
return
FALSE
;
...
...
scriptlib.h
View file @
e7572c70
...
@@ -158,6 +158,7 @@ public:
...
@@ -158,6 +158,7 @@ public:
static
int32
card_get_equip_target
(
lua_State
*
L
);
static
int32
card_get_equip_target
(
lua_State
*
L
);
static
int32
card_get_pre_equip_target
(
lua_State
*
L
);
static
int32
card_get_pre_equip_target
(
lua_State
*
L
);
static
int32
card_check_equip_target
(
lua_State
*
L
);
static
int32
card_check_equip_target
(
lua_State
*
L
);
static
int32
card_check_union_target
(
lua_State
*
L
);
static
int32
card_get_union_count
(
lua_State
*
L
);
static
int32
card_get_union_count
(
lua_State
*
L
);
static
int32
card_get_overlay_group
(
lua_State
*
L
);
static
int32
card_get_overlay_group
(
lua_State
*
L
);
static
int32
card_get_overlay_count
(
lua_State
*
L
);
static
int32
card_get_overlay_count
(
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