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
d8510201
Commit
d8510201
authored
Feb 24, 2020
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
eea64f9f
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
875 additions
and
929 deletions
+875
-929
Classes/ocgcore/card.cpp
Classes/ocgcore/card.cpp
+17
-82
Classes/ocgcore/card.h
Classes/ocgcore/card.h
+10
-10
Classes/ocgcore/common.h
Classes/ocgcore/common.h
+0
-4
Classes/ocgcore/duel.h
Classes/ocgcore/duel.h
+1
-1
Classes/ocgcore/effect.cpp
Classes/ocgcore/effect.cpp
+1
-2
Classes/ocgcore/effect.h
Classes/ocgcore/effect.h
+2
-2
Classes/ocgcore/field.cpp
Classes/ocgcore/field.cpp
+30
-30
Classes/ocgcore/field.h
Classes/ocgcore/field.h
+30
-31
Classes/ocgcore/group.h
Classes/ocgcore/group.h
+1
-1
Classes/ocgcore/interpreter.cpp
Classes/ocgcore/interpreter.cpp
+8
-8
Classes/ocgcore/interpreter.h
Classes/ocgcore/interpreter.h
+2
-3
Classes/ocgcore/libcard.cpp
Classes/ocgcore/libcard.cpp
+147
-145
Classes/ocgcore/libdebug.cpp
Classes/ocgcore/libdebug.cpp
+19
-19
Classes/ocgcore/libduel.cpp
Classes/ocgcore/libduel.cpp
+406
-406
Classes/ocgcore/libeffect.cpp
Classes/ocgcore/libeffect.cpp
+32
-32
Classes/ocgcore/libgroup.cpp
Classes/ocgcore/libgroup.cpp
+30
-30
Classes/ocgcore/ocgapi.cpp
Classes/ocgcore/ocgapi.cpp
+18
-18
Classes/ocgcore/operations.cpp
Classes/ocgcore/operations.cpp
+45
-45
Classes/ocgcore/playerop.cpp
Classes/ocgcore/playerop.cpp
+29
-29
Classes/ocgcore/processor.cpp
Classes/ocgcore/processor.cpp
+47
-31
No files found.
Classes/ocgcore/card.cpp
View file @
d8510201
...
...
@@ -172,17 +172,17 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
query_flag
&=
~
QUERY_EQUIP_CARD
;
}
if
(
query_flag
&
QUERY_TARGET_CARD
)
{
*
p
++
=
effect_target_cards
.
size
();
*
p
++
=
(
int32
)
effect_target_cards
.
size
();
for
(
auto
&
pcard
:
effect_target_cards
)
*
p
++
=
pcard
->
get_info_location
();
}
if
(
query_flag
&
QUERY_OVERLAY_CARD
)
{
*
p
++
=
xyz_materials
.
size
();
*
p
++
=
(
int32
)
xyz_materials
.
size
();
for
(
auto
&
xcard
:
xyz_materials
)
*
p
++
=
xcard
->
data
.
code
;
}
if
(
query_flag
&
QUERY_COUNTERS
)
{
*
p
++
=
counters
.
size
();
*
p
++
=
(
int32
)
counters
.
size
();
for
(
const
auto
&
cmit
:
counters
)
*
p
++
=
cmit
.
first
+
((
cmit
.
second
[
0
]
+
cmit
.
second
[
1
])
<<
16
);
}
...
...
@@ -223,7 +223,7 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
}
else
query_flag
&=
~
QUERY_LINK
;
}
}
*
(
uint32
*
)
buf
=
(
byte
*
)
p
-
buf
;
*
(
uint32
*
)
buf
=
(
uint32
)((
byte
*
)
p
-
buf
)
;
#ifdef _IRR_ANDROID_PLATFORM_
memcpy
(
buf
+
4
,
&
query_flag
,
sizeof
(
uint32
));
#else
...
...
@@ -513,7 +513,7 @@ int32 card::get_base_attack() {
eset
.
sort
();
// calculate continuous effects of this first
for
(
int32
i
=
0
;
i
<
eset
.
size
();)
{
if
(
(
eset
[
i
]
->
type
&
EFFECT_TYPE_SINGLE
)
&&
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
))
{
if
(
!
(
eset
[
i
]
->
type
&
EFFECT_TYPE_SINGLE
)
||
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
))
{
switch
(
eset
[
i
]
->
code
)
{
case
EFFECT_SET_BASE_ATTACK
:
batk
=
eset
[
i
]
->
get_value
(
this
);
...
...
@@ -577,7 +577,6 @@ int32 card::get_attack() {
filter_effect
(
EFFECT_UPDATE_ATTACK
,
&
eset
,
FALSE
);
filter_effect
(
EFFECT_SET_ATTACK
,
&
eset
,
FALSE
);
filter_effect
(
EFFECT_SET_ATTACK_FINAL
,
&
eset
,
FALSE
);
filter_effect
(
EFFECT_SWAP_ATTACK_FINAL
,
&
eset
,
FALSE
);
filter_effect
(
EFFECT_SET_BASE_ATTACK
,
&
eset
,
FALSE
);
if
(
!
(
data
.
type
&
TYPE_LINK
))
{
filter_effect
(
EFFECT_SWAP_AD
,
&
eset
,
FALSE
);
...
...
@@ -590,7 +589,7 @@ int32 card::get_attack() {
rev
=
TRUE
;
effect_set
effects_atk
,
effects_atk_r
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();)
{
if
(
(
eset
[
i
]
->
type
&
EFFECT_TYPE_SINGLE
)
&&
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
))
{
if
(
!
(
eset
[
i
]
->
type
&
EFFECT_TYPE_SINGLE
)
||
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
))
{
switch
(
eset
[
i
]
->
code
)
{
case
EFFECT_SET_BASE_ATTACK
:
batk
=
eset
[
i
]
->
get_value
(
this
);
...
...
@@ -641,11 +640,6 @@ int32 card::get_attack() {
batk
=
0
;
atk
=
-
1
;
break
;
case
EFFECT_SWAP_ATTACK_FINAL
:
atk
=
eset
[
i
]
->
get_value
(
this
);
up_atk
=
0
;
upc_atk
=
0
;
break
;
case
EFFECT_SET_BASE_DEFENSE
:
bdef
=
eset
[
i
]
->
get_value
(
this
);
if
(
bdef
<
0
)
...
...
@@ -710,7 +704,7 @@ int32 card::get_base_defense() {
filter_effect
(
EFFECT_SET_BASE_ATTACK
,
&
eset
,
FALSE
);
eset
.
sort
();
for
(
int32
i
=
0
;
i
<
eset
.
size
();)
{
if
(
(
eset
[
i
]
->
type
&
EFFECT_TYPE_SINGLE
)
&&
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
))
{
if
(
!
(
eset
[
i
]
->
type
&
EFFECT_TYPE_SINGLE
)
||
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
))
{
switch
(
eset
[
i
]
->
code
)
{
case
EFFECT_SET_BASE_ATTACK
:
batk
=
eset
[
i
]
->
get_value
(
this
);
...
...
@@ -777,7 +771,6 @@ int32 card::get_defense() {
filter_effect
(
EFFECT_UPDATE_DEFENSE
,
&
eset
,
FALSE
);
filter_effect
(
EFFECT_SET_DEFENSE
,
&
eset
,
FALSE
);
filter_effect
(
EFFECT_SET_DEFENSE_FINAL
,
&
eset
,
FALSE
);
filter_effect
(
EFFECT_SWAP_DEFENSE_FINAL
,
&
eset
,
FALSE
);
filter_effect
(
EFFECT_SWAP_BASE_AD
,
&
eset
,
FALSE
);
filter_effect
(
EFFECT_SET_BASE_ATTACK
,
&
eset
,
FALSE
);
filter_effect
(
EFFECT_SET_BASE_DEFENSE
,
&
eset
,
FALSE
);
...
...
@@ -787,7 +780,7 @@ int32 card::get_defense() {
rev
=
TRUE
;
effect_set
effects_def
,
effects_def_r
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();)
{
if
(
(
eset
[
i
]
->
type
&
EFFECT_TYPE_SINGLE
)
&&
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
))
{
if
(
!
(
eset
[
i
]
->
type
&
EFFECT_TYPE_SINGLE
)
||
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
))
{
switch
(
eset
[
i
]
->
code
)
{
case
EFFECT_SET_BASE_ATTACK
:
batk
=
eset
[
i
]
->
get_value
(
this
);
...
...
@@ -838,11 +831,6 @@ int32 card::get_defense() {
bdef
=
0
;
def
=
-
1
;
break
;
case
EFFECT_SWAP_DEFENSE_FINAL
:
def
=
eset
[
i
]
->
get_value
(
this
);
up_def
=
0
;
upc_def
=
0
;
break
;
case
EFFECT_SET_BASE_ATTACK
:
batk
=
eset
[
i
]
->
get_value
(
this
);
if
(
batk
<
0
)
...
...
@@ -1481,7 +1469,7 @@ void card::xyz_add(card* mat, card_set* des) {
mat
->
overlay_target
=
this
;
mat
->
current
.
controler
=
PLAYER_NONE
;
mat
->
current
.
location
=
LOCATION_OVERLAY
;
mat
->
current
.
sequence
=
xyz_materials
.
size
()
-
1
;
mat
->
current
.
sequence
=
(
uint8
)
xyz_materials
.
size
()
-
1
;
mat
->
current
.
reason
=
REASON_XYZ
+
REASON_MATERIAL
;
for
(
auto
&
eit
:
mat
->
xmaterial_effect
)
{
effect
*
peffect
=
eit
.
second
;
...
...
@@ -1502,7 +1490,7 @@ void card::xyz_remove(card* mat) {
mat
->
current
.
sequence
=
0
;
mat
->
overlay_target
=
0
;
for
(
auto
clit
=
xyz_materials
.
begin
();
clit
!=
xyz_materials
.
end
();
++
clit
)
(
*
clit
)
->
current
.
sequence
=
clit
-
xyz_materials
.
begin
(
);
(
*
clit
)
->
current
.
sequence
=
(
uint8
)(
clit
-
xyz_materials
.
begin
()
);
for
(
auto
&
eit
:
mat
->
xmaterial_effect
)
{
effect
*
peffect
=
eit
.
second
;
if
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
...
...
@@ -1915,7 +1903,8 @@ void card::reset(uint32 id, uint32 reset_type) {
}
}
if
(
id
&
RESET_TURN_SET
)
{
if
(
effect
*
peffect
=
check_control_effect
())
{
effect
*
peffect
=
std
::
get
<
effect
*>
(
refresh_control_status
());
if
(
peffect
&&
(
!
(
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
||
peffect
->
condition
))
{
effect
*
new_effect
=
pduel
->
new_effect
();
new_effect
->
id
=
peffect
->
id
;
new_effect
->
owner
=
this
;
...
...
@@ -1968,8 +1957,9 @@ void card::refresh_disable_status() {
if
(
pre_dis
!=
cur_dis
)
filter_immune_effect
();
}
uint8
card
::
refresh_control_status
()
{
std
::
tuple
<
uint8
,
effect
*>
card
::
refresh_control_status
()
{
uint8
final
=
owner
;
effect
*
ceffect
=
nullptr
;
uint32
last_id
=
0
;
if
(
pduel
->
game_field
->
core
.
remove_brainwashing
&&
is_affected_by_effect
(
EFFECT_REMOVE_BRAINWASHING
))
last_id
=
pduel
->
game_field
->
core
.
last_control_changed_id
;
...
...
@@ -1978,18 +1968,11 @@ uint8 card::refresh_control_status() {
if
(
eset
.
size
())
{
effect
*
peffect
=
eset
.
get_last
();
if
(
peffect
->
id
>=
last_id
)
{
card
*
pcard
=
peffect
->
get_handler
();
uint8
val
=
(
uint8
)
peffect
->
get_value
(
this
);
if
(
val
!=
current
.
controler
)
pduel
->
game_field
->
core
.
readjust_map
[
pcard
]
++
;
if
(
pduel
->
game_field
->
core
.
readjust_map
[
pcard
]
>
5
)
{
pduel
->
game_field
->
send_to
(
pcard
,
0
,
REASON_RULE
,
peffect
->
get_handler_player
(),
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
POS_FACEUP
);
return
final
;
}
final
=
val
;
final
=
(
uint8
)
peffect
->
get_value
(
this
);
ceffect
=
peffect
;
}
}
return
final
;
return
std
::
make_tuple
(
final
,
ceffect
)
;
}
void
card
::
count_turn
(
uint16
ct
)
{
turn_counter
=
ct
;
...
...
@@ -2734,54 +2717,6 @@ effect* card::is_affected_by_effect(int32 code, card* target) {
}
return
0
;
}
effect
*
card
::
check_control_effect
()
{
effect
*
ret_effect
=
0
;
for
(
auto
&
pcard
:
equiping_cards
)
{
auto
rg
=
pcard
->
equip_effect
.
equal_range
(
EFFECT_SET_CONTROL
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
effect
*
peffect
=
rg
.
first
->
second
;
if
(
!
ret_effect
||
peffect
->
id
>
ret_effect
->
id
)
ret_effect
=
peffect
;
}
}
for
(
auto
&
pcard
:
effect_target_owner
)
{
auto
rg
=
pcard
->
target_effect
.
equal_range
(
EFFECT_SET_CONTROL
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
effect
*
peffect
=
rg
.
first
->
second
;
if
(
!
ret_effect
||
peffect
->
is_target
(
pcard
)
&&
peffect
->
id
>
ret_effect
->
id
)
ret_effect
=
peffect
;
}
}
for
(
auto
&
pcard
:
xyz_materials
)
{
auto
rg
=
pcard
->
xmaterial_effect
.
equal_range
(
EFFECT_SET_CONTROL
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
effect
*
peffect
=
rg
.
first
->
second
;
if
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
continue
;
if
(
!
ret_effect
||
peffect
->
id
>
ret_effect
->
id
)
ret_effect
=
peffect
;
}
}
auto
rg
=
single_effect
.
equal_range
(
EFFECT_SET_CONTROL
);
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
effect
*
peffect
=
rg
.
first
->
second
;
if
(
!
peffect
->
condition
)
continue
;
if
(
!
ret_effect
||
peffect
->
id
>
ret_effect
->
id
)
ret_effect
=
peffect
;
}
/*
rg = pduel->game_field->effects.aura_effect.equal_range(EFFECT_SET_CONTROL);
for(; rg.first != rg.second; ++rg.first) {
effect* peffect = rg.first->second;
if(peffect->is_flag(EFFECT_FLAG_PLAYER_TARGET) || !peffect->is_target(this))
continue;
if(!ret_effect || peffect->id > ret_effect->id)
ret_effect = peffect;
}
*/
return
ret_effect
;
}
int32
card
::
fusion_check
(
group
*
fusion_m
,
card
*
cg
,
uint32
chkf
,
uint8
not_material
)
{
group
*
matgroup
=
0
;
if
(
fusion_m
&&
!
not_material
)
{
...
...
Classes/ocgcore/card.h
View file @
d8510201
...
...
@@ -14,6 +14,7 @@
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
class
card
;
class
duel
;
...
...
@@ -93,14 +94,14 @@ public:
return
std
::
hash
<
uint16
>
()(
v
.
second
);
}
};
typedef
std
::
vector
<
card
*>
card_vector
;
typedef
std
::
multimap
<
uint32
,
effect
*>
effect_container
;
typedef
std
::
set
<
card
*
,
card_sort
>
card_set
;
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_map
<
card
*
,
uint32
>
relation_map
;
typedef
std
::
map
<
uint16
,
std
::
array
<
uint16
,
2
>>
counter_map
;
typedef
std
::
map
<
uint32
,
int32
>
effect_count
;
using
card_vector
=
std
::
vector
<
card
*>
;
using
effect_container
=
std
::
multimap
<
uint32
,
effect
*>
;
using
card_set
=
std
::
set
<
card
*
,
card_sort
>
;
using
effect_indexer
=
std
::
unordered_map
<
effect
*
,
effect_container
::
iterator
>
;
using
effect_relation
=
std
::
unordered_set
<
std
::
pair
<
effect
*
,
uint16
>
,
effect_relation_hash
>
;
using
relation_map
=
std
::
unordered_map
<
card
*
,
uint32
>
;
using
counter_map
=
std
::
map
<
uint16
,
std
::
array
<
uint16
,
2
>>
;
using
effect_count
=
std
::
map
<
uint32
,
int32
>
;
class
attacker_map
:
public
std
::
unordered_map
<
uint16
,
std
::
pair
<
card
*
,
uint32
>>
{
public:
void
addcard
(
card
*
pcard
);
...
...
@@ -257,7 +258,7 @@ public:
void
reset
(
uint32
id
,
uint32
reset_type
);
void
reset_effect_count
();
void
refresh_disable_status
();
uint8
refresh_control_status
();
std
::
tuple
<
uint8
,
effect
*>
refresh_control_status
();
void
count_turn
(
uint16
ct
);
void
create_relation
(
card
*
target
,
uint32
reset
);
...
...
@@ -294,7 +295,6 @@ public:
void
filter_spsummon_procedure_g
(
uint8
playerid
,
effect_set
*
eset
);
effect
*
is_affected_by_effect
(
int32
code
);
effect
*
is_affected_by_effect
(
int32
code
,
card
*
target
);
effect
*
check_control_effect
();
int32
fusion_check
(
group
*
fusion_m
,
card
*
cg
,
uint32
chkf
,
uint8
not_material
);
void
fusion_select
(
uint8
playerid
,
group
*
fusion_m
,
card
*
cg
,
uint32
chkf
,
uint8
not_material
);
int32
check_fusion_substitute
(
card
*
fcard
);
...
...
Classes/ocgcore/common.h
View file @
d8510201
...
...
@@ -8,10 +8,6 @@
#ifndef COMMON_H_
#define COMMON_H_
#ifdef _MSC_VER
#pragma warning(disable: 4244)
#endif
typedef
unsigned
long
uptr
;
typedef
unsigned
long
long
uint64
;
typedef
unsigned
int
uint32
;
...
...
Classes/ocgcore/duel.h
View file @
d8510201
...
...
@@ -21,7 +21,7 @@ class interpreter;
class
duel
{
public:
typedef
std
::
set
<
card
*
,
card_sort
>
card_set
;
using
card_set
=
std
::
set
<
card
*
,
card_sort
>
;
char
strbuffer
[
256
];
byte
buffer
[
0x1000
];
uint32
bufferlen
;
...
...
Classes/ocgcore/effect.cpp
View file @
d8510201
...
...
@@ -270,8 +270,7 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
if
(
phandler
->
is_position
(
POS_FACEUP
)
&&
!
phandler
->
is_status
(
STATUS_EFFECT_ENABLED
))
return
FALSE
;
}
if
(
!
(
type
&
(
EFFECT_TYPE_FLIP
|
EFFECT_TYPE_TRIGGER_F
))
&&
!
((
type
&
EFFECT_TYPE_SINGLE
)
&&
(
code
==
EVENT_TO_GRAVE
||
code
==
EVENT_DESTROYED
||
code
==
EVENT_SPSUMMON_SUCCESS
||
code
==
EVENT_TO_HAND
||
code
==
EVENT_REMOVE
||
code
==
EVENT_FLIP
)))
{
if
(
!
(
type
&
(
EFFECT_TYPE_FLIP
|
EFFECT_TYPE_TRIGGER_F
))
&&
!
((
type
&
EFFECT_TYPE_TRIGGER_O
)
&&
(
type
&
EFFECT_TYPE_SINGLE
)))
{
if
((
code
<
1132
||
code
>
1149
)
&&
pduel
->
game_field
->
infos
.
phase
==
PHASE_DAMAGE
&&
!
is_flag
(
EFFECT_FLAG_DAMAGE_STEP
))
return
FALSE
;
if
((
code
<
1134
||
code
>
1136
)
&&
pduel
->
game_field
->
infos
.
phase
==
PHASE_DAMAGE_CAL
&&
!
is_flag
(
EFFECT_FLAG_DAMAGE_CAL
))
...
...
Classes/ocgcore/effect.h
View file @
d8510201
...
...
@@ -301,8 +301,8 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_REVERSE_UPDATE 108 //
#define EFFECT_SWAP_AD 109 //
#define EFFECT_SWAP_BASE_AD 110 //
#define EFFECT_SWAP_ATTACK_FINAL 111
#define EFFECT_SWAP_DEFENSE_FINAL 112
//
#define EFFECT_SWAP_ATTACK_FINAL 111
//
#define EFFECT_SWAP_DEFENSE_FINAL 112
#define EFFECT_ADD_CODE 113 //
#define EFFECT_CHANGE_CODE 114 //
#define EFFECT_ADD_TYPE 115 //
...
...
Classes/ocgcore/field.cpp
View file @
d8510201
...
...
@@ -133,7 +133,7 @@ void field::reload_field_info() {
if
(
pcard
)
{
pduel
->
write_buffer8
(
1
);
pduel
->
write_buffer8
(
pcard
->
current
.
position
);
pduel
->
write_buffer8
(
pcard
->
xyz_materials
.
size
());
pduel
->
write_buffer8
(
(
uint8
)
pcard
->
xyz_materials
.
size
());
}
else
{
pduel
->
write_buffer8
(
0
);
}
...
...
@@ -146,14 +146,14 @@ void field::reload_field_info() {
pduel
->
write_buffer8
(
0
);
}
}
pduel
->
write_buffer8
(
player
[
playerid
].
list_main
.
size
());
pduel
->
write_buffer8
(
player
[
playerid
].
list_hand
.
size
());
pduel
->
write_buffer8
(
player
[
playerid
].
list_grave
.
size
());
pduel
->
write_buffer8
(
player
[
playerid
].
list_remove
.
size
());
pduel
->
write_buffer8
(
player
[
playerid
].
list_extra
.
size
());
pduel
->
write_buffer8
(
player
[
playerid
].
extra_p_count
);
pduel
->
write_buffer8
(
(
uint8
)
player
[
playerid
].
list_main
.
size
());
pduel
->
write_buffer8
(
(
uint8
)
player
[
playerid
].
list_hand
.
size
());
pduel
->
write_buffer8
(
(
uint8
)
player
[
playerid
].
list_grave
.
size
());
pduel
->
write_buffer8
(
(
uint8
)
player
[
playerid
].
list_remove
.
size
());
pduel
->
write_buffer8
(
(
uint8
)
player
[
playerid
].
list_extra
.
size
());
pduel
->
write_buffer8
(
(
uint8
)
player
[
playerid
].
extra_p_count
);
}
pduel
->
write_buffer8
(
core
.
current_chain
.
size
());
pduel
->
write_buffer8
(
(
uint8
)
core
.
current_chain
.
size
());
for
(
const
auto
&
ch
:
core
.
current_chain
)
{
effect
*
peffect
=
ch
.
triggering_effect
;
pduel
->
write_buffer32
(
peffect
->
get_handler
()
->
data
.
code
);
...
...
@@ -191,13 +191,13 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
case
LOCATION_DECK
:
{
if
(
sequence
==
0
)
{
//deck top
player
[
playerid
].
list_main
.
push_back
(
pcard
);
pcard
->
current
.
sequence
=
player
[
playerid
].
list_main
.
size
()
-
1
;
pcard
->
current
.
sequence
=
(
uint8
)
player
[
playerid
].
list_main
.
size
()
-
1
;
}
else
if
(
sequence
==
1
)
{
//deck bottom
player
[
playerid
].
list_main
.
insert
(
player
[
playerid
].
list_main
.
begin
(),
pcard
);
reset_sequence
(
playerid
,
LOCATION_DECK
);
}
else
{
//deck top & shuffle
player
[
playerid
].
list_main
.
push_back
(
pcard
);
pcard
->
current
.
sequence
=
player
[
playerid
].
list_main
.
size
()
-
1
;
pcard
->
current
.
sequence
=
(
uint8
)
player
[
playerid
].
list_main
.
size
()
-
1
;
if
(
!
core
.
shuffle_check_disabled
)
core
.
shuffle_deck_check
[
playerid
]
=
TRUE
;
}
...
...
@@ -206,7 +206,7 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
}
case
LOCATION_HAND
:
{
player
[
playerid
].
list_hand
.
push_back
(
pcard
);
pcard
->
current
.
sequence
=
player
[
playerid
].
list_hand
.
size
()
-
1
;
pcard
->
current
.
sequence
=
(
uint8
)
player
[
playerid
].
list_hand
.
size
()
-
1
;
uint32
pos
=
pcard
->
is_affected_by_effect
(
EFFECT_PUBLIC
)
?
POS_FACEUP
:
POS_FACEDOWN
;
pcard
->
sendto_param
.
position
=
pos
;
if
(
!
(
pcard
->
current
.
reason
&
REASON_DRAW
)
&&
!
core
.
shuffle_check_disabled
)
...
...
@@ -215,12 +215,12 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
}
case
LOCATION_GRAVE
:
{
player
[
playerid
].
list_grave
.
push_back
(
pcard
);
pcard
->
current
.
sequence
=
player
[
playerid
].
list_grave
.
size
()
-
1
;
pcard
->
current
.
sequence
=
(
uint8
)
player
[
playerid
].
list_grave
.
size
()
-
1
;
break
;
}
case
LOCATION_REMOVED
:
{
player
[
playerid
].
list_remove
.
push_back
(
pcard
);
pcard
->
current
.
sequence
=
player
[
playerid
].
list_remove
.
size
()
-
1
;
pcard
->
current
.
sequence
=
(
uint8
)
player
[
playerid
].
list_remove
.
size
()
-
1
;
break
;
}
case
LOCATION_EXTRA
:
{
...
...
@@ -523,7 +523,7 @@ 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
)
if
((
core
.
remove_brainwashing
&&
pcard
->
is_affected_by_effect
(
EFFECT_REMOVE_BRAINWASHING
))
||
std
::
get
<
uint8
>
(
pcard
->
refresh_control_status
()
)
==
playerid
)
return
;
effect
*
peffect
=
pduel
->
new_effect
();
if
(
core
.
reason_effect
)
...
...
@@ -944,7 +944,7 @@ void field::shuffle(uint8 playerid, uint8 location) {
}
}
if
(
location
==
LOCATION_HAND
||
!
(
core
.
duel_options
&
DUEL_PSEUDO_SHUFFLE
))
{
uint32
s
=
svector
.
size
();
uint32
s
=
(
uint32
)
svector
.
size
();
if
(
location
==
LOCATION_EXTRA
)
s
=
s
-
player
[
playerid
].
extra_p_count
;
if
(
s
>
1
)
{
...
...
@@ -961,7 +961,7 @@ void field::shuffle(uint8 playerid, uint8 location) {
if
(
location
==
LOCATION_HAND
||
location
==
LOCATION_EXTRA
)
{
pduel
->
write_buffer8
((
location
==
LOCATION_HAND
)
?
MSG_SHUFFLE_HAND
:
MSG_SHUFFLE_EXTRA
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
svector
.
size
());
pduel
->
write_buffer8
(
(
uint8
)
svector
.
size
());
for
(
auto
&
pcard
:
svector
)
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
if
(
location
==
LOCATION_HAND
)
{
...
...
@@ -1080,7 +1080,7 @@ void field::swap_deck_and_grave(uint8 playerid) {
shuffle
(
playerid
,
LOCATION_DECK
);
}
void
field
::
reverse_deck
(
uint8
playerid
)
{
int32
count
=
player
[
playerid
].
list_main
.
size
();
int32
count
=
(
int32
)
player
[
playerid
].
list_main
.
size
();
if
(
count
==
0
)
return
;
for
(
int32
i
=
0
;
i
<
count
/
2
;
++
i
)
{
...
...
@@ -1125,10 +1125,10 @@ void field::tag_swap(uint8 playerid) {
}
pduel
->
write_buffer8
(
MSG_TAG_SWAP
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
player
[
playerid
].
list_main
.
size
());
pduel
->
write_buffer8
(
player
[
playerid
].
list_extra
.
size
());
pduel
->
write_buffer8
(
player
[
playerid
].
extra_p_count
);
pduel
->
write_buffer8
(
player
[
playerid
].
list_hand
.
size
());
pduel
->
write_buffer8
(
(
uint8
)
player
[
playerid
].
list_main
.
size
());
pduel
->
write_buffer8
(
(
uint8
)
player
[
playerid
].
list_extra
.
size
());
pduel
->
write_buffer8
(
(
uint8
)
player
[
playerid
].
extra_p_count
);
pduel
->
write_buffer8
(
(
uint8
)
player
[
playerid
].
list_hand
.
size
());
if
(
core
.
deck_reversed
&&
player
[
playerid
].
list_main
.
size
())
pduel
->
write_buffer32
(
player
[
playerid
].
list_main
.
back
()
->
data
.
code
);
else
...
...
@@ -1625,27 +1625,27 @@ int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, g
if
(
location
&
LOCATION_HAND
)
{
if
(
pgroup
)
pgroup
->
container
.
insert
(
player
[
self
].
list_hand
.
begin
(),
player
[
self
].
list_hand
.
end
());
count
+=
player
[
self
].
list_hand
.
size
();
count
+=
(
uint32
)
player
[
self
].
list_hand
.
size
();
}
if
(
location
&
LOCATION_DECK
)
{
if
(
pgroup
)
pgroup
->
container
.
insert
(
player
[
self
].
list_main
.
rbegin
(),
player
[
self
].
list_main
.
rend
());
count
+=
player
[
self
].
list_main
.
size
();
count
+=
(
uint32
)
player
[
self
].
list_main
.
size
();
}
if
(
location
&
LOCATION_EXTRA
)
{
if
(
pgroup
)
pgroup
->
container
.
insert
(
player
[
self
].
list_extra
.
rbegin
(),
player
[
self
].
list_extra
.
rend
());
count
+=
player
[
self
].
list_extra
.
size
();
count
+=
(
uint32
)
player
[
self
].
list_extra
.
size
();
}
if
(
location
&
LOCATION_GRAVE
)
{
if
(
pgroup
)
pgroup
->
container
.
insert
(
player
[
self
].
list_grave
.
rbegin
(),
player
[
self
].
list_grave
.
rend
());
count
+=
player
[
self
].
list_grave
.
size
();
count
+=
(
uint32
)
player
[
self
].
list_grave
.
size
();
}
if
(
location
&
LOCATION_REMOVED
)
{
if
(
pgroup
)
pgroup
->
container
.
insert
(
player
[
self
].
list_remove
.
rbegin
(),
player
[
self
].
list_remove
.
rend
());
count
+=
player
[
self
].
list_remove
.
size
();
count
+=
(
uint32
)
player
[
self
].
list_remove
.
size
();
}
location
=
location2
;
self
=
1
-
self
;
...
...
@@ -1905,7 +1905,7 @@ int32 field::get_overlay_count(uint8 self, uint8 s, uint8 o) {
if
(
c
)
{
for
(
auto
&
pcard
:
player
[
self
].
list_mzone
)
{
if
(
pcard
&&
!
pcard
->
get_status
(
STATUS_SUMMONING
|
STATUS_SPSUMMON_STEP
))
count
+=
pcard
->
xyz_materials
.
size
();
count
+=
(
uint32
)
pcard
->
xyz_materials
.
size
();
}
}
self
=
1
-
self
;
...
...
@@ -2782,7 +2782,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
card_set
mcset
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
mcset
.
insert
(
eset
[
i
]
->
handler
);
int32
mct
=
mcset
.
size
();
int32
mct
=
(
int32
)
mcset
.
size
();
if
(
mct
>
0
)
{
if
(
ct
==
0
&&
std
::
none_of
(
mcset
.
begin
(),
mcset
.
end
(),
[
=
](
card
*
pcard
)
{
return
handover_zone_cards
.
find
(
pcard
)
!=
handover_zone_cards
.
end
();
}))
...
...
@@ -2839,7 +2839,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
pcard
->
sum_param
|=
1
;
++
cit
;
}
ct
+=
std
::
count_if
(
mcset
.
begin
(),
mcset
.
end
(),
ct
+=
(
int32
)
std
::
count_if
(
mcset
.
begin
(),
mcset
.
end
(),
[
=
](
card
*
pcard
)
{
return
handover_zone_cards
.
find
(
pcard
)
!=
handover_zone_cards
.
end
();
});
std
::
multimap
<
int32
,
card
*
,
std
::
greater
<
int32
>>
mat
;
for
(
int32
icheck
=
1
;
icheck
<=
digit
;
icheck
<<=
1
)
{
...
...
@@ -3272,7 +3272,7 @@ chain* field::get_chain(uint32 chaincount) {
if
(
chaincount
==
0
&&
core
.
continuous_chain
.
size
()
&&
(
core
.
reason_effect
->
type
&
EFFECT_TYPE_CONTINUOUS
))
return
&
core
.
continuous_chain
.
back
();
if
(
chaincount
==
0
||
chaincount
>
core
.
current_chain
.
size
())
{
chaincount
=
core
.
current_chain
.
size
();
chaincount
=
(
uint32
)
core
.
current_chain
.
size
();
if
(
chaincount
==
0
)
return
0
;
}
...
...
Classes/ocgcore/field.h
View file @
d8510201
...
...
@@ -44,7 +44,7 @@ struct optarget {
int32
op_param
;
};
struct
chain
{
typedef
std
::
unordered_map
<
uint32
,
optarget
>
opmap
;
using
opmap
=
std
::
unordered_map
<
uint32
,
optarget
>
;
uint16
chain_id
;
uint8
chain_count
;
uint8
triggering_player
;
...
...
@@ -68,7 +68,7 @@ struct chain {
};
struct
player_info
{
typedef
std
::
vector
<
card
*>
card_vector
;
using
card_vector
=
std
::
vector
<
card
*>
;
int32
lp
;
int32
start_count
;
int32
draw_count
;
...
...
@@ -88,12 +88,12 @@ struct player_info {
card_vector
tag_list_extra
;
};
struct
field_effect
{
typedef
std
::
multimap
<
uint32
,
effect
*>
effect_container
;
typedef
std
::
unordered_map
<
effect
*
,
effect_container
::
iterator
>
effect_indexer
;
typedef
std
::
unordered_map
<
effect
*
,
effect
*>
oath_effects
;
typedef
std
::
unordered_set
<
effect
*>
effect_collection
;
typedef
std
::
unordered_map
<
card
*
,
effect
*>
gain_effects
;
typedef
std
::
unordered_map
<
effect
*
,
gain_effects
>
grant_effect_container
;
using
effect_container
=
std
::
multimap
<
uint32
,
effect
*>
;
using
effect_indexer
=
std
::
unordered_map
<
effect
*
,
effect_container
::
iterator
>
;
using
oath_effects
=
std
::
unordered_map
<
effect
*
,
effect
*>
;
using
effect_collection
=
std
::
unordered_set
<
effect
*>
;
using
gain_effects
=
std
::
unordered_map
<
card
*
,
effect
*>
;
using
grant_effect_container
=
std
::
unordered_map
<
effect
*
,
gain_effects
>
;
effect_container
aura_effect
;
effect_container
ignition_effect
;
...
...
@@ -150,23 +150,23 @@ union return_value {
int64
lvalue
[
8
];
};
struct
processor
{
typedef
std
::
vector
<
effect
*>
effect_vector
;
typedef
std
::
vector
<
card
*>
card_vector
;
typedef
std
::
vector
<
uint32
>
option_vector
;
typedef
std
::
list
<
card
*>
card_list
;
typedef
std
::
list
<
tevent
>
event_list
;
typedef
std
::
list
<
chain
>
chain_list
;
typedef
std
::
map
<
effect
*
,
chain
>
instant_f_list
;
typedef
std
::
vector
<
chain
>
chain_array
;
typedef
std
::
list
<
processor_unit
>
processor_list
;
typedef
std
::
set
<
card
*
,
card_sort
>
card_set
;
typedef
std
::
set
<
std
::
pair
<
effect
*
,
tevent
>>
delayed_effect_collection
;
using
effect_vector
=
std
::
vector
<
effect
*>
;
using
card_vector
=
std
::
vector
<
card
*>
;
using
option_vector
=
std
::
vector
<
uint32
>
;
using
card_list
=
std
::
list
<
card
*>
;
using
event_list
=
std
::
list
<
tevent
>
;
using
chain_list
=
std
::
list
<
chain
>
;
using
instant_f_list
=
std
::
map
<
effect
*
,
chain
>
;
using
chain_array
=
std
::
vector
<
chain
>
;
using
processor_list
=
std
::
list
<
processor_unit
>
;
using
card_set
=
std
::
set
<
card
*
,
card_sort
>
;
using
delayed_effect_collection
=
std
::
set
<
std
::
pair
<
effect
*
,
tevent
>>
;
struct
chain_limit_t
{
chain_limit_t
(
int32
f
,
int32
p
)
:
function
(
f
),
player
(
p
)
{}
int32
function
;
int32
player
;
};
typedef
std
::
vector
<
chain_limit_t
>
chain_limit_list
;
using
chain_limit_list
=
std
::
vector
<
chain_limit_t
>
;
processor_list
units
;
processor_list
subunits
;
...
...
@@ -209,7 +209,6 @@ struct processor {
chain_list
new_ochain_h
;
chain_list
new_chains
;
delayed_effect_collection
delayed_quick_tmp
;
delayed_effect_collection
delayed_quick_break
;
delayed_effect_collection
delayed_quick
;
instant_f_list
quick_f_chain
;
card_set
leave_confirmed
;
...
...
@@ -335,16 +334,16 @@ struct processor {
};
class
field
{
public:
typedef
std
::
multimap
<
uint32
,
effect
*>
effect_container
;
typedef
std
::
set
<
card
*
,
card_sort
>
card_set
;
typedef
std
::
vector
<
effect
*>
effect_vector
;
typedef
std
::
vector
<
card
*>
card_vector
;
typedef
std
::
list
<
card
*>
card_list
;
typedef
std
::
list
<
tevent
>
event_list
;
typedef
std
::
list
<
chain
>
chain_list
;
typedef
std
::
map
<
effect
*
,
chain
>
instant_f_list
;
typedef
std
::
vector
<
chain
>
chain_array
;
typedef
std
::
list
<
processor_unit
>
processor_list
;
using
effect_container
=
std
::
multimap
<
uint32
,
effect
*>
;
using
card_set
=
std
::
set
<
card
*
,
card_sort
>
;
using
effect_vector
=
std
::
vector
<
effect
*>
;
using
card_vector
=
std
::
vector
<
card
*>
;
using
card_list
=
std
::
list
<
card
*>
;
using
event_list
=
std
::
list
<
tevent
>
;
using
chain_list
=
std
::
list
<
chain
>
;
using
instant_f_list
=
std
::
map
<
effect
*
,
chain
>
;
using
chain_array
=
std
::
vector
<
chain
>
;
using
processor_list
=
std
::
list
<
processor_unit
>
;
duel
*
pduel
;
player_info
player
[
2
];
...
...
Classes/ocgcore/group.h
View file @
d8510201
...
...
@@ -17,7 +17,7 @@ class duel;
class
group
{
public:
typedef
std
::
set
<
card
*
,
card_sort
>
card_set
;
using
card_set
=
std
::
set
<
card
*
,
card_sort
>
;
int32
ref_handle
;
duel
*
pduel
;
card_set
container
;
...
...
Classes/ocgcore/interpreter.cpp
View file @
d8510201
...
...
@@ -183,7 +183,7 @@ void interpreter::push_param(lua_State* L, bool is_coroutine) {
lua_pushstring
(
L
,
(
const
char
*
)
it
.
first
);
break
;
case
PARAM_TYPE_BOOLEAN
:
lua_pushboolean
(
L
,
(
ptr
)
it
.
first
);
lua_pushboolean
(
L
,
(
int32
)(
ptr
)
it
.
first
);
break
;
case
PARAM_TYPE_CARD
:
{
if
(
it
.
first
)
...
...
@@ -207,7 +207,7 @@ void interpreter::push_param(lua_State* L, bool is_coroutine) {
break
;
}
case
PARAM_TYPE_FUNCTION
:
{
function2value
(
L
,
(
ptr
)
it
.
first
);
function2value
(
L
,
(
int32
)(
ptr
)
it
.
first
);
break
;
}
case
PARAM_TYPE_INDEX
:
{
...
...
@@ -433,7 +433,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg
}
return
OPERATION_FAIL
;
}
int32
result
=
lua_isinteger
(
current_state
,
-
1
)
?
lua_tointeger
(
current_state
,
-
1
)
:
std
::
round
(
lua_tonumber
(
current_state
,
-
1
)
);
int32
result
=
lua_isinteger
(
current_state
,
-
1
)
?
(
int32
)
lua_tointeger
(
current_state
,
-
1
)
:
(
int32
)
lua_tonumber
(
current_state
,
-
1
);
lua_pop
(
current_state
,
1
);
no_action
--
;
call_depth
--
;
...
...
@@ -455,9 +455,9 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count) {
if
(
lua_isboolean
(
current_state
,
-
1
))
result
=
lua_toboolean
(
current_state
,
-
1
);
else
if
(
lua_isinteger
(
current_state
,
-
1
))
result
=
lua_tointeger
(
current_state
,
-
1
);
result
=
(
int32
)
lua_tointeger
(
current_state
,
-
1
);
else
result
=
std
::
round
(
lua_tonumber
(
current_state
,
-
1
)
);
result
=
(
int32
)
lua_tonumber
(
current_state
,
-
1
);
lua_pop
(
current_state
,
1
);
no_action
--
;
call_depth
--
;
...
...
@@ -491,9 +491,9 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count, std::vector<i
if
(
lua_isboolean
(
current_state
,
index
))
return_value
=
lua_toboolean
(
current_state
,
index
);
else
if
(
lua_isinteger
(
current_state
,
index
))
return_value
=
lua_tointeger
(
current_state
,
index
);
return_value
=
(
int32
)
lua_tointeger
(
current_state
,
index
);
else
return_value
=
std
::
round
(
lua_tonumber
(
current_state
,
index
)
);
return_value
=
(
int32
)
lua_tonumber
(
current_state
,
index
);
result
->
push_back
(
return_value
);
}
lua_settop
(
current_state
,
stack_top
);
...
...
@@ -554,7 +554,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
if
(
result
==
0
)
{
coroutines
.
erase
(
f
);
if
(
yield_value
)
*
yield_value
=
lua_isboolean
(
rthread
,
-
1
)
?
lua_toboolean
(
rthread
,
-
1
)
:
lua_tointeger
(
rthread
,
-
1
);
*
yield_value
=
lua_isboolean
(
rthread
,
-
1
)
?
lua_toboolean
(
rthread
,
-
1
)
:
(
uint32
)
lua_tointeger
(
rthread
,
-
1
);
current_state
=
lua_state
;
call_depth
--
;
if
(
call_depth
==
0
)
{
...
...
Classes/ocgcore/interpreter.h
View file @
d8510201
...
...
@@ -15,7 +15,6 @@
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
class
card
;
class
effect
;
...
...
@@ -24,8 +23,8 @@ class duel;
class
interpreter
{
public:
typedef
std
::
unordered_map
<
int32
,
lua_State
*>
coroutine_map
;
typedef
std
::
list
<
std
::
pair
<
void
*
,
uint32
>>
param_list
;
using
coroutine_map
=
std
::
unordered_map
<
int32
,
lua_State
*>
;
using
param_list
=
std
::
list
<
std
::
pair
<
void
*
,
uint32
>>
;
duel
*
pduel
;
char
msgbuf
[
64
];
...
...
Classes/ocgcore/libcard.cpp
View file @
d8510201
This diff is collapsed.
Click to expand it.
Classes/ocgcore/libdebug.cpp
View file @
d8510201
...
...
@@ -25,12 +25,12 @@ int32 scriptlib::debug_message(lua_State *L) {
int32
scriptlib
::
debug_add_card
(
lua_State
*
L
)
{
check_param_count
(
L
,
6
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
code
=
lua_tointeger
(
L
,
1
);
int32
owner
=
lua_tointeger
(
L
,
2
);
int32
playerid
=
lua_tointeger
(
L
,
3
);
int32
location
=
lua_tointeger
(
L
,
4
);
int32
sequence
=
lua_tointeger
(
L
,
5
);
int32
position
=
lua_tointeger
(
L
,
6
);
int32
code
=
(
int32
)
lua_tointeger
(
L
,
1
);
int32
owner
=
(
int32
)
lua_tointeger
(
L
,
2
);
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
3
);
int32
location
=
(
int32
)
lua_tointeger
(
L
,
4
);
int32
sequence
=
(
int32
)
lua_tointeger
(
L
,
5
);
int32
position
=
(
int32
)
lua_tointeger
(
L
,
6
);
int32
proc
=
lua_toboolean
(
L
,
7
);
if
(
owner
!=
0
&&
owner
!=
1
)
return
0
;
...
...
@@ -65,7 +65,7 @@ int32 scriptlib::debug_add_card(lua_State *L) {
pcard
->
overlay_target
=
fcard
;
pcard
->
current
.
controler
=
PLAYER_NONE
;
pcard
->
current
.
location
=
LOCATION_OVERLAY
;
pcard
->
current
.
sequence
=
fcard
->
xyz_materials
.
size
()
-
1
;
pcard
->
current
.
sequence
=
(
uint8
)
fcard
->
xyz_materials
.
size
()
-
1
;
for
(
auto
&
eit
:
pcard
->
xmaterial_effect
)
{
effect
*
peffect
=
eit
.
second
;
if
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
...
...
@@ -79,10 +79,10 @@ int32 scriptlib::debug_add_card(lua_State *L) {
int32
scriptlib
::
debug_set_player_info
(
lua_State
*
L
)
{
check_param_count
(
L
,
4
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
playerid
=
lua_tointeger
(
L
,
1
);
uint32
lp
=
lua_tointeger
(
L
,
2
);
uint32
startcount
=
lua_tointeger
(
L
,
3
);
uint32
drawcount
=
lua_tointeger
(
L
,
4
);
uint32
playerid
=
(
uint32
)
lua_tointeger
(
L
,
1
);
uint32
lp
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint32
startcount
=
(
uint32
)
lua_tointeger
(
L
,
3
);
uint32
drawcount
=
(
uint32
)
lua_tointeger
(
L
,
4
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
pduel
->
game_field
->
player
[
playerid
].
lp
=
lp
;
...
...
@@ -94,10 +94,10 @@ int32 scriptlib::debug_pre_summon(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
summon_type
=
lua_tointeger
(
L
,
2
);
uint32
summon_type
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint8
summon_location
=
0
;
if
(
lua_gettop
(
L
)
>
2
)
summon_location
=
lua_tointeger
(
L
,
3
);
summon_location
=
(
uint8
)
lua_tointeger
(
L
,
3
);
pcard
->
summon_info
=
summon_type
|
(
summon_location
<<
16
);
return
0
;
}
...
...
@@ -132,8 +132,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
countertype
=
lua_tointeger
(
L
,
2
);
uint32
count
=
lua_tointeger
(
L
,
3
);
uint32
countertype
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint32
count
=
(
uint32
)
lua_tointeger
(
L
,
3
);
uint16
cttype
=
countertype
&
~
COUNTER_NEED_ENABLE
;
auto
pr
=
pcard
->
counters
.
emplace
(
cttype
,
card
::
counter_map
::
mapped_type
());
auto
cmit
=
pr
.
first
;
...
...
@@ -150,8 +150,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
int32
scriptlib
::
debug_reload_field_begin
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
flag
=
lua_tointeger
(
L
,
1
);
int32
rule
=
lua_tointeger
(
L
,
2
);
uint32
flag
=
(
uint32
)
lua_tointeger
(
L
,
1
);
int32
rule
=
(
int32
)
lua_tointeger
(
L
,
2
);
pduel
->
clear
();
pduel
->
game_field
->
core
.
duel_options
=
flag
;
if
(
rule
)
...
...
@@ -177,7 +177,7 @@ int32 scriptlib::debug_set_ai_name(lua_State *L) {
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
write_buffer8
(
MSG_AI_NAME
);
const
char
*
pstr
=
lua_tostring
(
L
,
1
);
int
len
=
strlen
(
pstr
);
int
len
=
(
int
)
strlen
(
pstr
);
if
(
len
>
100
)
len
=
100
;
pduel
->
write_buffer16
(
len
);
...
...
@@ -193,7 +193,7 @@ int32 scriptlib::debug_show_hint(lua_State *L) {
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
write_buffer8
(
MSG_SHOW_HINT
);
const
char
*
pstr
=
lua_tostring
(
L
,
1
);
int
len
=
strlen
(
pstr
);
int
len
=
(
int
)
strlen
(
pstr
);
if
(
len
>
1024
)
len
=
1024
;
pduel
->
write_buffer16
(
len
);
...
...
Classes/ocgcore/libduel.cpp
View file @
d8510201
This diff is collapsed.
Click to expand it.
Classes/ocgcore/libeffect.cpp
View file @
d8510201
...
...
@@ -62,7 +62,7 @@ int32 scriptlib::effect_set_description(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_tointeger
(
L
,
2
);
uint32
v
=
(
uint32
)
lua_tointeger
(
L
,
2
);
peffect
->
description
=
v
;
return
0
;
}
...
...
@@ -70,7 +70,7 @@ int32 scriptlib::effect_set_code(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_tointeger
(
L
,
2
);
uint32
v
=
(
uint32
)
lua_tointeger
(
L
,
2
);
peffect
->
code
=
v
;
return
0
;
}
...
...
@@ -78,7 +78,7 @@ int32 scriptlib::effect_set_range(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_tointeger
(
L
,
2
);
uint32
v
=
(
uint32
)
lua_tointeger
(
L
,
2
);
peffect
->
range
=
v
;
return
0
;
}
...
...
@@ -86,8 +86,8 @@ int32 scriptlib::effect_set_target_range(lua_State *L) {
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
s
=
lua_tointeger
(
L
,
2
);
uint32
o
=
lua_tointeger
(
L
,
3
);
uint32
s
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint32
o
=
(
uint32
)
lua_tointeger
(
L
,
3
);
peffect
->
s_range
=
s
;
peffect
->
o_range
=
o
;
peffect
->
flag
[
0
]
&=
~
EFFECT_FLAG_ABSOLUTE_TARGET
;
...
...
@@ -97,9 +97,9 @@ int32 scriptlib::effect_set_absolute_range(lua_State *L) {
check_param_count
(
L
,
4
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
playerid
=
lua_tointeger
(
L
,
2
);
uint32
s
=
lua_tointeger
(
L
,
3
);
uint32
o
=
lua_tointeger
(
L
,
4
);
uint32
playerid
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint32
s
=
(
uint32
)
lua_tointeger
(
L
,
3
);
uint32
o
=
(
uint32
)
lua_tointeger
(
L
,
4
);
if
(
playerid
==
0
)
{
peffect
->
s_range
=
s
;
peffect
->
o_range
=
o
;
...
...
@@ -114,10 +114,10 @@ int32 scriptlib::effect_set_count_limit(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_tointeger
(
L
,
2
);
uint32
v
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint32
code
=
0
;
if
(
lua_gettop
(
L
)
>=
3
)
code
=
lua_tointeger
(
L
,
3
);
code
=
(
uint32
)
lua_tointeger
(
L
,
3
);
if
(
v
==
0
)
v
=
1
;
peffect
->
flag
[
0
]
|=
EFFECT_FLAG_COUNT_LIMIT
;
...
...
@@ -130,8 +130,8 @@ int32 scriptlib::effect_set_reset(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_tointeger
(
L
,
2
);
uint32
c
=
lua_tointeger
(
L
,
3
);
uint32
v
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint32
c
=
(
uint32
)
lua_tointeger
(
L
,
3
);
if
(
c
==
0
)
c
=
1
;
if
(
v
&
(
RESET_PHASE
)
&&
!
(
v
&
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
)))
...
...
@@ -144,7 +144,7 @@ int32 scriptlib::effect_set_type(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_tointeger
(
L
,
2
);
uint32
v
=
(
uint32
)
lua_tointeger
(
L
,
2
);
if
(
v
&
0x0ff0
)
v
|=
EFFECT_TYPE_ACTIONS
;
else
...
...
@@ -165,8 +165,8 @@ int32 scriptlib::effect_set_property(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v1
=
lua_tointeger
(
L
,
2
);
uint32
v2
=
lua_tointeger
(
L
,
3
);
uint32
v1
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint32
v2
=
(
uint32
)
lua_tointeger
(
L
,
3
);
peffect
->
flag
[
0
]
=
(
peffect
->
flag
[
0
]
&
0x4f
)
|
(
v1
&
~
0x4f
);
peffect
->
flag
[
1
]
=
v2
;
return
0
;
...
...
@@ -177,7 +177,7 @@ int32 scriptlib::effect_set_label(lua_State *L) {
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
peffect
->
label
.
clear
();
for
(
int32
i
=
2
;
i
<=
lua_gettop
(
L
);
++
i
)
{
uint32
v
=
lua_tointeger
(
L
,
i
);
uint32
v
=
(
uint32
)
lua_tointeger
(
L
,
i
);
peffect
->
label
.
push_back
(
v
);
}
return
0
;
...
...
@@ -207,7 +207,7 @@ int32 scriptlib::effect_set_category(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_tointeger
(
L
,
2
);
uint32
v
=
(
uint32
)
lua_tointeger
(
L
,
2
);
peffect
->
category
=
v
;
return
0
;
}
...
...
@@ -215,10 +215,10 @@ int32 scriptlib::effect_set_hint_timing(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
vs
=
lua_tointeger
(
L
,
2
);
uint32
vs
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint32
vo
=
vs
;
if
(
lua_gettop
(
L
)
>=
3
)
vo
=
lua_tointeger
(
L
,
3
);
vo
=
(
uint32
)
lua_tointeger
(
L
,
3
);
peffect
->
hint_timing
[
0
]
=
vs
;
peffect
->
hint_timing
[
1
]
=
vo
;
return
0
;
...
...
@@ -267,9 +267,9 @@ int32 scriptlib::effect_set_value(lua_State *L) {
if
(
lua_isboolean
(
L
,
2
))
peffect
->
value
=
lua_toboolean
(
L
,
2
);
else
if
(
lua_isinteger
(
L
,
2
))
peffect
->
value
=
lua_tointeger
(
L
,
2
);
peffect
->
value
=
(
int32
)
lua_tointeger
(
L
,
2
);
else
peffect
->
value
=
std
::
round
(
lua_tonumber
(
L
,
2
)
);
peffect
->
value
=
(
int32
)
lua_tonumber
(
L
,
2
);
}
return
0
;
}
...
...
@@ -290,7 +290,7 @@ int32 scriptlib::effect_set_owner_player(lua_State *L) {
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
p
=
lua_tointeger
(
L
,
2
);
uint32
p
=
(
uint32
)
lua_tointeger
(
L
,
2
);
if
(
p
!=
0
&&
p
!=
1
)
return
0
;
peffect
->
effect_owner
=
p
;
...
...
@@ -348,7 +348,7 @@ int32 scriptlib::effect_get_label(lua_State *L) {
}
for
(
const
auto
&
lab
:
peffect
->
label
)
lua_pushinteger
(
L
,
lab
);
return
peffect
->
label
.
size
();
return
(
int32
)
peffect
->
label
.
size
();
}
return
0
;
}
...
...
@@ -456,7 +456,7 @@ int32 scriptlib::effect_is_active_type(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
type
=
lua_tointeger
(
L
,
2
);
uint32
type
=
(
uint32
)
lua_tointeger
(
L
,
2
);
if
(
peffect
->
get_active_type
()
&
type
)
lua_pushboolean
(
L
,
1
);
else
...
...
@@ -467,8 +467,8 @@ int32 scriptlib::effect_is_has_property(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
tflag1
=
lua_tointeger
(
L
,
2
);
uint32
tflag2
=
lua_tointeger
(
L
,
3
);
uint32
tflag1
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint32
tflag2
=
(
uint32
)
lua_tointeger
(
L
,
3
);
if
(
peffect
&&
(
!
tflag1
||
(
peffect
->
flag
[
0
]
&
tflag1
))
&&
(
!
tflag2
||
(
peffect
->
flag
[
1
]
&
tflag2
)))
lua_pushboolean
(
L
,
1
);
else
...
...
@@ -479,7 +479,7 @@ int32 scriptlib::effect_is_has_category(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
tcate
=
lua_tointeger
(
L
,
2
);
uint32
tcate
=
(
uint32
)
lua_tointeger
(
L
,
2
);
if
(
peffect
&&
(
peffect
->
category
&
tcate
))
lua_pushboolean
(
L
,
1
);
else
...
...
@@ -490,7 +490,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
ttype
=
lua_tointeger
(
L
,
2
);
uint32
ttype
=
(
uint32
)
lua_tointeger
(
L
,
2
);
if
(
peffect
&&
(
peffect
->
type
&
ttype
))
lua_pushboolean
(
L
,
1
);
else
...
...
@@ -500,7 +500,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) {
int32
scriptlib
::
effect_is_activatable
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
uint32
playerid
=
lua_tointeger
(
L
,
2
);
uint32
playerid
=
(
uint32
)
lua_tointeger
(
L
,
2
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
neglect_loc
=
0
;
uint32
neglect_target
=
0
;
...
...
@@ -537,7 +537,7 @@ int32 scriptlib::effect_check_count_limit(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
p
=
lua_tointeger
(
L
,
2
);
uint32
p
=
(
uint32
)
lua_tointeger
(
L
,
2
);
lua_pushboolean
(
L
,
peffect
->
check_count_limit
(
p
));
return
1
;
}
...
...
@@ -545,12 +545,12 @@ int32 scriptlib::effect_use_count_limit(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
p
=
lua_tointeger
(
L
,
2
);
uint32
p
=
(
uint32
)
lua_tointeger
(
L
,
2
);
uint32
count
=
1
;
uint32
oath_only
=
0
;
uint32
code
=
peffect
->
count_code
;
if
(
lua_gettop
(
L
)
>
2
)
{
count
=
lua_tointeger
(
L
,
3
);
count
=
(
uint32
)
lua_tointeger
(
L
,
3
);
if
(
lua_gettop
(
L
)
>
3
)
oath_only
=
lua_toboolean
(
L
,
4
);
}
...
...
Classes/ocgcore/libgroup.cpp
View file @
d8510201
...
...
@@ -206,11 +206,11 @@ int32 scriptlib::group_filter_select(lua_State *L) {
cset
.
erase
(
pcard
);
}
duel
*
pduel
=
pgroup
->
pduel
;
uint32
playerid
=
lua_tointeger
(
L
,
2
);
uint32
playerid
=
(
uint32
)
lua_tointeger
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
uint32
min
=
lua_tointeger
(
L
,
4
);
uint32
max
=
lua_tointeger
(
L
,
5
);
uint32
min
=
(
uint32
)
lua_tointeger
(
L
,
4
);
uint32
max
=
(
uint32
)
lua_tointeger
(
L
,
5
);
uint32
extraargs
=
lua_gettop
(
L
)
-
6
;
pduel
->
game_field
->
core
.
select_cards
.
clear
();
for
(
auto
&
pcard
:
cset
)
{
...
...
@@ -244,11 +244,11 @@ int32 scriptlib::group_select(lua_State *L) {
cset
.
erase
(
pcard
);
}
duel
*
pduel
=
pgroup
->
pduel
;
uint32
playerid
=
lua_tointeger
(
L
,
2
);
uint32
playerid
=
(
uint32
)
lua_tointeger
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
uint32
min
=
lua_tointeger
(
L
,
3
);
uint32
max
=
lua_tointeger
(
L
,
4
);
uint32
min
=
(
uint32
)
lua_tointeger
(
L
,
3
);
uint32
max
=
(
uint32
)
lua_tointeger
(
L
,
4
);
pduel
->
game_field
->
core
.
select_cards
.
clear
();
for
(
auto
&
pcard
:
cset
)
{
pduel
->
game_field
->
core
.
select_cards
.
push_back
(
pcard
);
...
...
@@ -273,7 +273,7 @@ int32 scriptlib::group_select_unselect(lua_State *L) {
group
*
pgroup1
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
group
*
pgroup2
=
*
(
group
**
)
lua_touserdata
(
L
,
2
);
duel
*
pduel
=
pgroup1
->
pduel
;
uint32
playerid
=
lua_tointeger
(
L
,
3
);
uint32
playerid
=
(
uint32
)
lua_tointeger
(
L
,
3
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
if
(
pgroup1
->
container
.
size
()
+
pgroup2
->
container
.
size
()
==
0
)
...
...
@@ -296,11 +296,11 @@ int32 scriptlib::group_select_unselect(lua_State *L) {
}
uint32
min
=
1
;
if
(
lua_gettop
(
L
)
>
5
)
{
min
=
lua_tointeger
(
L
,
6
);
min
=
(
uint32
)
lua_tointeger
(
L
,
6
);
}
uint32
max
=
1
;
if
(
lua_gettop
(
L
)
>
6
)
{
max
=
lua_tointeger
(
L
,
7
);
max
=
(
uint32
)
lua_tointeger
(
L
,
7
);
}
if
(
min
>
max
)
min
=
max
;
...
...
@@ -332,12 +332,12 @@ int32 scriptlib::group_random_select(lua_State *L) {
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
int32
playerid
=
lua_tointeger
(
L
,
2
);
uint32
count
=
lua_tointeger
(
L
,
3
);
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
2
);
uint32
count
=
(
uint32
)
lua_tointeger
(
L
,
3
);
duel
*
pduel
=
pgroup
->
pduel
;
group
*
newgroup
=
pduel
->
new_group
();
if
(
count
>
pgroup
->
container
.
size
())
count
=
pgroup
->
container
.
size
();
count
=
(
uint32
)
pgroup
->
container
.
size
();
if
(
count
==
0
)
{
interpreter
::
group2value
(
L
,
newgroup
);
return
1
;
...
...
@@ -346,7 +346,7 @@ int32 scriptlib::group_random_select(lua_State *L) {
newgroup
->
container
=
pgroup
->
container
;
else
{
while
(
newgroup
->
container
.
size
()
<
count
)
{
int32
i
=
pduel
->
get_next_integer
(
0
,
pgroup
->
container
.
size
()
-
1
);
int32
i
=
pduel
->
get_next_integer
(
0
,
(
int32
)
pgroup
->
container
.
size
()
-
1
);
auto
cit
=
pgroup
->
container
.
begin
();
std
::
advance
(
cit
,
i
);
newgroup
->
container
.
insert
(
*
cit
);
...
...
@@ -376,7 +376,7 @@ int32 scriptlib::group_is_exists(lua_State *L) {
cset
.
erase
(
pcard
);
}
duel
*
pduel
=
pgroup
->
pduel
;
uint32
count
=
lua_tointeger
(
L
,
3
);
uint32
count
=
(
uint32
)
lua_tointeger
(
L
,
3
);
uint32
extraargs
=
lua_gettop
(
L
)
-
4
;
uint32
fcount
=
0
;
uint32
result
=
FALSE
;
...
...
@@ -398,16 +398,16 @@ int32 scriptlib::group_check_with_sum_equal(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
2
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pgroup
->
pduel
;
int32
acc
=
lua_tointeger
(
L
,
3
);
int32
min
=
lua_tointeger
(
L
,
4
);
int32
max
=
lua_tointeger
(
L
,
5
);
int32
acc
=
(
int32
)
lua_tointeger
(
L
,
3
);
int32
min
=
(
int32
)
lua_tointeger
(
L
,
4
);
int32
max
=
(
int32
)
lua_tointeger
(
L
,
5
);
if
(
min
<
0
)
min
=
0
;
if
(
max
<
min
)
max
=
min
;
int32
extraargs
=
lua_gettop
(
L
)
-
5
;
field
::
card_vector
cv
(
pduel
->
game_field
->
core
.
must_select_cards
);
int32
mcount
=
cv
.
size
();
int32
mcount
=
(
int32
)
cv
.
size
();
for
(
auto
&
pcard
:
pgroup
->
container
)
{
auto
it
=
std
::
find
(
pduel
->
game_field
->
core
.
must_select_cards
.
begin
(),
pduel
->
game_field
->
core
.
must_select_cards
.
end
(),
pcard
);
if
(
it
==
pduel
->
game_field
->
core
.
must_select_cards
.
end
())
...
...
@@ -426,12 +426,12 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pgroup
->
pduel
;
int32
playerid
=
lua_tointeger
(
L
,
2
);
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
int32
acc
=
lua_tointeger
(
L
,
4
);
int32
min
=
lua_tointeger
(
L
,
5
);
int32
max
=
lua_tointeger
(
L
,
6
);
int32
acc
=
(
int32
)
lua_tointeger
(
L
,
4
);
int32
min
=
(
int32
)
lua_tointeger
(
L
,
5
);
int32
max
=
(
int32
)
lua_tointeger
(
L
,
6
);
if
(
min
<
0
)
min
=
0
;
if
(
max
<
min
)
...
...
@@ -443,7 +443,7 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) {
pduel
->
game_field
->
core
.
select_cards
.
erase
(
it
,
pduel
->
game_field
->
core
.
select_cards
.
end
());
}
field
::
card_vector
cv
(
pduel
->
game_field
->
core
.
must_select_cards
);
int32
mcount
=
cv
.
size
();
int32
mcount
=
(
int32
)
cv
.
size
();
cv
.
insert
(
cv
.
end
(),
pduel
->
game_field
->
core
.
select_cards
.
begin
(),
pduel
->
game_field
->
core
.
select_cards
.
end
());
for
(
auto
&
pcard
:
cv
)
pcard
->
sum_param
=
pduel
->
lua
->
get_operation_value
(
pcard
,
3
,
extraargs
);
...
...
@@ -457,7 +457,7 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) {
return
lua_yieldk
(
L
,
0
,
(
lua_KContext
)
pduel
,
[](
lua_State
*
L
,
int32
status
,
lua_KContext
ctx
)
{
duel
*
pduel
=
(
duel
*
)
ctx
;
group
*
pgroup
=
pduel
->
new_group
();
int32
mcount
=
pduel
->
game_field
->
core
.
must_select_cards
.
size
();
int32
mcount
=
(
int32
)
pduel
->
game_field
->
core
.
must_select_cards
.
size
();
for
(
int32
i
=
mcount
;
i
<
pduel
->
game_field
->
returns
.
bvalue
[
0
];
++
i
)
{
card
*
pcard
=
pduel
->
game_field
->
core
.
select_cards
[
pduel
->
game_field
->
returns
.
bvalue
[
i
+
1
]];
pgroup
->
container
.
insert
(
pcard
);
...
...
@@ -473,10 +473,10 @@ int32 scriptlib::group_check_with_sum_greater(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
2
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pgroup
->
pduel
;
int32
acc
=
lua_tointeger
(
L
,
3
);
int32
acc
=
(
int32
)
lua_tointeger
(
L
,
3
);
int32
extraargs
=
lua_gettop
(
L
)
-
3
;
field
::
card_vector
cv
(
pduel
->
game_field
->
core
.
must_select_cards
);
int32
mcount
=
cv
.
size
();
int32
mcount
=
(
int32
)
cv
.
size
();
for
(
auto
&
pcard
:
pgroup
->
container
)
{
auto
it
=
std
::
find
(
pduel
->
game_field
->
core
.
must_select_cards
.
begin
(),
pduel
->
game_field
->
core
.
must_select_cards
.
end
(),
pcard
);
if
(
it
==
pduel
->
game_field
->
core
.
must_select_cards
.
end
())
...
...
@@ -495,10 +495,10 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pgroup
->
pduel
;
int32
playerid
=
lua_tointeger
(
L
,
2
);
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
int32
acc
=
lua_tointeger
(
L
,
4
);
int32
acc
=
(
int32
)
lua_tointeger
(
L
,
4
);
int32
extraargs
=
lua_gettop
(
L
)
-
4
;
pduel
->
game_field
->
core
.
select_cards
.
assign
(
pgroup
->
container
.
begin
(),
pgroup
->
container
.
end
());
for
(
auto
&
pcard
:
pduel
->
game_field
->
core
.
must_select_cards
)
{
...
...
@@ -506,7 +506,7 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) {
pduel
->
game_field
->
core
.
select_cards
.
erase
(
it
,
pduel
->
game_field
->
core
.
select_cards
.
end
());
}
field
::
card_vector
cv
(
pduel
->
game_field
->
core
.
must_select_cards
);
int32
mcount
=
cv
.
size
();
int32
mcount
=
(
int32
)
cv
.
size
();
cv
.
insert
(
cv
.
end
(),
pduel
->
game_field
->
core
.
select_cards
.
begin
(),
pduel
->
game_field
->
core
.
select_cards
.
end
());
for
(
auto
&
pcard
:
cv
)
pcard
->
sum_param
=
pduel
->
lua
->
get_operation_value
(
pcard
,
3
,
extraargs
);
...
...
@@ -520,7 +520,7 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) {
return
lua_yieldk
(
L
,
0
,
(
lua_KContext
)
pduel
,
[](
lua_State
*
L
,
int32
status
,
lua_KContext
ctx
)
{
duel
*
pduel
=
(
duel
*
)
ctx
;
group
*
pgroup
=
pduel
->
new_group
();
int32
mcount
=
pduel
->
game_field
->
core
.
must_select_cards
.
size
();
int32
mcount
=
(
int32
)
pduel
->
game_field
->
core
.
must_select_cards
.
size
();
for
(
int32
i
=
mcount
;
i
<
pduel
->
game_field
->
returns
.
bvalue
[
0
];
++
i
)
{
card
*
pcard
=
pduel
->
game_field
->
core
.
select_cards
[
pduel
->
game_field
->
returns
.
bvalue
[
i
+
1
]];
pgroup
->
container
.
insert
(
pcard
);
...
...
Classes/ocgcore/ocgapi.cpp
View file @
d8510201
...
...
@@ -44,7 +44,7 @@ byte* default_script_reader(const char* script_name, int* slen) {
fp
=
fopen
(
script_name
,
"rb"
);
if
(
!
fp
)
return
0
;
int
len
=
fread
(
buffer
,
1
,
sizeof
(
buffer
),
fp
);
int
len
=
(
int
)
fread
(
buffer
,
1
,
sizeof
(
buffer
),
fp
);
fclose
(
fp
);
if
(
len
>=
sizeof
(
buffer
))
return
0
;
...
...
@@ -88,7 +88,7 @@ extern "C" DECL_DLLEXPORT void start_duel(ptr pduel, int32 options) {
pd
->
game_field
->
player
[
0
].
tag_list_hand
.
push_back
(
pcard
);
pcard
->
current
.
controler
=
0
;
pcard
->
current
.
location
=
LOCATION_HAND
;
pcard
->
current
.
sequence
=
pd
->
game_field
->
player
[
0
].
tag_list_hand
.
size
()
-
1
;
pcard
->
current
.
sequence
=
(
uint8
)
pd
->
game_field
->
player
[
0
].
tag_list_hand
.
size
()
-
1
;
pcard
->
current
.
position
=
POS_FACEDOWN
;
}
for
(
int
i
=
0
;
i
<
pd
->
game_field
->
player
[
1
].
start_count
&&
pd
->
game_field
->
player
[
1
].
tag_list_main
.
size
();
++
i
)
{
...
...
@@ -97,7 +97,7 @@ extern "C" DECL_DLLEXPORT void start_duel(ptr pduel, int32 options) {
pd
->
game_field
->
player
[
1
].
tag_list_hand
.
push_back
(
pcard
);
pcard
->
current
.
controler
=
1
;
pcard
->
current
.
location
=
LOCATION_HAND
;
pcard
->
current
.
sequence
=
pd
->
game_field
->
player
[
1
].
tag_list_hand
.
size
()
-
1
;
pcard
->
current
.
sequence
=
(
uint8
)
pd
->
game_field
->
player
[
1
].
tag_list_hand
.
size
()
-
1
;
pcard
->
current
.
position
=
POS_FACEDOWN
;
}
}
...
...
@@ -162,7 +162,7 @@ extern "C" DECL_DLLEXPORT void new_tag_card(ptr pduel, uint32 code, uint8 owner,
pcard
->
owner
=
owner
;
pcard
->
current
.
controler
=
owner
;
pcard
->
current
.
location
=
LOCATION_DECK
;
pcard
->
current
.
sequence
=
ptduel
->
game_field
->
player
[
owner
].
tag_list_main
.
size
()
-
1
;
pcard
->
current
.
sequence
=
(
uint8
)
ptduel
->
game_field
->
player
[
owner
].
tag_list_main
.
size
()
-
1
;
pcard
->
current
.
position
=
POS_FACEDOWN_DEFENSE
;
break
;
case
LOCATION_EXTRA
:
...
...
@@ -170,7 +170,7 @@ extern "C" DECL_DLLEXPORT void new_tag_card(ptr pduel, uint32 code, uint8 owner,
pcard
->
owner
=
owner
;
pcard
->
current
.
controler
=
owner
;
pcard
->
current
.
location
=
LOCATION_EXTRA
;
pcard
->
current
.
sequence
=
ptduel
->
game_field
->
player
[
owner
].
tag_list_extra
.
size
()
-
1
;
pcard
->
current
.
sequence
=
(
uint8
)
ptduel
->
game_field
->
player
[
owner
].
tag_list_extra
.
size
()
-
1
;
pcard
->
current
.
position
=
POS_FACEDOWN_DEFENSE
;
break
;
}
...
...
@@ -214,15 +214,15 @@ extern "C" DECL_DLLEXPORT int32 query_field_count(ptr pduel, uint8 playerid, uin
return
0
;
auto
&
player
=
ptduel
->
game_field
->
player
[
playerid
];
if
(
location
==
LOCATION_HAND
)
return
player
.
list_hand
.
size
();
return
(
int32
)
player
.
list_hand
.
size
();
if
(
location
==
LOCATION_GRAVE
)
return
player
.
list_grave
.
size
();
return
(
int32
)
player
.
list_grave
.
size
();
if
(
location
==
LOCATION_REMOVED
)
return
player
.
list_remove
.
size
();
return
(
int32
)
player
.
list_remove
.
size
();
if
(
location
==
LOCATION_EXTRA
)
return
player
.
list_extra
.
size
();
return
(
int32
)
player
.
list_extra
.
size
();
if
(
location
==
LOCATION_DECK
)
return
player
.
list_main
.
size
();
return
(
int32
)
player
.
list_main
.
size
();
if
(
location
==
LOCATION_MZONE
)
{
uint32
count
=
0
;
for
(
auto
&
pcard
:
player
.
list_mzone
)
...
...
@@ -295,7 +295,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
if
(
pcard
)
{
*
p
++
=
1
;
*
p
++
=
pcard
->
current
.
position
;
*
p
++
=
pcard
->
xyz_materials
.
size
();
*
p
++
=
(
uint8
)
pcard
->
xyz_materials
.
size
();
}
else
{
*
p
++
=
0
;
}
...
...
@@ -308,14 +308,14 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
*
p
++
=
0
;
}
}
*
p
++
=
player
.
list_main
.
size
();
*
p
++
=
player
.
list_hand
.
size
();
*
p
++
=
player
.
list_grave
.
size
();
*
p
++
=
player
.
list_remove
.
size
();
*
p
++
=
player
.
list_extra
.
size
();
*
p
++
=
player
.
extra_p_count
;
*
p
++
=
(
uint8
)
player
.
list_main
.
size
();
*
p
++
=
(
uint8
)
player
.
list_hand
.
size
();
*
p
++
=
(
uint8
)
player
.
list_grave
.
size
();
*
p
++
=
(
uint8
)
player
.
list_remove
.
size
();
*
p
++
=
(
uint8
)
player
.
list_extra
.
size
();
*
p
++
=
(
uint8
)
player
.
extra_p_count
;
}
*
p
++
=
ptduel
->
game_field
->
core
.
current_chain
.
size
();
*
p
++
=
(
uint8
)
ptduel
->
game_field
->
core
.
current_chain
.
size
();
for
(
const
auto
&
ch
:
ptduel
->
game_field
->
core
.
current_chain
)
{
effect
*
peffect
=
ch
.
triggering_effect
;
*
((
int
*
)
p
)
=
peffect
->
get_handler
()
->
data
.
code
;
...
...
Classes/ocgcore/operations.cpp
View file @
d8510201
This diff is collapsed.
Click to expand it.
Classes/ocgcore/playerop.cpp
View file @
d8510201
This diff is collapsed.
Click to expand it.
Classes/ocgcore/processor.cpp
View file @
d8510201
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