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
416b733f
Commit
416b733f
authored
May 03, 2016
by
DailyShana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Duel.ChangeAttackTarget
parent
2f65f10a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
36 deletions
+36
-36
field.cpp
field.cpp
+3
-3
field.h
field.h
+1
-1
libduel.cpp
libduel.cpp
+20
-6
processor.cpp
processor.cpp
+12
-26
No files found.
field.cpp
View file @
416b733f
...
...
@@ -1650,7 +1650,7 @@ int32 field::effect_replace_check(uint32 code, const tevent& e) {
}
return
FALSE
;
}
int32
field
::
get_attack_target
(
card
*
pcard
,
card_vector
*
v
,
uint8
chain_attack
)
{
int32
field
::
get_attack_target
(
card
*
pcard
,
card_vector
*
v
,
uint8
chain_attack
,
uint8
sub_attack
)
{
uint8
p
=
pcard
->
current
.
controler
;
effect
*
peffect
;
card
*
atarget
;
...
...
@@ -1714,13 +1714,13 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
continue
;
if
(
pcard
->
is_affected_by_effect
(
EFFECT_CANNOT_SELECT_BATTLE_TARGET
,
atarget
))
continue
;
if
(
chain_attack
&&
core
.
chain_attack_target
&&
atarget
!=
core
.
chain_attack_target
)
if
(
chain_attack
&&
!
sub_attack
&&
core
.
chain_attack_target
&&
atarget
!=
core
.
chain_attack_target
)
continue
;
v
->
push_back
(
atarget
);
}
if
(
must_be_attack
.
size
())
return
TRUE
;
if
((
mcount
==
0
||
pcard
->
is_affected_by_effect
(
EFFECT_DIRECT_ATTACK
))
if
((
mcount
==
0
||
pcard
->
is_affected_by_effect
(
EFFECT_DIRECT_ATTACK
)
||
sub_attack
)
&&
!
pcard
->
is_affected_by_effect
(
EFFECT_CANNOT_DIRECT_ATTACK
)
&&
!
(
chain_attack
&&
core
.
chain_attack_target
))
pcard
->
operation_param
=
1
;
...
...
field.h
View file @
416b733f
...
...
@@ -385,7 +385,7 @@ public:
uint32
get_field_counter
(
uint8
self
,
uint8
s
,
uint8
o
,
uint16
countertype
);
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
,
uint8
sub_attack
=
FALSE
);
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_tuner_material
(
card
*
pcard
,
card
*
tuner
,
int32
findex1
,
int32
findex2
,
int32
min
,
int32
max
,
card
*
smat
,
group
*
mg
);
...
...
libduel.cpp
View file @
416b733f
...
...
@@ -1180,16 +1180,30 @@ int32 scriptlib::duel_replace_attacker(lua_State *L) {
}
int32
scriptlib
::
duel_change_attack_target
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
duel
*
pduel
;
card
*
target
;
if
(
lua_isnil
(
L
,
1
))
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
core
.
sub_attack_
target
=
0
;
pduel
=
interpreter
::
get_duel_info
(
L
);
target
=
0
;
}
else
{
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
target
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
target
->
pduel
;
pduel
->
game_field
->
core
.
sub_attack_target
=
target
;
target
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
pduel
=
target
->
pduel
;
}
return
0
;
card
*
attacker
=
pduel
->
game_field
->
core
.
attacker
;
if
(
!
attacker
||
!
attacker
->
is_capable_attack
()
||
attacker
->
is_status
(
STATUS_ATTACK_CANCELED
))
{
lua_pushboolean
(
L
,
0
);
return
1
;
}
field
::
card_vector
cv
;
pduel
->
game_field
->
get_attack_target
(
attacker
,
&
cv
,
pduel
->
game_field
->
core
.
chain_attack
,
TRUE
);
if
(
!
target
&&
attacker
->
operation_param
||
target
&&
std
::
find
(
cv
.
begin
(),
cv
.
end
(),
target
)
!=
cv
.
end
())
{
pduel
->
game_field
->
core
.
sub_attack_target
=
target
;
lua_pushboolean
(
L
,
1
);
}
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
duel_replace_attack_target
(
lua_State
*
L
)
{
return
0
;
...
...
processor.cpp
View file @
416b733f
...
...
@@ -2999,8 +2999,9 @@ int32 field::process_battle_command(uint16 step) {
pduel
->
write_buffer8
(
MSG_ATTACK
);
pduel
->
write_buffer32
(
core
.
attacker
->
get_info_location
());
if
(
core
.
attack_target
)
{
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
);
uint32
reason
=
((
core
.
units
.
begin
()
->
arg1
>>
8
)
&
0xff
)
?
REASON_REPLACE
:
0
;
raise_single_event
(
core
.
attack_target
,
0
,
EVENT_BE_BATTLE_TARGET
,
0
,
reason
,
0
,
1
-
infos
.
turn_player
,
0
);
raise_event
(
core
.
attack_target
,
EVENT_BE_BATTLE_TARGET
,
0
,
reason
,
0
,
1
-
infos
.
turn_player
,
0
);
pduel
->
write_buffer32
(
core
.
attack_target
->
get_info_location
());
}
else
pduel
->
write_buffer32
(
0
);
...
...
@@ -3015,7 +3016,7 @@ int32 field::process_battle_command(uint16 step) {
else
core
.
opp_mzone
[
i
]
=
0
;
}
//core.units.begin()->arg1 ---> is rollbacked
//core.units.begin()->arg1 ---> is rollbacked
or sub_attacked
if
(
!
core
.
units
.
begin
()
->
arg1
)
{
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
);
...
...
@@ -3108,34 +3109,17 @@ int32 field::process_battle_command(uint16 step) {
||
((
core
.
sub_attack_target
!=
(
card
*
)
0xffffffff
)
&&
(
!
core
.
sub_attack_target
||
core
.
sub_attack_target
->
current
.
location
==
LOCATION_MZONE
)))
{
if
(
core
.
sub_attacker
)
core
.
attacker
=
core
.
sub_attacker
;
if
(
core
.
sub_attack_target
!=
(
card
*
)
0xffffffff
)
{
if
(
core
.
sub_attack_target
!=
(
card
*
)
0xffffffff
)
core
.
attack_target
=
core
.
sub_attack_target
;
if
(
core
.
attack_target
)
{
raise_single_event
(
core
.
attack_target
,
0
,
EVENT_BE_BATTLE_TARGET
,
0
,
REASON_REPLACE
,
0
,
1
-
infos
.
turn_player
,
0
);
raise_event
(
core
.
attack_target
,
EVENT_BE_BATTLE_TARGET
,
0
,
REASON_REPLACE
,
0
,
1
-
infos
.
turn_player
,
0
);
process_single_event
();
process_instant_event
();
add_process
(
PROCESSOR_POINT_EVENT
,
0
,
0
,
0
,
0
,
0
);
}
}
core
.
sub_attacker
=
0
;
core
.
sub_attack_target
=
(
card
*
)
0xffffffff
;
core
.
attacker
->
announce_count
++
;
core
.
attacker
->
announced_cards
.
addcard
(
core
.
attack_target
);
attack_all_target_check
();
core
.
attacker
->
attacked_cards
.
addcard
(
core
.
attack_target
);
pduel
->
write_buffer8
(
MSG_ATTACK
);
pduel
->
write_buffer32
(
core
.
attacker
->
get_info_location
());
if
(
core
.
attack_target
)
{
pduel
->
write_buffer32
(
core
.
attack_target
->
get_info_location
());
}
else
{
pduel
->
write_buffer32
(
0
);
}
core
.
units
.
begin
()
->
step
=
19
;
core
.
units
.
begin
()
->
arg1
=
core
.
units
.
begin
()
->
arg1
|
0x100
;
core
.
units
.
begin
()
->
step
=
6
;
return
FALSE
;
}
uint8
sub_attacked
=
(
core
.
units
.
begin
()
->
arg1
>>
8
)
&
0xff
;
core
.
select_cards
.
clear
();
core
.
units
.
begin
()
->
arg2
=
get_attack_target
(
core
.
attacker
,
&
core
.
select_cards
,
core
.
chain_attack
);
core
.
units
.
begin
()
->
arg2
=
get_attack_target
(
core
.
attacker
,
&
core
.
select_cards
,
core
.
chain_attack
,
sub_attacked
);
for
(
uint32
i
=
0
;
i
<
5
;
++
i
)
{
if
(
player
[
1
-
infos
.
turn_player
].
list_mzone
[
i
])
{
if
(
!
core
.
opp_mzone
[
i
]
||
core
.
opp_mzone
[
i
]
!=
player
[
1
-
infos
.
turn_player
].
list_mzone
[
i
]
->
fieldid_r
)
{
...
...
@@ -3150,7 +3134,7 @@ int32 field::process_battle_command(uint16 step) {
}
}
if
(
!
core
.
attack_target
&&
!
core
.
attacker
->
operation_param
||
core
.
attack_target
&&
std
::
find
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
core
.
attack_target
)
==
core
.
select_cards
.
end
())
||
core
.
attack_target
&&
std
::
find
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
core
.
attack_target
)
==
core
.
select_cards
.
end
())
rollback
=
true
;
if
(
!
rollback
)
{
core
.
attacker
->
announce_count
++
;
...
...
@@ -5323,6 +5307,8 @@ int32 field::adjust_step(uint16 step) {
attacker
->
set_status
(
STATUS_ATTACK_CANCELED
,
TRUE
);
if
(
core
.
attack_rollback
)
return
FALSE
;
if
(
core
.
sub_attack_target
!=
(
card
*
)
0xffffffff
)
return
FALSE
;
for
(
uint32
i
=
0
;
i
<
5
;
++
i
)
{
card
*
pcard
=
player
[
1
-
infos
.
turn_player
].
list_mzone
[
i
];
if
(
pcard
)
{
...
...
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