Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
fallenstardust
YGOMobile
Commits
44d3217c
Commit
44d3217c
authored
Aug 23, 2018
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
7a29b16e
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
139 additions
and
325 deletions
+139
-325
Classes/ocgcore/card.cpp
Classes/ocgcore/card.cpp
+9
-0
Classes/ocgcore/card.h
Classes/ocgcore/card.h
+2
-0
Classes/ocgcore/effect.cpp
Classes/ocgcore/effect.cpp
+11
-12
Classes/ocgcore/field.cpp
Classes/ocgcore/field.cpp
+64
-226
Classes/ocgcore/field.h
Classes/ocgcore/field.h
+1
-1
Classes/ocgcore/libcard.cpp
Classes/ocgcore/libcard.cpp
+5
-5
Classes/ocgcore/libduel.cpp
Classes/ocgcore/libduel.cpp
+15
-10
Classes/ocgcore/processor.cpp
Classes/ocgcore/processor.cpp
+32
-71
No files found.
Classes/ocgcore/card.cpp
View file @
44d3217c
...
@@ -60,6 +60,14 @@ void card::attacker_map::addcard(card* pcard) {
...
@@ -60,6 +60,14 @@ void card::attacker_map::addcard(card* pcard) {
auto
pr
=
emplace
(
fid
,
std
::
make_pair
(
pcard
,
0
));
auto
pr
=
emplace
(
fid
,
std
::
make_pair
(
pcard
,
0
));
pr
.
first
->
second
.
second
++
;
pr
.
first
->
second
.
second
++
;
}
}
uint32
card
::
attacker_map
::
findcard
(
card
*
pcard
)
{
uint16
fid
=
pcard
?
pcard
->
fieldid_r
:
0
;
auto
it
=
find
(
fid
);
if
(
it
==
end
())
return
0
;
else
return
it
->
second
.
second
;
}
void
card_data
::
clear
()
{
void
card_data
::
clear
()
{
std
::
memset
(
this
,
0
,
sizeof
(
card_data
));
std
::
memset
(
this
,
0
,
sizeof
(
card_data
));
}
}
...
@@ -1961,6 +1969,7 @@ void card::reset(uint32 id, uint32 reset_type) {
...
@@ -1961,6 +1969,7 @@ void card::reset(uint32 id, uint32 reset_type) {
indestructable_effects
.
clear
();
indestructable_effects
.
clear
();
announced_cards
.
clear
();
announced_cards
.
clear
();
attacked_cards
.
clear
();
attacked_cards
.
clear
();
attack_announce_count
=
0
;
announce_count
=
0
;
announce_count
=
0
;
attacked_count
=
0
;
attacked_count
=
0
;
attack_all_target
=
TRUE
;
attack_all_target
=
TRUE
;
...
...
Classes/ocgcore/card.h
View file @
44d3217c
...
@@ -105,6 +105,7 @@ public:
...
@@ -105,6 +105,7 @@ public:
class
attacker_map
:
public
std
::
unordered_map
<
uint16
,
std
::
pair
<
card
*
,
uint32
>
>
{
class
attacker_map
:
public
std
::
unordered_map
<
uint16
,
std
::
pair
<
card
*
,
uint32
>
>
{
public:
public:
void
addcard
(
card
*
pcard
);
void
addcard
(
card
*
pcard
);
uint32
findcard
(
card
*
pcard
);
};
};
struct
sendto_param_t
{
struct
sendto_param_t
{
void
set
(
uint8
p
,
uint8
pos
,
uint8
loc
,
uint8
seq
=
0
)
{
void
set
(
uint8
p
,
uint8
pos
,
uint8
loc
,
uint8
seq
=
0
)
{
...
@@ -141,6 +142,7 @@ public:
...
@@ -141,6 +142,7 @@ public:
uint32
position_param
;
uint32
position_param
;
uint32
spsummon_param
;
uint32
spsummon_param
;
uint32
to_field_param
;
uint32
to_field_param
;
uint8
attack_announce_count
;
uint8
direct_attackable
;
uint8
direct_attackable
;
uint8
announce_count
;
uint8
announce_count
;
uint8
attacked_count
;
uint8
attacked_count
;
...
...
Classes/ocgcore/effect.cpp
View file @
44d3217c
...
@@ -191,18 +191,7 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
...
@@ -191,18 +191,7 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
&&
!
pduel
->
game_field
->
get_cteffect
(
this
,
playerid
,
FALSE
))
&&
!
pduel
->
game_field
->
get_cteffect
(
this
,
playerid
,
FALSE
))
return
FALSE
;
return
FALSE
;
}
}
// additional check for each location
if
(
handler
->
current
.
location
==
LOCATION_SZONE
)
{
if
(
handler
->
current
.
location
==
LOCATION_HAND
)
{
if
(
handler
->
data
.
type
&
TYPE_MONSTER
)
{
if
(
!
(
handler
->
data
.
type
&
TYPE_PENDULUM
))
return
FALSE
;
if
(
!
pduel
->
game_field
->
is_location_useable
(
playerid
,
LOCATION_PZONE
,
0
)
&&
!
pduel
->
game_field
->
is_location_useable
(
playerid
,
LOCATION_PZONE
,
1
))
return
FALSE
;
}
else
if
(
!
(
handler
->
data
.
type
&
TYPE_FIELD
)
&&
pduel
->
game_field
->
get_useable_count
(
handler
,
playerid
,
LOCATION_SZONE
,
playerid
,
LOCATION_REASON_TOFIELD
)
<=
0
)
return
FALSE
;
}
else
if
(
handler
->
current
.
location
==
LOCATION_SZONE
)
{
if
(
handler
->
is_position
(
POS_FACEUP
))
if
(
handler
->
is_position
(
POS_FACEUP
))
return
FALSE
;
return
FALSE
;
if
(
handler
->
equiping_target
)
if
(
handler
->
equiping_target
)
...
@@ -211,6 +200,16 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
...
@@ -211,6 +200,16 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
if
((
handler
->
data
.
type
&
TYPE_SPELL
)
&&
(
handler
->
data
.
type
&
TYPE_QUICKPLAY
))
if
((
handler
->
data
.
type
&
TYPE_SPELL
)
&&
(
handler
->
data
.
type
&
TYPE_QUICKPLAY
))
return
FALSE
;
return
FALSE
;
}
}
}
else
{
if
(
handler
->
data
.
type
&
TYPE_MONSTER
)
{
if
(
!
(
handler
->
data
.
type
&
TYPE_PENDULUM
))
return
FALSE
;
if
(
!
pduel
->
game_field
->
is_location_useable
(
playerid
,
LOCATION_PZONE
,
0
)
&&
!
pduel
->
game_field
->
is_location_useable
(
playerid
,
LOCATION_PZONE
,
1
))
return
FALSE
;
}
else
if
(
!
(
handler
->
data
.
type
&
TYPE_FIELD
)
&&
pduel
->
game_field
->
get_useable_count
(
handler
,
playerid
,
LOCATION_SZONE
,
playerid
,
LOCATION_REASON_TOFIELD
)
<=
0
)
return
FALSE
;
}
}
// check activate in hand/in set turn
// check activate in hand/in set turn
int32
ecode
=
0
;
int32
ecode
=
0
;
...
...
Classes/ocgcore/field.cpp
View file @
44d3217c
This diff is collapsed.
Click to expand it.
Classes/ocgcore/field.h
View file @
44d3217c
...
@@ -429,7 +429,7 @@ public:
...
@@ -429,7 +429,7 @@ public:
uint32
get_field_counter
(
uint8
self
,
uint8
s
,
uint8
o
,
uint16
countertype
);
uint32
get_field_counter
(
uint8
self
,
uint8
s
,
uint8
o
,
uint16
countertype
);
int32
effect_replace_check
(
uint32
code
,
const
tevent
&
e
);
int32
effect_replace_check
(
uint32
code
,
const
tevent
&
e
);
int32
get_attack_target
(
card
*
pcard
,
card_vector
*
v
,
uint8
chain_attack
=
FALSE
);
int32
get_attack_target
(
card
*
pcard
,
card_vector
*
v
,
uint8
chain_attack
=
FALSE
,
bool
select_target
=
true
);
bool
confirm_attack_target
();
bool
confirm_attack_target
();
void
attack_all_target_check
();
void
attack_all_target_check
();
int32
check_synchro_material
(
card
*
pcard
,
int32
findex1
,
int32
findex2
,
int32
min
,
int32
max
,
card
*
smat
,
group
*
mg
);
int32
check_synchro_material
(
card
*
pcard
,
int32
findex1
,
int32
findex2
,
int32
min
,
int32
max
,
card
*
smat
,
group
*
mg
);
...
...
Classes/ocgcore/libcard.cpp
View file @
44d3217c
...
@@ -1318,17 +1318,17 @@ int32 scriptlib::card_get_attack_announced_count(lua_State *L) {
...
@@ -1318,17 +1318,17 @@ int32 scriptlib::card_get_attack_announced_count(lua_State *L) {
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
lua_pushinteger
(
L
,
pcard
->
announce_count
);
lua_pushinteger
(
L
,
pcard
->
a
ttack_a
nnounce_count
);
return
1
;
return
1
;
}
}
int32
scriptlib
::
card_is_direct_attacked
(
lua_State
*
L
)
{
int32
scriptlib
::
card_is_direct_attacked
(
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
);
bool
ret
=
false
;
if
(
pcard
->
attacked_cards
.
findcard
(
0
))
if
(
pcard
->
attacked_cards
.
find
(
0
)
!=
pcard
->
attacked_cards
.
end
())
lua_pushboolean
(
L
,
1
);
ret
=
true
;
else
lua_pushboolean
(
L
,
ret
);
lua_pushboolean
(
L
,
0
);
return
1
;
return
1
;
}
}
int32
scriptlib
::
card_set_card_target
(
lua_State
*
L
)
{
int32
scriptlib
::
card_set_card_target
(
lua_State
*
L
)
{
...
...
Classes/ocgcore/libduel.cpp
View file @
44d3217c
...
@@ -1414,13 +1414,15 @@ int32 scriptlib::duel_change_attacker(lua_State *L) {
...
@@ -1414,13 +1414,15 @@ int32 scriptlib::duel_change_attacker(lua_State *L) {
duel
*
pduel
=
attacker
->
pduel
;
duel
*
pduel
=
attacker
->
pduel
;
if
(
pduel
->
game_field
->
core
.
attacker
==
attacker
)
if
(
pduel
->
game_field
->
core
.
attacker
==
attacker
)
return
0
;
return
0
;
card
*
attack_target
=
pduel
->
game_field
->
core
.
attack_target
;
pduel
->
game_field
->
core
.
attacker
->
announce_count
++
;
pduel
->
game_field
->
core
.
attacker
->
announced_cards
.
addcard
(
attack_target
);
pduel
->
game_field
->
attack_all_target_check
();
pduel
->
game_field
->
core
.
attacker
=
attacker
;
pduel
->
game_field
->
core
.
attacker
=
attacker
;
attacker
->
attack_controler
=
attacker
->
current
.
controler
;
attacker
->
attack_controler
=
attacker
->
current
.
controler
;
pduel
->
game_field
->
core
.
pre_field
[
0
]
=
attacker
->
fieldid_r
;
pduel
->
game_field
->
core
.
pre_field
[
0
]
=
attacker
->
fieldid_r
;
if
(
!
ignore_count
)
{
if
(
!
ignore_count
)
{
card
*
attack_target
=
pduel
->
game_field
->
core
.
attack_target
;
attacker
->
attack_announce_count
++
;
attacker
->
announce_count
++
;
attacker
->
announced_cards
.
addcard
(
attack_target
);
if
(
pduel
->
game_field
->
infos
.
phase
==
PHASE_DAMAGE
)
{
if
(
pduel
->
game_field
->
infos
.
phase
==
PHASE_DAMAGE
)
{
attacker
->
attacked_count
++
;
attacker
->
attacked_count
++
;
attacker
->
attacked_cards
.
addcard
(
attack_target
);
attacker
->
attacked_cards
.
addcard
(
attack_target
);
...
@@ -1447,25 +1449,28 @@ int32 scriptlib::duel_change_attack_target(lua_State *L) {
...
@@ -1447,25 +1449,28 @@ int32 scriptlib::duel_change_attack_target(lua_State *L) {
}
}
field
::
card_vector
cv
;
field
::
card_vector
cv
;
pduel
->
game_field
->
get_attack_target
(
attacker
,
&
cv
,
pduel
->
game_field
->
core
.
chain_attack
);
pduel
->
game_field
->
get_attack_target
(
attacker
,
&
cv
,
pduel
->
game_field
->
core
.
chain_attack
);
auto
turnp
=
pduel
->
game_field
->
infos
.
turn_player
;
if
(
target
&&
std
::
find
(
cv
.
begin
(),
cv
.
end
(),
target
)
!=
cv
.
end
()
if
(
target
&&
std
::
find
(
cv
.
begin
(),
cv
.
end
(),
target
)
!=
cv
.
end
()
||
!
target
&&
!
attacker
->
is_affected_by_effect
(
EFFECT_CANNOT_DIRECT_ATTACK
))
{
||
!
target
&&
!
attacker
->
is_affected_by_effect
(
EFFECT_CANNOT_DIRECT_ATTACK
))
{
pduel
->
game_field
->
core
.
attack_target
=
target
;
pduel
->
game_field
->
core
.
attack_target
=
target
;
pduel
->
game_field
->
core
.
attack_rollback
=
FALSE
;
pduel
->
game_field
->
core
.
attack_rollback
=
FALSE
;
pduel
->
game_field
->
core
.
opp_mzone
.
clear
();
pduel
->
game_field
->
core
.
opp_mzone
.
clear
();
for
(
uint32
i
=
0
;
i
<
pduel
->
game_field
->
player
[
1
-
turnp
].
list_mzone
.
size
();
++
i
)
{
uint8
turnp
=
pduel
->
game_field
->
infos
.
turn_player
;
card
*
pcard
=
pduel
->
game_field
->
player
[
1
-
turnp
].
list_mzone
[
i
];
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
1
-
turnp
].
list_mzone
)
{
if
(
pcard
)
if
(
pcard
)
pduel
->
game_field
->
core
.
opp_mzone
.
insert
(
pcard
->
fieldid_r
);
pduel
->
game_field
->
core
.
opp_mzone
.
insert
(
pcard
->
fieldid_r
);
}
}
pduel
->
game_field
->
attack_all_target_check
();
pduel
->
write_buffer8
(
MSG_ATTACK
);
pduel
->
write_buffer32
(
attacker
->
get_info_location
());
if
(
target
)
{
if
(
target
)
{
pduel
->
game_field
->
raise_single_event
(
target
,
0
,
EVENT_BE_BATTLE_TARGET
,
0
,
REASON_REPLACE
,
0
,
1
-
turnp
,
0
);
pduel
->
game_field
->
raise_single_event
(
target
,
0
,
EVENT_BE_BATTLE_TARGET
,
0
,
REASON_REPLACE
,
0
,
1
-
turnp
,
0
);
pduel
->
game_field
->
raise_event
(
target
,
EVENT_BE_BATTLE_TARGET
,
0
,
REASON_REPLACE
,
0
,
1
-
turnp
,
0
);
pduel
->
game_field
->
raise_event
(
target
,
EVENT_BE_BATTLE_TARGET
,
0
,
REASON_REPLACE
,
0
,
1
-
turnp
,
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
();
}
else
pduel
->
write_buffer32
(
target
->
get_info_location
());
}
else
{
pduel
->
game_field
->
core
.
attack_player
=
TRUE
;
pduel
->
game_field
->
core
.
attack_player
=
TRUE
;
pduel
->
write_buffer32
(
0
);
}
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
}
else
}
else
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
...
@@ -1478,7 +1483,7 @@ int32 scriptlib::duel_calculate_damage(lua_State *L) {
...
@@ -1478,7 +1483,7 @@ int32 scriptlib::duel_calculate_damage(lua_State *L) {
card
*
attacker
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
attacker
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
attack_target
;
card
*
attack_target
;
if
(
lua_isnil
(
L
,
2
))
if
(
lua_isnil
(
L
,
2
))
attack_target
=
NULL
;
attack_target
=
0
;
else
{
else
{
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
attack_target
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
attack_target
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
...
...
Classes/ocgcore/processor.cpp
View file @
44d3217c
...
@@ -2784,7 +2784,6 @@ int32 field::process_idle_command(uint16 step) {
...
@@ -2784,7 +2784,6 @@ int32 field::process_idle_command(uint16 step) {
}
}
return
TRUE
;
return
TRUE
;
}
}
// core.attack_state_count: Duel.GetActivityCount()
int32
field
::
process_battle_command
(
uint16
step
)
{
int32
field
::
process_battle_command
(
uint16
step
)
{
switch
(
step
)
{
switch
(
step
)
{
case
0
:
{
case
0
:
{
...
@@ -2979,14 +2978,7 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -2979,14 +2978,7 @@ int32 field::process_battle_command(uint16 step) {
core
.
units
.
begin
()
->
step
=
5
;
core
.
units
.
begin
()
->
step
=
5
;
return
FALSE
;
return
FALSE
;
}
}
for
(
auto
cit
=
player
[
1
-
infos
.
turn_player
].
list_mzone
.
begin
();
cit
!=
player
[
1
-
infos
.
turn_player
].
list_mzone
.
end
();
++
cit
)
{
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
infos
.
turn_player
,
31
);
if
(
*
cit
)
{
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
infos
.
turn_player
,
31
);
return
FALSE
;
}
}
returns
.
ivalue
[
0
]
=
-
2
;
core
.
units
.
begin
()
->
step
=
5
;
return
FALSE
;
return
FALSE
;
}
}
// no target and not direct attackable
// no target and not direct attackable
...
@@ -3039,8 +3031,10 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -3039,8 +3031,10 @@ int32 field::process_battle_command(uint16 step) {
}
}
case
6
:
{
case
6
:
{
if
(
returns
.
ivalue
[
0
]
==
-
1
)
{
//cancel attack manually
if
(
returns
.
ivalue
[
0
]
==
-
1
)
{
//cancel attack manually
if
(
core
.
units
.
begin
()
->
arg1
)
if
(
core
.
units
.
begin
()
->
arg1
)
{
core
.
chain_attack
=
FALSE
;
core
.
units
.
begin
()
->
step
=
12
;
return
FALSE
;
}
core
.
units
.
begin
()
->
step
=
-
1
;
core
.
units
.
begin
()
->
step
=
-
1
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -3063,23 +3057,19 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -3063,23 +3057,19 @@ int32 field::process_battle_command(uint16 step) {
}
}
core
.
attack_state_count
[
infos
.
turn_player
]
++
;
core
.
attack_state_count
[
infos
.
turn_player
]
++
;
check_card_counter
(
core
.
attacker
,
5
,
infos
.
turn_player
);
check_card_counter
(
core
.
attacker
,
5
,
infos
.
turn_player
);
core
.
attacker
->
announce_count
++
;
core
.
attacker
->
attack_announce_count
++
;
if
(
!
core
.
units
.
begin
()
->
arg3
)
core
.
attacker
->
announced_cards
.
addcard
(
core
.
attack_target
);
}
}
if
(
core
.
units
.
begin
()
->
arg3
)
{
if
(
core
.
units
.
begin
()
->
arg3
)
{
core
.
attacker
->
announce_count
++
;
core
.
chain_attack
=
FALSE
;
core
.
chain_attack
=
FALSE
;
core
.
units
.
begin
()
->
step
=
-
1
;
core
.
units
.
begin
()
->
step
=
-
1
;
}
}
return
FALSE
;
return
FALSE
;
}
}
case
8
:
{
case
8
:
{
bool
evt
=
false
;
attack_all_target_check
();
pduel
->
write_buffer8
(
MSG_ATTACK
);
pduel
->
write_buffer8
(
MSG_ATTACK
);
pduel
->
write_buffer32
(
core
.
attacker
->
get_info_location
());
pduel
->
write_buffer32
(
core
.
attacker
->
get_info_location
());
if
(
core
.
attack_target
)
{
if
(
core
.
attack_target
)
{
evt
=
true
;
raise_single_event
(
core
.
attack_target
,
0
,
EVENT_BE_BATTLE_TARGET
,
0
,
0
,
0
,
1
-
infos
.
turn_player
,
0
);
raise_single_event
(
core
.
attack_target
,
0
,
EVENT_BE_BATTLE_TARGET
,
0
,
0
,
0
,
1
-
infos
.
turn_player
,
0
);
raise_event
(
core
.
attack_target
,
EVENT_BE_BATTLE_TARGET
,
0
,
0
,
0
,
1
-
infos
.
turn_player
,
0
);
raise_event
(
core
.
attack_target
,
EVENT_BE_BATTLE_TARGET
,
0
,
0
,
0
,
1
-
infos
.
turn_player
,
0
);
pduel
->
write_buffer32
(
core
.
attack_target
->
get_info_location
());
pduel
->
write_buffer32
(
core
.
attack_target
->
get_info_location
());
...
@@ -3087,23 +3077,19 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -3087,23 +3077,19 @@ int32 field::process_battle_command(uint16 step) {
pduel
->
write_buffer32
(
0
);
pduel
->
write_buffer32
(
0
);
core
.
attack_rollback
=
FALSE
;
core
.
attack_rollback
=
FALSE
;
core
.
opp_mzone
.
clear
();
core
.
opp_mzone
.
clear
();
for
(
uint32
i
=
0
;
i
<
player
[
1
-
infos
.
turn_player
].
list_mzone
.
size
();
++
i
)
{
for
(
auto
&
pcard
:
player
[
1
-
infos
.
turn_player
].
list_mzone
)
{
card
*
pcard
=
player
[
1
-
infos
.
turn_player
].
list_mzone
[
i
];
if
(
pcard
)
if
(
pcard
)
core
.
opp_mzone
.
insert
(
pcard
->
fieldid_r
);
core
.
opp_mzone
.
insert
(
pcard
->
fieldid_r
);
}
}
//core.units.begin()->arg1 ---> is rollbacked
//core.units.begin()->arg1 ---> is rollbacked
if
(
!
core
.
units
.
begin
()
->
arg1
)
{
if
(
!
core
.
units
.
begin
()
->
arg1
)
{
evt
=
true
;
raise_single_event
(
core
.
attacker
,
0
,
EVENT_ATTACK_ANNOUNCE
,
0
,
0
,
0
,
infos
.
turn_player
,
0
);
raise_single_event
(
core
.
attacker
,
0
,
EVENT_ATTACK_ANNOUNCE
,
0
,
0
,
0
,
infos
.
turn_player
,
0
);
raise_event
(
core
.
attacker
,
EVENT_ATTACK_ANNOUNCE
,
0
,
0
,
0
,
infos
.
turn_player
,
0
);
raise_event
(
core
.
attacker
,
EVENT_ATTACK_ANNOUNCE
,
0
,
0
,
0
,
infos
.
turn_player
,
0
);
}
}
core
.
attacker
->
attack_controler
=
core
.
attacker
->
current
.
controler
;
core
.
attacker
->
attack_controler
=
core
.
attacker
->
current
.
controler
;
core
.
pre_field
[
0
]
=
core
.
attacker
->
fieldid_r
;
core
.
pre_field
[
0
]
=
core
.
attacker
->
fieldid_r
;
if
(
evt
)
{
process_single_event
();
process_single_event
();
process_instant_event
();
process_instant_event
();
}
core
.
hint_timing
[
infos
.
turn_player
]
=
TIMING_ATTACK
;
core
.
hint_timing
[
infos
.
turn_player
]
=
TIMING_ATTACK
;
add_process
(
PROCESSOR_POINT_EVENT
,
0
,
0
,
0
,
0
,
0
);
add_process
(
PROCESSOR_POINT_EVENT
,
0
,
0
,
0
,
0
,
0
);
return
FALSE
;
return
FALSE
;
...
@@ -3134,66 +3120,33 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -3134,66 +3120,33 @@ int32 field::process_battle_command(uint16 step) {
return
FALSE
;
return
FALSE
;
}
}
case
11
:
{
case
11
:
{
uint8
rollback
=
core
.
attack_rollback
;
bool
atk_disabled
=
false
;
uint32
acon
=
core
.
attacker
->
attack_controler
;
uint32
afid
=
core
.
pre_field
[
0
];
if
(
core
.
attacker
->
is_affected_by_effect
(
EFFECT_ATTACK_DISABLED
))
{
if
(
core
.
attacker
->
is_affected_by_effect
(
EFFECT_ATTACK_DISABLED
))
{
core
.
attacker
->
reset
(
EFFECT_ATTACK_DISABLED
,
RESET_CODE
);
core
.
attacker
->
reset
(
EFFECT_ATTACK_DISABLED
,
RESET_CODE
);
atk_disabled
=
true
;
pduel
->
write_buffer8
(
MSG_ATTACK_DISABLED
);
pduel
->
write_buffer8
(
MSG_ATTACK_DISABLED
);
core
.
attacker
->
set_status
(
STATUS_ATTACK_CANCELED
,
TRUE
);
core
.
attacker
->
set_status
(
STATUS_ATTACK_CANCELED
,
TRUE
);
}
}
effect
*
peffect
=
is_player_affected_by_effect
(
infos
.
turn_player
,
EFFECT_SKIP_BP
);
if
(
is_player_affected_by_effect
(
infos
.
turn_player
,
EFFECT_SKIP_BP
)
if
(
peffect
)
{
||
!
core
.
attacker
->
is_capable_attack
()
||
core
.
attacker
->
is_status
(
STATUS_ATTACK_CANCELED
)
core
.
units
.
begin
()
->
step
=
41
;
||
core
.
attacker
->
current
.
controler
!=
core
.
attacker
->
attack_controler
core
.
units
.
begin
()
->
arg1
=
2
;
||
core
.
attacker
->
fieldid_r
!=
core
.
pre_field
[
0
])
{
if
(
is_player_affected_by_effect
(
infos
.
turn_player
,
EFFECT_BP_TWICE
))
core
.
units
.
begin
()
->
step
=
12
;
core
.
units
.
begin
()
->
arg2
=
1
;
else
core
.
units
.
begin
()
->
arg2
=
0
;
reset_phase
(
PHASE_DAMAGE
);
if
(
core
.
attacker
->
fieldid_r
==
afid
&&
!
atk_disabled
)
{
core
.
attacker
->
attacked_cards
.
addcard
(
core
.
attack_target
);
}
if
(
!
peffect
->
value
)
{
reset_phase
(
PHASE_BATTLE_STEP
);
adjust_all
();
infos
.
phase
=
PHASE_BATTLE
;
add_process
(
PROCESSOR_PHASE_EVENT
,
0
,
0
,
0
,
PHASE_BATTLE
,
0
);
}
else
{
core
.
hint_timing
[
infos
.
turn_player
]
=
0
;
reset_phase
(
PHASE_BATTLE
);
adjust_all
();
}
return
FALSE
;
}
if
(
atk_disabled
||
!
core
.
attacker
->
is_capable_attack
()
||
core
.
attacker
->
is_status
(
STATUS_ATTACK_CANCELED
)
||
core
.
attacker
->
current
.
controler
!=
acon
||
core
.
attacker
->
fieldid_r
!=
afid
)
{
core
.
chain_attack
=
FALSE
;
if
(
core
.
attacker
->
fieldid_r
==
afid
&&
!
atk_disabled
)
{
core
.
attacker
->
attacked_cards
.
addcard
(
core
.
attack_target
);
}
core
.
units
.
begin
()
->
step
=
-
1
;
reset_phase
(
PHASE_DAMAGE
);
adjust_all
();
return
FALSE
;
return
FALSE
;
}
}
uint8
rollback
=
core
.
attack_rollback
;
if
(
!
confirm_attack_target
())
if
(
!
confirm_attack_target
())
rollback
=
true
;
rollback
=
TRUE
;
// go to damage step
// go to damage step
if
(
!
rollback
)
{
if
(
!
rollback
)
{
core
.
attacker
->
announce_count
++
;
core
.
attacker
->
announced_cards
.
addcard
(
core
.
attack_target
);
attack_all_target_check
();
core
.
units
.
begin
()
->
step
=
18
;
core
.
units
.
begin
()
->
step
=
18
;
return
FALSE
;
return
FALSE
;
}
}
// attack canceled
card_vector
cv
;
card_vector
cv
;
get_attack_target
(
core
.
attacker
,
&
cv
,
core
.
chain_attack
);
get_attack_target
(
core
.
attacker
,
&
cv
,
core
.
chain_attack
);
if
(
!
cv
.
size
()
&&
!
core
.
attacker
->
direct_attackable
)
{
if
(
!
cv
.
size
()
&&
!
core
.
attacker
->
direct_attackable
)
{
core
.
chain_attack
=
FALSE
;
core
.
units
.
begin
()
->
step
=
12
;
core
.
units
.
begin
()
->
step
=
-
1
;
reset_phase
(
PHASE_DAMAGE
);
adjust_all
();
return
FALSE
;
return
FALSE
;
}
}
// replay
// replay
...
@@ -3211,8 +3164,14 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -3211,8 +3164,14 @@ int32 field::process_battle_command(uint16 step) {
core
.
units
.
begin
()
->
arg3
=
FALSE
;
core
.
units
.
begin
()
->
arg3
=
FALSE
;
core
.
attack_cancelable
=
TRUE
;
core
.
attack_cancelable
=
TRUE
;
core
.
units
.
begin
()
->
step
=
3
;
core
.
units
.
begin
()
->
step
=
3
;
return
FALSE
;
}
}
return
FALSE
;
}
case
13
:
{
core
.
attacker
->
announce_count
++
;
core
.
attacker
->
announced_cards
.
addcard
(
core
.
attack_target
);
if
(
core
.
attacker
->
fieldid_r
==
core
.
pre_field
[
0
])
attack_all_target_check
();
core
.
chain_attack
=
FALSE
;
core
.
chain_attack
=
FALSE
;
core
.
units
.
begin
()
->
step
=
-
1
;
core
.
units
.
begin
()
->
step
=
-
1
;
reset_phase
(
PHASE_DAMAGE
);
reset_phase
(
PHASE_DAMAGE
);
...
@@ -3723,6 +3682,7 @@ int32 field::process_damage_step(uint16 step, uint32 new_attack) {
...
@@ -3723,6 +3682,7 @@ int32 field::process_damage_step(uint16 step, uint32 new_attack) {
core
.
battled_count
[
infos
.
turn_player
]
++
;
core
.
battled_count
[
infos
.
turn_player
]
++
;
check_card_counter
(
core
.
attacker
,
5
,
infos
.
turn_player
);
check_card_counter
(
core
.
attacker
,
5
,
infos
.
turn_player
);
}
}
core
.
attacker
->
announced_cards
.
addcard
(
core
.
attack_target
);
attack_all_target_check
();
attack_all_target_check
();
pduel
->
write_buffer8
(
MSG_ATTACK
);
pduel
->
write_buffer8
(
MSG_ATTACK
);
pduel
->
write_buffer32
(
core
.
attacker
->
get_info_location
());
pduel
->
write_buffer32
(
core
.
attacker
->
get_info_location
());
...
@@ -3954,6 +3914,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
...
@@ -3954,6 +3914,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
pcard
->
set_status
(
STATUS_SET_TURN
,
FALSE
);
pcard
->
set_status
(
STATUS_SET_TURN
,
FALSE
);
pcard
->
set_status
(
STATUS_FORM_CHANGED
,
FALSE
);
pcard
->
set_status
(
STATUS_FORM_CHANGED
,
FALSE
);
pcard
->
indestructable_effects
.
clear
();
pcard
->
indestructable_effects
.
clear
();
pcard
->
attack_announce_count
=
0
;
pcard
->
announce_count
=
0
;
pcard
->
announce_count
=
0
;
pcard
->
attacked_count
=
0
;
pcard
->
attacked_count
=
0
;
pcard
->
announced_cards
.
clear
();
pcard
->
announced_cards
.
clear
();
...
@@ -4164,6 +4125,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
...
@@ -4164,6 +4125,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
card
*
pcard
=
*
cit
;
card
*
pcard
=
*
cit
;
if
(
!
pcard
)
if
(
!
pcard
)
continue
;
continue
;
pcard
->
attack_announce_count
=
0
;
pcard
->
announce_count
=
0
;
pcard
->
announce_count
=
0
;
pcard
->
attacked_count
=
0
;
pcard
->
attacked_count
=
0
;
pcard
->
announced_cards
.
clear
();
pcard
->
announced_cards
.
clear
();
...
@@ -5370,8 +5332,7 @@ int32 field::adjust_step(uint16 step) {
...
@@ -5370,8 +5332,7 @@ int32 field::adjust_step(uint16 step) {
if
(
core
.
attack_rollback
)
if
(
core
.
attack_rollback
)
return
FALSE
;
return
FALSE
;
std
::
set
<
uint16
>
fidset
;
std
::
set
<
uint16
>
fidset
;
for
(
uint32
i
=
0
;
i
<
player
[
1
-
infos
.
turn_player
].
list_mzone
.
size
();
++
i
)
{
for
(
auto
&
pcard
:
player
[
1
-
infos
.
turn_player
].
list_mzone
)
{
card
*
pcard
=
player
[
1
-
infos
.
turn_player
].
list_mzone
[
i
];
if
(
pcard
)
if
(
pcard
)
fidset
.
insert
(
pcard
->
fieldid_r
);
fidset
.
insert
(
pcard
->
fieldid_r
);
}
}
...
...
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