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
xiaoye
ygopro-core
Commits
8cf8c513
Commit
8cf8c513
authored
Jan 10, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Fluorohydride/ygopro-core
parents
1fddb6ed
0c07eb86
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
110 deletions
+90
-110
field.cpp
field.cpp
+87
-10
field.h
field.h
+1
-0
interpreter.cpp
interpreter.cpp
+0
-1
libduel.cpp
libduel.cpp
+1
-63
operations.cpp
operations.cpp
+1
-35
scriptlib.h
scriptlib.h
+0
-1
No files found.
field.cpp
View file @
8cf8c513
...
...
@@ -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
)
...
...
field.h
View file @
8cf8c513
...
...
@@ -365,6 +365,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
);
...
...
interpreter.cpp
View file @
8cf8c513
...
...
@@ -604,7 +604,6 @@ static const struct luaL_Reg duellib[] = {
{
"GetCustomActivityCount"
,
scriptlib
::
duel_get_custom_activity_count
},
{
"GetBattledCount"
,
scriptlib
::
duel_get_battled_count
},
{
"IsAbleToEnterBP"
,
scriptlib
::
duel_is_able_to_enter_bp
},
{
"VenomSwampCheck"
,
scriptlib
::
duel_venom_swamp_check
},
{
"SwapDeckAndGrave"
,
scriptlib
::
duel_swap_deck_and_grave
},
{
"MajesticCopy"
,
scriptlib
::
duel_majestic_copy
},
{
NULL
,
NULL
}
...
...
libduel.cpp
View file @
8cf8c513
...
...
@@ -1049,16 +1049,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
);
...
...
@@ -4552,59 +4543,6 @@ int32 scriptlib::duel_is_able_to_enter_bp(lua_State *L) {
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_able_to_enter_bp
());
return
1
;
}
int32
scriptlib
::
duel_venom_swamp_check
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
if
(
pcard
->
get_counter
(
0x9
)
==
0
||
pcard
->
is_affected_by_effect
(
EFFECT_SWAP_AD
)
||
pcard
->
is_affected_by_effect
(
EFFECT_REVERSE_UPDATE
))
{
lua_pushboolean
(
L
,
0
);
return
1
;
}
uint32
base
=
pcard
->
get_base_attack
();
pcard
->
temp
.
base_attack
=
base
;
pcard
->
temp
.
attack
=
base
;
int32
up
=
0
,
upc
=
0
;
effect_set
eset
;
effect
*
peffect
=
0
;
pcard
->
filter_effect
(
EFFECT_UPDATE_ATTACK
,
&
eset
,
FALSE
);
pcard
->
filter_effect
(
EFFECT_SET_ATTACK
,
&
eset
,
FALSE
);
pcard
->
filter_effect
(
EFFECT_SET_ATTACK_FINAL
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
switch
(
eset
[
i
]
->
code
)
{
case
EFFECT_UPDATE_ATTACK
:
{
if
(
eset
[
i
]
->
type
&
EFFECT_TYPE_SINGLE
&&
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
))
up
+=
eset
[
i
]
->
get_value
(
pcard
);
else
upc
+=
eset
[
i
]
->
get_value
(
pcard
);
if
(
pcard
->
temp
.
attack
>
0
)
peffect
=
eset
[
i
];
break
;
}
case
EFFECT_SET_ATTACK
:
base
=
eset
[
i
]
->
get_value
(
pcard
);
if
(
eset
[
i
]
->
type
&
EFFECT_TYPE_SINGLE
&&
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
))
up
=
0
;
break
;
case
EFFECT_SET_ATTACK_FINAL
:
if
(
eset
[
i
]
->
type
&
EFFECT_TYPE_SINGLE
&&
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
))
{
base
=
eset
[
i
]
->
get_value
(
pcard
);
up
=
0
;
upc
=
0
;
peffect
=
0
;
}
break
;
}
pcard
->
temp
.
attack
=
base
+
up
+
upc
;
}
int32
atk
=
pcard
->
temp
.
attack
;
pcard
->
temp
.
base_attack
=
0xffffffff
;
pcard
->
temp
.
attack
=
0xffffffff
;
if
((
atk
<=
0
)
&&
peffect
&&
(
peffect
->
handler
->
get_code
()
==
54306223
))
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
duel_swap_deck_and_grave
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_param_count
(
L
,
1
);
...
...
operations.cpp
View file @
8cf8c513
...
...
@@ -1088,48 +1088,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
;
...
...
scriptlib.h
View file @
8cf8c513
...
...
@@ -597,7 +597,6 @@ public:
static
int32
duel_get_battled_count
(
lua_State
*
L
);
//specific card functions
static
int32
duel_venom_swamp_check
(
lua_State
*
L
);
static
int32
duel_swap_deck_and_grave
(
lua_State
*
L
);
static
int32
duel_majestic_copy
(
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