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
96b3763c
Commit
96b3763c
authored
Sep 03, 2018
by
DailyShana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modern c++
parent
da5076b3
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
906 additions
and
1032 deletions
+906
-1032
card.cpp
card.cpp
+85
-88
card.h
card.h
+2
-2
duel.cpp
duel.cpp
+15
-16
effect.cpp
effect.cpp
+6
-6
field.cpp
field.cpp
+191
-238
field.h
field.h
+8
-8
interpreter.cpp
interpreter.cpp
+13
-13
interpreter.h
interpreter.h
+1
-1
libcard.cpp
libcard.cpp
+12
-12
libdebug.cpp
libdebug.cpp
+2
-2
libduel.cpp
libduel.cpp
+31
-40
libgroup.cpp
libgroup.cpp
+53
-53
ocgapi.cpp
ocgapi.cpp
+15
-19
operations.cpp
operations.cpp
+253
-280
playerop.cpp
playerop.cpp
+35
-53
processor.cpp
processor.cpp
+184
-201
No files found.
card.cpp
View file @
96b3763c
This diff is collapsed.
Click to expand it.
card.h
View file @
96b3763c
...
@@ -100,9 +100,9 @@ public:
...
@@ -100,9 +100,9 @@ public:
typedef
std
::
unordered_map
<
effect
*
,
effect_container
::
iterator
>
effect_indexer
;
typedef
std
::
unordered_map
<
effect
*
,
effect_container
::
iterator
>
effect_indexer
;
typedef
std
::
unordered_set
<
std
::
pair
<
effect
*
,
uint16
>
,
effect_relation_hash
>
effect_relation
;
typedef
std
::
unordered_set
<
std
::
pair
<
effect
*
,
uint16
>
,
effect_relation_hash
>
effect_relation
;
typedef
std
::
unordered_map
<
card
*
,
uint32
>
relation_map
;
typedef
std
::
unordered_map
<
card
*
,
uint32
>
relation_map
;
typedef
std
::
map
<
uint16
,
std
::
array
<
uint16
,
2
>
>
counter_map
;
typedef
std
::
map
<
uint16
,
std
::
array
<
uint16
,
2
>>
counter_map
;
typedef
std
::
map
<
uint32
,
int32
>
effect_count
;
typedef
std
::
map
<
uint32
,
int32
>
effect_count
;
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
);
uint32
findcard
(
card
*
pcard
);
...
...
duel.cpp
View file @
96b3763c
...
@@ -20,22 +20,22 @@ duel::duel() {
...
@@ -20,22 +20,22 @@ duel::duel() {
clear_buffer
();
clear_buffer
();
}
}
duel
::~
duel
()
{
duel
::~
duel
()
{
for
(
auto
cit
=
cards
.
begin
();
cit
!=
cards
.
end
();
++
cit
)
for
(
auto
&
pcard
:
cards
)
delete
*
cit
;
delete
pcard
;
for
(
auto
git
=
groups
.
begin
();
git
!=
groups
.
end
();
++
git
)
for
(
auto
&
pgroup
:
groups
)
delete
*
git
;
delete
pgroup
;
for
(
auto
eit
=
effects
.
begin
();
eit
!=
effects
.
end
();
++
eit
)
for
(
auto
&
peffect
:
effects
)
delete
*
ei
t
;
delete
peffec
t
;
delete
lua
;
delete
lua
;
delete
game_field
;
delete
game_field
;
}
}
void
duel
::
clear
()
{
void
duel
::
clear
()
{
for
(
auto
cit
=
cards
.
begin
();
cit
!=
cards
.
end
();
++
cit
)
for
(
auto
&
pcard
:
cards
)
delete
*
cit
;
delete
pcard
;
for
(
auto
git
=
groups
.
begin
();
git
!=
groups
.
end
();
++
git
)
for
(
auto
&
pgroup
:
groups
)
delete
*
git
;
delete
pgroup
;
for
(
auto
eit
=
effects
.
begin
();
eit
!=
effects
.
end
();
++
eit
)
for
(
auto
&
peffect
:
effects
)
delete
*
ei
t
;
delete
peffec
t
;
delete
game_field
;
delete
game_field
;
cards
.
clear
();
cards
.
clear
();
groups
.
clear
();
groups
.
clear
();
...
@@ -99,8 +99,7 @@ int32 duel::read_buffer(byte* buf) {
...
@@ -99,8 +99,7 @@ int32 duel::read_buffer(byte* buf) {
return
bufferlen
;
return
bufferlen
;
}
}
void
duel
::
release_script_group
()
{
void
duel
::
release_script_group
()
{
for
(
auto
sit
=
sgroups
.
begin
();
sit
!=
sgroups
.
end
();
++
sit
)
{
for
(
auto
&
pgroup
:
sgroups
)
{
group
*
pgroup
=
*
sit
;
if
(
pgroup
->
is_readonly
==
0
)
{
if
(
pgroup
->
is_readonly
==
0
)
{
lua
->
unregister_group
(
pgroup
);
lua
->
unregister_group
(
pgroup
);
groups
.
erase
(
pgroup
);
groups
.
erase
(
pgroup
);
...
@@ -110,8 +109,8 @@ void duel::release_script_group() {
...
@@ -110,8 +109,8 @@ void duel::release_script_group() {
sgroups
.
clear
();
sgroups
.
clear
();
}
}
void
duel
::
restore_assumes
()
{
void
duel
::
restore_assumes
()
{
for
(
auto
sit
=
assumes
.
begin
();
sit
!=
assumes
.
end
();
++
sit
)
for
(
auto
&
pcard
:
assumes
)
(
*
sit
)
->
assume_type
=
0
;
pcard
->
assume_type
=
0
;
assumes
.
clear
();
assumes
.
clear
();
}
}
void
duel
::
write_buffer32
(
uint32
value
)
{
void
duel
::
write_buffer32
(
uint32
value
)
{
...
...
effect.cpp
View file @
96b3763c
...
@@ -520,18 +520,18 @@ int32 effect::is_chainable(uint8 tp) {
...
@@ -520,18 +520,18 @@ int32 effect::is_chainable(uint8 tp) {
}
else
if
(
sp
<
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
triggering_effect
->
get_speed
())
}
else
if
(
sp
<
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
triggering_effect
->
get_speed
())
return
FALSE
;
return
FALSE
;
}
}
for
(
auto
it
=
pduel
->
game_field
->
core
.
chain_limit
.
begin
();
it
!=
pduel
->
game_field
->
core
.
chain_limit
.
end
();
++
it
)
{
for
(
const
auto
&
ch_lim
:
pduel
->
game_field
->
core
.
chain_lim
it
)
{
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
it
->
player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
ch_lim
.
player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
tp
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
tp
,
PARAM_TYPE_INT
);
if
(
!
pduel
->
lua
->
check_condition
(
it
->
function
,
3
))
if
(
!
pduel
->
lua
->
check_condition
(
ch_lim
.
function
,
3
))
return
FALSE
;
return
FALSE
;
}
}
for
(
auto
it
=
pduel
->
game_field
->
core
.
chain_limit_p
.
begin
();
it
!=
pduel
->
game_field
->
core
.
chain_limit_p
.
end
();
++
it
)
{
for
(
const
auto
&
ch_lim_p
:
pduel
->
game_field
->
core
.
chain_limit_p
)
{
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
it
->
player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
ch_lim_p
.
player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
tp
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
tp
,
PARAM_TYPE_INT
);
if
(
!
pduel
->
lua
->
check_condition
(
it
->
function
,
3
))
if
(
!
pduel
->
lua
->
check_condition
(
ch_lim_p
.
function
,
3
))
return
FALSE
;
return
FALSE
;
}
}
return
TRUE
;
return
TRUE
;
...
...
field.cpp
View file @
96b3763c
This diff is collapsed.
Click to expand it.
field.h
View file @
96b3763c
...
@@ -158,7 +158,7 @@ struct processor {
...
@@ -158,7 +158,7 @@ struct processor {
typedef
std
::
vector
<
chain
>
chain_array
;
typedef
std
::
vector
<
chain
>
chain_array
;
typedef
std
::
list
<
processor_unit
>
processor_list
;
typedef
std
::
list
<
processor_unit
>
processor_list
;
typedef
std
::
set
<
card
*
,
card_sort
>
card_set
;
typedef
std
::
set
<
card
*
,
card_sort
>
card_set
;
typedef
std
::
set
<
std
::
pair
<
effect
*
,
tevent
>
>
delayed_effect_collection
;
typedef
std
::
set
<
std
::
pair
<
effect
*
,
tevent
>>
delayed_effect_collection
;
struct
chain_limit_t
{
struct
chain_limit_t
{
chain_limit_t
(
int32
f
,
int32
p
)
:
function
(
f
),
player
(
p
)
{}
chain_limit_t
(
int32
f
,
int32
p
)
:
function
(
f
),
player
(
p
)
{}
int32
function
;
int32
function
;
...
@@ -238,7 +238,7 @@ struct processor {
...
@@ -238,7 +238,7 @@ struct processor {
std
::
unordered_map
<
uint32
,
uint32
>
effect_count_code_duel
;
std
::
unordered_map
<
uint32
,
uint32
>
effect_count_code_duel
;
std
::
unordered_map
<
uint32
,
uint32
>
spsummon_once_map
[
2
];
std
::
unordered_map
<
uint32
,
uint32
>
spsummon_once_map
[
2
];
std
::
unordered_map
<
uint32
,
uint32
>
spsummon_once_map_rst
[
2
];
std
::
unordered_map
<
uint32
,
uint32
>
spsummon_once_map_rst
[
2
];
std
::
multimap
<
int32
,
card
*
,
std
::
greater
<
int32
>
>
xmaterial_lst
;
std
::
multimap
<
int32
,
card
*
,
std
::
greater
<
int32
>>
xmaterial_lst
;
ptr
temp_var
[
4
];
ptr
temp_var
[
4
];
uint32
global_flag
;
uint32
global_flag
;
uint16
pre_field
[
2
];
uint16
pre_field
[
2
];
...
@@ -311,12 +311,12 @@ struct processor {
...
@@ -311,12 +311,12 @@ struct processor {
uint32
hint_timing
[
2
];
uint32
hint_timing
[
2
];
uint8
current_player
;
uint8
current_player
;
uint8
conti_player
;
uint8
conti_player
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>
>
summon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>>
summon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>
>
normalsummon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>>
normalsummon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>
>
spsummon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>>
spsummon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>
>
flipsummon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>>
flipsummon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>
>
attack_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>>
attack_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>
>
chain_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>>
chain_counter
;
processor_list
recover_damage_reserve
;
processor_list
recover_damage_reserve
;
effect_vector
dec_count_reserve
;
effect_vector
dec_count_reserve
;
};
};
...
...
interpreter.cpp
View file @
96b3763c
...
@@ -765,45 +765,45 @@ void interpreter::add_param(ptr param, int32 type, bool front) {
...
@@ -765,45 +765,45 @@ void interpreter::add_param(ptr param, int32 type, bool front) {
void
interpreter
::
push_param
(
lua_State
*
L
,
bool
is_coroutine
)
{
void
interpreter
::
push_param
(
lua_State
*
L
,
bool
is_coroutine
)
{
uint32
type
;
uint32
type
;
int32
pushed
=
0
;
int32
pushed
=
0
;
for
(
auto
it
=
params
.
begin
();
it
!=
params
.
end
();
++
it
)
{
for
(
const
auto
&
it
:
params
)
{
type
=
it
->
second
;
type
=
it
.
second
;
switch
(
type
)
{
switch
(
type
)
{
case
PARAM_TYPE_INT
:
case
PARAM_TYPE_INT
:
lua_pushinteger
(
L
,
(
ptr
)
it
->
first
);
lua_pushinteger
(
L
,
(
ptr
)
it
.
first
);
break
;
break
;
case
PARAM_TYPE_STRING
:
case
PARAM_TYPE_STRING
:
lua_pushstring
(
L
,
(
const
char
*
)
it
->
first
);
lua_pushstring
(
L
,
(
const
char
*
)
it
.
first
);
break
;
break
;
case
PARAM_TYPE_BOOLEAN
:
case
PARAM_TYPE_BOOLEAN
:
lua_pushboolean
(
L
,
(
ptr
)
it
->
first
);
lua_pushboolean
(
L
,
(
ptr
)
it
.
first
);
break
;
break
;
case
PARAM_TYPE_CARD
:
{
case
PARAM_TYPE_CARD
:
{
if
(
it
->
first
)
if
(
it
.
first
)
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
((
card
*
)
it
->
first
)
->
ref_handle
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
((
card
*
)
it
.
first
)
->
ref_handle
);
else
else
lua_pushnil
(
L
);
lua_pushnil
(
L
);
break
;
break
;
}
}
case
PARAM_TYPE_EFFECT
:
{
case
PARAM_TYPE_EFFECT
:
{
if
(
it
->
first
)
if
(
it
.
first
)
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
((
effect
*
)
it
->
first
)
->
ref_handle
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
((
effect
*
)
it
.
first
)
->
ref_handle
);
else
else
lua_pushnil
(
L
);
lua_pushnil
(
L
);
break
;
break
;
}
}
case
PARAM_TYPE_GROUP
:
{
case
PARAM_TYPE_GROUP
:
{
if
(
it
->
first
)
if
(
it
.
first
)
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
((
group
*
)
it
->
first
)
->
ref_handle
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
((
group
*
)
it
.
first
)
->
ref_handle
);
else
else
lua_pushnil
(
L
);
lua_pushnil
(
L
);
break
;
break
;
}
}
case
PARAM_TYPE_FUNCTION
:
{
case
PARAM_TYPE_FUNCTION
:
{
function2value
(
L
,
(
ptr
)
it
->
first
);
function2value
(
L
,
(
ptr
)
it
.
first
);
break
;
break
;
}
}
case
PARAM_TYPE_INDEX
:
{
case
PARAM_TYPE_INDEX
:
{
int32
index
=
(
int32
)(
ptr
)
it
->
first
;
int32
index
=
(
int32
)(
ptr
)
it
.
first
;
if
(
index
>
0
)
if
(
index
>
0
)
lua_pushvalue
(
L
,
index
);
lua_pushvalue
(
L
,
index
);
else
if
(
is_coroutine
)
{
else
if
(
is_coroutine
)
{
...
...
interpreter.h
View file @
96b3763c
...
@@ -34,7 +34,7 @@ class duel;
...
@@ -34,7 +34,7 @@ class duel;
class
interpreter
{
class
interpreter
{
public:
public:
typedef
std
::
unordered_map
<
int32
,
lua_State
*>
coroutine_map
;
typedef
std
::
unordered_map
<
int32
,
lua_State
*>
coroutine_map
;
typedef
std
::
list
<
std
::
pair
<
void
*
,
uint32
>
>
param_list
;
typedef
std
::
list
<
std
::
pair
<
void
*
,
uint32
>>
param_list
;
duel
*
pduel
;
duel
*
pduel
;
char
msgbuf
[
64
];
char
msgbuf
[
64
];
...
...
libcard.cpp
View file @
96b3763c
...
@@ -1273,9 +1273,9 @@ int32 scriptlib::card_get_attacked_group(lua_State *L) {
...
@@ -1273,9 +1273,9 @@ int32 scriptlib::card_get_attacked_group(lua_State *L) {
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
);
group
*
pgroup
=
pcard
->
pduel
->
new_group
();
group
*
pgroup
=
pcard
->
pduel
->
new_group
();
for
(
auto
cit
=
pcard
->
attacked_cards
.
begin
();
cit
!=
pcard
->
attacked_cards
.
end
();
++
cit
)
{
for
(
auto
&
cit
:
pcard
->
attacked_cards
)
{
if
(
cit
->
second
.
first
)
if
(
cit
.
second
.
first
)
pgroup
->
container
.
insert
(
cit
->
second
.
first
);
pgroup
->
container
.
insert
(
cit
.
second
.
first
);
}
}
interpreter
::
group2value
(
L
,
pgroup
);
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
return
1
;
...
@@ -1299,9 +1299,9 @@ int32 scriptlib::card_get_battled_group(lua_State *L) {
...
@@ -1299,9 +1299,9 @@ int32 scriptlib::card_get_battled_group(lua_State *L) {
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
);
group
*
pgroup
=
pcard
->
pduel
->
new_group
();
group
*
pgroup
=
pcard
->
pduel
->
new_group
();
for
(
auto
cit
=
pcard
->
battled_cards
.
begin
();
cit
!=
pcard
->
battled_cards
.
end
();
++
cit
)
{
for
(
auto
&
cit
:
pcard
->
battled_cards
)
{
if
(
cit
->
second
.
first
)
if
(
cit
.
second
.
first
)
pgroup
->
container
.
insert
(
cit
->
second
.
first
);
pgroup
->
container
.
insert
(
cit
.
second
.
first
);
}
}
interpreter
::
group2value
(
L
,
pgroup
);
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
return
1
;
...
@@ -1401,9 +1401,9 @@ int32 scriptlib::card_get_activate_effect(lua_State *L) {
...
@@ -1401,9 +1401,9 @@ int32 scriptlib::card_get_activate_effect(lua_State *L) {
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
);
int32
count
=
0
;
int32
count
=
0
;
for
(
auto
eit
=
pcard
->
field_effect
.
begin
();
eit
!=
pcard
->
field_effect
.
end
();
++
ei
t
)
{
for
(
auto
&
eit
:
pcard
->
field_effec
t
)
{
if
(
eit
->
second
->
type
&
EFFECT_TYPE_ACTIVATE
)
{
if
(
eit
.
second
->
type
&
EFFECT_TYPE_ACTIVATE
)
{
interpreter
::
effect2value
(
L
,
eit
->
second
);
interpreter
::
effect2value
(
L
,
eit
.
second
);
count
++
;
count
++
;
}
}
}
}
...
@@ -2471,13 +2471,13 @@ int32 scriptlib::card_remove_counter(lua_State *L) {
...
@@ -2471,13 +2471,13 @@ int32 scriptlib::card_remove_counter(lua_State *L) {
uint32
reason
=
lua_tointeger
(
L
,
5
);
uint32
reason
=
lua_tointeger
(
L
,
5
);
if
(
countertype
==
0
)
{
if
(
countertype
==
0
)
{
// c38834303: remove all counters
// c38834303: remove all counters
for
(
auto
cmit
=
pcard
->
counters
.
begin
();
cmit
!=
pcard
->
counters
.
end
();
++
cmit
)
{
for
(
const
auto
&
cmit
:
pcard
->
counters
)
{
pcard
->
pduel
->
write_buffer8
(
MSG_REMOVE_COUNTER
);
pcard
->
pduel
->
write_buffer8
(
MSG_REMOVE_COUNTER
);
pcard
->
pduel
->
write_buffer16
(
cmit
->
first
);
pcard
->
pduel
->
write_buffer16
(
cmit
.
first
);
pcard
->
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pcard
->
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pcard
->
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pcard
->
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pcard
->
pduel
->
write_buffer8
(
pcard
->
current
.
sequence
);
pcard
->
pduel
->
write_buffer8
(
pcard
->
current
.
sequence
);
pcard
->
pduel
->
write_buffer16
(
cmit
->
second
[
0
]
+
cmit
->
second
[
1
]);
pcard
->
pduel
->
write_buffer16
(
cmit
.
second
[
0
]
+
cmit
.
second
[
1
]);
}
}
pcard
->
counters
.
clear
();
pcard
->
counters
.
clear
();
return
0
;
return
0
;
...
...
libdebug.cpp
View file @
96b3763c
...
@@ -64,8 +64,8 @@ int32 scriptlib::debug_add_card(lua_State *L) {
...
@@ -64,8 +64,8 @@ int32 scriptlib::debug_add_card(lua_State *L) {
pcard
->
current
.
controler
=
PLAYER_NONE
;
pcard
->
current
.
controler
=
PLAYER_NONE
;
pcard
->
current
.
location
=
LOCATION_OVERLAY
;
pcard
->
current
.
location
=
LOCATION_OVERLAY
;
pcard
->
current
.
sequence
=
fcard
->
xyz_materials
.
size
()
-
1
;
pcard
->
current
.
sequence
=
fcard
->
xyz_materials
.
size
()
-
1
;
for
(
auto
eit
=
pcard
->
xmaterial_effect
.
begin
();
eit
!=
pcard
->
xmaterial_effect
.
end
();
++
ei
t
)
{
for
(
auto
&
eit
:
pcard
->
xmaterial_effec
t
)
{
effect
*
peffect
=
eit
->
second
;
effect
*
peffect
=
eit
.
second
;
if
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
if
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
pduel
->
game_field
->
add_effect
(
peffect
);
pduel
->
game_field
->
add_effect
(
peffect
);
}
}
...
...
libduel.cpp
View file @
96b3763c
...
@@ -881,11 +881,11 @@ int32 scriptlib::duel_confirm_cards(lua_State *L) {
...
@@ -881,11 +881,11 @@ int32 scriptlib::duel_confirm_cards(lua_State *L) {
pduel
->
write_buffer8
(
pcard
->
current
.
sequence
);
pduel
->
write_buffer8
(
pcard
->
current
.
sequence
);
}
else
{
}
else
{
pduel
->
write_buffer8
(
pgroup
->
container
.
size
());
pduel
->
write_buffer8
(
pgroup
->
container
.
size
());
for
(
auto
cit
=
pgroup
->
container
.
begin
();
cit
!=
pgroup
->
container
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
pgroup
->
container
)
{
pduel
->
write_buffer32
(
(
*
cit
)
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
(
*
cit
)
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
(
*
cit
)
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
(
*
cit
)
->
current
.
sequence
);
pduel
->
write_buffer8
(
pcard
->
current
.
sequence
);
}
}
}
}
pduel
->
game_field
->
add_process
(
PROCESSOR_WAIT
,
0
,
0
,
0
,
0
,
0
);
pduel
->
game_field
->
add_process
(
PROCESSOR_WAIT
,
0
,
0
,
0
,
0
,
0
);
...
@@ -1042,15 +1042,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
...
@@ -1042,15 +1042,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
}
}
if
(
!
ret
&&
(
loc
&
LOCATION_SZONE
))
{
if
(
!
ret
&&
(
loc
&
LOCATION_SZONE
))
{
if
(
playerid
==
0
||
playerid
==
PLAYER_ALL
)
{
if
(
playerid
==
0
||
playerid
==
PLAYER_ALL
)
{
for
(
auto
cit
=
pduel
->
game_field
->
player
[
0
].
list_szone
.
begin
();
cit
!=
pduel
->
game_field
->
player
[
0
].
list_szone
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
0
].
list_szone
)
{
card
*
pcard
=
*
cit
;
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
ret
=
1
;
ret
=
1
;
}
}
}
}
if
(
playerid
==
1
||
playerid
==
PLAYER_ALL
)
{
if
(
playerid
==
1
||
playerid
==
PLAYER_ALL
)
{
for
(
auto
cit
=
pduel
->
game_field
->
player
[
1
].
list_szone
.
begin
();
cit
!=
pduel
->
game_field
->
player
[
1
].
list_szone
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
0
].
list_szone
)
{
card
*
pcard
=
*
cit
;
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
ret
=
1
;
ret
=
1
;
}
}
...
@@ -1058,15 +1056,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
...
@@ -1058,15 +1056,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
}
}
if
(
!
ret
&&
(
loc
&
LOCATION_MZONE
))
{
if
(
!
ret
&&
(
loc
&
LOCATION_MZONE
))
{
if
(
playerid
==
0
||
playerid
==
PLAYER_ALL
)
{
if
(
playerid
==
0
||
playerid
==
PLAYER_ALL
)
{
for
(
auto
cit
=
pduel
->
game_field
->
player
[
0
].
list_mzone
.
begin
();
cit
!=
pduel
->
game_field
->
player
[
0
].
list_mzone
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
0
].
list_mzone
)
{
card
*
pcard
=
*
cit
;
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
ret
=
1
;
ret
=
1
;
}
}
}
}
if
(
playerid
==
1
||
playerid
==
PLAYER_ALL
)
{
if
(
playerid
==
1
||
playerid
==
PLAYER_ALL
)
{
for
(
auto
cit
=
pduel
->
game_field
->
player
[
1
].
list_mzone
.
begin
();
cit
!=
pduel
->
game_field
->
player
[
1
].
list_mzone
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
0
].
list_mzone
)
{
card
*
pcard
=
*
cit
;
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
ret
=
1
;
ret
=
1
;
}
}
...
@@ -1175,15 +1171,14 @@ int32 scriptlib::duel_equip(lua_State *L) {
...
@@ -1175,15 +1171,14 @@ int32 scriptlib::duel_equip(lua_State *L) {
int32
scriptlib
::
duel_equip_complete
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_equip_complete
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
field
::
card_set
etargets
;
field
::
card_set
etargets
;
for
(
auto
cit
=
pduel
->
game_field
->
core
.
equiping_cards
.
begin
();
cit
!=
pduel
->
game_field
->
core
.
equiping_cards
.
end
();
++
cit
)
{
for
(
auto
&
equip_card
:
pduel
->
game_field
->
core
.
equiping_cards
)
{
card
*
equip_card
=
*
cit
;
if
(
equip_card
->
is_position
(
POS_FACEUP
))
if
(
equip_card
->
is_position
(
POS_FACEUP
))
equip_card
->
enable_field_effect
(
true
);
equip_card
->
enable_field_effect
(
true
);
etargets
.
insert
(
equip_card
->
equiping_target
);
etargets
.
insert
(
equip_card
->
equiping_target
);
}
}
pduel
->
game_field
->
adjust_instant
();
pduel
->
game_field
->
adjust_instant
();
for
(
auto
cit
=
etargets
.
begin
();
cit
!=
etargets
.
end
();
++
cit
)
for
(
auto
&
equip_target
:
etargets
)
pduel
->
game_field
->
raise_single_event
(
*
ci
t
,
&
pduel
->
game_field
->
core
.
equiping_cards
,
EVENT_EQUIP
,
pduel
->
game_field
->
raise_single_event
(
equip_targe
t
,
&
pduel
->
game_field
->
core
.
equiping_cards
,
EVENT_EQUIP
,
pduel
->
game_field
->
core
.
reason_effect
,
0
,
pduel
->
game_field
->
core
.
reason_player
,
PLAYER_NONE
,
0
);
pduel
->
game_field
->
core
.
reason_effect
,
0
,
pduel
->
game_field
->
core
.
reason_player
,
PLAYER_NONE
,
0
);
pduel
->
game_field
->
raise_event
(
&
pduel
->
game_field
->
core
.
equiping_cards
,
EVENT_EQUIP
,
pduel
->
game_field
->
raise_event
(
&
pduel
->
game_field
->
core
.
equiping_cards
,
EVENT_EQUIP
,
pduel
->
game_field
->
core
.
reason_effect
,
0
,
pduel
->
game_field
->
core
.
reason_player
,
PLAYER_NONE
,
0
);
pduel
->
game_field
->
core
.
reason_effect
,
0
,
pduel
->
game_field
->
core
.
reason_player
,
PLAYER_NONE
,
0
);
...
@@ -1365,8 +1360,7 @@ int32 scriptlib::duel_shuffle_setcard(lua_State *L) {
...
@@ -1365,8 +1360,7 @@ int32 scriptlib::duel_shuffle_setcard(lua_State *L) {
uint8
tp
=
2
;
uint8
tp
=
2
;
uint8
loc
=
0
;
uint8
loc
=
0
;
uint8
ct
=
0
;
uint8
ct
=
0
;
for
(
auto
cit
=
pgroup
->
container
.
begin
();
cit
!=
pgroup
->
container
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
pgroup
->
container
)
{
card
*
pcard
=
*
cit
;
if
((
loc
!=
0
&&
(
pcard
->
current
.
location
!=
loc
))
||
(
pcard
->
current
.
location
!=
LOCATION_MZONE
&&
pcard
->
current
.
location
!=
LOCATION_SZONE
)
if
((
loc
!=
0
&&
(
pcard
->
current
.
location
!=
loc
))
||
(
pcard
->
current
.
location
!=
LOCATION_MZONE
&&
pcard
->
current
.
location
!=
LOCATION_SZONE
)
||
(
pcard
->
current
.
position
&
POS_FACEUP
)
||
(
pcard
->
current
.
sequence
>
4
)
||
(
tp
!=
2
&&
(
pcard
->
current
.
controler
!=
tp
)))
||
(
pcard
->
current
.
position
&
POS_FACEUP
)
||
(
pcard
->
current
.
sequence
>
4
)
||
(
tp
!=
2
&&
(
pcard
->
current
.
controler
!=
tp
)))
return
0
;
return
0
;
...
@@ -1615,11 +1609,11 @@ int32 scriptlib::duel_disable_summon(lua_State *L) {
...
@@ -1615,11 +1609,11 @@ int32 scriptlib::duel_disable_summon(lua_State *L) {
if
((
pcard
->
summon_info
&
SUMMON_TYPE_PENDULUM
)
!=
SUMMON_TYPE_PENDULUM
)
if
((
pcard
->
summon_info
&
SUMMON_TYPE_PENDULUM
)
!=
SUMMON_TYPE_PENDULUM
)
pcard
->
set_status
(
STATUS_PROC_COMPLETE
,
FALSE
);
pcard
->
set_status
(
STATUS_PROC_COMPLETE
,
FALSE
);
}
else
{
}
else
{
for
(
auto
cit
=
pgroup
->
container
.
begin
();
cit
!=
pgroup
->
container
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
pgroup
->
container
)
{
(
*
cit
)
->
set_status
(
STATUS_SUMMONING
,
FALSE
);
pcard
->
set_status
(
STATUS_SUMMONING
,
FALSE
);
(
*
cit
)
->
set_status
(
STATUS_SUMMON_DISABLED
,
TRUE
);
pcard
->
set_status
(
STATUS_SUMMON_DISABLED
,
TRUE
);
if
((
(
*
cit
)
->
summon_info
&
SUMMON_TYPE_PENDULUM
)
!=
SUMMON_TYPE_PENDULUM
)
if
((
pcard
->
summon_info
&
SUMMON_TYPE_PENDULUM
)
!=
SUMMON_TYPE_PENDULUM
)
(
*
cit
)
->
set_status
(
STATUS_PROC_COMPLETE
,
FALSE
);
pcard
->
set_status
(
STATUS_PROC_COMPLETE
,
FALSE
);
}
}
}
}
return
0
;
return
0
;
...
@@ -1695,8 +1689,7 @@ int32 scriptlib::duel_get_mzone_count(lua_State *L) {
...
@@ -1695,8 +1689,7 @@ int32 scriptlib::duel_get_mzone_count(lua_State *L) {
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
2
);
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
2
);
for
(
int32
p
=
0
;
p
<
2
;
p
++
)
{
for
(
int32
p
=
0
;
p
<
2
;
p
++
)
{
uint32
digit
=
1
;
uint32
digit
=
1
;
for
(
auto
cit
=
pduel
->
game_field
->
player
[
p
].
list_mzone
.
begin
();
cit
!=
pduel
->
game_field
->
player
[
p
].
list_mzone
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
p
].
list_mzone
)
{
card
*
pcard
=
*
cit
;
if
(
pcard
&&
pcard
!=
mcard
&&
!
(
mgroup
&&
mgroup
->
container
.
find
(
pcard
)
!=
mgroup
->
container
.
end
()))
{
if
(
pcard
&&
pcard
!=
mcard
&&
!
(
mgroup
&&
mgroup
->
container
.
find
(
pcard
)
!=
mgroup
->
container
.
end
()))
{
used_location
[
p
]
|=
digit
;
used_location
[
p
]
|=
digit
;
list_mzone
[
p
].
push_back
(
pcard
);
list_mzone
[
p
].
push_back
(
pcard
);
...
@@ -1753,8 +1746,7 @@ int32 scriptlib::duel_get_location_count_fromex(lua_State *L) {
...
@@ -1753,8 +1746,7 @@ int32 scriptlib::duel_get_location_count_fromex(lua_State *L) {
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
3
);
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
3
);
for
(
int32
p
=
0
;
p
<
2
;
p
++
)
{
for
(
int32
p
=
0
;
p
<
2
;
p
++
)
{
uint32
digit
=
1
;
uint32
digit
=
1
;
for
(
auto
cit
=
pduel
->
game_field
->
player
[
p
].
list_mzone
.
begin
();
cit
!=
pduel
->
game_field
->
player
[
p
].
list_mzone
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
p
].
list_mzone
)
{
card
*
pcard
=
*
cit
;
if
(
pcard
&&
pcard
!=
mcard
&&
!
(
mgroup
&&
mgroup
->
container
.
find
(
pcard
)
!=
mgroup
->
container
.
end
()))
{
if
(
pcard
&&
pcard
!=
mcard
&&
!
(
mgroup
&&
mgroup
->
container
.
find
(
pcard
)
!=
mgroup
->
container
.
end
()))
{
used_location
[
p
]
|=
digit
;
used_location
[
p
]
|=
digit
;
list_mzone
[
p
].
push_back
(
pcard
);
list_mzone
[
p
].
push_back
(
pcard
);
...
@@ -1959,8 +1951,8 @@ int32 scriptlib::duel_get_first_target(lua_State *L) {
...
@@ -1959,8 +1951,8 @@ int32 scriptlib::duel_get_first_target(lua_State *L) {
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
0
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
0
);
if
(
!
ch
||
!
ch
->
target_cards
||
ch
->
target_cards
->
container
.
size
()
==
0
)
if
(
!
ch
||
!
ch
->
target_cards
||
ch
->
target_cards
->
container
.
size
()
==
0
)
return
0
;
return
0
;
for
(
auto
iter
=
ch
->
target_cards
->
container
.
begin
();
iter
!=
ch
->
target_cards
->
container
.
end
();
++
it
er
)
for
(
auto
&
pcard
:
ch
->
target_cards
->
contain
er
)
interpreter
::
card2value
(
L
,
*
iter
);
interpreter
::
card2value
(
L
,
pcard
);
return
ch
->
target_cards
->
container
.
size
();
return
ch
->
target_cards
->
container
.
size
();
}
}
int32
scriptlib
::
duel_get_current_phase
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_current_phase
(
lua_State
*
L
)
{
...
@@ -2811,8 +2803,8 @@ int32 scriptlib::duel_set_target_card(lua_State *L) {
...
@@ -2811,8 +2803,8 @@ int32 scriptlib::duel_set_target_card(lua_State *L) {
pcard
->
create_relation
(
*
ch
);
pcard
->
create_relation
(
*
ch
);
}
else
{
}
else
{
targets
->
container
.
insert
(
pgroup
->
container
.
begin
(),
pgroup
->
container
.
end
());
targets
->
container
.
insert
(
pgroup
->
container
.
begin
(),
pgroup
->
container
.
end
());
for
(
auto
cit
=
pgroup
->
container
.
begin
();
cit
!=
pgroup
->
container
.
end
();
++
cit
)
for
(
auto
&
pcard
:
pgroup
->
container
)
(
*
cit
)
->
create_relation
(
*
ch
);
pcard
->
create_relation
(
*
ch
);
}
}
if
(
peffect
->
is_flag
(
EFFECT_FLAG_CARD_TARGET
))
{
if
(
peffect
->
is_flag
(
EFFECT_FLAG_CARD_TARGET
))
{
if
(
pcard
)
{
if
(
pcard
)
{
...
@@ -2822,12 +2814,12 @@ int32 scriptlib::duel_set_target_card(lua_State *L) {
...
@@ -2822,12 +2814,12 @@ int32 scriptlib::duel_set_target_card(lua_State *L) {
pduel
->
write_buffer8
(
1
);
pduel
->
write_buffer8
(
1
);
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
}
else
{
}
else
{
for
(
auto
cit
=
pgroup
->
container
.
begin
();
cit
!=
pgroup
->
container
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
pgroup
->
container
)
{
if
(
(
*
cit
)
->
current
.
location
&
0x30
)
if
(
pcard
->
current
.
location
&
0x30
)
pduel
->
game_field
->
move_card
(
(
*
cit
)
->
current
.
controler
,
(
*
cit
),
(
*
cit
)
->
current
.
location
,
0
);
pduel
->
game_field
->
move_card
(
pcard
->
current
.
controler
,
pcard
,
pcard
->
current
.
location
,
0
);
pduel
->
write_buffer8
(
MSG_BECOME_TARGET
);
pduel
->
write_buffer8
(
MSG_BECOME_TARGET
);
pduel
->
write_buffer8
(
1
);
pduel
->
write_buffer8
(
1
);
pduel
->
write_buffer32
(
(
*
cit
)
->
get_info_location
());
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
}
}
}
}
}
}
...
@@ -3085,8 +3077,7 @@ int32 scriptlib::duel_hint_selection(lua_State *L) {
...
@@ -3085,8 +3077,7 @@ int32 scriptlib::duel_hint_selection(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pgroup
->
pduel
;
duel
*
pduel
=
pgroup
->
pduel
;
for
(
auto
cit
=
pgroup
->
container
.
begin
();
cit
!=
pgroup
->
container
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
pgroup
->
container
)
{
card
*
pcard
=
*
cit
;
pduel
->
write_buffer8
(
MSG_BECOME_TARGET
);
pduel
->
write_buffer8
(
MSG_BECOME_TARGET
);
pduel
->
write_buffer8
(
1
);
pduel
->
write_buffer8
(
1
);
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
...
@@ -3667,8 +3658,8 @@ int32 scriptlib::duel_check_chain_uniqueness(lua_State *L) {
...
@@ -3667,8 +3658,8 @@ int32 scriptlib::duel_check_chain_uniqueness(lua_State *L) {
return
1
;
return
1
;
}
}
std
::
set
<
uint32
>
er
;
std
::
set
<
uint32
>
er
;
for
(
auto
cait
=
pduel
->
game_field
->
core
.
current_chain
.
begin
();
cait
!=
pduel
->
game_field
->
core
.
current_chain
.
end
();
++
cait
)
for
(
const
auto
&
ch
:
pduel
->
game_field
->
core
.
current_chain
)
er
.
insert
(
c
ait
->
triggering_effect
->
get_handler
()
->
get_code
());
er
.
insert
(
c
h
.
triggering_effect
->
get_handler
()
->
get_code
());
if
(
er
.
size
()
==
pduel
->
game_field
->
core
.
current_chain
.
size
())
if
(
er
.
size
()
==
pduel
->
game_field
->
core
.
current_chain
.
size
())
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
...
libgroup.cpp
View file @
96b3763c
This diff is collapsed.
Click to expand it.
ocgapi.cpp
View file @
96b3763c
...
@@ -225,14 +225,14 @@ extern "C" DECL_DLLEXPORT int32 query_field_count(ptr pduel, uint8 playerid, uin
...
@@ -225,14 +225,14 @@ extern "C" DECL_DLLEXPORT int32 query_field_count(ptr pduel, uint8 playerid, uin
return
player
.
list_main
.
size
();
return
player
.
list_main
.
size
();
if
(
location
==
LOCATION_MZONE
)
{
if
(
location
==
LOCATION_MZONE
)
{
uint32
count
=
0
;
uint32
count
=
0
;
for
(
auto
cit
=
player
.
list_mzone
.
begin
();
cit
!=
player
.
list_mzone
.
end
();
++
cit
)
for
(
auto
&
pcard
:
player
.
list_mzone
)
if
(
*
cit
)
count
++
;
if
(
pcard
)
count
++
;
return
count
;
return
count
;
}
}
if
(
location
==
LOCATION_SZONE
)
{
if
(
location
==
LOCATION_SZONE
)
{
uint32
count
=
0
;
uint32
count
=
0
;
for
(
auto
cit
=
player
.
list_szone
.
begin
();
cit
!=
player
.
list_szone
.
end
();
++
cit
)
for
(
auto
&
pcard
:
player
.
list_szone
)
if
(
*
cit
)
count
++
;
if
(
pcard
)
count
++
;
return
count
;
return
count
;
}
}
return
0
;
return
0
;
...
@@ -244,8 +244,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint
...
@@ -244,8 +244,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint
auto
&
player
=
ptduel
->
game_field
->
player
[
playerid
];
auto
&
player
=
ptduel
->
game_field
->
player
[
playerid
];
byte
*
p
=
buf
;
byte
*
p
=
buf
;
if
(
location
==
LOCATION_MZONE
)
{
if
(
location
==
LOCATION_MZONE
)
{
for
(
auto
cit
=
player
.
list_mzone
.
begin
();
cit
!=
player
.
list_mzone
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
player
.
list_mzone
)
{
card
*
pcard
=
*
cit
;
if
(
pcard
)
{
if
(
pcard
)
{
uint32
clen
=
pcard
->
get_infos
(
p
,
query_flag
,
use_cache
);
uint32
clen
=
pcard
->
get_infos
(
p
,
query_flag
,
use_cache
);
p
+=
clen
;
p
+=
clen
;
...
@@ -255,8 +254,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint
...
@@ -255,8 +254,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint
}
}
}
}
}
else
if
(
location
==
LOCATION_SZONE
)
{
}
else
if
(
location
==
LOCATION_SZONE
)
{
for
(
auto
cit
=
player
.
list_szone
.
begin
();
cit
!=
player
.
list_szone
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
player
.
list_szone
)
{
card
*
pcard
=
*
cit
;
if
(
pcard
)
{
if
(
pcard
)
{
uint32
clen
=
pcard
->
get_infos
(
p
,
query_flag
,
use_cache
);
uint32
clen
=
pcard
->
get_infos
(
p
,
query_flag
,
use_cache
);
p
+=
clen
;
p
+=
clen
;
...
@@ -277,8 +275,8 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint
...
@@ -277,8 +275,8 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint
lst
=
&
player
.
list_extra
;
lst
=
&
player
.
list_extra
;
else
if
(
location
==
LOCATION_DECK
)
else
if
(
location
==
LOCATION_DECK
)
lst
=
&
player
.
list_main
;
lst
=
&
player
.
list_main
;
for
(
auto
cit
=
lst
->
begin
();
cit
!=
lst
->
end
();
++
ci
t
)
{
for
(
auto
&
pcard
:
*
ls
t
)
{
uint32
clen
=
(
*
cit
)
->
get_infos
(
p
,
query_flag
,
use_cache
);
uint32
clen
=
pcard
->
get_infos
(
p
,
query_flag
,
use_cache
);
p
+=
clen
;
p
+=
clen
;
}
}
}
}
...
@@ -293,8 +291,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
...
@@ -293,8 +291,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
auto
&
player
=
ptduel
->
game_field
->
player
[
playerid
];
auto
&
player
=
ptduel
->
game_field
->
player
[
playerid
];
*
((
int
*
)
p
)
=
player
.
lp
;
*
((
int
*
)
p
)
=
player
.
lp
;
p
+=
4
;
p
+=
4
;
for
(
auto
cit
=
player
.
list_mzone
.
begin
();
cit
!=
player
.
list_mzone
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
player
.
list_mzone
)
{
card
*
pcard
=
*
cit
;
if
(
pcard
)
{
if
(
pcard
)
{
*
p
++
=
1
;
*
p
++
=
1
;
*
p
++
=
pcard
->
current
.
position
;
*
p
++
=
pcard
->
current
.
position
;
...
@@ -303,8 +300,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
...
@@ -303,8 +300,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
*
p
++
=
0
;
*
p
++
=
0
;
}
}
}
}
for
(
auto
cit
=
player
.
list_szone
.
begin
();
cit
!=
player
.
list_szone
.
end
();
++
cit
)
{
for
(
auto
&
pcard
:
player
.
list_szone
)
{
card
*
pcard
=
*
cit
;
if
(
pcard
)
{
if
(
pcard
)
{
*
p
++
=
1
;
*
p
++
=
1
;
*
p
++
=
pcard
->
current
.
position
;
*
p
++
=
pcard
->
current
.
position
;
...
@@ -320,15 +316,15 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
...
@@ -320,15 +316,15 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
*
p
++
=
player
.
extra_p_count
;
*
p
++
=
player
.
extra_p_count
;
}
}
*
p
++
=
ptduel
->
game_field
->
core
.
current_chain
.
size
();
*
p
++
=
ptduel
->
game_field
->
core
.
current_chain
.
size
();
for
(
auto
chit
=
ptduel
->
game_field
->
core
.
current_chain
.
begin
();
chit
!=
ptduel
->
game_field
->
core
.
current_chain
.
end
();
++
chit
)
{
for
(
const
auto
&
ch
:
ptduel
->
game_field
->
core
.
current_chain
)
{
effect
*
peffect
=
ch
it
->
triggering_effect
;
effect
*
peffect
=
ch
.
triggering_effect
;
*
((
int
*
)
p
)
=
peffect
->
get_handler
()
->
data
.
code
;
*
((
int
*
)
p
)
=
peffect
->
get_handler
()
->
data
.
code
;
p
+=
4
;
p
+=
4
;
*
((
int
*
)
p
)
=
peffect
->
get_handler
()
->
get_info_location
();
*
((
int
*
)
p
)
=
peffect
->
get_handler
()
->
get_info_location
();
p
+=
4
;
p
+=
4
;
*
p
++
=
ch
it
->
triggering_controler
;
*
p
++
=
ch
.
triggering_controler
;
*
p
++
=
(
uint8
)
ch
it
->
triggering_location
;
*
p
++
=
(
uint8
)
ch
.
triggering_location
;
*
p
++
=
ch
it
->
triggering_sequence
;
*
p
++
=
ch
.
triggering_sequence
;
*
((
int
*
)
p
)
=
peffect
->
description
;
*
((
int
*
)
p
)
=
peffect
->
description
;
p
+=
4
;
p
+=
4
;
}
}
...
...
operations.cpp
View file @
96b3763c
This diff is collapsed.
Click to expand it.
playerop.cpp
View file @
96b3763c
This diff is collapsed.
Click to expand it.
processor.cpp
View file @
96b3763c
This diff is collapsed.
Click to expand it.
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