Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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-Cn-Ko-En
Commits
badfe147
Commit
badfe147
authored
Jan 09, 2020
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
88474f45
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
168 additions
and
55 deletions
+168
-55
Classes/ocgcore/effect.h
Classes/ocgcore/effect.h
+1
-0
Classes/ocgcore/field.cpp
Classes/ocgcore/field.cpp
+87
-10
Classes/ocgcore/field.h
Classes/ocgcore/field.h
+1
-0
Classes/ocgcore/libduel.cpp
Classes/ocgcore/libduel.cpp
+1
-10
Classes/ocgcore/operations.cpp
Classes/ocgcore/operations.cpp
+1
-35
Classes/ocgcore/processor.cpp
Classes/ocgcore/processor.cpp
+77
-0
No files found.
Classes/ocgcore/effect.h
View file @
badfe147
...
...
@@ -365,6 +365,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_BATTLE_DAMAGE_TO_EFFECT 205
#define EFFECT_BOTH_BATTLE_DAMAGE 206
#define EFFECT_ALSO_BATTLE_DAMAGE 207
#define EFFECT_CHANGE_BATTLE_DAMAGE 208
#define EFFECT_TOSS_COIN_REPLACE 220
#define EFFECT_TOSS_DICE_REPLACE 221
#define EFFECT_FUSION_MATERIAL 230
...
...
Classes/ocgcore/field.cpp
View file @
badfe147
...
...
@@ -431,19 +431,96 @@ void field::move_card(uint8 playerid, card* pcard, uint8 location, uint8 sequenc
}
add_card
(
playerid
,
pcard
,
location
,
sequence
,
pzone
);
}
void
field
::
swap_card
(
card
*
pcard1
,
card
*
pcard2
)
{
void
field
::
swap_card
(
card
*
pcard1
,
card
*
pcard2
,
uint8
new_sequence1
,
uint8
new_sequence2
)
{
uint8
p1
=
pcard1
->
current
.
controler
,
p2
=
pcard2
->
current
.
controler
;
uint8
l1
=
pcard1
->
current
.
location
,
l2
=
pcard2
->
current
.
location
;
uint8
s1
=
pcard1
->
current
.
sequence
,
s2
=
pcard2
->
current
.
sequence
;
remove_card
(
pcard1
);
remove_card
(
pcard2
);
add_card
(
p2
,
pcard1
,
l2
,
s2
);
add_card
(
p1
,
pcard2
,
l1
,
s1
);
pduel
->
write_buffer8
(
MSG_SWAP
);
pduel
->
write_buffer32
(
pcard1
->
data
.
code
);
pduel
->
write_buffer32
(
pcard2
->
get_info_location
());
pduel
->
write_buffer32
(
pcard2
->
data
.
code
);
pduel
->
write_buffer32
(
pcard1
->
get_info_location
());
uint32
info1
=
pcard1
->
get_info_location
(),
info2
=
pcard2
->
get_info_location
();
if
(
!
(
l1
&
LOCATION_ONFIELD
)
||
!
(
l2
&
LOCATION_ONFIELD
))
return
;
if
(
new_sequence1
!=
s1
&&
!
is_location_useable
(
p1
,
l1
,
new_sequence1
)
||
new_sequence2
!=
s2
&&
!
is_location_useable
(
p2
,
l2
,
new_sequence2
))
return
;
if
(
p1
==
p2
&&
l1
==
l2
&&
(
new_sequence1
==
s2
||
new_sequence2
==
s1
))
return
;
if
(
l1
==
l2
)
{
pcard1
->
previous
.
controler
=
p1
;
pcard1
->
previous
.
location
=
l1
;
pcard1
->
previous
.
sequence
=
s1
;
pcard1
->
previous
.
position
=
pcard1
->
current
.
position
;
pcard1
->
previous
.
pzone
=
pcard1
->
current
.
pzone
;
pcard1
->
current
.
controler
=
p2
;
pcard1
->
current
.
location
=
l2
;
pcard1
->
current
.
sequence
=
new_sequence2
;
pcard2
->
previous
.
controler
=
p2
;
pcard2
->
previous
.
location
=
l2
;
pcard2
->
previous
.
sequence
=
s2
;
pcard2
->
previous
.
position
=
pcard2
->
current
.
position
;
pcard2
->
previous
.
pzone
=
pcard2
->
current
.
pzone
;
pcard2
->
current
.
controler
=
p1
;
pcard2
->
current
.
location
=
l1
;
pcard2
->
current
.
sequence
=
new_sequence1
;
if
(
p1
!=
p2
)
{
pcard1
->
fieldid
=
infos
.
field_id
++
;
pcard2
->
fieldid
=
infos
.
field_id
++
;
}
if
(
l1
==
LOCATION_MZONE
)
{
player
[
p1
].
list_mzone
[
s1
]
=
0
;
player
[
p1
].
used_location
&=
~
(
1
<<
s1
);
player
[
p2
].
list_mzone
[
s2
]
=
0
;
player
[
p2
].
used_location
&=
~
(
1
<<
s2
);
player
[
p2
].
list_mzone
[
new_sequence2
]
=
pcard1
;
player
[
p2
].
used_location
|=
1
<<
new_sequence2
;
player
[
p1
].
list_mzone
[
new_sequence1
]
=
pcard2
;
player
[
p1
].
used_location
|=
1
<<
new_sequence1
;
}
else
if
(
l1
==
LOCATION_SZONE
)
{
player
[
p1
].
list_szone
[
s1
]
=
0
;
player
[
p1
].
used_location
&=
~
(
256
<<
s1
);
player
[
p2
].
list_szone
[
s2
]
=
0
;
player
[
p2
].
used_location
&=
~
(
256
<<
s2
);
player
[
p2
].
list_szone
[
new_sequence2
]
=
pcard1
;
player
[
p2
].
used_location
|=
256
<<
new_sequence2
;
player
[
p1
].
list_szone
[
new_sequence1
]
=
pcard2
;
player
[
p1
].
used_location
|=
256
<<
new_sequence1
;
}
}
else
{
remove_card
(
pcard1
);
remove_card
(
pcard2
);
add_card
(
p2
,
pcard1
,
l2
,
new_sequence2
);
add_card
(
p1
,
pcard2
,
l1
,
new_sequence1
);
}
if
(
s1
==
new_sequence1
&&
s2
==
new_sequence2
)
{
pduel
->
write_buffer8
(
MSG_SWAP
);
pduel
->
write_buffer32
(
pcard1
->
data
.
code
);
pduel
->
write_buffer32
(
info1
);
pduel
->
write_buffer32
(
pcard2
->
data
.
code
);
pduel
->
write_buffer32
(
info2
);
}
else
if
(
s1
==
new_sequence1
)
{
pduel
->
write_buffer8
(
MSG_MOVE
);
pduel
->
write_buffer32
(
pcard1
->
data
.
code
);
pduel
->
write_buffer32
(
info1
);
pduel
->
write_buffer32
(
pcard1
->
get_info_location
());
pduel
->
write_buffer32
(
0
);
pduel
->
write_buffer8
(
MSG_MOVE
);
pduel
->
write_buffer32
(
pcard2
->
data
.
code
);
pduel
->
write_buffer32
(
info2
);
pduel
->
write_buffer32
(
pcard2
->
get_info_location
());
pduel
->
write_buffer32
(
0
);
}
else
{
pduel
->
write_buffer8
(
MSG_MOVE
);
pduel
->
write_buffer32
(
pcard2
->
data
.
code
);
pduel
->
write_buffer32
(
info2
);
pduel
->
write_buffer32
(
pcard2
->
get_info_location
());
pduel
->
write_buffer32
(
0
);
pduel
->
write_buffer8
(
MSG_MOVE
);
pduel
->
write_buffer32
(
pcard1
->
data
.
code
);
pduel
->
write_buffer32
(
info1
);
pduel
->
write_buffer32
(
pcard1
->
get_info_location
());
pduel
->
write_buffer32
(
0
);
}
}
void
field
::
swap_card
(
card
*
pcard1
,
card
*
pcard2
)
{
return
swap_card
(
pcard1
,
pcard2
,
pcard1
->
current
.
sequence
,
pcard2
->
current
.
sequence
);
}
void
field
::
set_control
(
card
*
pcard
,
uint8
playerid
,
uint16
reset_phase
,
uint8
reset_count
)
{
if
((
core
.
remove_brainwashing
&&
pcard
->
is_affected_by_effect
(
EFFECT_REMOVE_BRAINWASHING
))
||
pcard
->
refresh_control_status
()
==
playerid
)
...
...
Classes/ocgcore/field.h
View file @
badfe147
...
...
@@ -363,6 +363,7 @@ public:
void
add_card
(
uint8
playerid
,
card
*
pcard
,
uint8
location
,
uint8
sequence
,
uint8
pzone
=
FALSE
);
void
remove_card
(
card
*
pcard
);
void
move_card
(
uint8
playerid
,
card
*
pcard
,
uint8
location
,
uint8
sequence
,
uint8
pzone
=
FALSE
);
void
swap_card
(
card
*
pcard1
,
card
*
pcard2
,
uint8
new_sequence1
,
uint8
new_sequence2
);
void
swap_card
(
card
*
pcard1
,
card
*
pcard2
);
void
set_control
(
card
*
pcard
,
uint8
playerid
,
uint16
reset_phase
,
uint8
reset_count
);
card
*
get_field_card
(
uint32
playerid
,
uint32
location
,
uint32
sequence
);
...
...
Classes/ocgcore/libduel.cpp
View file @
badfe147
...
...
@@ -829,16 +829,7 @@ int32 scriptlib::duel_swap_sequence(lua_State *L) {
&&
location
==
LOCATION_MZONE
&&
pcard2
->
current
.
location
==
location
&&
pcard1
->
is_affect_by_effect
(
pduel
->
game_field
->
core
.
reason_effect
)
&&
pcard2
->
is_affect_by_effect
(
pduel
->
game_field
->
core
.
reason_effect
))
{
uint8
s1
=
pcard1
->
current
.
sequence
,
s2
=
pcard2
->
current
.
sequence
;
pduel
->
game_field
->
remove_card
(
pcard1
);
pduel
->
game_field
->
remove_card
(
pcard2
);
pduel
->
game_field
->
add_card
(
player
,
pcard1
,
location
,
s2
);
pduel
->
game_field
->
add_card
(
player
,
pcard2
,
location
,
s1
);
pduel
->
write_buffer8
(
MSG_SWAP
);
pduel
->
write_buffer32
(
pcard1
->
data
.
code
);
pduel
->
write_buffer32
(
pcard2
->
get_info_location
());
pduel
->
write_buffer32
(
pcard2
->
data
.
code
);
pduel
->
write_buffer32
(
pcard1
->
get_info_location
());
pduel
->
game_field
->
swap_card
(
pcard1
,
pcard2
);
field
::
card_set
swapped
;
swapped
.
insert
(
pcard1
);
swapped
.
insert
(
pcard2
);
...
...
Classes/ocgcore/operations.cpp
View file @
badfe147
...
...
@@ -1063,48 +1063,14 @@ int32 field::swap_control(uint16 step, effect* reason_effect, uint8 reason_playe
card
*
pcard1
=
*
targets1
->
it
;
card
*
pcard2
=
*
targets2
->
it
;
uint8
p1
=
pcard1
->
current
.
controler
,
p2
=
pcard2
->
current
.
controler
;
uint8
s1
=
pcard1
->
current
.
sequence
,
s2
=
pcard2
->
current
.
sequence
;
uint8
new_s1
=
core
.
units
.
begin
()
->
arg4
,
new_s2
=
returns
.
bvalue
[
2
];
uint32
info1
=
pcard1
->
get_info_location
(),
info2
=
pcard2
->
get_info_location
();
remove_card
(
pcard1
);
remove_card
(
pcard2
);
add_card
(
p2
,
pcard1
,
LOCATION_MZONE
,
new_s2
);
add_card
(
p1
,
pcard2
,
LOCATION_MZONE
,
new_s1
);
swap_card
(
pcard1
,
pcard2
,
new_s1
,
new_s2
);
pcard1
->
reset
(
RESET_CONTROL
,
RESET_EVENT
);
pcard2
->
reset
(
RESET_CONTROL
,
RESET_EVENT
);
set_control
(
pcard1
,
p2
,
reset_phase
,
reset_count
);
set_control
(
pcard2
,
p1
,
reset_phase
,
reset_count
);
pcard1
->
set_status
(
STATUS_ATTACK_CANCELED
,
TRUE
);
pcard2
->
set_status
(
STATUS_ATTACK_CANCELED
,
TRUE
);
if
(
s1
==
new_s1
&&
s2
==
new_s2
)
{
pduel
->
write_buffer8
(
MSG_SWAP
);
pduel
->
write_buffer32
(
pcard1
->
data
.
code
);
pduel
->
write_buffer32
(
info1
);
pduel
->
write_buffer32
(
pcard2
->
data
.
code
);
pduel
->
write_buffer32
(
info2
);
}
else
if
(
s1
==
new_s1
)
{
pduel
->
write_buffer8
(
MSG_MOVE
);
pduel
->
write_buffer32
(
pcard1
->
data
.
code
);
pduel
->
write_buffer32
(
info1
);
pduel
->
write_buffer32
(
pcard1
->
get_info_location
());
pduel
->
write_buffer32
(
0
);
pduel
->
write_buffer8
(
MSG_MOVE
);
pduel
->
write_buffer32
(
pcard2
->
data
.
code
);
pduel
->
write_buffer32
(
info2
);
pduel
->
write_buffer32
(
pcard2
->
get_info_location
());
pduel
->
write_buffer32
(
0
);
}
else
{
pduel
->
write_buffer8
(
MSG_MOVE
);
pduel
->
write_buffer32
(
pcard2
->
data
.
code
);
pduel
->
write_buffer32
(
info2
);
pduel
->
write_buffer32
(
pcard2
->
get_info_location
());
pduel
->
write_buffer32
(
0
);
pduel
->
write_buffer8
(
MSG_MOVE
);
pduel
->
write_buffer32
(
pcard1
->
data
.
code
);
pduel
->
write_buffer32
(
info1
);
pduel
->
write_buffer32
(
pcard1
->
get_info_location
());
pduel
->
write_buffer32
(
0
);
}
++
targets1
->
it
;
++
targets2
->
it
;
core
.
units
.
begin
()
->
step
=
0
;
...
...
Classes/ocgcore/processor.cpp
View file @
badfe147
...
...
@@ -3394,6 +3394,44 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
}
}
}
effect_set
eset
;
core
.
attacker
->
filter_effect
(
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
core
.
attack_target
->
filter_effect
(
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
filter_player_effect
(
pa
,
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
filter_player_effect
(
1
-
pa
,
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
eset
.
sort
();
for
(
uint8
p
=
0
;
p
<
2
;
++
p
)
{
bool
double_dam
=
false
;
bool
half_dam
=
false
;
int32
dam_value
=
-
1
;
for
(
uint32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
int32
val
=
-
1
;
if
(
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_PLAYER_TARGET
))
{
pduel
->
lua
->
add_param
(
p
,
PARAM_TYPE_INT
);
val
=
eset
[
i
]
->
get_value
(
1
);
}
else
if
(
eset
[
i
]
->
is_target_player
(
p
))
val
=
eset
[
i
]
->
get_value
();
if
(
val
==
0
)
{
dam_value
=
0
;
break
;
}
else
if
(
val
>
0
)
dam_value
=
val
;
else
if
(
val
==
DOUBLE_DAMAGE
)
double_dam
=
true
;
else
if
(
val
==
HALF_DAMAGE
)
half_dam
=
true
;
}
if
(
double_dam
&&
half_dam
)
{
double_dam
=
false
;
half_dam
=
false
;
}
if
(
double_dam
)
core
.
battle_damage
[
p
]
*=
2
;
if
(
half_dam
)
core
.
battle_damage
[
p
]
/=
2
;
if
(
dam_value
>=
0
&&
core
.
battle_damage
[
p
]
>
0
)
core
.
battle_damage
[
p
]
=
dam_value
;
}
if
(
core
.
attacker
->
is_affected_by_effect
(
EFFECT_NO_BATTLE_DAMAGE
)
||
core
.
attack_target
->
is_affected_by_effect
(
EFFECT_AVOID_BATTLE_DAMAGE
,
core
.
attacker
)
||
is_player_affected_by_effect
(
pd
,
EFFECT_AVOID_BATTLE_DAMAGE
))
...
...
@@ -3475,6 +3513,45 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
}
}
}
effect_set
eset
;
reason_card
->
filter_effect
(
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
if
(
dam_card
)
dam_card
->
filter_effect
(
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
filter_player_effect
(
damp
,
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
filter_player_effect
(
1
-
damp
,
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
eset
.
sort
();
for
(
uint8
p
=
0
;
p
<
2
;
++
p
)
{
bool
double_dam
=
false
;
bool
half_dam
=
false
;
int32
dam_value
=
-
1
;
for
(
uint32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
int32
val
=
-
1
;
if
(
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_PLAYER_TARGET
))
{
pduel
->
lua
->
add_param
(
p
,
PARAM_TYPE_INT
);
val
=
eset
[
i
]
->
get_value
(
1
);
}
else
if
(
eset
[
i
]
->
is_target_player
(
p
))
val
=
eset
[
i
]
->
get_value
();
if
(
val
==
0
)
{
dam_value
=
0
;
break
;
}
else
if
(
val
>
0
)
dam_value
=
val
;
else
if
(
val
==
DOUBLE_DAMAGE
)
double_dam
=
true
;
else
if
(
val
==
HALF_DAMAGE
)
half_dam
=
true
;
}
if
(
double_dam
&&
half_dam
)
{
double_dam
=
false
;
half_dam
=
false
;
}
if
(
double_dam
)
core
.
battle_damage
[
p
]
*=
2
;
if
(
half_dam
)
core
.
battle_damage
[
p
]
/=
2
;
if
(
dam_value
>=
0
&&
core
.
battle_damage
[
p
]
>
0
)
core
.
battle_damage
[
p
]
=
dam_value
;
}
if
(
reason_card
->
is_affected_by_effect
(
EFFECT_NO_BATTLE_DAMAGE
)
||
dam_card
&&
dam_card
->
is_affected_by_effect
(
EFFECT_AVOID_BATTLE_DAMAGE
,
reason_card
)
||
is_player_affected_by_effect
(
damp
,
EFFECT_AVOID_BATTLE_DAMAGE
))
...
...
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