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
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
MyCard
ygopro-core
Commits
96bbbedb
Commit
96bbbedb
authored
Nov 16, 2016
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add EFFECT_TYPE_XMATERIAL
parent
79b9ee57
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
419 additions
and
304 deletions
+419
-304
card.cpp
card.cpp
+63
-3
card.h
card.h
+1
-0
effect.cpp
effect.cpp
+47
-31
effect.h
effect.h
+4
-0
field.cpp
field.cpp
+7
-7
field.h
field.h
+1
-0
libduel.cpp
libduel.cpp
+4
-4
libeffect.cpp
libeffect.cpp
+5
-5
ocgapi.cpp
ocgapi.cpp
+2
-2
playerop.cpp
playerop.cpp
+3
-3
processor.cpp
processor.cpp
+282
-249
No files found.
card.cpp
View file @
96bbbedb
...
@@ -90,6 +90,7 @@ card::~card() {
...
@@ -90,6 +90,7 @@ card::~card() {
single_effect
.
clear
();
single_effect
.
clear
();
field_effect
.
clear
();
field_effect
.
clear
();
equip_effect
.
clear
();
equip_effect
.
clear
();
xmaterial_effect
.
clear
();
relate_effect
.
clear
();
relate_effect
.
clear
();
}
}
uint32
card
::
get_infos
(
byte
*
buf
,
int32
query_flag
,
int32
use_cache
)
{
uint32
card
::
get_infos
(
byte
*
buf
,
int32
query_flag
,
int32
use_cache
)
{
...
@@ -1285,6 +1286,12 @@ int32 card::add_effect(effect* peffect) {
...
@@ -1285,6 +1286,12 @@ int32 card::add_effect(effect* peffect) {
check_target
=
equiping_target
;
check_target
=
equiping_target
;
else
else
check_target
=
0
;
check_target
=
0
;
}
else
if
(
peffect
->
type
&
EFFECT_TYPE_XMATERIAL
)
{
eit
=
xmaterial_effect
.
insert
(
std
::
make_pair
(
peffect
->
code
,
peffect
));
if
(
overlay_target
)
check_target
=
overlay_target
;
else
check_target
=
0
;
}
else
}
else
return
0
;
return
0
;
peffect
->
id
=
pduel
->
game_field
->
infos
.
field_id
++
;
peffect
->
id
=
pduel
->
game_field
->
infos
.
field_id
++
;
...
@@ -1362,6 +1369,12 @@ void card::remove_effect(effect* peffect, effect_container::iterator it) {
...
@@ -1362,6 +1369,12 @@ void card::remove_effect(effect* peffect, effect_container::iterator it) {
check_target
=
equiping_target
;
check_target
=
equiping_target
;
else
else
check_target
=
0
;
check_target
=
0
;
}
else
if
(
peffect
->
type
&
EFFECT_TYPE_XMATERIAL
)
{
xmaterial_effect
.
erase
(
it
);
if
(
overlay_target
)
check_target
=
overlay_target
;
else
check_target
=
0
;
}
}
if
((
current
.
controler
!=
PLAYER_NONE
)
&&
!
get_status
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
)
&&
check_target
)
{
if
((
current
.
controler
!=
PLAYER_NONE
)
&&
!
get_status
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
)
&&
check_target
)
{
if
(
peffect
->
is_disable_related
())
if
(
peffect
->
is_disable_related
())
...
@@ -1432,7 +1445,7 @@ int32 card::copy_effect(uint32 code, uint32 reset, uint32 count) {
...
@@ -1432,7 +1445,7 @@ int32 card::copy_effect(uint32 code, uint32 reset, uint32 count) {
if
(
!
(
data
.
type
&
TYPE_EFFECT
))
{
if
(
!
(
data
.
type
&
TYPE_EFFECT
))
{
effect
*
peffect
=
pduel
->
new_effect
();
effect
*
peffect
=
pduel
->
new_effect
();
if
(
pduel
->
game_field
->
core
.
reason_effect
)
if
(
pduel
->
game_field
->
core
.
reason_effect
)
peffect
->
owner
=
pduel
->
game_field
->
core
.
reason_effect
->
handler
;
peffect
->
owner
=
pduel
->
game_field
->
core
.
reason_effect
->
get_handler
()
;
else
else
peffect
->
owner
=
this
;
peffect
->
owner
=
this
;
peffect
->
handler
=
this
;
peffect
->
handler
=
this
;
...
@@ -1476,7 +1489,7 @@ int32 card::replace_effect(uint32 code, uint32 reset, uint32 count) {
...
@@ -1476,7 +1489,7 @@ int32 card::replace_effect(uint32 code, uint32 reset, uint32 count) {
if
(
!
(
data
.
type
&
TYPE_EFFECT
))
{
if
(
!
(
data
.
type
&
TYPE_EFFECT
))
{
effect
*
peffect
=
pduel
->
new_effect
();
effect
*
peffect
=
pduel
->
new_effect
();
if
(
pduel
->
game_field
->
core
.
reason_effect
)
if
(
pduel
->
game_field
->
core
.
reason_effect
)
peffect
->
owner
=
pduel
->
game_field
->
core
.
reason_effect
->
handler
;
peffect
->
owner
=
pduel
->
game_field
->
core
.
reason_effect
->
get_handler
()
;
else
else
peffect
->
owner
=
this
;
peffect
->
owner
=
this
;
peffect
->
handler
=
this
;
peffect
->
handler
=
this
;
...
@@ -1869,6 +1882,14 @@ void card::filter_effect(int32 code, effect_set* eset, uint8 sort) {
...
@@ -1869,6 +1882,14 @@ void card::filter_effect(int32 code, effect_set* eset, uint8 sort) {
eset
->
add_item
(
peffect
);
eset
->
add_item
(
peffect
);
}
}
}
}
for
(
auto
cit
=
xyz_materials
.
begin
();
cit
!=
xyz_materials
.
end
();
++
cit
)
{
rg
=
(
*
cit
)
->
xmaterial_effect
.
equal_range
(
code
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
peffect
=
rg
.
first
->
second
;
if
(
peffect
->
is_available
()
&&
is_affect_by_effect
(
peffect
))
eset
->
add_item
(
peffect
);
}
}
rg
=
pduel
->
game_field
->
effects
.
aura_effect
.
equal_range
(
code
);
rg
=
pduel
->
game_field
->
effects
.
aura_effect
.
equal_range
(
code
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
peffect
=
rg
.
first
->
second
;
peffect
=
rg
.
first
->
second
;
...
@@ -1899,6 +1920,11 @@ void card::filter_single_continuous_effect(int32 code, effect_set* eset, uint8 s
...
@@ -1899,6 +1920,11 @@ void card::filter_single_continuous_effect(int32 code, effect_set* eset, uint8 s
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
eset
->
add_item
(
rg
.
first
->
second
);
eset
->
add_item
(
rg
.
first
->
second
);
}
}
for
(
auto
cit
=
xyz_materials
.
begin
();
cit
!=
xyz_materials
.
end
();
++
cit
)
{
rg
=
(
*
cit
)
->
xmaterial_effect
.
equal_range
(
code
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
eset
->
add_item
(
rg
.
first
->
second
);
}
if
(
sort
)
if
(
sort
)
eset
->
sort
();
eset
->
sort
();
}
}
...
@@ -1920,6 +1946,14 @@ void card::filter_immune_effect() {
...
@@ -1920,6 +1946,14 @@ void card::filter_immune_effect() {
immune_effect
.
add_item
(
peffect
);
immune_effect
.
add_item
(
peffect
);
}
}
}
}
for
(
auto
cit
=
xyz_materials
.
begin
();
cit
!=
xyz_materials
.
end
();
++
cit
)
{
rg
=
(
*
cit
)
->
xmaterial_effect
.
equal_range
(
EFFECT_IMMUNE_EFFECT
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
peffect
=
rg
.
first
->
second
;
if
(
peffect
->
is_available
())
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
;
peffect
=
rg
.
first
->
second
;
...
@@ -1939,6 +1973,8 @@ void card::filter_disable_related_cards() {
...
@@ -1939,6 +1973,8 @@ void card::filter_disable_related_cards() {
pduel
->
game_field
->
update_disable_check_list
(
peffect
);
pduel
->
game_field
->
update_disable_check_list
(
peffect
);
else
if
((
peffect
->
type
&
EFFECT_TYPE_EQUIP
)
&&
equiping_target
)
else
if
((
peffect
->
type
&
EFFECT_TYPE_EQUIP
)
&&
equiping_target
)
pduel
->
game_field
->
add_to_disable_check_list
(
equiping_target
);
pduel
->
game_field
->
add_to_disable_check_list
(
equiping_target
);
else
if
((
peffect
->
type
&
EFFECT_TYPE_XMATERIAL
)
&&
overlay_target
)
pduel
->
game_field
->
add_to_disable_check_list
(
overlay_target
);
}
}
}
}
}
}
...
@@ -2094,6 +2130,14 @@ effect* card::is_affected_by_effect(int32 code) {
...
@@ -2094,6 +2130,14 @@ effect* card::is_affected_by_effect(int32 code) {
return
peffect
;
return
peffect
;
}
}
}
}
for
(
auto
cit
=
xyz_materials
.
begin
();
cit
!=
xyz_materials
.
end
();
++
cit
)
{
rg
=
(
*
cit
)
->
xmaterial_effect
.
equal_range
(
code
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
peffect
=
rg
.
first
->
second
;
if
(
peffect
->
is_available
()
&&
is_affect_by_effect
(
peffect
))
return
peffect
;
}
}
rg
=
pduel
->
game_field
->
effects
.
aura_effect
.
equal_range
(
code
);
rg
=
pduel
->
game_field
->
effects
.
aura_effect
.
equal_range
(
code
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
peffect
=
rg
.
first
->
second
;
peffect
=
rg
.
first
->
second
;
...
@@ -2120,6 +2164,14 @@ effect* card::is_affected_by_effect(int32 code, card* target) {
...
@@ -2120,6 +2164,14 @@ effect* card::is_affected_by_effect(int32 code, card* target) {
return
peffect
;
return
peffect
;
}
}
}
}
for
(
auto
cit
=
xyz_materials
.
begin
();
cit
!=
xyz_materials
.
end
();
++
cit
)
{
rg
=
(
*
cit
)
->
xmaterial_effect
.
equal_range
(
code
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
peffect
=
rg
.
first
->
second
;
if
(
peffect
->
is_available
()
&&
is_affect_by_effect
(
peffect
)
&&
peffect
->
get_value
(
target
))
return
peffect
;
}
}
rg
=
pduel
->
game_field
->
effects
.
aura_effect
.
equal_range
(
code
);
rg
=
pduel
->
game_field
->
effects
.
aura_effect
.
equal_range
(
code
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
peffect
=
rg
.
first
->
second
;
peffect
=
rg
.
first
->
second
;
...
@@ -2139,6 +2191,14 @@ effect* card::check_control_effect() {
...
@@ -2139,6 +2191,14 @@ effect* card::check_control_effect() {
ret_effect
=
peffect
;
ret_effect
=
peffect
;
}
}
}
}
for
(
auto
cit
=
xyz_materials
.
begin
();
cit
!=
xyz_materials
.
end
();
++
cit
)
{
auto
rg
=
(
*
cit
)
->
xmaterial_effect
.
equal_range
(
EFFECT_SET_CONTROL
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
effect
*
peffect
=
rg
.
first
->
second
;
if
(
!
ret_effect
||
peffect
->
id
>
ret_effect
->
id
)
ret_effect
=
peffect
;
}
}
auto
rg
=
single_effect
.
equal_range
(
EFFECT_SET_CONTROL
);
auto
rg
=
single_effect
.
equal_range
(
EFFECT_SET_CONTROL
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
effect
*
peffect
=
rg
.
first
->
second
;
effect
*
peffect
=
rg
.
first
->
second
;
...
@@ -2886,7 +2946,7 @@ int32 card::is_capable_be_effect_target(effect* peffect, uint8 playerid) {
...
@@ -2886,7 +2946,7 @@ int32 card::is_capable_be_effect_target(effect* peffect, uint8 playerid) {
return
FALSE
;
return
FALSE
;
}
}
eset
.
clear
();
eset
.
clear
();
peffect
->
handler
->
filter_effect
(
EFFECT_CANNOT_SELECT_EFFECT_TARGET
,
&
eset
);
peffect
->
get_handler
()
->
filter_effect
(
EFFECT_CANNOT_SELECT_EFFECT_TARGET
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_CARD
);
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_CARD
);
if
(
eset
[
i
]
->
get_value
(
peffect
,
1
))
if
(
eset
[
i
]
->
get_value
(
peffect
,
1
))
...
...
card.h
View file @
96bbbedb
...
@@ -152,6 +152,7 @@ public:
...
@@ -152,6 +152,7 @@ public:
effect_container
single_effect
;
effect_container
single_effect
;
effect_container
field_effect
;
effect_container
field_effect
;
effect_container
equip_effect
;
effect_container
equip_effect
;
effect_container
xmaterial_effect
;
effect_indexer
indexer
;
effect_indexer
indexer
;
effect_relation
relate_effect
;
effect_relation
relate_effect
;
effect_set_v
immune_effect
;
effect_set_v
immune_effect
;
...
...
effect.cpp
View file @
96bbbedb
...
@@ -24,6 +24,7 @@ effect::effect(duel* pd) {
...
@@ -24,6 +24,7 @@ effect::effect(duel* pd) {
effect_owner
=
PLAYER_NONE
;
effect_owner
=
PLAYER_NONE
;
card_type
=
0
;
card_type
=
0
;
active_type
=
0
;
active_type
=
0
;
active_handler
=
0
;
id
=
0
;
id
=
0
;
code
=
0
;
code
=
0
;
type
=
0
;
type
=
0
;
...
@@ -71,22 +72,24 @@ int32 effect::is_can_be_forbidden() {
...
@@ -71,22 +72,24 @@ int32 effect::is_can_be_forbidden() {
int32
effect
::
is_available
()
{
int32
effect
::
is_available
()
{
if
(
type
&
EFFECT_TYPE_ACTIONS
)
if
(
type
&
EFFECT_TYPE_ACTIONS
)
return
FALSE
;
return
FALSE
;
if
(
type
&
EFFECT_TYPE_SINGLE
)
{
if
((
type
&
(
EFFECT_TYPE_SINGLE
|
EFFECT_TYPE_XMATERIAL
))
&&
!
(
type
&
EFFECT_TYPE_FIELD
))
{
if
(
handler
->
current
.
controler
==
PLAYER_NONE
)
card
*
phandler
=
get_handler
();
card
*
powner
=
get_owner
();
if
(
phandler
->
current
.
controler
==
PLAYER_NONE
)
return
FALSE
;
return
FALSE
;
if
(
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
!
in_range
(
handler
->
current
.
location
,
handler
->
current
.
sequence
))
if
(
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
!
in_range
(
phandler
->
current
.
location
,
p
handler
->
current
.
sequence
))
return
FALSE
;
return
FALSE
;
if
(
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
!
handler
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
!
is_flag
(
EFFECT_FLAG_IMMEDIATELY_APPLY
))
if
(
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
!
p
handler
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
!
is_flag
(
EFFECT_FLAG_IMMEDIATELY_APPLY
))
return
FALSE
;
return
FALSE
;
if
(
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
(
handler
->
current
.
location
&
LOCATION_ONFIELD
)
&&
!
handler
->
is_position
(
POS_FACEUP
))
if
(
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
(
phandler
->
current
.
location
&
LOCATION_ONFIELD
)
&&
!
p
handler
->
is_position
(
POS_FACEUP
))
return
FALSE
;
return
FALSE
;
if
(
is_flag
(
EFFECT_FLAG_OWNER_RELATE
)
&&
is_can_be_forbidden
()
&&
owner
->
is_status
(
STATUS_FORBIDDEN
))
if
(
is_flag
(
EFFECT_FLAG_OWNER_RELATE
)
&&
is_can_be_forbidden
()
&&
p
owner
->
is_status
(
STATUS_FORBIDDEN
))
return
FALSE
;
return
FALSE
;
if
(
owner
==
handler
&&
is_can_be_forbidden
()
&&
handler
->
get_status
(
STATUS_FORBIDDEN
))
if
(
powner
==
phandler
&&
is_can_be_forbidden
()
&&
p
handler
->
get_status
(
STATUS_FORBIDDEN
))
return
FALSE
;
return
FALSE
;
if
(
is_flag
(
EFFECT_FLAG_OWNER_RELATE
)
&&
!
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
)
&&
owner
->
is_status
(
STATUS_DISABLED
))
if
(
is_flag
(
EFFECT_FLAG_OWNER_RELATE
)
&&
!
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
)
&&
p
owner
->
is_status
(
STATUS_DISABLED
))
return
FALSE
;
return
FALSE
;
if
(
owner
==
handler
&&
!
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
)
&&
handler
->
get_status
(
STATUS_DISABLED
))
if
(
powner
==
phandler
&&
!
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
)
&&
p
handler
->
get_status
(
STATUS_DISABLED
))
return
FALSE
;
return
FALSE
;
}
}
if
(
type
&
EFFECT_TYPE_EQUIP
)
{
if
(
type
&
EFFECT_TYPE_EQUIP
)
{
...
@@ -152,7 +155,7 @@ int32 effect::check_count_limit(uint8 playerid) {
...
@@ -152,7 +155,7 @@ int32 effect::check_count_limit(uint8 playerid) {
uint32
code
=
count_code
&
0xfffffff
;
uint32
code
=
count_code
&
0xfffffff
;
uint32
count
=
(
reset_count
>>
12
)
&
0xf
;
uint32
count
=
(
reset_count
>>
12
)
&
0xf
;
if
(
code
==
1
)
{
if
(
code
==
1
)
{
if
(
pduel
->
game_field
->
get_effect_code
((
count_code
&
0xf0000000
)
|
handler
->
fieldid
,
PLAYER_NONE
)
>=
count
)
if
(
pduel
->
game_field
->
get_effect_code
((
count_code
&
0xf0000000
)
|
get_handler
()
->
fieldid
,
PLAYER_NONE
)
>=
count
)
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
if
(
pduel
->
game_field
->
get_effect_code
(
count_code
,
playerid
)
>=
count
)
if
(
pduel
->
game_field
->
get_effect_code
(
count_code
,
playerid
)
>=
count
)
...
@@ -235,16 +238,17 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
...
@@ -235,16 +238,17 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
if
(
handler
->
is_affected_by_effect
(
EFFECT_CANNOT_TRIGGER
))
if
(
handler
->
is_affected_by_effect
(
EFFECT_CANNOT_TRIGGER
))
return
FALSE
;
return
FALSE
;
}
else
if
(
!
(
type
&
EFFECT_TYPE_CONTINUOUS
))
{
}
else
if
(
!
(
type
&
EFFECT_TYPE_CONTINUOUS
))
{
if
((
handler
->
data
.
type
&
TYPE_MONSTER
)
&&
(
handler
->
current
.
location
&
LOCATION_SZONE
)
card
*
phandler
=
get_handler
();
&&
!
in_range
(
handler
->
current
.
location
,
handler
->
current
.
sequence
))
if
((
phandler
->
data
.
type
&
TYPE_MONSTER
)
&&
(
phandler
->
current
.
location
&
LOCATION_SZONE
)
&&
!
in_range
(
phandler
->
current
.
location
,
phandler
->
current
.
sequence
))
return
FALSE
;
return
FALSE
;
if
((
handler
->
current
.
location
&
(
LOCATION_ONFIELD
|
LOCATION_REMOVED
)))
{
if
((
p
handler
->
current
.
location
&
(
LOCATION_ONFIELD
|
LOCATION_REMOVED
)))
{
// effects which can be activated while face-down:
// effects which can be activated while face-down:
// 1. effects with EFFECT_FLAG_SET_AVAILABLE
// 1. effects with EFFECT_FLAG_SET_AVAILABLE
// 2. events with FLIP_SET_AVAILABLE
// 2. events with FLIP_SET_AVAILABLE
if
(
!
handler
->
is_position
(
POS_FACEUP
)
&&
!
is_flag
(
EFFECT_FLAG_SET_AVAILABLE
)
&&
(
code
!=
EVENT_FLIP
||
!
(
e
.
event_value
&
(
FLIP_SET_AVAILABLE
>>
16
))))
if
(
!
p
handler
->
is_position
(
POS_FACEUP
)
&&
!
is_flag
(
EFFECT_FLAG_SET_AVAILABLE
)
&&
(
code
!=
EVENT_FLIP
||
!
(
e
.
event_value
&
(
FLIP_SET_AVAILABLE
>>
16
))))
return
FALSE
;
return
FALSE
;
if
(
handler
->
is_position
(
POS_FACEUP
)
&&
!
handler
->
is_status
(
STATUS_EFFECT_ENABLED
))
if
(
phandler
->
is_position
(
POS_FACEUP
)
&&
!
p
handler
->
is_status
(
STATUS_EFFECT_ENABLED
))
return
FALSE
;
return
FALSE
;
}
}
if
(
!
(
type
&
(
EFFECT_TYPE_FLIP
|
EFFECT_TYPE_TRIGGER_F
))
if
(
!
(
type
&
(
EFFECT_TYPE_FLIP
|
EFFECT_TYPE_TRIGGER_F
))
...
@@ -254,29 +258,30 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
...
@@ -254,29 +258,30 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
if
((
code
<
1134
||
code
>
1136
)
&&
pduel
->
game_field
->
infos
.
phase
==
PHASE_DAMAGE_CAL
&&
!
is_flag
(
EFFECT_FLAG_DAMAGE_CAL
))
if
((
code
<
1134
||
code
>
1136
)
&&
pduel
->
game_field
->
infos
.
phase
==
PHASE_DAMAGE_CAL
&&
!
is_flag
(
EFFECT_FLAG_DAMAGE_CAL
))
return
FALSE
;
return
FALSE
;
}
}
if
(
handler
->
current
.
location
==
LOCATION_OVERLAY
)
if
(
p
handler
->
current
.
location
==
LOCATION_OVERLAY
)
return
FALSE
;
return
FALSE
;
if
((
type
&
EFFECT_TYPE_FIELD
)
&&
(
handler
->
current
.
controler
!=
playerid
)
&&
!
is_flag
(
EFFECT_FLAG_BOTH_SIDE
))
if
((
type
&
EFFECT_TYPE_FIELD
)
&&
(
p
handler
->
current
.
controler
!=
playerid
)
&&
!
is_flag
(
EFFECT_FLAG_BOTH_SIDE
))
return
FALSE
;
return
FALSE
;
if
(
handler
->
is_status
(
STATUS_FORBIDDEN
))
if
(
p
handler
->
is_status
(
STATUS_FORBIDDEN
))
return
FALSE
;
return
FALSE
;
if
(
handler
->
is_affected_by_effect
(
EFFECT_CANNOT_TRIGGER
))
if
(
p
handler
->
is_affected_by_effect
(
EFFECT_CANNOT_TRIGGER
))
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
if
(
!
is_flag
(
EFFECT_FLAG_AVAILABLE_BD
)
&&
(
type
&
EFFECT_TYPE_FIELD
)
&&
handler
->
is_status
(
STATUS_BATTLE_DESTROYED
))
card
*
phandler
=
get_handler
();
if
(
!
is_flag
(
EFFECT_FLAG_AVAILABLE_BD
)
&&
(
type
&
EFFECT_TYPE_FIELD
)
&&
phandler
->
is_status
(
STATUS_BATTLE_DESTROYED
))
return
FALSE
;
return
FALSE
;
if
(((
type
&
EFFECT_TYPE_FIELD
)
||
((
type
&
EFFECT_TYPE_SINGLE
)
&&
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)))
&&
(
handler
->
current
.
location
&
LOCATION_ONFIELD
)
if
(((
type
&
EFFECT_TYPE_FIELD
)
||
((
type
&
EFFECT_TYPE_SINGLE
)
&&
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)))
&&
(
p
handler
->
current
.
location
&
LOCATION_ONFIELD
)
&&
(
!
handler
->
is_position
(
POS_FACEUP
)
||
!
handler
->
is_status
(
STATUS_EFFECT_ENABLED
)))
&&
(
!
phandler
->
is_position
(
POS_FACEUP
)
||
!
p
handler
->
is_status
(
STATUS_EFFECT_ENABLED
)))
return
FALSE
;
return
FALSE
;
if
((
type
&
EFFECT_TYPE_SINGLE
)
&&
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
!
in_range
(
handler
->
current
.
location
,
handler
->
current
.
sequence
))
if
((
type
&
EFFECT_TYPE_SINGLE
)
&&
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
!
in_range
(
phandler
->
current
.
location
,
p
handler
->
current
.
sequence
))
return
FALSE
;
return
FALSE
;
if
(
is_flag
(
EFFECT_FLAG_OWNER_RELATE
)
&&
is_can_be_forbidden
()
&&
owner
->
is_status
(
STATUS_FORBIDDEN
))
if
(
is_flag
(
EFFECT_FLAG_OWNER_RELATE
)
&&
is_can_be_forbidden
()
&&
owner
->
is_status
(
STATUS_FORBIDDEN
))
return
FALSE
;
return
FALSE
;
if
(
handler
==
owner
&&
is_can_be_forbidden
()
&&
handler
->
is_status
(
STATUS_FORBIDDEN
))
if
(
phandler
==
owner
&&
is_can_be_forbidden
()
&&
p
handler
->
is_status
(
STATUS_FORBIDDEN
))
return
FALSE
;
return
FALSE
;
if
(
is_flag
(
EFFECT_FLAG_OWNER_RELATE
)
&&
!
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
)
&&
owner
->
is_status
(
STATUS_DISABLED
))
if
(
is_flag
(
EFFECT_FLAG_OWNER_RELATE
)
&&
!
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
)
&&
owner
->
is_status
(
STATUS_DISABLED
))
return
FALSE
;
return
FALSE
;
if
(
handler
==
owner
&&
!
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
)
&&
handler
->
is_status
(
STATUS_DISABLED
))
if
(
phandler
==
owner
&&
!
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
)
&&
p
handler
->
is_status
(
STATUS_DISABLED
))
return
FALSE
;
return
FALSE
;
}
}
}
else
{
}
else
{
...
@@ -371,7 +376,8 @@ int32 effect::is_activate_ready(uint8 playerid, const tevent& e, int32 neglect_c
...
@@ -371,7 +376,8 @@ int32 effect::is_activate_ready(uint8 playerid, const tevent& e, int32 neglect_c
}
}
// check functions: condition
// check functions: condition
int32
effect
::
is_condition_check
(
uint8
playerid
,
const
tevent
&
e
)
{
int32
effect
::
is_condition_check
(
uint8
playerid
,
const
tevent
&
e
)
{
if
(
!
(
type
&
EFFECT_TYPE_ACTIVATE
)
&&
(
handler
->
current
.
location
&
(
LOCATION_ONFIELD
|
LOCATION_REMOVED
))
&&
!
handler
->
is_position
(
POS_FACEUP
))
card
*
phandler
=
get_handler
();
if
(
!
(
type
&
EFFECT_TYPE_ACTIVATE
)
&&
(
phandler
->
current
.
location
&
(
LOCATION_ONFIELD
|
LOCATION_REMOVED
))
&&
!
phandler
->
is_position
(
POS_FACEUP
))
return
FALSE
;
return
FALSE
;
if
(
!
condition
)
if
(
!
condition
)
return
TRUE
;
return
TRUE
;
...
@@ -415,7 +421,7 @@ int32 effect::is_activate_check(uint8 playerid, const tevent& e, int32 neglect_c
...
@@ -415,7 +421,7 @@ int32 effect::is_activate_check(uint8 playerid, const tevent& e, int32 neglect_c
int32
effect
::
is_target
(
card
*
pcard
)
{
int32
effect
::
is_target
(
card
*
pcard
)
{
if
(
type
&
EFFECT_TYPE_ACTIONS
)
if
(
type
&
EFFECT_TYPE_ACTIONS
)
return
FALSE
;
return
FALSE
;
if
(
(
type
&
EFFECT_TYPE_SINGLE
)
||
(
type
&
EFFECT_TYPE_EQUIP
))
if
(
type
&
(
EFFECT_TYPE_SINGLE
|
EFFECT_TYPE_EQUIP
|
EFFECT_TYPE_XMATERIAL
))
return
TRUE
;
return
TRUE
;
if
(
pcard
&&
!
is_flag
(
EFFECT_FLAG_SET_AVAILABLE
)
&&
(
pcard
->
current
.
location
&
LOCATION_ONFIELD
)
if
(
pcard
&&
!
is_flag
(
EFFECT_FLAG_SET_AVAILABLE
)
&&
(
pcard
->
current
.
location
&
LOCATION_ONFIELD
)
&&
!
pcard
->
is_position
(
POS_FACEUP
))
&&
!
pcard
->
is_position
(
POS_FACEUP
))
...
@@ -500,7 +506,7 @@ int32 effect::is_chainable(uint8 tp) {
...
@@ -500,7 +506,7 @@ int32 effect::is_chainable(uint8 tp) {
return
FALSE
;
return
FALSE
;
if
(
pduel
->
game_field
->
core
.
current_chain
.
size
())
{
if
(
pduel
->
game_field
->
core
.
current_chain
.
size
())
{
if
(
!
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
(
type
&
EFFECT_TYPE_TRIGGER_O
)
if
(
!
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
(
type
&
EFFECT_TYPE_TRIGGER_O
)
&&
(
handler
->
current
.
location
==
LOCATION_HAND
))
{
&&
(
get_handler
()
->
current
.
location
==
LOCATION_HAND
))
{
if
(
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
triggering_effect
->
get_speed
()
>
2
)
if
(
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
triggering_effect
->
get_speed
()
>
2
)
return
FALSE
;
return
FALSE
;
}
else
if
(
sp
<
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
triggering_effect
->
get_speed
())
}
else
if
(
sp
<
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
triggering_effect
->
get_speed
())
...
@@ -575,7 +581,7 @@ void effect::dec_count(uint32 playerid) {
...
@@ -575,7 +581,7 @@ void effect::dec_count(uint32 playerid) {
if
(
count_code
)
{
if
(
count_code
)
{
uint32
code
=
count_code
&
0xfffffff
;
uint32
code
=
count_code
&
0xfffffff
;
if
(
code
==
1
)
if
(
code
==
1
)
pduel
->
game_field
->
add_effect_code
((
count_code
&
0xf0000000
)
|
handler
->
fieldid
,
PLAYER_NONE
);
pduel
->
game_field
->
add_effect_code
((
count_code
&
0xf0000000
)
|
get_handler
()
->
fieldid
,
PLAYER_NONE
);
else
else
pduel
->
game_field
->
add_effect_code
(
count_code
,
playerid
);
pduel
->
game_field
->
add_effect_code
(
count_code
,
playerid
);
}
}
...
@@ -650,15 +656,25 @@ int32 effect::get_speed() {
...
@@ -650,15 +656,25 @@ int32 effect::get_speed() {
}
}
return
0
;
return
0
;
}
}
card
*
effect
::
get_owner
()
const
{
if
(
type
&
EFFECT_TYPE_XMATERIAL
)
return
active_handler
?
active_handler
:
handler
->
overlay_target
;
return
owner
;
}
uint8
effect
::
get_owner_player
()
{
uint8
effect
::
get_owner_player
()
{
if
(
effect_owner
!=
PLAYER_NONE
)
if
(
effect_owner
!=
PLAYER_NONE
)
return
effect_owner
;
return
effect_owner
;
return
owner
->
current
.
controler
;
return
get_owner
()
->
current
.
controler
;
}
card
*
effect
::
get_handler
()
const
{
if
(
type
&
EFFECT_TYPE_XMATERIAL
)
return
active_handler
?
active_handler
:
handler
->
overlay_target
;
return
handler
;
}
}
uint8
effect
::
get_handler_player
()
{
uint8
effect
::
get_handler_player
()
{
if
(
is_flag
(
EFFECT_FLAG_FIELD_ONLY
))
if
(
is_flag
(
EFFECT_FLAG_FIELD_ONLY
))
return
effect_owner
;
return
effect_owner
;
return
handler
->
current
.
controler
;
return
get_handler
()
->
current
.
controler
;
}
}
int32
effect
::
in_range
(
int32
loc
,
int32
seq
)
{
int32
effect
::
in_range
(
int32
loc
,
int32
seq
)
{
if
(
loc
!=
LOCATION_SZONE
)
if
(
loc
!=
LOCATION_SZONE
)
...
...
effect.h
View file @
96bbbedb
...
@@ -50,6 +50,7 @@ public:
...
@@ -50,6 +50,7 @@ public:
uint32
hint_timing
[
2
];
uint32
hint_timing
[
2
];
uint32
card_type
;
uint32
card_type
;
uint32
active_type
;
uint32
active_type
;
card
*
active_handler
;
uint16
field_ref
;
uint16
field_ref
;
uint16
status
;
uint16
status
;
void
*
label_object
;
void
*
label_object
;
...
@@ -84,7 +85,9 @@ public:
...
@@ -84,7 +85,9 @@ public:
int32
get_value
(
effect
*
peffect
,
uint32
extraargs
=
0
);
int32
get_value
(
effect
*
peffect
,
uint32
extraargs
=
0
);
int32
check_value_condition
(
uint32
extraargs
=
0
);
int32
check_value_condition
(
uint32
extraargs
=
0
);
int32
get_speed
();
int32
get_speed
();
card
*
get_owner
()
const
;
uint8
get_owner_player
();
uint8
get_owner_player
();
card
*
get_handler
()
const
;
uint8
get_handler_player
();
uint8
get_handler_player
();
int32
in_range
(
int32
loc
,
int32
seq
);
int32
in_range
(
int32
loc
,
int32
seq
);
bool
is_flag
(
effect_flag
flag
)
const
{
bool
is_flag
(
effect_flag
flag
)
const
{
...
@@ -138,6 +141,7 @@ public:
...
@@ -138,6 +141,7 @@ public:
#define EFFECT_TYPE_TRIGGER_F 0x0200 //
#define EFFECT_TYPE_TRIGGER_F 0x0200 //
#define EFFECT_TYPE_QUICK_F 0x0400 //
#define EFFECT_TYPE_QUICK_F 0x0400 //
#define EFFECT_TYPE_CONTINUOUS 0x0800 //
#define EFFECT_TYPE_CONTINUOUS 0x0800 //
#define EFFECT_TYPE_XMATERIAL 0x1000 //
//========== Flags ==========
//========== Flags ==========
enum
effect_flag
:
uint32
{
enum
effect_flag
:
uint32
{
...
...
field.cpp
View file @
96bbbedb
...
@@ -138,8 +138,8 @@ void field::reload_field_info() {
...
@@ -138,8 +138,8 @@ void field::reload_field_info() {
pduel
->
write_buffer8
(
core
.
current_chain
.
size
());
pduel
->
write_buffer8
(
core
.
current_chain
.
size
());
for
(
auto
chit
=
core
.
current_chain
.
begin
();
chit
!=
core
.
current_chain
.
end
();
++
chit
)
{
for
(
auto
chit
=
core
.
current_chain
.
begin
();
chit
!=
core
.
current_chain
.
end
();
++
chit
)
{
effect
*
peffect
=
chit
->
triggering_effect
;
effect
*
peffect
=
chit
->
triggering_effect
;
pduel
->
write_buffer32
(
peffect
->
handler
->
data
.
code
);
pduel
->
write_buffer32
(
peffect
->
get_handler
()
->
data
.
code
);
pduel
->
write_buffer32
(
peffect
->
handler
->
get_info_location
());
pduel
->
write_buffer32
(
peffect
->
get_handler
()
->
get_info_location
());
pduel
->
write_buffer8
(
chit
->
triggering_controler
);
pduel
->
write_buffer8
(
chit
->
triggering_controler
);
pduel
->
write_buffer8
(
chit
->
triggering_location
);
pduel
->
write_buffer8
(
chit
->
triggering_location
);
pduel
->
write_buffer8
(
chit
->
triggering_sequence
);
pduel
->
write_buffer8
(
chit
->
triggering_sequence
);
...
@@ -405,7 +405,7 @@ void field::set_control(card* pcard, uint8 playerid, uint16 reset_phase, uint8 r
...
@@ -405,7 +405,7 @@ void field::set_control(card* pcard, uint8 playerid, uint16 reset_phase, uint8 r
return
;
return
;
effect
*
peffect
=
pduel
->
new_effect
();
effect
*
peffect
=
pduel
->
new_effect
();
if
(
core
.
reason_effect
)
if
(
core
.
reason_effect
)
peffect
->
owner
=
core
.
reason_effect
->
handler
;
peffect
->
owner
=
core
.
reason_effect
->
get_handler
()
;
else
else
peffect
->
owner
=
pcard
;
peffect
->
owner
=
pcard
;
peffect
->
handler
=
pcard
;
peffect
->
handler
=
pcard
;
...
@@ -1611,7 +1611,7 @@ void field::set_spsummon_counter(uint8 playerid, bool add, bool chain) {
...
@@ -1611,7 +1611,7 @@ void field::set_spsummon_counter(uint8 playerid, bool add, bool chain) {
if
(
core
.
global_flag
&
GLOBALFLAG_SPSUMMON_COUNT
)
{
if
(
core
.
global_flag
&
GLOBALFLAG_SPSUMMON_COUNT
)
{
for
(
auto
iter
=
effects
.
spsummon_count_eff
.
begin
();
iter
!=
effects
.
spsummon_count_eff
.
end
();
++
iter
)
{
for
(
auto
iter
=
effects
.
spsummon_count_eff
.
begin
();
iter
!=
effects
.
spsummon_count_eff
.
end
();
++
iter
)
{
effect
*
peffect
=
*
iter
;
effect
*
peffect
=
*
iter
;
card
*
pcard
=
peffect
->
handler
;
card
*
pcard
=
peffect
->
get_handler
()
;
if
(
add
)
{
if
(
add
)
{
if
(
peffect
->
is_available
())
{
if
(
peffect
->
is_available
())
{
if
(((
playerid
==
pcard
->
current
.
controler
)
&&
peffect
->
s_range
)
||
((
playerid
!=
pcard
->
current
.
controler
)
&&
peffect
->
o_range
))
{
if
(((
playerid
==
pcard
->
current
.
controler
)
&&
peffect
->
s_range
)
||
((
playerid
!=
pcard
->
current
.
controler
)
&&
peffect
->
o_range
))
{
...
@@ -1631,7 +1631,7 @@ int32 field::check_spsummon_counter(uint8 playerid, uint8 ct) {
...
@@ -1631,7 +1631,7 @@ int32 field::check_spsummon_counter(uint8 playerid, uint8 ct) {
if
(
core
.
global_flag
&
GLOBALFLAG_SPSUMMON_COUNT
)
{
if
(
core
.
global_flag
&
GLOBALFLAG_SPSUMMON_COUNT
)
{
for
(
auto
iter
=
effects
.
spsummon_count_eff
.
begin
();
iter
!=
effects
.
spsummon_count_eff
.
end
();
++
iter
)
{
for
(
auto
iter
=
effects
.
spsummon_count_eff
.
begin
();
iter
!=
effects
.
spsummon_count_eff
.
end
();
++
iter
)
{
effect
*
peffect
=
*
iter
;
effect
*
peffect
=
*
iter
;
card
*
pcard
=
peffect
->
handler
;
card
*
pcard
=
peffect
->
get_handler
()
;
uint16
val
=
(
uint16
)
peffect
->
value
;
uint16
val
=
(
uint16
)
peffect
->
value
;
if
(
peffect
->
is_available
())
{
if
(
peffect
->
is_available
())
{
if
(
pcard
->
spsummon_counter
[
playerid
]
+
ct
>
val
)
if
(
pcard
->
spsummon_counter
[
playerid
]
+
ct
>
val
)
...
@@ -2574,7 +2574,7 @@ int32 field::is_chain_disablable(uint8 chaincount, uint8 naga_check) {
...
@@ -2574,7 +2574,7 @@ int32 field::is_chain_disablable(uint8 chaincount, uint8 naga_check) {
peffect
=
core
.
current_chain
[
chaincount
-
1
].
triggering_effect
;
peffect
=
core
.
current_chain
[
chaincount
-
1
].
triggering_effect
;
if
(
naga_check
&&
peffect
->
is_flag
(
EFFECT_FLAG2_NAGA
))
if
(
naga_check
&&
peffect
->
is_flag
(
EFFECT_FLAG2_NAGA
))
return
FALSE
;
return
FALSE
;
if
(
!
peffect
->
handler
->
get_status
(
STATUS_FORBIDDEN
))
{
if
(
!
peffect
->
get_handler
()
->
get_status
(
STATUS_FORBIDDEN
))
{
if
(
peffect
->
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
))
if
(
peffect
->
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
))
return
FALSE
;
return
FALSE
;
filter_field_effect
(
EFFECT_CANNOT_DISEFFECT
,
&
eset
);
filter_field_effect
(
EFFECT_CANNOT_DISEFFECT
,
&
eset
);
...
@@ -2596,7 +2596,7 @@ int32 field::is_chain_disabled(uint8 chaincount) {
...
@@ -2596,7 +2596,7 @@ int32 field::is_chain_disabled(uint8 chaincount) {
pchain
=
&
core
.
current_chain
[
chaincount
-
1
];
pchain
=
&
core
.
current_chain
[
chaincount
-
1
];
if
(
pchain
->
flag
&
CHAIN_DISABLE_EFFECT
)
if
(
pchain
->
flag
&
CHAIN_DISABLE_EFFECT
)
return
TRUE
;
return
TRUE
;
card
*
pcard
=
pchain
->
triggering_effect
->
handler
;
card
*
pcard
=
pchain
->
triggering_effect
->
get_handler
()
;
effect_set
eset
;
effect_set
eset
;
pcard
->
filter_effect
(
EFFECT_DISABLE_CHAIN
,
&
eset
);
pcard
->
filter_effect
(
EFFECT_DISABLE_CHAIN
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
...
...
field.h
View file @
96bbbedb
...
@@ -444,6 +444,7 @@ public:
...
@@ -444,6 +444,7 @@ public:
int32
process_quick_effect
(
int16
step
,
int32
skip_freechain
,
uint8
priority
);
int32
process_quick_effect
(
int16
step
,
int32
skip_freechain
,
uint8
priority
);
int32
process_instant_event
();
int32
process_instant_event
();
int32
process_single_event
();
int32
process_single_event
();
int32
process_single_event
(
effect
*
peffect
,
const
tevent
&
e
,
effect_vector
&
tp
,
effect_vector
&
ntp
,
event_list
&
tev
,
event_list
&
ntev
);
int32
process_idle_command
(
uint16
step
);
int32
process_idle_command
(
uint16
step
);
int32
process_battle_command
(
uint16
step
);
int32
process_battle_command
(
uint16
step
);
int32
process_damage_step
(
uint16
step
,
uint32
new_attack
);
int32
process_damage_step
(
uint16
step
,
uint32
new_attack
);
...
...
libduel.cpp
View file @
96bbbedb
...
@@ -1361,9 +1361,9 @@ int32 scriptlib::duel_negate_related_chain(lua_State *L) {
...
@@ -1361,9 +1361,9 @@ int32 scriptlib::duel_negate_related_chain(lua_State *L) {
if
(
!
pcard
->
is_affect_by_effect
(
pduel
->
game_field
->
core
.
reason_effect
))
if
(
!
pcard
->
is_affect_by_effect
(
pduel
->
game_field
->
core
.
reason_effect
))
return
0
;
return
0
;
for
(
auto
it
=
pduel
->
game_field
->
core
.
current_chain
.
rbegin
();
it
!=
pduel
->
game_field
->
core
.
current_chain
.
rend
();
++
it
)
{
for
(
auto
it
=
pduel
->
game_field
->
core
.
current_chain
.
rbegin
();
it
!=
pduel
->
game_field
->
core
.
current_chain
.
rend
();
++
it
)
{
if
(
it
->
triggering_effect
->
handler
==
pcard
&&
pcard
->
is_has_relation
(
*
it
))
{
if
(
it
->
triggering_effect
->
get_handler
()
==
pcard
&&
pcard
->
is_has_relation
(
*
it
))
{
effect
*
negeff
=
pduel
->
new_effect
();
effect
*
negeff
=
pduel
->
new_effect
();
negeff
->
owner
=
pduel
->
game_field
->
core
.
reason_effect
->
handler
;
negeff
->
owner
=
pduel
->
game_field
->
core
.
reason_effect
->
get_handler
()
;
negeff
->
type
=
EFFECT_TYPE_SINGLE
;
negeff
->
type
=
EFFECT_TYPE_SINGLE
;
negeff
->
code
=
EFFECT_DISABLE_CHAIN
;
negeff
->
code
=
EFFECT_DISABLE_CHAIN
;
negeff
->
value
=
it
->
chain_id
;
negeff
->
value
=
it
->
chain_id
;
...
@@ -1636,7 +1636,7 @@ int32 scriptlib::duel_chain_attack(lua_State *L) {
...
@@ -1636,7 +1636,7 @@ int32 scriptlib::duel_chain_attack(lua_State *L) {
}
}
int32
scriptlib
::
duel_readjust
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_readjust
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
card
*
adjcard
=
pduel
->
game_field
->
core
.
reason_effect
->
handler
;
card
*
adjcard
=
pduel
->
game_field
->
core
.
reason_effect
->
get_handler
()
;
pduel
->
game_field
->
core
.
readjust_map
[
adjcard
]
++
;
pduel
->
game_field
->
core
.
readjust_map
[
adjcard
]
++
;
if
(
pduel
->
game_field
->
core
.
readjust_map
[
adjcard
]
>
3
)
{
if
(
pduel
->
game_field
->
core
.
readjust_map
[
adjcard
]
>
3
)
{
pduel
->
game_field
->
send_to
(
adjcard
,
0
,
REASON_RULE
,
pduel
->
game_field
->
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
POS_FACEUP
);
pduel
->
game_field
->
send_to
(
adjcard
,
0
,
REASON_RULE
,
pduel
->
game_field
->
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
POS_FACEUP
);
...
@@ -3171,7 +3171,7 @@ int32 scriptlib::duel_check_chain_uniqueness(lua_State *L) {
...
@@ -3171,7 +3171,7 @@ int32 scriptlib::duel_check_chain_uniqueness(lua_State *L) {
}
}
std
::
set
<
uint32
>
er
;
std
::
set
<
uint32
>
er
;
for
(
auto
cait
=
pduel
->
game_field
->
core
.
current_chain
.
begin
();
cait
!=
pduel
->
game_field
->
core
.
current_chain
.
end
();
++
cait
)
for
(
auto
cait
=
pduel
->
game_field
->
core
.
current_chain
.
begin
();
cait
!=
pduel
->
game_field
->
core
.
current_chain
.
end
();
++
cait
)
er
.
insert
(
cait
->
triggering_effect
->
handler
->
get_code
());
er
.
insert
(
cait
->
triggering_effect
->
get_handler
()
->
get_code
());
if
(
er
.
size
()
==
pduel
->
game_field
->
core
.
current_chain
.
size
())
if
(
er
.
size
()
==
pduel
->
game_field
->
core
.
current_chain
.
size
())
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
...
libeffect.cpp
View file @
96bbbedb
...
@@ -397,7 +397,7 @@ int32 scriptlib::effect_get_handler(lua_State *L) {
...
@@ -397,7 +397,7 @@ int32 scriptlib::effect_get_handler(lua_State *L) {
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
interpreter
::
card2value
(
L
,
peffect
->
handler
);
interpreter
::
card2value
(
L
,
peffect
->
get_handler
()
);
return
1
;
return
1
;
}
}
int32
scriptlib
::
effect_get_owner_player
(
lua_State
*
L
)
{
int32
scriptlib
::
effect_get_owner_player
(
lua_State
*
L
)
{
...
@@ -461,10 +461,10 @@ int32 scriptlib::effect_get_active_type(lua_State *L) {
...
@@ -461,10 +461,10 @@ int32 scriptlib::effect_get_active_type(lua_State *L) {
if
(
peffect
->
type
&
0x7f0
)
{
if
(
peffect
->
type
&
0x7f0
)
{
if
(
peffect
->
active_type
)
if
(
peffect
->
active_type
)
atype
=
peffect
->
active_type
;
atype
=
peffect
->
active_type
;
else
if
((
peffect
->
type
&
EFFECT_TYPE_ACTIVATE
)
&&
(
peffect
->
handler
->
data
.
type
&
TYPE_PENDULUM
))
else
if
((
peffect
->
type
&
EFFECT_TYPE_ACTIVATE
)
&&
(
peffect
->
get_handler
()
->
data
.
type
&
TYPE_PENDULUM
))
atype
=
TYPE_PENDULUM
+
TYPE_SPELL
;
atype
=
TYPE_PENDULUM
+
TYPE_SPELL
;
else
else
atype
=
peffect
->
handler
->
get_type
();
atype
=
peffect
->
get_handler
()
->
get_type
();
}
else
}
else
atype
=
peffect
->
owner
->
get_type
();
atype
=
peffect
->
owner
->
get_type
();
lua_pushinteger
(
L
,
atype
);
lua_pushinteger
(
L
,
atype
);
...
@@ -479,10 +479,10 @@ int32 scriptlib::effect_is_active_type(lua_State *L) {
...
@@ -479,10 +479,10 @@ int32 scriptlib::effect_is_active_type(lua_State *L) {
if
(
peffect
->
type
&
0x7f0
)
{
if
(
peffect
->
type
&
0x7f0
)
{
if
(
peffect
->
active_type
)
if
(
peffect
->
active_type
)
atype
=
peffect
->
active_type
;
atype
=
peffect
->
active_type
;
else
if
((
peffect
->
type
&
EFFECT_TYPE_ACTIVATE
)
&&
(
peffect
->
handler
->
data
.
type
&
TYPE_PENDULUM
))
else
if
((
peffect
->
type
&
EFFECT_TYPE_ACTIVATE
)
&&
(
peffect
->
get_handler
()
->
data
.
type
&
TYPE_PENDULUM
))
atype
=
TYPE_PENDULUM
+
TYPE_SPELL
;
atype
=
TYPE_PENDULUM
+
TYPE_SPELL
;
else
else
atype
=
peffect
->
handler
->
get_type
();
atype
=
peffect
->
get_handler
()
->
get_type
();
}
else
}
else
atype
=
peffect
->
owner
->
get_type
();
atype
=
peffect
->
owner
->
get_type
();
lua_pushboolean
(
L
,
atype
&
tpe
);
lua_pushboolean
(
L
,
atype
&
tpe
);
...
...
ocgapi.cpp
View file @
96bbbedb
...
@@ -322,9 +322,9 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
...
@@ -322,9 +322,9 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
*
buf
++
=
ptduel
->
game_field
->
core
.
current_chain
.
size
();
*
buf
++
=
ptduel
->
game_field
->
core
.
current_chain
.
size
();
for
(
auto
chit
=
ptduel
->
game_field
->
core
.
current_chain
.
begin
();
chit
!=
ptduel
->
game_field
->
core
.
current_chain
.
end
();
++
chit
)
{
for
(
auto
chit
=
ptduel
->
game_field
->
core
.
current_chain
.
begin
();
chit
!=
ptduel
->
game_field
->
core
.
current_chain
.
end
();
++
chit
)
{
effect
*
peffect
=
chit
->
triggering_effect
;
effect
*
peffect
=
chit
->
triggering_effect
;
*
((
int
*
)(
buf
))
=
peffect
->
handler
->
data
.
code
;
*
((
int
*
)(
buf
))
=
peffect
->
get_handler
()
->
data
.
code
;
buf
+=
4
;
buf
+=
4
;
*
((
int
*
)(
buf
))
=
peffect
->
handler
->
get_info_location
();
*
((
int
*
)(
buf
))
=
peffect
->
get_handler
()
->
get_info_location
();
buf
+=
4
;
buf
+=
4
;
*
buf
++
=
chit
->
triggering_controler
;
*
buf
++
=
chit
->
triggering_controler
;
*
buf
++
=
chit
->
triggering_location
;
*
buf
++
=
chit
->
triggering_location
;
...
...
playerop.cpp
View file @
96bbbedb
...
@@ -27,7 +27,7 @@ int32 field::select_battle_command(uint16 step, uint8 playerid) {
...
@@ -27,7 +27,7 @@ int32 field::select_battle_command(uint16 step, uint8 playerid) {
std
::
sort
(
core
.
select_chains
.
begin
(),
core
.
select_chains
.
end
(),
chain
::
chain_operation_sort
);
std
::
sort
(
core
.
select_chains
.
begin
(),
core
.
select_chains
.
end
(),
chain
::
chain_operation_sort
);
for
(
i
=
0
;
i
<
core
.
select_chains
.
size
();
++
i
)
{
for
(
i
=
0
;
i
<
core
.
select_chains
.
size
();
++
i
)
{
peffect
=
core
.
select_chains
[
i
].
triggering_effect
;
peffect
=
core
.
select_chains
[
i
].
triggering_effect
;
pcard
=
peffect
->
handler
;
pcard
=
peffect
->
get_handler
()
;
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
...
@@ -125,7 +125,7 @@ int32 field::select_idle_command(uint16 step, uint8 playerid) {
...
@@ -125,7 +125,7 @@ int32 field::select_idle_command(uint16 step, uint8 playerid) {
std
::
sort
(
core
.
select_chains
.
begin
(),
core
.
select_chains
.
end
(),
chain
::
chain_operation_sort
);
std
::
sort
(
core
.
select_chains
.
begin
(),
core
.
select_chains
.
end
(),
chain
::
chain_operation_sort
);
for
(
i
=
0
;
i
<
core
.
select_chains
.
size
();
++
i
)
{
for
(
i
=
0
;
i
<
core
.
select_chains
.
size
();
++
i
)
{
peffect
=
core
.
select_chains
[
i
].
triggering_effect
;
peffect
=
core
.
select_chains
[
i
].
triggering_effect
;
pcard
=
peffect
->
handler
;
pcard
=
peffect
->
get_handler
()
;
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
...
@@ -308,7 +308,7 @@ int32 field::select_chain(uint16 step, uint8 playerid, uint8 spe_count, uint8 fo
...
@@ -308,7 +308,7 @@ int32 field::select_chain(uint16 step, uint8 playerid, uint8 spe_count, uint8 fo
std
::
sort
(
core
.
select_chains
.
begin
(),
core
.
select_chains
.
end
(),
chain
::
chain_operation_sort
);
std
::
sort
(
core
.
select_chains
.
begin
(),
core
.
select_chains
.
end
(),
chain
::
chain_operation_sort
);
for
(
uint32
i
=
0
;
i
<
core
.
select_chains
.
size
();
++
i
)
{
for
(
uint32
i
=
0
;
i
<
core
.
select_chains
.
size
();
++
i
)
{
effect
*
peffect
=
core
.
select_chains
[
i
].
triggering_effect
;
effect
*
peffect
=
core
.
select_chains
[
i
].
triggering_effect
;
card
*
pcard
=
peffect
->
handler
;
card
*
pcard
=
peffect
->
get_handler
()
;
if
(
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
))
if
(
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
))
pduel
->
write_buffer8
(
EDESC_OPERATION
);
pduel
->
write_buffer8
(
EDESC_OPERATION
);
else
if
(
!
(
peffect
->
type
&
EFFECT_TYPE_ACTIONS
))
else
if
(
!
(
peffect
->
type
&
EFFECT_TYPE_ACTIONS
))
...
...
processor.cpp
View file @
96bbbedb
This diff is collapsed.
Click to expand it.
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