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
1e5f5097
Commit
1e5f5097
authored
Nov 23, 2024
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into develop-8888
parents
157cb50e
8386cb62
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
497 additions
and
492 deletions
+497
-492
card.cpp
card.cpp
+38
-39
card.h
card.h
+8
-8
common.h
common.h
+11
-11
duel.cpp
duel.cpp
+4
-3
duel.h
duel.h
+4
-0
effect.cpp
effect.cpp
+1
-1
effect.h
effect.h
+24
-14
field.cpp
field.cpp
+46
-41
field.h
field.h
+17
-15
libcard.cpp
libcard.cpp
+10
-6
libdebug.cpp
libdebug.cpp
+1
-1
libduel.cpp
libduel.cpp
+50
-57
libeffect.cpp
libeffect.cpp
+7
-11
operations.cpp
operations.cpp
+136
-143
playerop.cpp
playerop.cpp
+6
-5
premake/dll.lua
premake/dll.lua
+1
-1
processor.cpp
processor.cpp
+132
-135
scriptlib.h
scriptlib.h
+1
-1
No files found.
card.cpp
View file @
1e5f5097
...
@@ -179,6 +179,11 @@ bool card::card_operation_sort(card* c1, card* c2) {
...
@@ -179,6 +179,11 @@ bool card::card_operation_sort(card* c1, card* c2) {
return
c1
->
current
.
sequence
<
c2
->
current
.
sequence
;
return
c1
->
current
.
sequence
<
c2
->
current
.
sequence
;
}
}
}
}
bool
card
::
check_card_setcode
(
uint32
code
,
uint32
value
)
{
card_data
dat
;
::
read_card
(
code
,
&
dat
);
return
dat
.
is_setcode
(
value
);
}
void
card
::
attacker_map
::
addcard
(
card
*
pcard
)
{
void
card
::
attacker_map
::
addcard
(
card
*
pcard
)
{
auto
fid
=
pcard
?
pcard
->
fieldid_r
:
0
;
auto
fid
=
pcard
?
pcard
->
fieldid_r
:
0
;
auto
pr
=
emplace
(
fid
,
std
::
make_pair
(
pcard
,
0
));
auto
pr
=
emplace
(
fid
,
std
::
make_pair
(
pcard
,
0
));
...
@@ -467,13 +472,13 @@ uint32 card::get_info_location() const {
...
@@ -467,13 +472,13 @@ uint32 card::get_info_location() const {
uint32
l
=
overlay_target
->
current
.
location
|
LOCATION_OVERLAY
;
uint32
l
=
overlay_target
->
current
.
location
|
LOCATION_OVERLAY
;
uint32
s
=
overlay_target
->
current
.
sequence
;
uint32
s
=
overlay_target
->
current
.
sequence
;
uint32
ss
=
current
.
sequence
;
uint32
ss
=
current
.
sequence
;
return
c
+
(
l
<<
8
)
+
(
s
<<
16
)
+
(
ss
<<
24
);
return
c
|
(
l
<<
8
)
|
(
s
<<
16
)
|
(
ss
<<
24
);
}
else
{
}
else
{
uint32
c
=
current
.
controler
;
uint32
c
=
current
.
controler
;
uint32
l
=
current
.
location
;
uint32
l
=
current
.
location
;
uint32
s
=
current
.
sequence
;
uint32
s
=
current
.
sequence
;
uint32
ss
=
current
.
position
;
uint32
ss
=
current
.
position
;
return
c
+
(
l
<<
8
)
+
(
s
<<
16
)
+
(
ss
<<
24
);
return
c
|
(
l
<<
8
)
|
(
s
<<
16
)
|
(
ss
<<
24
);
}
}
}
}
// get the printed code on card
// get the printed code on card
...
@@ -535,11 +540,6 @@ inline bool check_setcode(uint16_t setcode, uint32 value) {
...
@@ -535,11 +540,6 @@ inline bool check_setcode(uint16_t setcode, uint32 value) {
uint32
setsubtype
=
value
&
0xf000U
;
uint32
setsubtype
=
value
&
0xf000U
;
return
(
setcode
&
0x0fffU
)
==
settype
&&
(
setcode
&
0xf000U
&
setsubtype
)
==
setsubtype
;
return
(
setcode
&
0x0fffU
)
==
settype
&&
(
setcode
&
0xf000U
&
setsubtype
)
==
setsubtype
;
}
}
bool
card
::
check_card_setcode
(
uint32
code
,
uint32
value
)
{
card_data
dat
;
::
read_card
(
code
,
&
dat
);
return
dat
.
is_setcode
(
value
);
}
int32
card
::
is_set_card
(
uint32
set_code
)
{
int32
card
::
is_set_card
(
uint32
set_code
)
{
uint32
code1
=
get_code
();
uint32
code1
=
get_code
();
card_data
dat1
;
card_data
dat1
;
...
@@ -1345,7 +1345,7 @@ uint32 card::get_rscale() {
...
@@ -1345,7 +1345,7 @@ uint32 card::get_rscale() {
temp
.
rscale
=
UINT32_MAX
;
temp
.
rscale
=
UINT32_MAX
;
return
rscale
;
return
rscale
;
}
}
uint32
card
::
get_link_marker
()
{
uint32
card
::
get_link_marker
()
const
{
effect_set
effects
;
effect_set
effects
;
effect_set
effects2
;
effect_set
effects2
;
uint32
link_marker
=
data
.
link_marker
;
uint32
link_marker
=
data
.
link_marker
;
...
@@ -1378,14 +1378,14 @@ uint32 card::get_link_marker() {
...
@@ -1378,14 +1378,14 @@ uint32 card::get_link_marker() {
}
}
return
link_marker
;
return
link_marker
;
}
}
int32
card
::
is_link_marker
(
uint32
dir
)
{
uint32
card
::
is_link_marker
(
uint32
dir
)
const
{
return
(
int32
)(
get_link_marker
()
&
dir
)
;
return
get_link_marker
()
&
dir
;
}
}
uint32
card
::
get_linked_zone
()
{
uint32
card
::
get_linked_zone
()
const
{
if
((
!
(
data
.
type
&
TYPE_LINK
)
||
current
.
location
!=
LOCATION_MZONE
||
is_treated_as_not_on_field
())
if
((
!
(
data
.
type
&
TYPE_LINK
)
||
current
.
location
!=
LOCATION_MZONE
||
is_treated_as_not_on_field
())
&&
(
!
is_affected_by_effect
(
EFFECT_LINK_SPELL_KOISHI
)
||
current
.
location
!=
LOCATION_SZONE
))
&&
(
!
is_affected_by_effect
(
EFFECT_LINK_SPELL_KOISHI
)
||
current
.
location
!=
LOCATION_SZONE
))
return
0
;
return
0
;
int32
zones
=
0
;
u
int32
zones
=
0
;
int32
s
=
current
.
sequence
;
int32
s
=
current
.
sequence
;
if
(
current
.
location
==
LOCATION_SZONE
)
{
if
(
current
.
location
==
LOCATION_SZONE
)
{
if
(
s
>
4
)
if
(
s
>
4
)
...
@@ -1448,26 +1448,26 @@ void card::get_linked_cards(card_set* cset) {
...
@@ -1448,26 +1448,26 @@ void card::get_linked_cards(card_set* cset) {
pduel
->
game_field
->
get_cards_in_zone
(
cset
,
linked_zone
,
p
,
LOCATION_MZONE
);
pduel
->
game_field
->
get_cards_in_zone
(
cset
,
linked_zone
,
p
,
LOCATION_MZONE
);
pduel
->
game_field
->
get_cards_in_zone
(
cset
,
linked_zone
>>
16
,
1
-
p
,
LOCATION_MZONE
);
pduel
->
game_field
->
get_cards_in_zone
(
cset
,
linked_zone
>>
16
,
1
-
p
,
LOCATION_MZONE
);
}
}
uint32
card
::
get_mutual_linked_zone
()
{
uint32
card
::
get_mutual_linked_zone
()
const
{
if
(
!
(
data
.
type
&
TYPE_LINK
)
||
current
.
location
!=
LOCATION_MZONE
||
is_treated_as_not_on_field
())
if
(
!
(
data
.
type
&
TYPE_LINK
)
||
current
.
location
!=
LOCATION_MZONE
||
is_treated_as_not_on_field
())
return
0
;
return
0
;
int32
zones
=
0
;
u
int32
zones
=
0
;
int32
p
=
current
.
controler
;
int32
p
=
current
.
controler
;
int32
s
=
current
.
sequence
;
int32
s
=
current
.
sequence
;
uint32
linked_zone
=
get_linked_zone
();
uint32
linked_zone
=
get_linked_zone
();
uint32
icheck
=
0x1
;
uint32
icheck
=
0x1
U
;
for
(
u
int32
i
=
0
;
i
<
7
;
++
i
,
icheck
<<=
1
)
{
for
(
int32
i
=
0
;
i
<
7
;
++
i
,
icheck
<<=
1
)
{
if
(
icheck
&
linked_zone
)
{
if
(
icheck
&
linked_zone
)
{
card
*
pcard
=
pduel
->
game_field
->
player
[
p
].
list_mzone
[
i
];
card
*
pcard
=
pduel
->
game_field
->
player
[
p
].
list_mzone
[
i
];
if
(
pcard
&&
(
pcard
->
get_linked_zone
()
&
(
1u
<<
s
)))
if
(
pcard
&&
(
pcard
->
get_linked_zone
()
&
(
0x
1u
<<
s
)))
zones
|=
icheck
;
zones
|=
icheck
;
}
}
}
}
icheck
=
0x10000
;
icheck
=
0x10000
U
;
for
(
uint32
i
=
0
;
i
<
7
;
++
i
,
icheck
<<=
1
)
{
for
(
uint32
i
=
0
;
i
<
7
;
++
i
,
icheck
<<=
1
)
{
if
(
icheck
&
linked_zone
)
{
if
(
icheck
&
linked_zone
)
{
card
*
pcard
=
pduel
->
game_field
->
player
[
1
-
p
].
list_mzone
[
i
];
card
*
pcard
=
pduel
->
game_field
->
player
[
1
-
p
].
list_mzone
[
i
];
if
(
pcard
&&
(
pcard
->
get_linked_zone
()
&
(
1u
<<
(
s
+
16
))))
if
(
pcard
&&
(
pcard
->
get_linked_zone
()
&
(
0x
1u
<<
(
s
+
16
))))
zones
|=
icheck
;
zones
|=
icheck
;
}
}
}
}
...
@@ -1491,28 +1491,28 @@ int32 card::is_link_state() {
...
@@ -1491,28 +1491,28 @@ int32 card::is_link_state() {
return
TRUE
;
return
TRUE
;
int32
p
=
current
.
controler
;
int32
p
=
current
.
controler
;
uint32
linked_zone
=
pduel
->
game_field
->
get_linked_zone
(
p
);
uint32
linked_zone
=
pduel
->
game_field
->
get_linked_zone
(
p
);
if
((
linked_zone
>>
current
.
sequence
)
&
1
)
if
((
linked_zone
>>
current
.
sequence
)
&
0x1U
)
return
TRUE
;
return
TRUE
;
return
FALSE
;
return
FALSE
;
}
}
int32
card
::
is_extra_link_state
()
{
int32
card
::
is_extra_link_state
()
{
if
(
current
.
location
!=
LOCATION_MZONE
)
if
(
current
.
location
!=
LOCATION_MZONE
)
return
FALSE
;
return
FALSE
;
uint32
checked
=
1u
<<
current
.
sequence
;
uint32
checked
=
0x1U
<<
current
.
sequence
;
uint32
linked_zone
=
get_mutual_linked_zone
();
uint32
linked_zone
=
get_mutual_linked_zone
();
const
auto
&
list_mzone0
=
pduel
->
game_field
->
player
[
current
.
controler
].
list_mzone
;
const
auto
&
list_mzone0
=
pduel
->
game_field
->
player
[
current
.
controler
].
list_mzone
;
const
auto
&
list_mzone1
=
pduel
->
game_field
->
player
[
1
-
current
.
controler
].
list_mzone
;
const
auto
&
list_mzone1
=
pduel
->
game_field
->
player
[
1
-
current
.
controler
].
list_mzone
;
while
(
true
)
{
while
(
true
)
{
if
(((
linked_zone
>>
5
)
|
(
linked_zone
>>
(
16
+
6
)))
&
((
linked_zone
>>
6
)
|
(
linked_zone
>>
(
16
+
5
)))
&
1
)
if
(((
linked_zone
>>
5
)
|
(
linked_zone
>>
(
16
+
6
)))
&
((
linked_zone
>>
6
)
|
(
linked_zone
>>
(
16
+
5
)))
&
0x1U
)
return
TRUE
;
return
TRUE
;
int32
checking
=
(
int32
)(
linked_zone
&
~
checked
)
;
uint32
checking
=
linked_zone
&
~
checked
;
if
(
!
checking
)
if
(
!
checking
)
return
FALSE
;
return
FALSE
;
int32
rightmost
=
checking
&
(
-
checking
);
u
int32
rightmost
=
checking
&
(
-
checking
);
checked
|=
(
uint32
)
rightmost
;
checked
|=
rightmost
;
if
(
rightmost
<
0x10000
)
{
if
(
rightmost
<
0x10000
U
)
{
for
(
int32
i
=
0
;
i
<
7
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
7
;
++
i
)
{
if
(
rightmost
&
1
)
{
if
(
rightmost
&
0x1U
)
{
card
*
pcard
=
list_mzone0
[
i
];
card
*
pcard
=
list_mzone0
[
i
];
linked_zone
|=
pcard
->
get_mutual_linked_zone
();
linked_zone
|=
pcard
->
get_mutual_linked_zone
();
break
;
break
;
...
@@ -1522,7 +1522,7 @@ int32 card::is_extra_link_state() {
...
@@ -1522,7 +1522,7 @@ int32 card::is_extra_link_state() {
}
else
{
}
else
{
rightmost
>>=
16
;
rightmost
>>=
16
;
for
(
int32
i
=
0
;
i
<
7
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
7
;
++
i
)
{
if
(
rightmost
&
1
)
{
if
(
rightmost
&
0x1U
)
{
card
*
pcard
=
list_mzone1
[
i
];
card
*
pcard
=
list_mzone1
[
i
];
uint32
zone
=
pcard
->
get_mutual_linked_zone
();
uint32
zone
=
pcard
->
get_mutual_linked_zone
();
linked_zone
|=
(
zone
<<
16
)
|
(
zone
>>
16
);
linked_zone
|=
(
zone
<<
16
)
|
(
zone
>>
16
);
...
@@ -1534,7 +1534,7 @@ int32 card::is_extra_link_state() {
...
@@ -1534,7 +1534,7 @@ int32 card::is_extra_link_state() {
}
}
return
FALSE
;
return
FALSE
;
}
}
int32
card
::
is_position
(
int32
pos
)
{
int32
card
::
is_position
(
uint32
pos
)
const
{
return
current
.
position
&
pos
;
return
current
.
position
&
pos
;
}
}
void
card
::
set_status
(
uint32
x
,
int32
enabled
)
{
void
card
::
set_status
(
uint32
x
,
int32
enabled
)
{
...
@@ -1630,7 +1630,7 @@ uint32 card::get_select_info_location(uint8 *deck_seq_pointer) {
...
@@ -1630,7 +1630,7 @@ uint32 card::get_select_info_location(uint8 *deck_seq_pointer) {
return
get_info_location
();
return
get_info_location
();
}
}
}
}
int32
card
::
is_treated_as_not_on_field
()
{
int32
card
::
is_treated_as_not_on_field
()
const
{
return
get_status
(
STATUS_SUMMONING
|
STATUS_SUMMON_DISABLED
|
STATUS_ACTIVATE_DISABLED
|
STATUS_SPSUMMON_STEP
);
return
get_status
(
STATUS_SUMMONING
|
STATUS_SUMMON_DISABLED
|
STATUS_ACTIVATE_DISABLED
|
STATUS_SPSUMMON_STEP
);
}
}
void
card
::
equip
(
card
*
target
,
uint32
send_msg
)
{
void
card
::
equip
(
card
*
target
,
uint32
send_msg
)
{
...
@@ -1677,12 +1677,11 @@ int32 card::get_old_union_count() {
...
@@ -1677,12 +1677,11 @@ int32 card::get_old_union_count() {
}
}
return
count
;
return
count
;
}
}
void
card
::
xyz_overlay
(
c
ard_set
*
materials
)
{
void
card
::
xyz_overlay
(
c
onst
card_set
&
materials
)
{
if
(
materials
->
empty
())
if
(
materials
.
empty
())
return
;
return
;
card_set
des
,
leave_grave
,
leave_deck
;
card_set
des
,
leave_grave
,
leave_deck
;
card_vector
cv
;
card_vector
cv
(
materials
.
begin
(),
materials
.
end
());
cv
.
assign
(
materials
->
begin
(),
materials
->
end
());
std
::
sort
(
cv
.
begin
(),
cv
.
end
(),
card
::
card_operation_sort
);
std
::
sort
(
cv
.
begin
(),
cv
.
end
(),
card
::
card_operation_sort
);
if
(
pduel
->
game_field
->
core
.
global_flag
&
GLOBALFLAG_DECK_REVERSE_CHECK
)
{
if
(
pduel
->
game_field
->
core
.
global_flag
&
GLOBALFLAG_DECK_REVERSE_CHECK
)
{
int32
d0
=
(
int32
)
pduel
->
game_field
->
player
[
0
].
list_main
.
size
()
-
1
,
s0
=
d0
;
int32
d0
=
(
int32
)
pduel
->
game_field
->
player
[
0
].
list_main
.
size
()
-
1
,
s0
=
d0
;
...
@@ -1758,16 +1757,16 @@ void card::xyz_overlay(card_set* materials) {
...
@@ -1758,16 +1757,16 @@ void card::xyz_overlay(card_set* materials) {
}
}
if
(
leave_grave
.
size
()
||
leave_deck
.
size
())
{
if
(
leave_grave
.
size
()
||
leave_deck
.
size
())
{
if
(
leave_grave
.
size
())
{
if
(
leave_grave
.
size
())
{
pduel
->
game_field
->
raise_event
(
&
leave_grave
,
EVENT_LEAVE_GRAVE
,
pduel
->
game_field
->
core
.
reason_effect
,
REASON_XYZ
+
REASON_MATERIAL
,
pduel
->
game_field
->
core
.
reason_player
,
0
,
0
);
pduel
->
game_field
->
raise_event
(
leave_grave
,
EVENT_LEAVE_GRAVE
,
pduel
->
game_field
->
core
.
reason_effect
,
REASON_XYZ
+
REASON_MATERIAL
,
pduel
->
game_field
->
core
.
reason_player
,
0
,
0
);
}
}
if
(
leave_deck
.
size
())
{
if
(
leave_deck
.
size
())
{
pduel
->
game_field
->
raise_event
(
&
leave_deck
,
EVENT_LEAVE_DECK
,
pduel
->
game_field
->
core
.
reason_effect
,
REASON_XYZ
+
REASON_MATERIAL
,
pduel
->
game_field
->
core
.
reason_player
,
0
,
0
);
pduel
->
game_field
->
raise_event
(
leave_deck
,
EVENT_LEAVE_DECK
,
pduel
->
game_field
->
core
.
reason_effect
,
REASON_XYZ
+
REASON_MATERIAL
,
pduel
->
game_field
->
core
.
reason_player
,
0
,
0
);
}
}
pduel
->
game_field
->
process_single_event
();
pduel
->
game_field
->
process_single_event
();
pduel
->
game_field
->
process_instant_event
();
pduel
->
game_field
->
process_instant_event
();
}
}
if
(
des
.
size
())
if
(
des
.
size
())
pduel
->
game_field
->
destroy
(
&
des
,
0
,
REASON_LOST_TARGET
+
REASON_RULE
,
PLAYER_NONE
);
pduel
->
game_field
->
destroy
(
des
,
0
,
REASON_LOST_TARGET
+
REASON_RULE
,
PLAYER_NONE
);
else
else
pduel
->
game_field
->
adjust_instant
();
pduel
->
game_field
->
adjust_instant
();
}
}
...
@@ -2070,6 +2069,7 @@ effect_indexer::iterator card::remove_effect(effect* peffect) {
...
@@ -2070,6 +2069,7 @@ effect_indexer::iterator card::remove_effect(effect* peffect) {
pduel
->
game_field
->
update_disable_check_list
(
peffect
);
pduel
->
game_field
->
update_disable_check_list
(
peffect
);
}
}
field_effect
.
erase
(
it
);
field_effect
.
erase
(
it
);
pduel
->
game_field
->
remove_effect
(
peffect
);
}
}
if
((
current
.
controler
!=
PLAYER_NONE
)
&&
!
get_status
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
)
&&
!
check_target
.
empty
())
{
if
((
current
.
controler
!=
PLAYER_NONE
)
&&
!
get_status
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
)
&&
!
check_target
.
empty
())
{
if
(
peffect
->
is_disable_related
())
{
if
(
peffect
->
is_disable_related
())
{
...
@@ -2113,7 +2113,6 @@ effect_indexer::iterator card::remove_effect(effect* peffect) {
...
@@ -2113,7 +2113,6 @@ effect_indexer::iterator card::remove_effect(effect* peffect) {
unique_pos
[
0
]
=
unique_pos
[
1
]
=
0
;
unique_pos
[
0
]
=
unique_pos
[
1
]
=
0
;
unique_code
=
0
;
unique_code
=
0
;
}
}
pduel
->
game_field
->
remove_effect
(
peffect
);
pduel
->
game_field
->
core
.
reseted_effects
.
insert
(
peffect
);
pduel
->
game_field
->
core
.
reseted_effects
.
insert
(
peffect
);
return
ret
;
return
ret
;
}
}
...
@@ -3751,7 +3750,7 @@ int32 card::is_setable_szone(uint8 playerid, uint8 ignore_fd, uint8 toplayer, ui
...
@@ -3751,7 +3750,7 @@ int32 card::is_setable_szone(uint8 playerid, uint8 ignore_fd, uint8 toplayer, ui
}
}
int32
card
::
is_affect_by_effect
(
effect
*
reason_effect
)
{
int32
card
::
is_affect_by_effect
(
effect
*
reason_effect
)
{
if
(
is_status
(
STATUS_SUMMONING
))
if
(
is_status
(
STATUS_SUMMONING
))
return
reason_effect
&&
(
reason_effect
->
code
==
EFFECT_CANNOT_DISABLE_SUMMON
||
reason_effect
->
code
==
EFFECT_CANNOT_DISABLE_SPSUMMON
);
return
reason_effect
&&
affect_summoning_effect
.
find
(
reason_effect
->
code
)
!=
affect_summoning_effect
.
end
(
);
if
(
!
reason_effect
||
reason_effect
->
is_flag
(
EFFECT_FLAG_IGNORE_IMMUNE
))
if
(
!
reason_effect
||
reason_effect
->
is_flag
(
EFFECT_FLAG_IGNORE_IMMUNE
))
return
TRUE
;
return
TRUE
;
if
(
reason_effect
->
is_immuned
(
this
))
if
(
reason_effect
->
is_immuned
(
this
))
...
...
card.h
View file @
1e5f5097
...
@@ -229,6 +229,7 @@ public:
...
@@ -229,6 +229,7 @@ public:
explicit
card
(
duel
*
pd
);
explicit
card
(
duel
*
pd
);
~
card
()
=
default
;
~
card
()
=
default
;
static
bool
card_operation_sort
(
card
*
c1
,
card
*
c2
);
static
bool
card_operation_sort
(
card
*
c1
,
card
*
c2
);
static
bool
check_card_setcode
(
uint32
code
,
uint32
value
);
bool
is_extra_deck_monster
()
const
{
return
!!
(
data
.
type
&
TYPES_EXTRA_DECK
);
}
bool
is_extra_deck_monster
()
const
{
return
!!
(
data
.
type
&
TYPES_EXTRA_DECK
);
}
int32
get_infos
(
byte
*
buf
,
uint32
query_flag
,
int32
use_cache
=
TRUE
);
int32
get_infos
(
byte
*
buf
,
uint32
query_flag
,
int32
use_cache
=
TRUE
);
...
@@ -237,7 +238,6 @@ public:
...
@@ -237,7 +238,6 @@ public:
std
::
tuple
<
uint32
,
uint32
>
get_original_code_rule
()
const
;
std
::
tuple
<
uint32
,
uint32
>
get_original_code_rule
()
const
;
uint32
get_code
();
uint32
get_code
();
uint32
get_another_code
();
uint32
get_another_code
();
static
bool
check_card_setcode
(
uint32
code
,
uint32
value
);
int32
is_set_card
(
uint32
set_code
);
int32
is_set_card
(
uint32
set_code
);
int32
is_origin_set_card
(
uint32
set_code
);
int32
is_origin_set_card
(
uint32
set_code
);
int32
is_pre_set_card
(
uint32
set_code
);
int32
is_pre_set_card
(
uint32
set_code
);
...
@@ -272,15 +272,15 @@ public:
...
@@ -272,15 +272,15 @@ public:
uint32
get_grave_race
(
uint8
playerid
);
uint32
get_grave_race
(
uint8
playerid
);
uint32
get_lscale
();
uint32
get_lscale
();
uint32
get_rscale
();
uint32
get_rscale
();
uint32
get_link_marker
();
uint32
get_link_marker
()
const
;
int32
is_link_marker
(
uint32
dir
)
;
uint32
is_link_marker
(
uint32
dir
)
const
;
uint32
get_linked_zone
();
uint32
get_linked_zone
()
const
;
void
get_linked_cards
(
card_set
*
cset
);
void
get_linked_cards
(
card_set
*
cset
);
uint32
get_mutual_linked_zone
();
uint32
get_mutual_linked_zone
()
const
;
void
get_mutual_linked_cards
(
card_set
*
cset
);
void
get_mutual_linked_cards
(
card_set
*
cset
);
int32
is_link_state
();
int32
is_link_state
();
int32
is_extra_link_state
();
int32
is_extra_link_state
();
int32
is_position
(
int32
pos
)
;
int32
is_position
(
uint32
pos
)
const
;
void
set_status
(
uint32
status
,
int32
enabled
);
void
set_status
(
uint32
status
,
int32
enabled
);
int32
get_status
(
uint32
status
)
const
;
int32
get_status
(
uint32
status
)
const
;
int32
is_status
(
uint32
status
)
const
;
int32
is_status
(
uint32
status
)
const
;
...
@@ -289,13 +289,13 @@ public:
...
@@ -289,13 +289,13 @@ public:
int32
is_all_column
();
int32
is_all_column
();
uint8
get_select_sequence
(
uint8
*
deck_seq_pointer
);
uint8
get_select_sequence
(
uint8
*
deck_seq_pointer
);
uint32
get_select_info_location
(
uint8
*
deck_seq_pointer
);
uint32
get_select_info_location
(
uint8
*
deck_seq_pointer
);
int32
is_treated_as_not_on_field
();
int32
is_treated_as_not_on_field
()
const
;
void
equip
(
card
*
target
,
uint32
send_msg
=
TRUE
);
void
equip
(
card
*
target
,
uint32
send_msg
=
TRUE
);
void
unequip
();
void
unequip
();
int32
get_union_count
();
int32
get_union_count
();
int32
get_old_union_count
();
int32
get_old_union_count
();
void
xyz_overlay
(
c
ard_set
*
materials
);
void
xyz_overlay
(
c
onst
card_set
&
materials
);
void
xyz_add
(
card
*
mat
);
void
xyz_add
(
card
*
mat
);
void
xyz_remove
(
card
*
mat
);
void
xyz_remove
(
card
*
mat
);
void
apply_field_effect
();
void
apply_field_effect
();
...
...
common.h
View file @
1e5f5097
...
@@ -49,17 +49,17 @@ typedef signed char int8;
...
@@ -49,17 +49,17 @@ typedef signed char int8;
#define CURRENT_RULE 5
#define CURRENT_RULE 5
//Locations
//Locations
#define LOCATION_DECK 0x01
//
#define LOCATION_DECK 0x01
U
#define LOCATION_HAND 0x02
//
#define LOCATION_HAND 0x02
U
#define LOCATION_MZONE 0x04
//
#define LOCATION_MZONE 0x04
U
#define LOCATION_SZONE 0x08
//
#define LOCATION_SZONE 0x08
U
#define LOCATION_GRAVE 0x10
//
#define LOCATION_GRAVE 0x10
U
#define LOCATION_REMOVED 0x20
//
#define LOCATION_REMOVED 0x20
U
#define LOCATION_EXTRA 0x40
//
#define LOCATION_EXTRA 0x40
U
#define LOCATION_OVERLAY 0x80
//
#define LOCATION_OVERLAY 0x80
U
#define LOCATION_ONFIELD
0x0c //
#define LOCATION_ONFIELD
(LOCATION_MZONE | LOCATION_SZONE)
#define LOCATION_FZONE 0x100
//
#define LOCATION_FZONE 0x100
U
#define LOCATION_PZONE 0x200
//
#define LOCATION_PZONE 0x200
U
//For redirect
//For redirect
#define LOCATION_DECKBOT 0x10001 //Return to deck bottom
#define LOCATION_DECKBOT 0x10001 //Return to deck bottom
#define LOCATION_DECKSHF 0x20001 //Return to deck and shuffle
#define LOCATION_DECKSHF 0x20001 //Return to deck and shuffle
...
...
duel.cpp
View file @
1e5f5097
...
@@ -102,9 +102,10 @@ void duel::delete_effect(effect* peffect) {
...
@@ -102,9 +102,10 @@ void duel::delete_effect(effect* peffect) {
delete
peffect
;
delete
peffect
;
}
}
int32
duel
::
read_buffer
(
byte
*
buf
)
{
int32
duel
::
read_buffer
(
byte
*
buf
)
{
if
(
message_buffer
.
size
())
auto
size
=
buffer_size
();
std
::
memcpy
(
buf
,
message_buffer
.
data
(),
message_buffer
.
size
());
if
(
size
)
return
(
int32
)
message_buffer
.
size
();
std
::
memcpy
(
buf
,
message_buffer
.
data
(),
size
);
return
(
int32
)
size
;
}
}
void
duel
::
release_script_group
()
{
void
duel
::
release_script_group
()
{
for
(
auto
&
pgroup
:
sgroups
)
{
for
(
auto
&
pgroup
:
sgroups
)
{
...
...
duel.h
View file @
1e5f5097
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
#include <set>
#include <set>
#include <unordered_set>
#include <unordered_set>
#include <cstring>
#include <cstring>
#include <vector>
class
card
;
class
card
;
class
group
;
class
group
;
...
@@ -41,6 +42,9 @@ public:
...
@@ -41,6 +42,9 @@ public:
~
duel
();
~
duel
();
void
clear
();
void
clear
();
uint32
buffer_size
()
const
{
return
(
uint32
)
message_buffer
.
size
()
&
PROCESSOR_BUFFER_LEN
;
}
card
*
new_card
(
uint32
code
);
card
*
new_card
(
uint32
code
);
group
*
new_group
();
group
*
new_group
();
group
*
new_group
(
card
*
pcard
);
group
*
new_group
(
card
*
pcard
);
...
...
effect.cpp
View file @
1e5f5097
...
@@ -873,7 +873,7 @@ uint32 effect::get_active_type(uint8 uselast) {
...
@@ -873,7 +873,7 @@ uint32 effect::get_active_type(uint8 uselast) {
}
else
}
else
return
owner
->
get_type
();
return
owner
->
get_type
();
}
}
int32
effect
::
get_code_type
()
const
{
code_type
effect
::
get_code_type
()
const
{
// start from the highest bit
// start from the highest bit
if
(
code
&
0xf0000000
)
if
(
code
&
0xf0000000
)
return
CODE_CUSTOM
;
return
CODE_CUSTOM
;
...
...
effect.h
View file @
1e5f5097
...
@@ -20,8 +20,11 @@ class effect;
...
@@ -20,8 +20,11 @@ class effect;
struct
tevent
;
struct
tevent
;
struct
effect_set
;
struct
effect_set
;
struct
effect_set_v
;
struct
effect_set_v
;
enum
effect_flag
:
uint32
;
enum
effect_flag
:
uint64
;
enum
effect_flag2
:
uint32
;
enum
effect_flag2
:
uint64
;
enum
code_type
:
int32
;
bool
is_continuous_event
(
uint32
code
);
class
effect
{
class
effect
{
public:
public:
...
@@ -32,7 +35,6 @@ public:
...
@@ -32,7 +35,6 @@ public:
uint8
effect_owner
{
PLAYER_NONE
};
uint8
effect_owner
{
PLAYER_NONE
};
uint32
description
{
0
};
uint32
description
{
0
};
uint32
code
{
0
};
uint32
code
{
0
};
uint32
flag
[
2
]{};
uint32
id
{
0
};
uint32
id
{
0
};
uint32
type
{
0
};
uint32
type
{
0
};
uint16
copy_id
{
0
};
uint16
copy_id
{
0
};
...
@@ -41,18 +43,19 @@ public:
...
@@ -41,18 +43,19 @@ public:
uint16
o_range
{
0
};
uint16
o_range
{
0
};
uint8
count_limit
{
0
};
uint8
count_limit
{
0
};
uint8
count_limit_max
{
0
};
uint8
count_limit_max
{
0
};
uint16
status
{
0
};
int32
reset_count
{
0
};
int32
reset_count
{
0
};
uint32
reset_flag
{
0
};
uint32
reset_flag
{
0
};
uint32
count_code
{
0
};
uint32
count_code
{
0
};
uint32
category
{
0
};
uint64
category
{
0
};
uint64
flag
[
2
]{};
uint32
hint_timing
[
2
]{};
uint32
hint_timing
[
2
]{};
uint32
card_type
{
0
};
uint32
card_type
{
0
};
uint32
active_type
{
0
};
uint32
active_type
{
0
};
uint16
active_location
{
0
};
uint16
active_location
{
0
};
uint16
active_sequence
{
0
};
uint16
active_sequence
{
0
};
card
*
active_handler
{
nullptr
};
card
*
active_handler
{
nullptr
};
uint16
status
{
0
};
std
::
vector
<
lua_Integer
>
label
;
std
::
vector
<
uint32
>
label
;
int32
label_object
{
0
};
int32
label_object
{
0
};
int32
condition
{
0
};
int32
condition
{
0
};
int32
cost
{
0
};
int32
cost
{
0
};
...
@@ -112,7 +115,7 @@ public:
...
@@ -112,7 +115,7 @@ public:
void
set_activate_location
();
void
set_activate_location
();
void
set_active_type
();
void
set_active_type
();
uint32
get_active_type
(
uint8
uselast
=
TRUE
);
uint32
get_active_type
(
uint8
uselast
=
TRUE
);
int32
get_code_type
()
const
;
code_type
get_code_type
()
const
;
bool
is_flag
(
effect_flag
x
)
const
{
bool
is_flag
(
effect_flag
x
)
const
{
return
!!
(
flag
[
0
]
&
x
);
return
!!
(
flag
[
0
]
&
x
);
...
@@ -195,7 +198,7 @@ constexpr uint32 EFFECT_TYPES_TRIGGER_LIKE = EFFECT_TYPE_ACTIVATE | EFFECT_TYPE_
...
@@ -195,7 +198,7 @@ constexpr uint32 EFFECT_TYPES_TRIGGER_LIKE = EFFECT_TYPE_ACTIVATE | EFFECT_TYPE_
constexpr
uint32
EFFECT_TYPES_CHAIN_LINK
=
EFFECT_TYPES_TRIGGER_LIKE
|
EFFECT_TYPE_FLIP
|
EFFECT_TYPE_IGNITION
;
constexpr
uint32
EFFECT_TYPES_CHAIN_LINK
=
EFFECT_TYPES_TRIGGER_LIKE
|
EFFECT_TYPE_FLIP
|
EFFECT_TYPE_IGNITION
;
//========== Flags ==========
//========== Flags ==========
enum
effect_flag
:
uint
32
{
enum
effect_flag
:
uint
64
{
EFFECT_FLAG_INITIAL
=
0x0001
,
EFFECT_FLAG_INITIAL
=
0x0001
,
EFFECT_FLAG_FUNC_VALUE
=
0x0002
,
EFFECT_FLAG_FUNC_VALUE
=
0x0002
,
EFFECT_FLAG_COUNT_LIMIT
=
0x0004
,
EFFECT_FLAG_COUNT_LIMIT
=
0x0004
,
...
@@ -229,7 +232,7 @@ enum effect_flag : uint32 {
...
@@ -229,7 +232,7 @@ enum effect_flag : uint32 {
// EFFECT_FLAG_CVAL_CHECK = 0x40000000,
// EFFECT_FLAG_CVAL_CHECK = 0x40000000,
EFFECT_FLAG_IMMEDIATELY_APPLY
=
0x80000000
,
EFFECT_FLAG_IMMEDIATELY_APPLY
=
0x80000000
,
};
};
enum
effect_flag2
:
uint
32
{
enum
effect_flag2
:
uint
64
{
EFFECT_FLAG2_REPEAT_UPDATE
=
0x0001
,
EFFECT_FLAG2_REPEAT_UPDATE
=
0x0001
,
EFFECT_FLAG2_COF
=
0x0002
,
EFFECT_FLAG2_COF
=
0x0002
,
EFFECT_FLAG2_WICKED
=
0x0004
,
EFFECT_FLAG2_WICKED
=
0x0004
,
...
@@ -584,10 +587,12 @@ constexpr int32 HALF_DAMAGE = 0x80000001;
...
@@ -584,10 +587,12 @@ constexpr int32 HALF_DAMAGE = 0x80000001;
#define MAX_CARD_ID 0xfffffff
#define MAX_CARD_ID 0xfffffff
// The type of effect code
// The type of effect code
#define CODE_CUSTOM 1 // header + id (28 bits)
enum
code_type
:
int32
{
#define CODE_COUNTER 2 // header + counter_id (16 bits)
CODE_CUSTOM
=
1
,
// header + id (28 bits)
#define CODE_PHASE 3 // header + phase_id (12 bits)
CODE_COUNTER
,
// header + counter_id (16 bits)
#define CODE_VALUE 4 // numeric value, max = 4095
CODE_PHASE
,
// header + phase_id (12 bits)
CODE_VALUE
,
// numeric value, max = 4095
};
const
std
::
unordered_set
<
uint32
>
continuous_event
{
const
std
::
unordered_set
<
uint32
>
continuous_event
{
EVENT_ADJUST
,
EVENT_ADJUST
,
...
@@ -596,6 +601,11 @@ const std::unordered_set<uint32> continuous_event{
...
@@ -596,6 +601,11 @@ const std::unordered_set<uint32> continuous_event{
EVENT_PRE_BATTLE_DAMAGE
,
EVENT_PRE_BATTLE_DAMAGE
,
EVENT_SPSUMMON_SUCCESS_G_P
,
EVENT_SPSUMMON_SUCCESS_G_P
,
};
};
bool
is_continuous_event
(
uint32
code
);
const
std
::
unordered_set
<
uint32
>
affect_summoning_effect
{
EFFECT_CANNOT_DISABLE_SUMMON
,
EFFECT_CANNOT_DISABLE_SPSUMMON
,
EVENT_BE_PRE_MATERIAL
,
};
#endif
/* EFFECT_H_ */
#endif
/* EFFECT_H_ */
field.cpp
View file @
1e5f5097
...
@@ -492,7 +492,21 @@ void field::set_control(card* pcard, uint8 playerid, uint16 reset_phase, uint8 r
...
@@ -492,7 +492,21 @@ void field::set_control(card* pcard, uint8 playerid, uint16 reset_phase, uint8 r
pcard
->
current
.
controler
=
playerid
;
pcard
->
current
.
controler
=
playerid
;
}
}
card
*
field
::
get_field_card
(
uint8
playerid
,
uint32
general_location
,
uint8
sequence
)
{
int32
field
::
get_pzone_sequence
(
uint8
pseq
)
const
{
if
(
core
.
duel_rule
>=
NEW_MASTER_RULE
)
{
if
(
!
pseq
)
return
0
;
else
return
4
;
}
else
{
if
(
!
pseq
)
return
6
;
else
return
7
;
}
}
card
*
field
::
get_field_card
(
uint8
playerid
,
uint32
general_location
,
uint8
sequence
)
const
{
if
(
!
check_playerid
(
playerid
))
if
(
!
check_playerid
(
playerid
))
return
nullptr
;
return
nullptr
;
switch
(
general_location
)
{
switch
(
general_location
)
{
...
@@ -518,12 +532,9 @@ card* field::get_field_card(uint8 playerid, uint32 general_location, uint8 seque
...
@@ -518,12 +532,9 @@ card* field::get_field_card(uint8 playerid, uint32 general_location, uint8 seque
break
;
break
;
}
}
case
LOCATION_PZONE
:
{
case
LOCATION_PZONE
:
{
if
(
sequence
==
0
)
{
if
(
sequence
==
0
||
sequence
==
1
)
{
card
*
pcard
=
player
[
playerid
].
list_szone
[
core
.
duel_rule
>=
NEW_MASTER_RULE
?
0
:
6
];
card
*
pcard
=
player
[
playerid
].
list_szone
[
get_pzone_sequence
(
sequence
)];
return
(
pcard
&&
pcard
->
current
.
pzone
)
?
pcard
:
0
;
return
(
pcard
&&
pcard
->
current
.
pzone
)
?
pcard
:
nullptr
;
}
else
if
(
sequence
==
1
)
{
card
*
pcard
=
player
[
playerid
].
list_szone
[
core
.
duel_rule
>=
NEW_MASTER_RULE
?
4
:
7
];
return
(
pcard
&&
pcard
->
current
.
pzone
)
?
pcard
:
0
;
}
else
}
else
return
nullptr
;
return
nullptr
;
break
;
break
;
...
@@ -573,33 +584,28 @@ int32 field::is_location_useable(uint8 playerid, uint32 general_location, uint8
...
@@ -573,33 +584,28 @@ int32 field::is_location_useable(uint8 playerid, uint32 general_location, uint8
if
(
general_location
==
LOCATION_MZONE
)
{
if
(
general_location
==
LOCATION_MZONE
)
{
if
(
sequence
>=
(
int32
)
player
[
playerid
].
list_mzone
.
size
())
if
(
sequence
>=
(
int32
)
player
[
playerid
].
list_mzone
.
size
())
return
FALSE
;
return
FALSE
;
if
(
flag
&
(
0x1
u
<<
sequence
))
if
(
flag
&
(
0x1
U
<<
sequence
))
return
FALSE
;
return
FALSE
;
if
(
sequence
>=
5
)
{
if
(
sequence
>=
5
)
{
uint32
oppo
=
player
[
1
-
playerid
].
disabled_location
|
player
[
1
-
playerid
].
used_location
;
uint32
oppo
=
player
[
1
-
playerid
].
disabled_location
|
player
[
1
-
playerid
].
used_location
;
if
(
oppo
&
(
0x1
u
<<
(
11
-
sequence
)))
if
(
oppo
&
(
0x1
U
<<
(
11
-
sequence
)))
return
FALSE
;
return
FALSE
;
}
}
}
else
if
(
general_location
==
LOCATION_SZONE
)
{
}
else
if
(
general_location
==
LOCATION_SZONE
)
{
if
(
sequence
>=
player
[
playerid
].
szone_size
)
if
(
sequence
>=
player
[
playerid
].
szone_size
)
return
FALSE
;
return
FALSE
;
if
(
flag
&
(
0x100
u
<<
sequence
))
if
(
flag
&
(
0x100
U
<<
sequence
))
return
FALSE
;
return
FALSE
;
}
else
if
(
general_location
==
LOCATION_FZONE
)
{
}
else
if
(
general_location
==
LOCATION_FZONE
)
{
if
(
sequence
>=
1
)
if
(
sequence
>=
1
)
return
FALSE
;
return
FALSE
;
if
(
flag
&
(
0x100
u
<<
(
5
+
sequence
)))
if
(
flag
&
(
0x100
U
<<
(
5
+
sequence
)))
return
FALSE
;
return
FALSE
;
}
else
if
(
general_location
==
LOCATION_PZONE
)
{
}
else
if
(
general_location
==
LOCATION_PZONE
)
{
if
(
sequence
>=
2
)
if
(
sequence
>=
2
)
return
FALSE
;
return
FALSE
;
if
(
core
.
duel_rule
>=
NEW_MASTER_RULE
)
{
if
(
flag
&
(
0x100U
<<
get_pzone_sequence
(
sequence
)))
if
(
flag
&
(
0x100u
<<
(
sequence
*
4
)))
return
FALSE
;
return
FALSE
;
}
else
{
if
(
flag
&
(
0x100u
<<
(
6
+
sequence
)))
return
FALSE
;
}
}
}
return
TRUE
;
return
TRUE
;
}
}
...
@@ -814,11 +820,11 @@ int32 field::get_szone_limit(uint8 playerid, uint8 uplayer, uint32 reason) {
...
@@ -814,11 +820,11 @@ int32 field::get_szone_limit(uint8 playerid, uint8 uplayer, uint32 reason) {
}
}
uint32
field
::
get_linked_zone
(
int32
playerid
)
{
uint32
field
::
get_linked_zone
(
int32
playerid
)
{
uint32
zones
=
0
;
uint32
zones
=
0
;
for
(
auto
&
pcard
:
player
[
playerid
].
list_mzone
)
{
for
(
const
auto
&
pcard
:
player
[
playerid
].
list_mzone
)
{
if
(
pcard
)
if
(
pcard
)
zones
|=
pcard
->
get_linked_zone
()
&
0xff
;
zones
|=
pcard
->
get_linked_zone
()
&
0xff
ff
;
}
}
for
(
auto
&
pcard
:
player
[
1
-
playerid
].
list_mzone
)
{
for
(
const
auto
&
pcard
:
player
[
1
-
playerid
].
list_mzone
)
{
if
(
pcard
)
if
(
pcard
)
zones
|=
pcard
->
get_linked_zone
()
>>
16
;
zones
|=
pcard
->
get_linked_zone
()
>>
16
;
}
}
...
@@ -892,19 +898,19 @@ int32 field::check_extra_link(int32 playerid) {
...
@@ -892,19 +898,19 @@ int32 field::check_extra_link(int32 playerid) {
if
(
!
player
[
playerid
].
list_mzone
[
5
]
||
!
player
[
playerid
].
list_mzone
[
6
])
if
(
!
player
[
playerid
].
list_mzone
[
5
]
||
!
player
[
playerid
].
list_mzone
[
6
])
return
FALSE
;
return
FALSE
;
card
*
pcard
=
player
[
playerid
].
list_mzone
[
5
];
card
*
pcard
=
player
[
playerid
].
list_mzone
[
5
];
uint32
checked
=
1u
<<
5
;
uint32
checked
=
0x
1u
<<
5
;
uint32
linked_zone
=
pcard
->
get_mutual_linked_zone
();
uint32
linked_zone
=
pcard
->
get_mutual_linked_zone
();
while
(
true
)
{
while
(
true
)
{
if
((
linked_zone
>>
6
)
&
1
)
if
((
linked_zone
>>
6
)
&
0x1U
)
return
TRUE
;
return
TRUE
;
int32
checking
=
(
int32
)(
linked_zone
&
~
checked
)
;
uint32
checking
=
linked_zone
&
~
checked
;
if
(
!
checking
)
if
(
!
checking
)
return
FALSE
;
return
FALSE
;
int32
rightmost
=
checking
&
(
-
checking
);
u
int32
rightmost
=
checking
&
(
-
checking
);
checked
|=
(
uint32
)
rightmost
;
checked
|=
rightmost
;
if
(
rightmost
<
0x10000
)
{
if
(
rightmost
<
0x10000
U
)
{
for
(
int32
i
=
0
;
i
<
7
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
7
;
++
i
)
{
if
(
rightmost
&
1
)
{
if
(
rightmost
&
0x1U
)
{
pcard
=
player
[
playerid
].
list_mzone
[
i
];
pcard
=
player
[
playerid
].
list_mzone
[
i
];
linked_zone
|=
pcard
->
get_mutual_linked_zone
();
linked_zone
|=
pcard
->
get_mutual_linked_zone
();
break
;
break
;
...
@@ -914,7 +920,7 @@ int32 field::check_extra_link(int32 playerid) {
...
@@ -914,7 +920,7 @@ int32 field::check_extra_link(int32 playerid) {
}
else
{
}
else
{
rightmost
>>=
16
;
rightmost
>>=
16
;
for
(
int32
i
=
0
;
i
<
7
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
7
;
++
i
)
{
if
(
rightmost
&
1
)
{
if
(
rightmost
&
0x1U
)
{
pcard
=
player
[
1
-
playerid
].
list_mzone
[
i
];
pcard
=
player
[
1
-
playerid
].
list_mzone
[
i
];
uint32
zone
=
pcard
->
get_mutual_linked_zone
();
uint32
zone
=
pcard
->
get_mutual_linked_zone
();
linked_zone
|=
(
zone
<<
16
)
|
(
zone
>>
16
);
linked_zone
|=
(
zone
<<
16
)
|
(
zone
>>
16
);
...
@@ -1360,7 +1366,7 @@ void field::add_effect_code(uint32 code, uint32 playerid) {
...
@@ -1360,7 +1366,7 @@ void field::add_effect_code(uint32 code, uint32 playerid) {
count_map
=
&
core
.
effect_count_code_duel
;
count_map
=
&
core
.
effect_count_code_duel
;
else
if
(
code
&
EFFECT_COUNT_CODE_CHAIN
)
else
if
(
code
&
EFFECT_COUNT_CODE_CHAIN
)
count_map
=
&
core
.
effect_count_code_chain
;
count_map
=
&
core
.
effect_count_code_chain
;
++
(
*
count_map
)[
code
+
(
playerid
<<
30
)]
;
(
*
count_map
)[
code
+
(
playerid
<<
30
)]
++
;
}
}
uint32
field
::
get_effect_code
(
uint32
code
,
uint32
playerid
)
{
uint32
field
::
get_effect_code
(
uint32
code
,
uint32
playerid
)
{
auto
*
count_map
=
&
core
.
effect_count_code
;
auto
*
count_map
=
&
core
.
effect_count_code
;
...
@@ -1530,7 +1536,7 @@ int32 field::filter_matching_card(lua_State* L, int32 findex, uint8 self, uint32
...
@@ -1530,7 +1536,7 @@ int32 field::filter_matching_card(lua_State* L, int32 findex, uint8 self, uint32
}
}
if
(
location
&
LOCATION_PZONE
)
{
if
(
location
&
LOCATION_PZONE
)
{
for
(
int32
i
=
0
;
i
<
2
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
2
;
++
i
)
{
card
*
pcard
=
player
[
self
].
list_szone
[
core
.
duel_rule
>=
NEW_MASTER_RULE
?
i
*
4
:
i
+
6
];
card
*
pcard
=
player
[
self
].
list_szone
[
get_pzone_sequence
(
i
)
];
if
(
pcard
&&
pcard
->
current
.
pzone
&&
!
pcard
->
is_treated_as_not_on_field
()
if
(
pcard
&&
pcard
->
current
.
pzone
&&
!
pcard
->
is_treated_as_not_on_field
()
&&
pcard
!=
pexception
&&
!
(
pexgroup
&&
pexgroup
->
has_card
(
pcard
))
&&
pcard
!=
pexception
&&
!
(
pexgroup
&&
pexgroup
->
has_card
(
pcard
))
&&
pduel
->
lua
->
check_filter
(
L
,
pcard
,
findex
,
extraargs
)
&&
pduel
->
lua
->
check_filter
(
L
,
pcard
,
findex
,
extraargs
)
...
@@ -1656,7 +1662,7 @@ int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, g
...
@@ -1656,7 +1662,7 @@ int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, g
}
}
if
(
location
&
LOCATION_PZONE
)
{
if
(
location
&
LOCATION_PZONE
)
{
for
(
int32
i
=
0
;
i
<
2
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
2
;
++
i
)
{
card
*
pcard
=
player
[
self
].
list_szone
[
core
.
duel_rule
>=
NEW_MASTER_RULE
?
i
*
4
:
i
+
6
];
card
*
pcard
=
player
[
self
].
list_szone
[
get_pzone_sequence
(
i
)
];
if
(
pcard
&&
pcard
->
current
.
pzone
)
{
if
(
pcard
&&
pcard
->
current
.
pzone
)
{
result
.
insert
(
pcard
);
result
.
insert
(
pcard
);
}
}
...
@@ -1682,7 +1688,7 @@ int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, g
...
@@ -1682,7 +1688,7 @@ int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, g
}
}
if
(
pgroup
)
if
(
pgroup
)
pgroup
->
container
.
insert
(
result
.
begin
(),
result
.
end
());
pgroup
->
container
.
insert
(
result
.
begin
(),
result
.
end
());
return
result
.
size
();
return
(
int32
)
result
.
size
();
}
}
effect
*
field
::
is_player_affected_by_effect
(
uint8
playerid
,
uint32
code
)
{
effect
*
field
::
is_player_affected_by_effect
(
uint8
playerid
,
uint32
code
)
{
auto
rg
=
effects
.
aura_effect
.
equal_range
(
code
);
auto
rg
=
effects
.
aura_effect
.
equal_range
(
code
);
...
@@ -1947,11 +1953,11 @@ void field::get_fusion_material(uint8 playerid, card_set* material_all, card_set
...
@@ -1947,11 +1953,11 @@ void field::get_fusion_material(uint8 playerid, card_set* material_all, card_set
}
}
material_all
->
insert
(
material_base
->
begin
(),
material_base
->
end
());
material_all
->
insert
(
material_base
->
begin
(),
material_base
->
end
());
}
}
void
field
::
ritual_release
(
c
ard_set
*
material
)
{
void
field
::
ritual_release
(
c
onst
card_set
&
material
)
{
card_set
rel
;
card_set
rel
;
card_set
rem
;
card_set
rem
;
card_set
tgy
;
card_set
tgy
;
for
(
auto
&
pcard
:
*
material
)
{
for
(
const
auto
&
pcard
:
material
)
{
if
(
pcard
->
current
.
location
==
LOCATION_GRAVE
)
if
(
pcard
->
current
.
location
==
LOCATION_GRAVE
)
rem
.
insert
(
pcard
);
rem
.
insert
(
pcard
);
else
if
(
pcard
->
current
.
location
==
LOCATION_OVERLAY
||
pcard
->
current
.
location
==
LOCATION_EXTRA
)
else
if
(
pcard
->
current
.
location
==
LOCATION_OVERLAY
||
pcard
->
current
.
location
==
LOCATION_EXTRA
)
...
@@ -1959,9 +1965,9 @@ void field::ritual_release(card_set* material) {
...
@@ -1959,9 +1965,9 @@ void field::ritual_release(card_set* material) {
else
else
rel
.
insert
(
pcard
);
rel
.
insert
(
pcard
);
}
}
send_to
(
&
tgy
,
core
.
reason_effect
,
REASON_RITUAL
+
REASON_EFFECT
+
REASON_MATERIAL
,
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
POS_FACEUP
);
send_to
(
tgy
,
core
.
reason_effect
,
REASON_RITUAL
+
REASON_EFFECT
+
REASON_MATERIAL
,
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
POS_FACEUP
);
release
(
&
rel
,
core
.
reason_effect
,
REASON_RITUAL
+
REASON_EFFECT
+
REASON_MATERIAL
,
core
.
reason_player
);
release
(
rel
,
core
.
reason_effect
,
REASON_RITUAL
+
REASON_EFFECT
+
REASON_MATERIAL
,
core
.
reason_player
);
send_to
(
&
rem
,
core
.
reason_effect
,
REASON_RITUAL
+
REASON_EFFECT
+
REASON_MATERIAL
,
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_REMOVED
,
0
,
POS_FACEUP
);
send_to
(
rem
,
core
.
reason_effect
,
REASON_RITUAL
+
REASON_EFFECT
+
REASON_MATERIAL
,
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_REMOVED
,
0
,
POS_FACEUP
);
}
}
void
field
::
get_xyz_material
(
lua_State
*
L
,
card
*
scard
,
int32
findex
,
uint32
lv
,
int32
maxc
,
group
*
mg
)
{
void
field
::
get_xyz_material
(
lua_State
*
L
,
card
*
scard
,
int32
findex
,
uint32
lv
,
int32
maxc
,
group
*
mg
)
{
core
.
xmaterial_lst
.
clear
();
core
.
xmaterial_lst
.
clear
();
...
@@ -2144,6 +2150,8 @@ int32 field::adjust_grant_effect() {
...
@@ -2144,6 +2150,8 @@ int32 field::adjust_grant_effect() {
effect
*
geffect
=
(
effect
*
)
peffect
->
get_label_object
();
effect
*
geffect
=
(
effect
*
)
peffect
->
get_label_object
();
if
(
geffect
->
type
&
EFFECT_TYPE_GRANT
)
if
(
geffect
->
type
&
EFFECT_TYPE_GRANT
)
continue
;
continue
;
if
(
geffect
->
code
==
EFFECT_UNIQUE_CHECK
)
continue
;
card_set
cset
;
card_set
cset
;
if
(
peffect
->
is_available
())
if
(
peffect
->
is_available
())
filter_affected_cards
(
peffect
,
&
cset
);
filter_affected_cards
(
peffect
,
&
cset
);
...
@@ -2158,9 +2166,6 @@ int32 field::adjust_grant_effect() {
...
@@ -2158,9 +2166,6 @@ int32 field::adjust_grant_effect() {
if
(
!
pcard
->
is_affect_by_effect
(
peffect
)
||
!
cset
.
count
(
pcard
))
if
(
!
pcard
->
is_affect_by_effect
(
peffect
)
||
!
cset
.
count
(
pcard
))
remove_set
.
insert
(
pcard
);
remove_set
.
insert
(
pcard
);
}
}
//X gains an effect from itself will break card::remove_effect
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
))
add_set
.
erase
(
peffect
->
handler
);
for
(
auto
&
pcard
:
add_set
)
{
for
(
auto
&
pcard
:
add_set
)
{
effect
*
ceffect
=
geffect
->
clone
();
effect
*
ceffect
=
geffect
->
clone
();
ceffect
->
owner
=
pcard
;
ceffect
->
owner
=
pcard
;
...
...
field.h
View file @
1e5f5097
...
@@ -126,10 +126,10 @@ struct field_effect {
...
@@ -126,10 +126,10 @@ struct field_effect {
};
};
struct
field_info
{
struct
field_info
{
int32
field_id
{
1
};
int32
field_id
{
1
};
int16
copy_id
{
1
};
u
int16
copy_id
{
1
};
int16
turn_id
{};
u
int16
turn_id
{};
int16
turn_id_by_player
[
2
]{};
u
int16
turn_id_by_player
[
2
]{};
int16
card_id
{
1
};
u
int16
card_id
{
1
};
uint16
phase
{};
uint16
phase
{};
uint8
turn_player
{};
uint8
turn_player
{};
uint8
priorities
[
2
]{};
uint8
priorities
[
2
]{};
...
@@ -390,7 +390,9 @@ public:
...
@@ -390,7 +390,9 @@ public:
void
swap_card
(
card
*
pcard1
,
card
*
pcard2
,
uint8
new_sequence1
,
uint8
new_sequence2
);
void
swap_card
(
card
*
pcard1
,
card
*
pcard2
,
uint8
new_sequence1
,
uint8
new_sequence2
);
void
swap_card
(
card
*
pcard1
,
card
*
pcard2
);
void
swap_card
(
card
*
pcard1
,
card
*
pcard2
);
void
set_control
(
card
*
pcard
,
uint8
playerid
,
uint16
reset_phase
,
uint8
reset_count
);
void
set_control
(
card
*
pcard
,
uint8
playerid
,
uint16
reset_phase
,
uint8
reset_count
);
card
*
get_field_card
(
uint8
playerid
,
uint32
general_location
,
uint8
sequence
);
int32
get_pzone_sequence
(
uint8
pseq
)
const
;
card
*
get_field_card
(
uint8
playerid
,
uint32
general_location
,
uint8
sequence
)
const
;
int32
is_location_useable
(
uint8
playerid
,
uint32
general_location
,
uint8
sequence
)
const
;
int32
is_location_useable
(
uint8
playerid
,
uint32
general_location
,
uint8
sequence
)
const
;
int32
get_useable_count
(
card
*
pcard
,
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
=
0xff
,
uint32
*
list
=
nullptr
);
int32
get_useable_count
(
card
*
pcard
,
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
=
0xff
,
uint32
*
list
=
nullptr
);
int32
get_useable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
=
0xff
,
uint32
*
list
=
nullptr
);
int32
get_useable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
=
0xff
,
uint32
*
list
=
nullptr
);
...
@@ -441,7 +443,7 @@ public:
...
@@ -441,7 +443,7 @@ public:
int32
get_draw_count
(
uint8
playerid
);
int32
get_draw_count
(
uint8
playerid
);
void
get_ritual_material
(
uint8
playerid
,
effect
*
peffect
,
card_set
*
material
,
uint8
no_level
=
FALSE
);
void
get_ritual_material
(
uint8
playerid
,
effect
*
peffect
,
card_set
*
material
,
uint8
no_level
=
FALSE
);
void
get_fusion_material
(
uint8
playerid
,
card_set
*
material_all
,
card_set
*
material_base
,
uint32
location
);
void
get_fusion_material
(
uint8
playerid
,
card_set
*
material_all
,
card_set
*
material_base
,
uint32
location
);
void
ritual_release
(
c
ard_set
*
material
);
void
ritual_release
(
c
onst
card_set
&
material
);
void
get_xyz_material
(
lua_State
*
L
,
card
*
scard
,
int32
findex
,
uint32
lv
,
int32
maxc
,
group
*
mg
);
void
get_xyz_material
(
lua_State
*
L
,
card
*
scard
,
int32
findex
,
uint32
lv
,
int32
maxc
,
group
*
mg
);
void
get_overlay_group
(
uint8
self
,
uint8
s
,
uint8
o
,
card_set
*
pset
);
void
get_overlay_group
(
uint8
self
,
uint8
s
,
uint8
o
,
card_set
*
pset
);
int32
get_overlay_count
(
uint8
self
,
uint8
s
,
uint8
o
);
int32
get_overlay_count
(
uint8
self
,
uint8
s
,
uint8
o
);
...
@@ -527,7 +529,7 @@ public:
...
@@ -527,7 +529,7 @@ public:
int32
execute_operation
(
uint16
step
,
effect
*
peffect
,
uint8
triggering_player
);
int32
execute_operation
(
uint16
step
,
effect
*
peffect
,
uint8
triggering_player
);
int32
execute_target
(
uint16
step
,
effect
*
peffect
,
uint8
triggering_player
);
int32
execute_target
(
uint16
step
,
effect
*
peffect
,
uint8
triggering_player
);
void
raise_event
(
card
*
event_card
,
uint32
event_code
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
event_player
,
uint32
event_value
);
void
raise_event
(
card
*
event_card
,
uint32
event_code
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
event_player
,
uint32
event_value
);
void
raise_event
(
c
ard_set
*
event_cards
,
uint32
event_code
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
event_player
,
uint32
event_value
);
void
raise_event
(
c
onst
card_set
&
event_cards
,
uint32
event_code
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
event_player
,
uint32
event_value
);
void
raise_single_event
(
card
*
trigger_card
,
card_set
*
event_cards
,
uint32
event_code
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
event_player
,
uint32
event_value
);
void
raise_single_event
(
card
*
trigger_card
,
card_set
*
event_cards
,
uint32
event_code
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
event_player
,
uint32
event_value
);
int32
check_event
(
uint32
code
,
tevent
*
pe
=
nullptr
);
int32
check_event
(
uint32
code
,
tevent
*
pe
=
nullptr
);
int32
check_event_c
(
effect
*
peffect
,
uint8
playerid
,
int32
neglect_con
,
int32
neglect_cost
,
int32
copy_info
,
tevent
*
pe
=
nullptr
);
int32
check_event_c
(
effect
*
peffect
,
uint8
playerid
,
int32
neglect_con
,
int32
neglect_cost
,
int32
copy_info
,
tevent
*
pe
=
nullptr
);
...
@@ -564,9 +566,9 @@ public:
...
@@ -564,9 +566,9 @@ public:
void
change_target_param
(
uint8
chaincount
,
int32
param
);
void
change_target_param
(
uint8
chaincount
,
int32
param
);
void
remove_counter
(
uint32
reason
,
card
*
pcard
,
uint32
rplayer
,
uint32
s
,
uint32
o
,
uint32
countertype
,
uint32
count
);
void
remove_counter
(
uint32
reason
,
card
*
pcard
,
uint32
rplayer
,
uint32
s
,
uint32
o
,
uint32
countertype
,
uint32
count
);
void
remove_overlay_card
(
uint32
reason
,
card
*
pcard
,
uint32
rplayer
,
uint32
s
,
uint32
o
,
uint16
min
,
uint16
max
);
void
remove_overlay_card
(
uint32
reason
,
card
*
pcard
,
uint32
rplayer
,
uint32
s
,
uint32
o
,
uint16
min
,
uint16
max
);
void
get_control
(
c
ard_set
*
targets
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
playerid
,
uint32
reset_phase
,
uint32
reset_count
,
uint32
zone
);
void
get_control
(
c
onst
card_set
&
targets
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
playerid
,
uint32
reset_phase
,
uint32
reset_count
,
uint32
zone
);
void
get_control
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
playerid
,
uint32
reset_phase
,
uint32
reset_count
,
uint32
zone
);
void
get_control
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
playerid
,
uint32
reset_phase
,
uint32
reset_count
,
uint32
zone
);
void
swap_control
(
effect
*
reason_effect
,
uint32
reason_player
,
c
ard_set
*
targets1
,
card_set
*
targets2
,
uint32
reset_phase
,
uint32
reset_count
);
void
swap_control
(
effect
*
reason_effect
,
uint32
reason_player
,
c
onst
card_set
&
targets1
,
const
card_set
&
targets2
,
uint32
reset_phase
,
uint32
reset_count
);
void
swap_control
(
effect
*
reason_effect
,
uint32
reason_player
,
card
*
pcard1
,
card
*
pcard2
,
uint32
reset_phase
,
uint32
reset_count
);
void
swap_control
(
effect
*
reason_effect
,
uint32
reason_player
,
card
*
pcard1
,
card
*
pcard2
,
uint32
reset_phase
,
uint32
reset_count
);
void
equip
(
uint32
equip_player
,
card
*
equip_card
,
card
*
target
,
uint32
up
,
uint32
is_step
);
void
equip
(
uint32
equip_player
,
card
*
equip_card
,
card
*
target
,
uint32
up
,
uint32
is_step
);
void
draw
(
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
int32
count
);
void
draw
(
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
int32
count
);
...
@@ -575,17 +577,17 @@ public:
...
@@ -575,17 +577,17 @@ public:
void
summon
(
uint32
sumplayer
,
card
*
target
,
effect
*
proc
,
uint32
ignore_count
,
uint32
min_tribute
,
uint32
zone
=
0x1f
,
uint32
action_type
=
SUMMON_IN_IDLE
);
void
summon
(
uint32
sumplayer
,
card
*
target
,
effect
*
proc
,
uint32
ignore_count
,
uint32
min_tribute
,
uint32
zone
=
0x1f
,
uint32
action_type
=
SUMMON_IN_IDLE
);
void
mset
(
uint32
setplayer
,
card
*
target
,
effect
*
proc
,
uint32
ignore_count
,
uint32
min_tribute
,
uint32
zone
=
0x1f
,
uint32
action_type
=
SUMMON_IN_IDLE
);
void
mset
(
uint32
setplayer
,
card
*
target
,
effect
*
proc
,
uint32
ignore_count
,
uint32
min_tribute
,
uint32
zone
=
0x1f
,
uint32
action_type
=
SUMMON_IN_IDLE
);
void
special_summon_rule
(
uint32
sumplayer
,
card
*
target
,
uint32
summon_type
,
uint32
action_type
=
SUMMON_IN_IDLE
);
void
special_summon_rule
(
uint32
sumplayer
,
card
*
target
,
uint32
summon_type
,
uint32
action_type
=
SUMMON_IN_IDLE
);
void
special_summon
(
c
ard_set
*
target
,
uint32
sumtype
,
uint32
sumplayer
,
uint32
playerid
,
uint32
nocheck
,
uint32
nolimit
,
uint32
positions
,
uint32
zone
);
void
special_summon
(
c
onst
card_set
&
target
,
uint32
sumtype
,
uint32
sumplayer
,
uint32
playerid
,
uint32
nocheck
,
uint32
nolimit
,
uint32
positions
,
uint32
zone
);
void
special_summon_step
(
card
*
target
,
uint32
sumtype
,
uint32
sumplayer
,
uint32
playerid
,
uint32
nocheck
,
uint32
nolimit
,
uint32
positions
,
uint32
zone
);
void
special_summon_step
(
card
*
target
,
uint32
sumtype
,
uint32
sumplayer
,
uint32
playerid
,
uint32
nocheck
,
uint32
nolimit
,
uint32
positions
,
uint32
zone
);
void
special_summon_complete
(
effect
*
reason_effect
,
uint8
reason_player
);
void
special_summon_complete
(
effect
*
reason_effect
,
uint8
reason_player
);
void
destroy
(
card_set
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
=
2
,
uint32
destination
=
0
,
uint32
sequence
=
0
);
void
destroy
(
card_set
&
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
=
2
,
uint32
destination
=
0
,
uint32
sequence
=
0
);
void
destroy
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
=
2
,
uint32
destination
=
0
,
uint32
sequence
=
0
);
void
destroy
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
=
2
,
uint32
destination
=
0
,
uint32
sequence
=
0
);
void
release
(
c
ard_set
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
);
void
release
(
c
onst
card_set
&
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
);
void
release
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
);
void
release
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
);
void
send_to
(
c
ard_set
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
destination
,
uint32
sequence
,
uint32
position
,
uint8
send_activating
=
FALSE
);
void
send_to
(
c
onst
card_set
&
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
destination
,
uint32
sequence
,
uint32
position
,
uint8
send_activating
=
FALSE
);
void
send_to
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
destination
,
uint32
sequence
,
uint32
position
,
uint8
send_activating
=
FALSE
);
void
send_to
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
destination
,
uint32
sequence
,
uint32
position
,
uint8
send_activating
=
FALSE
);
void
move_to_field
(
card
*
target
,
uint32
move_player
,
uint32
playerid
,
uint32
destination
,
uint32
positions
,
uint32
enable
=
FALSE
,
uint32
ret
=
0
,
uint32
pzone
=
FALSE
,
uint32
zone
=
0xff
);
void
move_to_field
(
card
*
target
,
uint32
move_player
,
uint32
playerid
,
uint32
destination
,
uint32
positions
,
uint32
enable
=
FALSE
,
uint32
ret
=
0
,
uint32
pzone
=
FALSE
,
uint32
zone
=
0xff
);
void
change_position
(
c
ard_set
*
targets
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
au
,
uint32
ad
,
uint32
du
,
uint32
dd
,
uint32
flag
,
uint32
enable
=
FALSE
);
void
change_position
(
c
onst
card_set
&
targets
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
au
,
uint32
ad
,
uint32
du
,
uint32
dd
,
uint32
flag
,
uint32
enable
=
FALSE
);
void
change_position
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
npos
,
uint32
flag
,
uint32
enable
=
FALSE
);
void
change_position
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
npos
,
uint32
flag
,
uint32
enable
=
FALSE
);
void
operation_replace
(
int32
type
,
int32
step
,
group
*
targets
);
void
operation_replace
(
int32
type
,
int32
step
,
group
*
targets
);
void
select_tribute_cards
(
card
*
target
,
uint8
playerid
,
uint8
cancelable
,
int32
min
,
int32
max
,
uint8
toplayer
,
uint32
zone
);
void
select_tribute_cards
(
card
*
target
,
uint8
playerid
,
uint8
cancelable
,
int32
min
,
int32
max
,
uint8
toplayer
,
uint32
zone
);
...
@@ -629,7 +631,7 @@ public:
...
@@ -629,7 +631,7 @@ public:
int32
toss_dice
(
uint16
step
,
effect
*
reason_effect
,
uint8
reason_player
,
uint8
playerid
,
uint8
count1
,
uint8
count2
);
int32
toss_dice
(
uint16
step
,
effect
*
reason_effect
,
uint8
reason_player
,
uint8
playerid
,
uint8
count1
,
uint8
count2
);
int32
rock_paper_scissors
(
uint16
step
,
uint8
repeat
);
int32
rock_paper_scissors
(
uint16
step
,
uint8
repeat
);
bool
check_response
(
int32
vector_size
,
int32
min_len
,
int32
max_len
)
const
;
bool
check_response
(
size_t
vector_size
,
int32
min_len
,
int32
max_len
)
const
;
int32
select_battle_command
(
uint16
step
,
uint8
playerid
);
int32
select_battle_command
(
uint16
step
,
uint8
playerid
);
int32
select_idle_command
(
uint16
step
,
uint8
playerid
);
int32
select_idle_command
(
uint16
step
,
uint8
playerid
);
int32
select_effect_yes_no
(
uint16
step
,
uint8
playerid
,
uint32
description
,
card
*
pcard
);
int32
select_effect_yes_no
(
uint16
step
,
uint8
playerid
,
uint32
description
,
card
*
pcard
);
...
...
libcard.cpp
View file @
1e5f5097
...
@@ -524,10 +524,14 @@ int32 scriptlib::card_get_current_scale(lua_State *L) {
...
@@ -524,10 +524,14 @@ int32 scriptlib::card_get_current_scale(lua_State *L) {
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
if
(
pcard
->
current
.
pzone
&&
pcard
->
current
.
sequence
==
(
pcard
->
pduel
->
game_field
->
core
.
duel_rule
>=
NEW_MASTER_RULE
?
0
:
6
))
if
(
pcard
->
current
.
pzone
)
{
lua_pushinteger
(
L
,
pcard
->
get_lscale
());
if
(
pcard
->
current
.
sequence
==
pcard
->
pduel
->
game_field
->
get_pzone_sequence
(
0
))
lua_pushinteger
(
L
,
pcard
->
get_lscale
());
else
lua_pushinteger
(
L
,
pcard
->
get_rscale
());
}
else
else
lua_pushinteger
(
L
,
pcard
->
get_rscale
()
);
lua_pushinteger
(
L
,
pcard
->
data
.
lscale
);
return
1
;
return
1
;
}
}
int32
scriptlib
::
card_is_link_marker
(
lua_State
*
L
)
{
int32
scriptlib
::
card_is_link_marker
(
lua_State
*
L
)
{
...
@@ -2020,10 +2024,10 @@ int32 scriptlib::card_register_flag_effect(lua_State *L) {
...
@@ -2020,10 +2024,10 @@ int32 scriptlib::card_register_flag_effect(lua_State *L) {
int32
reset
=
(
int32
)
lua_tointeger
(
L
,
3
);
int32
reset
=
(
int32
)
lua_tointeger
(
L
,
3
);
uint32
flag
=
(
uint32
)
lua_tointeger
(
L
,
4
);
uint32
flag
=
(
uint32
)
lua_tointeger
(
L
,
4
);
int32
count
=
(
int32
)
lua_tointeger
(
L
,
5
);
int32
count
=
(
int32
)
lua_tointeger
(
L
,
5
);
int32
lab
=
0
;
lua_Integer
lab
=
0
;
int32
desc
=
0
;
int32
desc
=
0
;
if
(
lua_gettop
(
L
)
>=
6
)
if
(
lua_gettop
(
L
)
>=
6
)
lab
=
(
int32
)
lua_tointeger
(
L
,
6
);
lab
=
lua_tointeger
(
L
,
6
);
if
(
lua_gettop
(
L
)
>=
7
)
if
(
lua_gettop
(
L
)
>=
7
)
desc
=
(
int32
)
lua_tointeger
(
L
,
7
);
desc
=
(
int32
)
lua_tointeger
(
L
,
7
);
if
(
count
==
0
)
if
(
count
==
0
)
...
@@ -2067,7 +2071,7 @@ int32 scriptlib::card_set_flag_effect_label(lua_State *L) {
...
@@ -2067,7 +2071,7 @@ int32 scriptlib::card_set_flag_effect_label(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
(
lua_tointeger
(
L
,
2
)
&
MAX_CARD_ID
)
|
EFFECT_FLAG_EFFECT
;
uint32
code
=
(
lua_tointeger
(
L
,
2
)
&
MAX_CARD_ID
)
|
EFFECT_FLAG_EFFECT
;
int32
lab
=
(
int32
)
lua_tointeger
(
L
,
3
);
auto
lab
=
lua_tointeger
(
L
,
3
);
auto
eit
=
pcard
->
single_effect
.
find
(
code
);
auto
eit
=
pcard
->
single_effect
.
find
(
code
);
if
(
eit
==
pcard
->
single_effect
.
end
())
if
(
eit
==
pcard
->
single_effect
.
end
())
lua_pushboolean
(
L
,
FALSE
);
lua_pushboolean
(
L
,
FALSE
);
...
...
libdebug.cpp
View file @
1e5f5097
...
@@ -49,7 +49,7 @@ int32 scriptlib::debug_add_card(lua_State *L) {
...
@@ -49,7 +49,7 @@ int32 scriptlib::debug_add_card(lua_State *L) {
position
=
POS_FACEDOWN_DEFENSE
;
position
=
POS_FACEDOWN_DEFENSE
;
pcard
->
sendto_param
.
position
=
position
;
pcard
->
sendto_param
.
position
=
position
;
if
(
location
==
LOCATION_PZONE
)
{
if
(
location
==
LOCATION_PZONE
)
{
int32
seq
=
pduel
->
game_field
->
core
.
duel_rule
>=
NEW_MASTER_RULE
?
sequence
*
4
:
sequence
+
6
;
int32
seq
=
pduel
->
game_field
->
get_pzone_sequence
(
sequence
)
;
pduel
->
game_field
->
add_card
(
playerid
,
pcard
,
LOCATION_SZONE
,
seq
,
TRUE
);
pduel
->
game_field
->
add_card
(
playerid
,
pcard
,
LOCATION_SZONE
,
seq
,
TRUE
);
}
else
{
}
else
{
pduel
->
game_field
->
add_card
(
playerid
,
pcard
,
location
,
sequence
);
pduel
->
game_field
->
add_card
(
playerid
,
pcard
,
location
,
sequence
);
...
...
libduel.cpp
View file @
1e5f5097
This diff is collapsed.
Click to expand it.
libeffect.cpp
View file @
1e5f5097
...
@@ -66,7 +66,7 @@ int32 scriptlib::get_effect_property(lua_State* L, effect_member type) {
...
@@ -66,7 +66,7 @@ int32 scriptlib::get_effect_property(lua_State* L, effect_member type) {
lua_pushinteger
(
L
,
value
);
lua_pushinteger
(
L
,
value
);
return
1
;
return
1
;
}
}
int32
scriptlib
::
is_effect_property
(
lua_State
*
L
,
effect_member
type
)
{
int32
scriptlib
::
is_effect_
has_
property
(
lua_State
*
L
,
effect_member
type
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
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
);
...
@@ -76,9 +76,6 @@ int32 scriptlib::is_effect_property(lua_State* L, effect_member type) {
...
@@ -76,9 +76,6 @@ int32 scriptlib::is_effect_property(lua_State* L, effect_member type) {
case
MEMBER_CATEGORY
:
case
MEMBER_CATEGORY
:
value
=
peffect
->
category
;
value
=
peffect
->
category
;
break
;
break
;
case
MEMBER_CODE
:
value
=
peffect
->
code
;
break
;
case
MEMBER_RANGE
:
case
MEMBER_RANGE
:
value
=
peffect
->
range
;
value
=
peffect
->
range
;
break
;
break
;
...
@@ -265,8 +262,7 @@ int32 scriptlib::effect_set_label(lua_State *L) {
...
@@ -265,8 +262,7 @@ int32 scriptlib::effect_set_label(lua_State *L) {
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
peffect
->
label
.
clear
();
peffect
->
label
.
clear
();
for
(
int32
i
=
2
;
i
<=
lua_gettop
(
L
);
++
i
)
{
for
(
int32
i
=
2
;
i
<=
lua_gettop
(
L
);
++
i
)
{
uint32
v
=
(
uint32
)
lua_tointeger
(
L
,
i
);
peffect
->
label
.
push_back
(
lua_tointeger
(
L
,
i
));
peffect
->
label
.
push_back
(
v
);
}
}
return
0
;
return
0
;
}
}
...
@@ -534,8 +530,8 @@ int32 scriptlib::effect_is_has_property(lua_State *L) {
...
@@ -534,8 +530,8 @@ int32 scriptlib::effect_is_has_property(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
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
);
uint
32
tflag1
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint
64
tflag1
=
lua_tointeger
(
L
,
2
);
uint
32
tflag2
=
(
uint32
)
lua_tointeger
(
L
,
3
);
uint
64
tflag2
=
lua_tointeger
(
L
,
3
);
if
(
peffect
&&
(
!
tflag1
||
(
peffect
->
flag
[
0
]
&
tflag1
))
&&
(
!
tflag2
||
(
peffect
->
flag
[
1
]
&
tflag2
)))
if
(
peffect
&&
(
!
tflag1
||
(
peffect
->
flag
[
0
]
&
tflag1
))
&&
(
!
tflag2
||
(
peffect
->
flag
[
1
]
&
tflag2
)))
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -543,13 +539,13 @@ int32 scriptlib::effect_is_has_property(lua_State *L) {
...
@@ -543,13 +539,13 @@ int32 scriptlib::effect_is_has_property(lua_State *L) {
return
1
;
return
1
;
}
}
int32
scriptlib
::
effect_is_has_category
(
lua_State
*
L
)
{
int32
scriptlib
::
effect_is_has_category
(
lua_State
*
L
)
{
return
is_effect_property
(
L
,
MEMBER_CATEGORY
);
return
is_effect_
has_
property
(
L
,
MEMBER_CATEGORY
);
}
}
int32
scriptlib
::
effect_is_has_type
(
lua_State
*
L
)
{
int32
scriptlib
::
effect_is_has_type
(
lua_State
*
L
)
{
return
is_effect_property
(
L
,
MEMBER_TYPE
);
return
is_effect_
has_
property
(
L
,
MEMBER_TYPE
);
}
}
int32
scriptlib
::
effect_is_has_range
(
lua_State
*
L
)
{
int32
scriptlib
::
effect_is_has_range
(
lua_State
*
L
)
{
return
is_effect_property
(
L
,
MEMBER_RANGE
);
return
is_effect_
has_
property
(
L
,
MEMBER_RANGE
);
}
}
int32
scriptlib
::
effect_is_activatable
(
lua_State
*
L
)
{
int32
scriptlib
::
effect_is_activatable
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
...
...
operations.cpp
View file @
1e5f5097
This diff is collapsed.
Click to expand it.
playerop.cpp
View file @
1e5f5097
...
@@ -14,14 +14,14 @@
...
@@ -14,14 +14,14 @@
#include <algorithm>
#include <algorithm>
#include <stack>
#include <stack>
bool
field
::
check_response
(
int32
vector_size
,
int32
min_len
,
int32
max_len
)
const
{
bool
field
::
check_response
(
size_t
vector_size
,
int32
min_len
,
int32
max_len
)
const
{
const
int32
len
=
returns
.
bvalue
[
0
];
const
int32
len
=
returns
.
bvalue
[
0
];
if
(
len
<
min_len
||
len
>
max_len
)
if
(
len
<
min_len
||
len
>
max_len
)
return
false
;
return
false
;
std
::
set
<
uint8
>
index_set
;
std
::
set
<
uint8
>
index_set
;
for
(
int32
i
=
0
;
i
<
len
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
len
;
++
i
)
{
uint8
index
=
returns
.
bvalue
[
1
+
i
];
uint8
index
=
returns
.
bvalue
[
1
+
i
];
if
(
index
>=
vector_size
||
index_set
.
count
(
index
))
{
if
(
index
>=
(
int32
)
vector_size
||
index_set
.
count
(
index
))
{
return
false
;
return
false
;
}
}
index_set
.
insert
(
index
);
index_set
.
insert
(
index
);
...
@@ -787,7 +787,7 @@ int32 field::sort_card(int16 step, uint8 playerid) {
...
@@ -787,7 +787,7 @@ int32 field::sort_card(int16 step, uint8 playerid) {
int32
field
::
announce_race
(
int16
step
,
uint8
playerid
,
int32
count
,
int32
available
)
{
int32
field
::
announce_race
(
int16
step
,
uint8
playerid
,
int32
count
,
int32
available
)
{
if
(
step
==
0
)
{
if
(
step
==
0
)
{
int32
scount
=
0
;
int32
scount
=
0
;
for
(
int32
ft
=
0x1
;
ft
<
(
1
<<
RACES_COUNT
);
ft
<<=
1
)
{
for
(
uint32
ft
=
0x1
;
ft
<
(
0x1U
<<
RACES_COUNT
);
ft
<<=
1
)
{
if
(
ft
&
available
)
if
(
ft
&
available
)
++
scount
;
++
scount
;
}
}
...
@@ -803,8 +803,9 @@ int32 field::announce_race(int16 step, uint8 playerid, int32 count, int32 availa
...
@@ -803,8 +803,9 @@ int32 field::announce_race(int16 step, uint8 playerid, int32 count, int32 availa
}
else
{
}
else
{
int32
rc
=
returns
.
ivalue
[
0
];
int32
rc
=
returns
.
ivalue
[
0
];
int32
sel
=
0
;
int32
sel
=
0
;
for
(
int32
ft
=
0x1
;
ft
<
(
1
<<
RACES_COUNT
);
ft
<<=
1
)
{
for
(
uint32
ft
=
0x1
;
ft
<
(
0x1U
<<
RACES_COUNT
);
ft
<<=
1
)
{
if
(
!
(
ft
&
rc
))
continue
;
if
(
!
(
ft
&
rc
))
continue
;
if
(
!
(
ft
&
available
))
{
if
(
!
(
ft
&
available
))
{
pduel
->
write_buffer8
(
MSG_RETRY
);
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
return
FALSE
;
...
...
premake/dll.lua
View file @
1e5f5097
...
@@ -37,7 +37,7 @@ workspace "ocgcoredll"
...
@@ -37,7 +37,7 @@ workspace "ocgcoredll"
filter
{
"configurations:Release"
,
"action:vs*"
}
filter
{
"configurations:Release"
,
"action:vs*"
}
flags
{
"LinkTimeOptimization"
}
flags
{
"LinkTimeOptimization"
}
staticruntime
"On"
staticruntime
"On"
disablewarnings
{
"4
267"
,
"4
334"
}
disablewarnings
{
"4334"
}
filter
"action:vs*"
filter
"action:vs*"
buildoptions
{
"/utf-8"
}
buildoptions
{
"/utf-8"
}
...
...
processor.cpp
View file @
1e5f5097
This diff is collapsed.
Click to expand it.
scriptlib.h
View file @
1e5f5097
...
@@ -333,7 +333,7 @@ public:
...
@@ -333,7 +333,7 @@ public:
//Effect functions
//Effect functions
static
int32
get_effect_property
(
lua_State
*
L
,
effect_member
type
);
static
int32
get_effect_property
(
lua_State
*
L
,
effect_member
type
);
static
int32
is_effect_property
(
lua_State
*
L
,
effect_member
type
);
static
int32
is_effect_
has_
property
(
lua_State
*
L
,
effect_member
type
);
static
int32
effect_new
(
lua_State
*
L
);
static
int32
effect_new
(
lua_State
*
L
);
static
int32
effect_newex
(
lua_State
*
L
);
static
int32
effect_newex
(
lua_State
*
L
);
static
int32
effect_clone
(
lua_State
*
L
);
static
int32
effect_clone
(
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