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
6e1886a8
Commit
6e1886a8
authored
Dec 13, 2015
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update EFFECT_ATTACK_ALL
parent
dcde72e4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
53 deletions
+36
-53
card.cpp
card.cpp
+5
-0
card.h
card.h
+4
-1
field.cpp
field.cpp
+7
-3
libcard.cpp
libcard.cpp
+6
-7
libduel.cpp
libduel.cpp
+1
-5
processor.cpp
processor.cpp
+13
-37
No files found.
card.cpp
View file @
6e1886a8
...
...
@@ -46,6 +46,11 @@ bool card::card_operation_sort(card* c1, card* c2) {
return
c1
->
current
.
sequence
<
c2
->
current
.
sequence
;
}
}
void
card
::
attacker_map
::
addcard
(
card
*
pcard
)
{
uint16
fid
=
pcard
?
pcard
->
fieldid_r
:
0
;
auto
pr
=
insert
(
std
::
make_pair
(
fid
,
std
::
make_pair
(
pcard
,
0
)));
pr
.
first
->
second
.
second
++
;
}
card
::
card
(
duel
*
pd
)
{
scrtype
=
1
;
ref_handle
=
0
;
...
...
card.h
View file @
6e1886a8
...
...
@@ -85,7 +85,10 @@ public:
typedef
std
::
unordered_map
<
effect
*
,
uint32
>
effect_relation
;
typedef
std
::
unordered_map
<
card
*
,
uint32
>
relation_map
;
typedef
std
::
map
<
uint16
,
std
::
array
<
uint16
,
2
>
>
counter_map
;
typedef
std
::
unordered_map
<
uint16
,
card
*>
attacker_map
;
class
attacker_map
:
public
std
::
unordered_map
<
uint16
,
std
::
pair
<
card
*
,
uint32
>
>
{
public:
void
addcard
(
card
*
pcard
);
}
;
int32
scrtype
;
int32
ref_handle
;
duel
*
pduel
;
...
...
field.cpp
View file @
6e1886a8
...
...
@@ -1689,8 +1689,13 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
pv
=
&
player
[
1
-
p
].
list_mzone
;
for
(
cit
=
pv
->
begin
();
cit
!=
pv
->
end
();
++
cit
)
{
atarget
=
*
cit
;
if
(
!
atarget
||
pcard
->
announced_cards
.
count
(
atarget
->
fieldid_r
)
)
if
(
!
atarget
)
continue
;
auto
it
=
pcard
->
announced_cards
.
find
(
atarget
->
fieldid_r
);
if
(
it
!=
pcard
->
announced_cards
.
end
())
{
if
(
it
->
second
.
second
>=
peffect
->
get_value
(
atarget
))
continue
;
}
if
(
atarget
->
is_affected_by_effect
(
EFFECT_IGNORE_BATTLE_TARGET
))
continue
;
if
(
atarget
->
is_affected_by_effect
(
EFFECT_CANNOT_BE_BATTLE_TARGET
,
pcard
))
...
...
@@ -1749,8 +1754,7 @@ void field::attack_all_target_check() {
effect
*
peffect
=
core
.
attacker
->
is_affected_by_effect
(
EFFECT_ATTACK_ALL
);
if
(
!
peffect
)
return
;
pduel
->
lua
->
add_param
(
core
.
attack_target
,
PARAM_TYPE_CARD
);
if
(
!
peffect
->
check_value_condition
(
1
))
if
(
!
peffect
->
get_value
(
core
.
attack_target
))
core
.
attacker
->
attack_all_target
=
FALSE
;
}
int32
field
::
check_synchro_material
(
card
*
pcard
,
int32
findex1
,
int32
findex2
,
int32
min
,
int32
max
,
card
*
smat
,
group
*
mg
)
{
...
...
libcard.cpp
View file @
6e1886a8
...
...
@@ -744,8 +744,8 @@ int32 scriptlib::card_get_attacked_group(lua_State *L) {
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
group
*
pgroup
=
pcard
->
pduel
->
new_group
();
for
(
auto
cit
=
pcard
->
attacked_cards
.
begin
();
cit
!=
pcard
->
attacked_cards
.
end
();
++
cit
)
{
if
(
cit
->
second
)
pgroup
->
container
.
insert
(
cit
->
second
);
if
(
cit
->
second
.
first
)
pgroup
->
container
.
insert
(
cit
->
second
.
first
);
}
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
...
...
@@ -770,8 +770,8 @@ int32 scriptlib::card_get_battled_group(lua_State *L) {
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
group
*
pgroup
=
pcard
->
pduel
->
new_group
();
for
(
auto
cit
=
pcard
->
battled_cards
.
begin
();
cit
!=
pcard
->
battled_cards
.
end
();
++
cit
)
{
if
(
cit
->
second
)
pgroup
->
container
.
insert
(
cit
->
second
);
if
(
cit
->
second
.
first
)
pgroup
->
container
.
insert
(
cit
->
second
.
first
);
}
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
...
...
@@ -795,9 +795,8 @@ int32 scriptlib::card_is_direct_attacked(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
bool
ret
=
false
;
for
(
auto
cit
=
pcard
->
attacked_cards
.
begin
();
cit
!=
pcard
->
attacked_cards
.
end
();
++
cit
)
if
(
cit
->
first
==
0
)
ret
=
true
;
if
(
pcard
->
attacked_cards
.
find
(
0
)
!=
pcard
->
attacked_cards
.
end
())
ret
=
true
;
lua_pushboolean
(
L
,
ret
);
return
1
;
}
...
...
libduel.cpp
View file @
6e1886a8
...
...
@@ -1157,11 +1157,7 @@ int32 scriptlib::duel_change_attacker(lua_State *L) {
card
*
attacker
=
pduel
->
game_field
->
core
.
attacker
;
card
*
attack_target
=
pduel
->
game_field
->
core
.
attack_target
;
attacker
->
announce_count
++
;
if
(
attack_target
)
{
attacker
->
announced_cards
[
attack_target
->
fieldid_r
]
=
attack_target
;
}
else
{
attacker
->
announced_cards
[
0
]
=
0
;
}
attacker
->
announced_cards
.
addcard
(
attack_target
);
pduel
->
game_field
->
core
.
sub_attacker
=
target
;
return
0
;
}
...
...
processor.cpp
View file @
6e1886a8
...
...
@@ -2923,7 +2923,7 @@ int32 field::process_battle_command(uint16 step) {
if
(
core
.
select_cards
.
size
()
==
0
)
{
if
(
!
core
.
attack_cancelable
)
{
core
.
attacker
->
announce_count
++
;
core
.
attacker
->
announced_cards
[
0
]
=
0
;
core
.
attacker
->
announced_cards
.
addcard
(
0
)
;
}
core
.
units
.
begin
()
->
step
=
-
1
;
return
FALSE
;
...
...
@@ -2949,10 +2949,7 @@ int32 field::process_battle_command(uint16 step) {
//rollback
if
(
core
.
units
.
begin
()
->
arg1
)
{
core
.
attacker
->
announce_count
++
;
if
(
core
.
attack_target
)
core
.
attacker
->
announced_cards
[
core
.
attack_target
->
fieldid_r
]
=
core
.
attack_target
;
else
core
.
attacker
->
announced_cards
[
0
]
=
0
;
core
.
attacker
->
announced_cards
.
addcard
(
core
.
attack_target
);
}
core
.
units
.
begin
()
->
step
=
-
1
;
return
FALSE
;
...
...
@@ -3050,10 +3047,7 @@ int32 field::process_battle_command(uint16 step) {
reset_phase
(
PHASE_DAMAGE
);
if
(
core
.
attacker
->
fieldid_r
==
afid
)
{
if
(
!
atk_disabled
)
{
if
(
core
.
attack_target
)
core
.
attacker
->
attacked_cards
[
core
.
attack_target
->
fieldid_r
]
=
core
.
attack_target
;
else
core
.
attacker
->
attacked_cards
[
0
]
=
0
;
core
.
attacker
->
attacked_cards
.
addcard
(
core
.
attack_target
);
}
core
.
attacker
->
announce_count
++
;
attack_all_target_check
();
...
...
@@ -3070,17 +3064,11 @@ int32 field::process_battle_command(uint16 step) {
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
)
{
if
(
core
.
attacker
->
fieldid_r
==
afid
)
{
if
(
core
.
attack_target
)
core
.
attacker
->
announced_cards
[
core
.
attack_target
->
fieldid_r
]
=
core
.
attack_target
;
else
core
.
attacker
->
announced_cards
[
0
]
=
0
;
core
.
attacker
->
announce_count
++
;
core
.
attacker
->
announced_cards
.
addcard
(
core
.
attack_target
);
attack_all_target_check
();
if
(
!
core
.
attacker
->
is_status
(
STATUS_ATTACK_CANCELED
))
{
if
(
core
.
attack_target
)
core
.
attacker
->
attacked_cards
[
core
.
attack_target
->
fieldid_r
]
=
core
.
attack_target
;
else
core
.
attacker
->
attacked_cards
[
0
]
=
0
;
core
.
attacker
->
attacked_cards
.
addcard
(
core
.
attack_target
);
}
}
core
.
units
.
begin
()
->
step
=
-
1
;
...
...
@@ -3105,16 +3093,14 @@ int32 field::process_battle_command(uint16 step) {
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
)
{
core
.
attacker
->
announced_cards
[
core
.
attack_target
->
fieldid_r
]
=
core
.
attack_target
;
core
.
attacker
->
attacked_cards
[
core
.
attack_target
->
fieldid_r
]
=
core
.
attack_target
;
pduel
->
write_buffer32
(
core
.
attack_target
->
get_info_location
());
}
else
{
core
.
attacker
->
announced_cards
[
0
]
=
0
;
core
.
attacker
->
attacked_cards
[
0
]
=
0
;
pduel
->
write_buffer32
(
0
);
}
core
.
units
.
begin
()
->
step
=
19
;
...
...
@@ -3139,14 +3125,9 @@ int32 field::process_battle_command(uint16 step) {
rollback
=
true
;
if
(
!
rollback
)
{
core
.
attacker
->
announce_count
++
;
core
.
attacker
->
announced_cards
.
addcard
(
core
.
attack_target
);
attack_all_target_check
();
if
(
core
.
attack_target
)
{
core
.
attacker
->
announced_cards
[
core
.
attack_target
->
fieldid_r
]
=
core
.
attack_target
;
core
.
attacker
->
attacked_cards
[
core
.
attack_target
->
fieldid_r
]
=
core
.
attack_target
;
}
else
{
core
.
attacker
->
announced_cards
[
0
]
=
0
;
core
.
attacker
->
attacked_cards
[
0
]
=
0
;
}
core
.
attacker
->
attacked_cards
.
addcard
(
core
.
attack_target
);
core
.
units
.
begin
()
->
step
=
19
;
adjust_instant
();
adjust_all
();
...
...
@@ -3176,10 +3157,7 @@ int32 field::process_battle_command(uint16 step) {
return
FALSE
;
}
core
.
attacker
->
announce_count
++
;
if
(
core
.
attack_target
)
core
.
attacker
->
announced_cards
[
core
.
attack_target
->
fieldid_r
]
=
core
.
attack_target
;
else
core
.
attacker
->
announced_cards
[
0
]
=
0
;
core
.
attacker
->
announced_cards
.
addcard
(
core
.
attack_target
);
attack_all_target_check
();
core
.
units
.
begin
()
->
step
=
-
1
;
reset_phase
(
PHASE_DAMAGE
);
...
...
@@ -3421,11 +3399,9 @@ int32 field::process_battle_command(uint16 step) {
infos
.
phase
=
PHASE_DAMAGE
;
core
.
hint_timing
[
infos
.
turn_player
]
=
0
;
core
.
chain_attack
=
FALSE
;
if
(
core
.
attack_target
)
{
core
.
attacker
->
battled_cards
[
core
.
attack_target
->
fieldid_r
]
=
core
.
attack_target
;
core
.
attack_target
->
battled_cards
[
core
.
attacker
->
fieldid_r
]
=
core
.
attacker
;
}
else
core
.
attacker
->
battled_cards
[
0
]
=
0
;
core
.
attacker
->
battled_cards
.
addcard
(
core
.
attack_target
);
if
(
core
.
attack_target
)
core
.
attack_target
->
battled_cards
.
addcard
(
core
.
attacker
);
uint8
reason_player
=
core
.
temp_var
[
0
];
card
*
reason_card
=
0
;
if
(
core
.
temp_var
[
1
]
==
1
)
...
...
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