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
4226b9a7
Commit
4226b9a7
authored
Dec 04, 2024
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
c9c85d2f
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
141 additions
and
119 deletions
+141
-119
Classes/ocgcore/buffer.h
Classes/ocgcore/buffer.h
+9
-1
Classes/ocgcore/card.cpp
Classes/ocgcore/card.cpp
+45
-40
Classes/ocgcore/card.h
Classes/ocgcore/card.h
+1
-0
Classes/ocgcore/duel.cpp
Classes/ocgcore/duel.cpp
+1
-1
Classes/ocgcore/effect.cpp
Classes/ocgcore/effect.cpp
+6
-6
Classes/ocgcore/effect.h
Classes/ocgcore/effect.h
+3
-3
Classes/ocgcore/interpreter.cpp
Classes/ocgcore/interpreter.cpp
+13
-10
Classes/ocgcore/interpreter.h
Classes/ocgcore/interpreter.h
+3
-3
Classes/ocgcore/ocgapi.cpp
Classes/ocgcore/ocgapi.cpp
+5
-1
Classes/ocgcore/ocgapi.h
Classes/ocgcore/ocgapi.h
+1
-0
Classes/ocgcore/operations.cpp
Classes/ocgcore/operations.cpp
+54
-54
No files found.
Classes/ocgcore/buffer.h
View file @
4226b9a7
#ifndef CORE_BUFFER_H
#ifndef CORE_BUFFER_H
#define CORE_BUFFER_H
#define CORE_BUFFER_H
#include <cstdio>
#include <cstring>
#include <cstring>
#include <vector>
#include <vector>
...
@@ -21,7 +22,7 @@ inline void buffer_write_block(unsigned char*& p, const void* src, size_t size)
...
@@ -21,7 +22,7 @@ inline void buffer_write_block(unsigned char*& p, const void* src, size_t size)
}
}
template
<
typename
T
>
template
<
typename
T
>
inline
void
buffer_write
(
unsigned
char
*&
p
,
T
value
)
{
inline
void
buffer_write
(
unsigned
char
*&
p
,
T
value
)
{
buffer_write_block
(
p
,
&
value
,
sizeof
(
T
));
buffer_write_block
(
p
,
&
value
,
sizeof
(
T
));
}
}
inline
void
vector_write_block
(
std
::
vector
<
unsigned
char
>&
buffer
,
const
void
*
src
,
size_t
size
)
{
inline
void
vector_write_block
(
std
::
vector
<
unsigned
char
>&
buffer
,
const
void
*
src
,
size_t
size
)
{
...
@@ -34,4 +35,11 @@ inline void vector_write(std::vector<unsigned char>& buffer, T value) {
...
@@ -34,4 +35,11 @@ inline void vector_write(std::vector<unsigned char>& buffer, T value) {
vector_write_block
(
buffer
,
&
value
,
sizeof
(
T
));
vector_write_block
(
buffer
,
&
value
,
sizeof
(
T
));
}
}
inline
void
vector_fread
(
std
::
vector
<
unsigned
char
>&
buffer
,
FILE
*
fp
)
{
unsigned
char
temp
[
4096
]{};
while
(
size_t
len
=
std
::
fread
(
temp
,
1
,
sizeof
temp
,
fp
))
vector_write_block
(
buffer
,
temp
,
len
);
std
::
fclose
(
fp
);
}
#endif // !CORE_BUFFER_H
#endif // !CORE_BUFFER_H
Classes/ocgcore/card.cpp
View file @
4226b9a7
...
@@ -2611,6 +2611,13 @@ void card::filter_effect_container(const effect_container& container, uint32 cod
...
@@ -2611,6 +2611,13 @@ void card::filter_effect_container(const effect_container& container, uint32 cod
eset
.
add_item
(
it
->
second
);
eset
.
add_item
(
it
->
second
);
}
}
}
}
void
card
::
filter_effect_container
(
const
effect_container
&
container
,
uint32
code
,
effect_filter
f
,
effect_collection
&
eset
)
{
auto
rg
=
container
.
equal_range
(
code
);
for
(
auto
it
=
rg
.
first
;
it
!=
rg
.
second
;
++
it
)
{
if
(
f
(
this
,
it
->
second
))
eset
.
insert
(
it
->
second
);
}
}
void
card
::
filter_effect
(
uint32
code
,
effect_set
*
eset
,
uint8
sort
)
{
void
card
::
filter_effect
(
uint32
code
,
effect_set
*
eset
,
uint8
sort
)
{
filter_effect_container
(
single_effect
,
code
,
default_single_filter
,
*
eset
);
filter_effect_container
(
single_effect
,
code
,
default_single_filter
,
*
eset
);
for
(
const
auto
&
pcard
:
equiping_cards
)
for
(
const
auto
&
pcard
:
equiping_cards
)
...
@@ -2736,11 +2743,11 @@ int32 card::filter_summon_procedure(uint8 playerid, effect_set* peset, uint8 ign
...
@@ -2736,11 +2743,11 @@ int32 card::filter_summon_procedure(uint8 playerid, effect_set* peset, uint8 ign
effect_set
extra_count
;
effect_set
extra_count
;
filter_effect
(
EFFECT_EXTRA_SUMMON_COUNT
,
&
extra_count
);
filter_effect
(
EFFECT_EXTRA_SUMMON_COUNT
,
&
extra_count
);
for
(
int32
i
=
0
;
i
<
extra_count
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
extra_count
.
size
();
++
i
)
{
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
extra_count
[
i
]
->
get_value
(
this
,
0
,
&
retval
);
extra_count
[
i
]
->
get_value
(
this
,
0
,
retval
);
int32
new_min
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
new_min
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
new_zone
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0x1f
;
uint32
new_zone
=
retval
.
size
()
>
1
?
static_cast
<
uint32
>
(
retval
[
1
])
:
0x1f
;
int32
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
retval
[
2
]
:
retval
[
2
]
)
:
0xff00ff
;
int32
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
static_cast
<
int32
>
(
retval
[
2
])
:
static_cast
<
int32
>
(
retval
[
2
])
)
:
0xff00ff
;
if
(
new_min
<
min
)
if
(
new_min
<
min
)
new_min
=
min
;
new_min
=
min
;
new_zone
&=
zone
;
new_zone
&=
zone
;
...
@@ -2769,12 +2776,12 @@ int32 card::check_summon_procedure(effect* proc, uint8 playerid, uint8 ignore_co
...
@@ -2769,12 +2776,12 @@ int32 card::check_summon_procedure(effect* proc, uint8 playerid, uint8 ignore_co
effect_set
eset
;
effect_set
eset
;
filter_effect
(
EFFECT_EXTRA_SUMMON_COUNT
,
&
eset
);
filter_effect
(
EFFECT_EXTRA_SUMMON_COUNT
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
eset
[
i
]
->
get_value
(
this
,
0
,
&
retval
);
eset
[
i
]
->
get_value
(
this
,
0
,
retval
);
int32
new_min_tribute
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
new_min_tribute
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
new_zone
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0x1f
;
uint32
new_zone
=
retval
.
size
()
>
1
?
static_cast
<
uint32
>
(
retval
[
1
])
:
0x1f
;
int32
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
retval
[
2
]
:
retval
[
2
]
)
:
0xff00ff
;
int32
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
static_cast
<
int32
>
(
retval
[
2
])
:
static_cast
<
int32
>
(
retval
[
2
])
)
:
0xff00ff
;
if
(
new_min_tribute
<
(
int32
)
min_tribute
)
if
(
new_min_tribute
<
min_tribute
)
new_min_tribute
=
min_tribute
;
new_min_tribute
=
min_tribute
;
new_zone
&=
zone
;
new_zone
&=
zone
;
if
(
is_summonable
(
proc
,
new_min_tribute
,
new_zone
,
releasable
))
if
(
is_summonable
(
proc
,
new_min_tribute
,
new_zone
,
releasable
))
...
@@ -2819,11 +2826,11 @@ int32 card::filter_set_procedure(uint8 playerid, effect_set* peset, uint8 ignore
...
@@ -2819,11 +2826,11 @@ int32 card::filter_set_procedure(uint8 playerid, effect_set* peset, uint8 ignore
effect_set
extra_count
;
effect_set
extra_count
;
filter_effect
(
EFFECT_EXTRA_SET_COUNT
,
&
extra_count
);
filter_effect
(
EFFECT_EXTRA_SET_COUNT
,
&
extra_count
);
for
(
int32
i
=
0
;
i
<
extra_count
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
extra_count
.
size
();
++
i
)
{
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
extra_count
[
i
]
->
get_value
(
this
,
0
,
&
retval
);
extra_count
[
i
]
->
get_value
(
this
,
0
,
retval
);
int32
new_min
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
new_min
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
new_zone
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0x1f
;
uint32
new_zone
=
retval
.
size
()
>
1
?
static_cast
<
uint32
>
(
retval
[
1
])
:
0x1f
;
int32
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
retval
[
2
]
:
retval
[
2
]
)
:
0xff00ff
;
int32
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
static_cast
<
int32
>
(
retval
[
2
])
:
static_cast
<
int32
>
(
retval
[
2
])
)
:
0xff00ff
;
if
(
new_min
<
min
)
if
(
new_min
<
min
)
new_min
=
min
;
new_min
=
min
;
new_zone
&=
zone
;
new_zone
&=
zone
;
...
@@ -2849,12 +2856,12 @@ int32 card::check_set_procedure(effect* proc, uint8 playerid, uint8 ignore_count
...
@@ -2849,12 +2856,12 @@ int32 card::check_set_procedure(effect* proc, uint8 playerid, uint8 ignore_count
effect_set
eset
;
effect_set
eset
;
filter_effect
(
EFFECT_EXTRA_SET_COUNT
,
&
eset
);
filter_effect
(
EFFECT_EXTRA_SET_COUNT
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
eset
[
i
]
->
get_value
(
this
,
0
,
&
retval
);
eset
[
i
]
->
get_value
(
this
,
0
,
retval
);
int32
new_min_tribute
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
new_min_tribute
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
new_zone
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0x1f
;
uint32
new_zone
=
retval
.
size
()
>
1
?
static_cast
<
uint32
>
(
retval
[
1
])
:
0x1f
;
int32
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
retval
[
2
]
:
retval
[
2
]
)
:
0xff00ff
;
int32
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
static_cast
<
int32
>
(
retval
[
2
])
:
static_cast
<
int32
>
(
retval
[
2
])
)
:
0xff00ff
;
if
(
new_min_tribute
<
(
int32
)
min_tribute
)
if
(
new_min_tribute
<
min_tribute
)
new_min_tribute
=
min_tribute
;
new_min_tribute
=
min_tribute
;
new_zone
&=
zone
;
new_zone
&=
zone
;
if
(
is_summonable
(
proc
,
new_min_tribute
,
new_zone
,
releasable
))
if
(
is_summonable
(
proc
,
new_min_tribute
,
new_zone
,
releasable
))
...
@@ -2865,12 +2872,11 @@ int32 card::check_set_procedure(effect* proc, uint8 playerid, uint8 ignore_count
...
@@ -2865,12 +2872,11 @@ int32 card::check_set_procedure(effect* proc, uint8 playerid, uint8 ignore_count
return
FALSE
;
return
FALSE
;
}
}
void
card
::
filter_spsummon_procedure
(
uint8
playerid
,
effect_set
*
peset
,
uint32
summon_type
,
material_info
info
)
{
void
card
::
filter_spsummon_procedure
(
uint8
playerid
,
effect_set
*
peset
,
uint32
summon_type
,
material_info
info
)
{
auto
pr
=
field_effect
.
equal_range
(
EFFECT_SPSUMMON_PROC
);
effect_collection
proc_set
;
uint8
toplayer
;
filter_effect_container
(
field_effect
,
EFFECT_SPSUMMON_PROC
,
accept_filter
,
proc_set
);
uint8
topos
;
for
(
auto
&
peffect
:
proc_set
)
{
for
(
auto
eit
=
pr
.
first
;
eit
!=
pr
.
second
;)
{
uint8
toplayer
{};
effect
*
peffect
=
eit
->
second
;
uint8
topos
{};
++
eit
;
if
(
peffect
->
is_flag
(
EFFECT_FLAG_SPSUM_PARAM
))
{
if
(
peffect
->
is_flag
(
EFFECT_FLAG_SPSUM_PARAM
))
{
topos
=
(
uint8
)
peffect
->
s_range
;
topos
=
(
uint8
)
peffect
->
s_range
;
if
(
peffect
->
o_range
==
0
)
if
(
peffect
->
o_range
==
0
)
...
@@ -2894,10 +2900,9 @@ void card::filter_spsummon_procedure(uint8 playerid, effect_set* peset, uint32 s
...
@@ -2894,10 +2900,9 @@ void card::filter_spsummon_procedure(uint8 playerid, effect_set* peset, uint32 s
}
}
}
}
void
card
::
filter_spsummon_procedure_g
(
uint8
playerid
,
effect_set
*
peset
)
{
void
card
::
filter_spsummon_procedure_g
(
uint8
playerid
,
effect_set
*
peset
)
{
auto
pr
=
field_effect
.
equal_range
(
EFFECT_SPSUMMON_PROC_G
);
effect_collection
proc_set
;
for
(
auto
eit
=
pr
.
first
;
eit
!=
pr
.
second
;)
{
filter_effect_container
(
field_effect
,
EFFECT_SPSUMMON_PROC_G
,
accept_filter
,
proc_set
);
effect
*
peffect
=
eit
->
second
;
for
(
auto
&
peffect
:
proc_set
)
{
++
eit
;
if
(
!
peffect
->
is_available
()
||
!
peffect
->
check_count_limit
(
playerid
))
if
(
!
peffect
->
is_available
()
||
!
peffect
->
check_count_limit
(
playerid
))
continue
;
continue
;
if
(
current
.
controler
!=
playerid
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_BOTH_SIDE
))
if
(
current
.
controler
!=
playerid
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_BOTH_SIDE
))
...
@@ -3395,10 +3400,10 @@ int32 card::get_summon_tribute_count() {
...
@@ -3395,10 +3400,10 @@ int32 card::get_summon_tribute_count() {
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
&&
eset
[
i
]
->
count_limit
==
0
)
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
&&
eset
[
i
]
->
count_limit
==
0
)
continue
;
continue
;
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
eset
[
i
]
->
get_value
(
this
,
0
,
&
retval
);
eset
[
i
]
->
get_value
(
this
,
0
,
retval
);
int32
dec
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
dec
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
static_cast
<
int32
>
(
retval
[
1
])
:
0
;
if
(
effect_code
>
0
)
{
if
(
effect_code
>
0
)
{
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
if
(
it
==
duplicate
.
end
())
if
(
it
==
duplicate
.
end
())
...
@@ -3428,10 +3433,10 @@ int32 card::get_set_tribute_count() {
...
@@ -3428,10 +3433,10 @@ int32 card::get_set_tribute_count() {
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
&&
eset
[
i
]
->
count_limit
==
0
)
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
&&
eset
[
i
]
->
count_limit
==
0
)
continue
;
continue
;
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
eset
[
i
]
->
get_value
(
this
,
0
,
&
retval
);
eset
[
i
]
->
get_value
(
this
,
0
,
retval
);
int32
dec
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
dec
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
static_cast
<
int32
>
(
retval
[
1
])
:
0
;
if
(
effect_code
>
0
)
{
if
(
effect_code
>
0
)
{
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
if
(
it
==
duplicate
.
end
())
if
(
it
==
duplicate
.
end
())
...
...
Classes/ocgcore/card.h
View file @
4226b9a7
...
@@ -327,6 +327,7 @@ public:
...
@@ -327,6 +327,7 @@ public:
template
<
typename
T
>
template
<
typename
T
>
void
filter_effect_container
(
const
effect_container
&
container
,
uint32
code
,
effect_filter
f
,
T
&
eset
);
void
filter_effect_container
(
const
effect_container
&
container
,
uint32
code
,
effect_filter
f
,
T
&
eset
);
void
filter_effect_container
(
const
effect_container
&
container
,
uint32
code
,
effect_filter
f
,
effect_collection
&
eset
);
void
filter_effect
(
uint32
code
,
effect_set
*
eset
,
uint8
sort
=
TRUE
);
void
filter_effect
(
uint32
code
,
effect_set
*
eset
,
uint8
sort
=
TRUE
);
void
filter_single_continuous_effect
(
uint32
code
,
effect_set
*
eset
,
uint8
sort
=
TRUE
);
void
filter_single_continuous_effect
(
uint32
code
,
effect_set
*
eset
,
uint8
sort
=
TRUE
);
void
filter_self_effect
(
uint32
code
,
effect_set
*
eset
,
uint8
sort
=
TRUE
);
void
filter_self_effect
(
uint32
code
,
effect_set
*
eset
,
uint8
sort
=
TRUE
);
...
...
Classes/ocgcore/duel.cpp
View file @
4226b9a7
...
@@ -51,7 +51,7 @@ void duel::clear() {
...
@@ -51,7 +51,7 @@ void duel::clear() {
card
*
duel
::
new_card
(
uint32
code
)
{
card
*
duel
::
new_card
(
uint32
code
)
{
card
*
pcard
=
new
card
(
this
);
card
*
pcard
=
new
card
(
this
);
cards
.
insert
(
pcard
);
cards
.
insert
(
pcard
);
if
(
code
)
if
(
code
!=
TEMP_CARD_ID
)
::
read_card
(
code
,
&
(
pcard
->
data
));
::
read_card
(
code
,
&
(
pcard
->
data
));
pcard
->
data
.
code
=
code
;
pcard
->
data
.
code
=
code
;
lua
->
register_card
(
pcard
);
lua
->
register_card
(
pcard
);
...
...
Classes/ocgcore/effect.cpp
View file @
4226b9a7
...
@@ -722,33 +722,33 @@ int32 effect::get_value(effect* peffect, uint32 extraargs) {
...
@@ -722,33 +722,33 @@ int32 effect::get_value(effect* peffect, uint32 extraargs) {
return
(
int32
)
value
;
return
(
int32
)
value
;
}
}
}
}
void
effect
::
get_value
(
uint32
extraargs
,
std
::
vector
<
int32
>*
result
)
{
void
effect
::
get_value
(
uint32
extraargs
,
std
::
vector
<
lua_Integer
>&
result
)
{
if
(
is_flag
(
EFFECT_FLAG_FUNC_VALUE
))
{
if
(
is_flag
(
EFFECT_FLAG_FUNC_VALUE
))
{
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
,
TRUE
);
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
,
TRUE
);
pduel
->
lua
->
get_function_value
(
value
,
1
+
extraargs
,
result
);
pduel
->
lua
->
get_function_value
(
value
,
1
+
extraargs
,
result
);
}
else
{
}
else
{
pduel
->
lua
->
params
.
clear
();
pduel
->
lua
->
params
.
clear
();
result
->
push_back
((
int32
)
value
);
result
.
push_back
(
value
);
}
}
}
}
void
effect
::
get_value
(
card
*
pcard
,
uint32
extraargs
,
std
::
vector
<
int32
>*
result
)
{
void
effect
::
get_value
(
card
*
pcard
,
uint32
extraargs
,
std
::
vector
<
lua_Integer
>&
result
)
{
if
(
is_flag
(
EFFECT_FLAG_FUNC_VALUE
))
{
if
(
is_flag
(
EFFECT_FLAG_FUNC_VALUE
))
{
pduel
->
lua
->
add_param
(
pcard
,
PARAM_TYPE_CARD
,
TRUE
);
pduel
->
lua
->
add_param
(
pcard
,
PARAM_TYPE_CARD
,
TRUE
);
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
,
TRUE
);
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
,
TRUE
);
pduel
->
lua
->
get_function_value
(
value
,
2
+
extraargs
,
result
);
pduel
->
lua
->
get_function_value
(
value
,
2
+
extraargs
,
result
);
}
else
{
}
else
{
pduel
->
lua
->
params
.
clear
();
pduel
->
lua
->
params
.
clear
();
result
->
push_back
((
int32
)
value
);
result
.
push_back
(
value
);
}
}
}
}
void
effect
::
get_value
(
effect
*
peffect
,
uint32
extraargs
,
std
::
vector
<
int32
>*
result
)
{
void
effect
::
get_value
(
effect
*
peffect
,
uint32
extraargs
,
std
::
vector
<
lua_Integer
>&
result
)
{
if
(
is_flag
(
EFFECT_FLAG_FUNC_VALUE
))
{
if
(
is_flag
(
EFFECT_FLAG_FUNC_VALUE
))
{
pduel
->
lua
->
add_param
(
peffect
,
PARAM_TYPE_EFFECT
,
TRUE
);
pduel
->
lua
->
add_param
(
peffect
,
PARAM_TYPE_EFFECT
,
TRUE
);
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
,
TRUE
);
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
,
TRUE
);
pduel
->
lua
->
get_function_value
(
value
,
2
+
extraargs
,
result
);
pduel
->
lua
->
get_function_value
(
value
,
2
+
extraargs
,
result
);
}
else
{
}
else
{
pduel
->
lua
->
params
.
clear
();
pduel
->
lua
->
params
.
clear
();
result
->
push_back
((
int32
)
value
);
result
.
push_back
((
int32
)
value
);
}
}
}
}
int32
effect
::
get_integer_value
()
{
int32
effect
::
get_integer_value
()
{
...
...
Classes/ocgcore/effect.h
View file @
4226b9a7
...
@@ -98,9 +98,9 @@ public:
...
@@ -98,9 +98,9 @@ public:
int32
get_value
(
uint32
extraargs
=
0
);
int32
get_value
(
uint32
extraargs
=
0
);
int32
get_value
(
card
*
pcard
,
uint32
extraargs
=
0
);
int32
get_value
(
card
*
pcard
,
uint32
extraargs
=
0
);
int32
get_value
(
effect
*
peffect
,
uint32
extraargs
=
0
);
int32
get_value
(
effect
*
peffect
,
uint32
extraargs
=
0
);
void
get_value
(
uint32
extraargs
,
std
::
vector
<
int32
>*
result
);
void
get_value
(
uint32
extraargs
,
std
::
vector
<
lua_Integer
>&
result
);
void
get_value
(
card
*
pcard
,
uint32
extraargs
,
std
::
vector
<
int32
>*
result
);
void
get_value
(
card
*
pcard
,
uint32
extraargs
,
std
::
vector
<
lua_Integer
>&
result
);
void
get_value
(
effect
*
peffect
,
uint32
extraargs
,
std
::
vector
<
int32
>*
result
);
void
get_value
(
effect
*
peffect
,
uint32
extraargs
,
std
::
vector
<
lua_Integer
>&
result
);
int32
get_integer_value
();
int32
get_integer_value
();
int32
check_value_condition
(
uint32
extraargs
=
0
);
int32
check_value_condition
(
uint32
extraargs
=
0
);
void
*
get_label_object
();
void
*
get_label_object
();
...
...
Classes/ocgcore/interpreter.cpp
View file @
4226b9a7
...
@@ -46,7 +46,9 @@ interpreter::interpreter(duel* pd): coroutines(256) {
...
@@ -46,7 +46,9 @@ interpreter::interpreter(duel* pd): coroutines(256) {
interpreter
::~
interpreter
()
{
interpreter
::~
interpreter
()
{
lua_close
(
lua_state
);
lua_close
(
lua_state
);
}
}
int32
interpreter
::
register_card
(
card
*
pcard
)
{
void
interpreter
::
register_card
(
card
*
pcard
)
{
if
(
!
pcard
)
return
;
//create a card in by userdata
//create a card in by userdata
luaL_checkstack
(
lua_state
,
1
,
nullptr
);
luaL_checkstack
(
lua_state
,
1
,
nullptr
);
card
**
ppcard
=
(
card
**
)
lua_newuserdata
(
lua_state
,
sizeof
(
card
*
));
//+1 userdata
card
**
ppcard
=
(
card
**
)
lua_newuserdata
(
lua_state
,
sizeof
(
card
*
));
//+1 userdata
...
@@ -61,14 +63,13 @@ int32 interpreter::register_card(card *pcard) {
...
@@ -61,14 +63,13 @@ int32 interpreter::register_card(card *pcard) {
lua_setmetatable
(
current_state
,
-
2
);
//-1
lua_setmetatable
(
current_state
,
-
2
);
//-1
lua_pop
(
current_state
,
1
);
//-1
lua_pop
(
current_state
,
1
);
//-1
//Initial
//Initial
if
(
pcard
->
data
.
code
&&
is_load_script
(
pcard
->
data
))
{
if
(
is_load_script
(
pcard
->
data
))
{
pcard
->
set_status
(
STATUS_INITIALIZING
,
TRUE
);
pcard
->
set_status
(
STATUS_INITIALIZING
,
TRUE
);
add_param
(
pcard
,
PARAM_TYPE_CARD
);
add_param
(
pcard
,
PARAM_TYPE_CARD
);
call_card_function
(
pcard
,
"initial_effect"
,
1
,
0
);
call_card_function
(
pcard
,
"initial_effect"
,
1
,
0
);
pcard
->
set_status
(
STATUS_INITIALIZING
,
FALSE
);
pcard
->
set_status
(
STATUS_INITIALIZING
,
FALSE
);
}
}
pcard
->
cardid
=
pduel
->
game_field
->
infos
.
card_id
++
;
pcard
->
cardid
=
pduel
->
game_field
->
infos
.
card_id
++
;
return
OPERATION_SUCCESS
;
}
}
void
interpreter
::
register_effect
(
effect
*
peffect
)
{
void
interpreter
::
register_effect
(
effect
*
peffect
)
{
if
(
!
peffect
)
if
(
!
peffect
)
...
@@ -501,7 +502,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count) {
...
@@ -501,7 +502,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count) {
}
}
return
OPERATION_FAIL
;
return
OPERATION_FAIL
;
}
}
int32
interpreter
::
get_function_value
(
int32
f
,
uint32
param_count
,
std
::
vector
<
int32
>*
result
)
{
int32
interpreter
::
get_function_value
(
int32
f
,
uint32
param_count
,
std
::
vector
<
lua_Integer
>&
result
)
{
int32
is_success
=
OPERATION_FAIL
;
int32
is_success
=
OPERATION_FAIL
;
if
(
!
f
)
{
if
(
!
f
)
{
params
.
clear
();
params
.
clear
();
...
@@ -513,14 +514,14 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count, std::vector<i
...
@@ -513,14 +514,14 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count, std::vector<i
if
(
call_function
(
f
,
param_count
,
LUA_MULTRET
))
{
if
(
call_function
(
f
,
param_count
,
LUA_MULTRET
))
{
int32
stack_newtop
=
lua_gettop
(
current_state
);
int32
stack_newtop
=
lua_gettop
(
current_state
);
for
(
int32
index
=
stack_top
+
1
;
index
<=
stack_newtop
;
++
index
)
{
for
(
int32
index
=
stack_top
+
1
;
index
<=
stack_newtop
;
++
index
)
{
int32
return_value
=
0
;
lua_Integer
return_value
=
0
;
if
(
lua_isboolean
(
current_state
,
index
))
if
(
lua_isboolean
(
current_state
,
index
))
return_value
=
lua_toboolean
(
current_state
,
index
);
return_value
=
lua_toboolean
(
current_state
,
index
);
else
if
(
lua_isinteger
(
current_state
,
index
))
else
if
(
lua_isinteger
(
current_state
,
index
))
return_value
=
(
int32
)
lua_tointeger
(
current_state
,
index
);
return_value
=
lua_tointeger
(
current_state
,
index
);
else
else
return_value
=
(
int32
)
lua_tonumber
(
current_state
,
index
);
return_value
=
static_cast
<
lua_Integer
>
(
lua_tonumber
(
current_state
,
index
)
);
result
->
push_back
(
return_value
);
result
.
push_back
(
return_value
);
}
}
lua_settop
(
current_state
,
stack_top
);
lua_settop
(
current_state
,
stack_top
);
is_success
=
OPERATION_SUCCESS
;
is_success
=
OPERATION_SUCCESS
;
...
@@ -668,11 +669,13 @@ int32 interpreter::get_function_handle(lua_State* L, int32 index) {
...
@@ -668,11 +669,13 @@ int32 interpreter::get_function_handle(lua_State* L, int32 index) {
int32
ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
int32
ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
return
ref
;
return
ref
;
}
}
duel
*
interpreter
::
get_duel_info
(
lua_State
*
L
)
{
duel
*
interpreter
::
get_duel_info
(
lua_State
*
L
)
{
duel
*
pduel
;
duel
*
pduel
;
std
::
memcpy
(
&
pduel
,
lua_getextraspace
(
L
),
LUA_EXTRASPACE
);
std
::
memcpy
(
&
pduel
,
lua_getextraspace
(
L
),
LUA_EXTRASPACE
);
return
pduel
;
return
pduel
;
}
}
bool
interpreter
::
is_load_script
(
card_data
data
)
{
bool
interpreter
::
is_load_script
(
const
card_data
&
data
)
{
if
(
data
.
code
==
TEMP_CARD_ID
)
return
false
;
return
!
(
data
.
type
&
TYPE_NORMAL
)
||
(
data
.
type
&
TYPE_PENDULUM
);
return
!
(
data
.
type
&
TYPE_NORMAL
)
||
(
data
.
type
&
TYPE_PENDULUM
);
}
}
Classes/ocgcore/interpreter.h
View file @
4226b9a7
...
@@ -54,7 +54,7 @@ public:
...
@@ -54,7 +54,7 @@ public:
explicit
interpreter
(
duel
*
pd
);
explicit
interpreter
(
duel
*
pd
);
~
interpreter
();
~
interpreter
();
int32
register_card
(
card
*
pcard
);
void
register_card
(
card
*
pcard
);
void
register_effect
(
effect
*
peffect
);
void
register_effect
(
effect
*
peffect
);
void
unregister_effect
(
effect
*
peffect
);
void
unregister_effect
(
effect
*
peffect
);
void
register_group
(
group
*
pgroup
);
void
register_group
(
group
*
pgroup
);
...
@@ -72,7 +72,7 @@ public:
...
@@ -72,7 +72,7 @@ public:
int32
check_filter
(
lua_State
*
L
,
card
*
pcard
,
int32
findex
,
int32
extraargs
);
int32
check_filter
(
lua_State
*
L
,
card
*
pcard
,
int32
findex
,
int32
extraargs
);
int32
get_operation_value
(
card
*
pcard
,
int32
findex
,
int32
extraargs
);
int32
get_operation_value
(
card
*
pcard
,
int32
findex
,
int32
extraargs
);
int32
get_function_value
(
int32
f
,
uint32
param_count
);
int32
get_function_value
(
int32
f
,
uint32
param_count
);
int32
get_function_value
(
int32
f
,
uint32
param_count
,
std
::
vector
<
int32
>*
result
);
int32
get_function_value
(
int32
f
,
uint32
param_count
,
std
::
vector
<
lua_Integer
>&
result
);
int32
call_coroutine
(
int32
f
,
uint32
param_count
,
int32
*
yield_value
,
uint16
step
);
int32
call_coroutine
(
int32
f
,
uint32
param_count
,
int32
*
yield_value
,
uint16
step
);
int32
clone_function_ref
(
int32
func_ref
);
int32
clone_function_ref
(
int32
func_ref
);
void
*
get_ref_object
(
int32
ref_handler
);
void
*
get_ref_object
(
int32
ref_handler
);
...
@@ -83,7 +83,7 @@ public:
...
@@ -83,7 +83,7 @@ public:
static
void
function2value
(
lua_State
*
L
,
int32
func_ref
);
static
void
function2value
(
lua_State
*
L
,
int32
func_ref
);
static
int32
get_function_handle
(
lua_State
*
L
,
int32
index
);
static
int32
get_function_handle
(
lua_State
*
L
,
int32
index
);
static
duel
*
get_duel_info
(
lua_State
*
L
);
static
duel
*
get_duel_info
(
lua_State
*
L
);
static
bool
is_load_script
(
c
ard_data
data
);
static
bool
is_load_script
(
c
onst
card_data
&
data
);
template
<
size_t
N
,
typename
...
TR
>
template
<
size_t
N
,
typename
...
TR
>
static
int
sprintf
(
char
(
&
buffer
)[
N
],
const
char
*
format
,
TR
...
args
)
{
static
int
sprintf
(
char
(
&
buffer
)[
N
],
const
char
*
format
,
TR
...
args
)
{
...
...
Classes/ocgcore/ocgapi.cpp
View file @
4226b9a7
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
#include <cstdio>
#include <cstdio>
#include <cstring>
#include <cstring>
#include <set>
#include "ocgapi.h"
#include "ocgapi.h"
#include "duel.h"
#include "duel.h"
#include "card.h"
#include "card.h"
...
@@ -14,7 +15,6 @@
...
@@ -14,7 +15,6 @@
#include "field.h"
#include "field.h"
#include "interpreter.h"
#include "interpreter.h"
#include "buffer.h"
#include "buffer.h"
#include <set>
static
script_reader
sreader
=
default_script_reader
;
static
script_reader
sreader
=
default_script_reader
;
static
card_reader
creader
=
default_card_reader
;
static
card_reader
creader
=
default_card_reader
;
...
@@ -35,6 +35,10 @@ byte* read_script(const char* script_name, int* len) {
...
@@ -35,6 +35,10 @@ byte* read_script(const char* script_name, int* len) {
return
sreader
(
script_name
,
len
);
return
sreader
(
script_name
,
len
);
}
}
uint32
read_card
(
uint32
code
,
card_data
*
data
)
{
uint32
read_card
(
uint32
code
,
card_data
*
data
)
{
if
(
code
==
TEMP_CARD_ID
)
{
data
->
clear
();
return
0
;
}
return
creader
(
code
,
data
);
return
creader
(
code
,
data
);
}
}
uint32
handle_message
(
void
*
pduel
,
uint32
msg_type
)
{
uint32
handle_message
(
void
*
pduel
,
uint32
msg_type
)
{
...
...
Classes/ocgcore/ocgapi.h
View file @
4226b9a7
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#define LEN_FAIL 0
#define LEN_FAIL 0
#define LEN_EMPTY 4
#define LEN_EMPTY 4
#define LEN_HEADER 8
#define LEN_HEADER 8
#define TEMP_CARD_ID 0
class
card
;
class
card
;
struct
card_data
;
struct
card_data
;
...
...
Classes/ocgcore/operations.cpp
View file @
4226b9a7
...
@@ -1525,14 +1525,14 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
...
@@ -1525,14 +1525,14 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
}
}
if
(
!
ignore_count
&&
!
core
.
extra_summon
[
sumplayer
])
{
if
(
!
ignore_count
&&
!
core
.
extra_summon
[
sumplayer
])
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
eset
[
i
]
->
get_value
(
target
,
0
,
&
retval
);
eset
[
i
]
->
get_value
(
target
,
0
,
retval
);
int32
new_min_tribute
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
new_min_tribute
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
new_zone
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0x1f
;
uint32
new_zone
=
retval
.
size
()
>
1
?
static_cast
<
uint32
>
(
retval
[
1
])
:
0x1f
;
int32
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
retval
[
2
]
:
retval
[
2
]
)
:
0xff00ff
;
int32
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
static_cast
<
int32
>
(
retval
[
2
])
:
static_cast
<
int32
>
(
retval
[
2
])
)
:
0xff00ff
;
new_zone
&=
zone
;
new_zone
&=
zone
;
if
(
proc
)
{
if
(
proc
)
{
if
(
new_min_tribute
<
(
int32
)
min_tribute
)
if
(
new_min_tribute
<
min_tribute
)
new_min_tribute
=
min_tribute
;
new_min_tribute
=
min_tribute
;
if
(
!
target
->
is_summonable
(
proc
,
new_min_tribute
,
new_zone
,
releasable
))
if
(
!
target
->
is_summonable
(
proc
,
new_min_tribute
,
new_zone
,
releasable
))
continue
;
continue
;
...
@@ -1542,7 +1542,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
...
@@ -1542,7 +1542,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
int32
max
=
(
rcount
>>
16
)
&
0xffff
;
int32
max
=
(
rcount
>>
16
)
&
0xffff
;
if
(
!
is_player_can_summon
(
SUMMON_TYPE_ADVANCE
,
sumplayer
,
target
,
sumplayer
))
if
(
!
is_player_can_summon
(
SUMMON_TYPE_ADVANCE
,
sumplayer
,
target
,
sumplayer
))
max
=
0
;
max
=
0
;
if
(
min
<
(
int32
)
min_tribute
)
if
(
min
<
min_tribute
)
min
=
min_tribute
;
min
=
min_tribute
;
if
(
max
<
min
)
if
(
max
<
min
)
continue
;
continue
;
...
@@ -1566,13 +1566,13 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
...
@@ -1566,13 +1566,13 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
core
.
units
.
begin
()
->
ptr1
=
pextra
;
core
.
units
.
begin
()
->
ptr1
=
pextra
;
int32
releasable
=
0xff00ff
;
int32
releasable
=
0xff00ff
;
if
(
pextra
)
{
if
(
pextra
)
{
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
pextra
->
get_value
(
target
,
0
,
&
retval
);
pextra
->
get_value
(
target
,
0
,
retval
);
int32
new_min_tribute
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
new_min_tribute
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
new_zone
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0x1f
;
uint32
new_zone
=
retval
.
size
()
>
1
?
static_cast
<
uint32
>
(
retval
[
1
])
:
0x1f
;
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
retval
[
2
]
:
retval
[
2
]
)
:
0xff00ff
;
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
static_cast
<
int32
>
(
retval
[
2
])
:
static_cast
<
int32
>
(
retval
[
2
])
)
:
0xff00ff
;
if
((
int32
)
min_tribute
<
new_min_tribute
)
if
(
min_tribute
<
new_min_tribute
)
min_tribute
=
new_min_tribute
;
min_tribute
=
static_cast
<
uint8
>
(
new_min_tribute
)
;
zone
&=
new_zone
;
zone
&=
new_zone
;
core
.
units
.
begin
()
->
arg1
=
sumplayer
+
(
ignore_count
<<
8
)
+
(
min_tribute
<<
16
)
+
(
zone
<<
24
);
core
.
units
.
begin
()
->
arg1
=
sumplayer
+
(
ignore_count
<<
8
)
+
(
min_tribute
<<
16
)
+
(
zone
<<
24
);
core
.
units
.
begin
()
->
value1
=
releasable
;
core
.
units
.
begin
()
->
value1
=
releasable
;
...
@@ -1677,10 +1677,10 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
...
@@ -1677,10 +1677,10 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
))
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
))
continue
;
continue
;
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
eset
[
i
]
->
get_value
(
target
,
0
,
&
retval
);
eset
[
i
]
->
get_value
(
target
,
0
,
retval
);
int32
dec
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
dec
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
static_cast
<
int32
>
(
retval
[
1
])
:
0
;
if
(
effect_code
>
0
)
{
if
(
effect_code
>
0
)
{
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
if
(
it
==
duplicate
.
end
())
if
(
it
==
duplicate
.
end
())
...
@@ -1697,10 +1697,10 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
...
@@ -1697,10 +1697,10 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
for
(
int32
i
=
0
;
i
<
eset
.
size
()
&&
min
>
0
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
()
&&
min
>
0
;
++
i
)
{
if
(
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
||
eset
[
i
]
->
count_limit
==
0
||
!
eset
[
i
]
->
target
)
if
(
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
||
eset
[
i
]
->
count_limit
==
0
||
!
eset
[
i
]
->
target
)
continue
;
continue
;
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
eset
[
i
]
->
get_value
(
target
,
0
,
&
retval
);
eset
[
i
]
->
get_value
(
target
,
0
,
retval
);
int32
dec
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
dec
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
static_cast
<
int32
>
(
retval
[
1
])
:
0
;
if
(
effect_code
>
0
)
{
if
(
effect_code
>
0
)
{
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
if
(
it
==
duplicate
.
end
())
if
(
it
==
duplicate
.
end
())
...
@@ -1718,10 +1718,10 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
...
@@ -1718,10 +1718,10 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
for
(
int32
i
=
0
;
i
<
eset
.
size
()
&&
min
>
0
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
()
&&
min
>
0
;
++
i
)
{
if
(
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
||
eset
[
i
]
->
count_limit
==
0
||
eset
[
i
]
->
target
)
if
(
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
||
eset
[
i
]
->
count_limit
==
0
||
eset
[
i
]
->
target
)
continue
;
continue
;
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
eset
[
i
]
->
get_value
(
target
,
0
,
&
retval
);
eset
[
i
]
->
get_value
(
target
,
0
,
retval
);
int32
dec
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
dec
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
static_cast
<
int32
>
(
retval
[
1
])
:
0
;
if
(
effect_code
>
0
)
{
if
(
effect_code
>
0
)
{
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
if
(
it
==
duplicate
.
end
())
if
(
it
==
duplicate
.
end
())
...
@@ -2125,11 +2125,11 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
...
@@ -2125,11 +2125,11 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
}
}
if
(
!
ignore_count
&&
!
core
.
extra_summon
[
setplayer
])
{
if
(
!
ignore_count
&&
!
core
.
extra_summon
[
setplayer
])
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
eset
[
i
]
->
get_value
(
target
,
0
,
&
retval
);
eset
[
i
]
->
get_value
(
target
,
0
,
retval
);
int32
new_min_tribute
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
new_min_tribute
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
new_zone
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0x1f
;
uint32
new_zone
=
retval
.
size
()
>
1
?
static_cast
<
uint32
>
(
retval
[
1
])
:
0x1f
;
int32
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
retval
[
2
]
:
retval
[
2
]
)
:
0xff00ff
;
int32
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
static_cast
<
int32
>
(
retval
[
2
])
:
static_cast
<
int32
>
(
retval
[
2
])
)
:
0xff00ff
;
new_zone
&=
zone
;
new_zone
&=
zone
;
if
(
proc
)
{
if
(
proc
)
{
if
(
new_min_tribute
<
(
int32
)
min_tribute
)
if
(
new_min_tribute
<
(
int32
)
min_tribute
)
...
@@ -2166,13 +2166,13 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
...
@@ -2166,13 +2166,13 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
core
.
units
.
begin
()
->
ptr1
=
pextra
;
core
.
units
.
begin
()
->
ptr1
=
pextra
;
int32
releasable
=
0xff00ff
;
int32
releasable
=
0xff00ff
;
if
(
pextra
)
{
if
(
pextra
)
{
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
pextra
->
get_value
(
target
,
0
,
&
retval
);
pextra
->
get_value
(
target
,
0
,
retval
);
int32
new_min_tribute
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
new_min_tribute
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
new_zone
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0x1f
;
uint32
new_zone
=
retval
.
size
()
>
1
?
static_cast
<
uint32
>
(
retval
[
1
])
:
0x1f
;
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
retval
[
2
]
:
retval
[
2
]
)
:
0xff00ff
;
releasable
=
retval
.
size
()
>
2
?
(
retval
[
2
]
<
0
?
0xff00ff
+
static_cast
<
int32
>
(
retval
[
2
])
:
static_cast
<
int32
>
(
retval
[
2
])
)
:
0xff00ff
;
if
(
(
int32
)
min_tribute
<
new_min_tribute
)
if
(
min_tribute
<
new_min_tribute
)
min_tribute
=
new_min_tribute
;
min_tribute
=
static_cast
<
uint8
>
(
new_min_tribute
)
;
zone
&=
new_zone
;
zone
&=
new_zone
;
core
.
units
.
begin
()
->
arg1
=
setplayer
+
(
ignore_count
<<
8
)
+
(
min_tribute
<<
16
)
+
(
zone
<<
24
);
core
.
units
.
begin
()
->
arg1
=
setplayer
+
(
ignore_count
<<
8
)
+
(
min_tribute
<<
16
)
+
(
zone
<<
24
);
}
}
...
@@ -2268,10 +2268,10 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
...
@@ -2268,10 +2268,10 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
))
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
))
continue
;
continue
;
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
eset
[
i
]
->
get_value
(
target
,
0
,
&
retval
);
eset
[
i
]
->
get_value
(
target
,
0
,
retval
);
int32
dec
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
dec
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
static_cast
<
int32
>
(
retval
[
1
])
:
0
;
if
(
effect_code
>
0
)
{
if
(
effect_code
>
0
)
{
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
if
(
it
==
duplicate
.
end
())
if
(
it
==
duplicate
.
end
())
...
@@ -2288,10 +2288,10 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
...
@@ -2288,10 +2288,10 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
for
(
int32
i
=
0
;
i
<
eset
.
size
()
&&
min
>
0
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
()
&&
min
>
0
;
++
i
)
{
if
(
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
||
eset
[
i
]
->
count_limit
==
0
||
!
eset
[
i
]
->
target
)
if
(
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
||
eset
[
i
]
->
count_limit
==
0
||
!
eset
[
i
]
->
target
)
continue
;
continue
;
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
eset
[
i
]
->
get_value
(
target
,
0
,
&
retval
);
eset
[
i
]
->
get_value
(
target
,
0
,
retval
);
int32
dec
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
dec
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
static_cast
<
int32
>
(
retval
[
1
])
:
0
;
if
(
effect_code
>
0
)
{
if
(
effect_code
>
0
)
{
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
if
(
it
==
duplicate
.
end
())
if
(
it
==
duplicate
.
end
())
...
@@ -2309,10 +2309,10 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
...
@@ -2309,10 +2309,10 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
for
(
int32
i
=
0
;
i
<
eset
.
size
()
&&
min
>
0
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
()
&&
min
>
0
;
++
i
)
{
if
(
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
||
eset
[
i
]
->
count_limit
==
0
||
eset
[
i
]
->
target
)
if
(
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
||
eset
[
i
]
->
count_limit
==
0
||
eset
[
i
]
->
target
)
continue
;
continue
;
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
eset
[
i
]
->
get_value
(
target
,
0
,
&
retval
);
eset
[
i
]
->
get_value
(
target
,
0
,
retval
);
int32
dec
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
int32
dec
=
retval
.
size
()
>
0
?
static_cast
<
int32
>
(
retval
[
0
])
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0
;
int32
effect_code
=
retval
.
size
()
>
1
?
static_cast
<
int32
>
(
retval
[
1
])
:
0
;
if
(
effect_code
>
0
)
{
if
(
effect_code
>
0
)
{
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
auto
it
=
std
::
find
(
duplicate
.
begin
(),
duplicate
.
end
(),
effect_code
);
if
(
it
==
duplicate
.
end
())
if
(
it
==
duplicate
.
end
())
...
@@ -2832,13 +2832,13 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
...
@@ -2832,13 +2832,13 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
else
else
targetplayer
=
1
-
sumplayer
;
targetplayer
=
1
-
sumplayer
;
}
}
std
::
vector
<
int32
>
retval
;
std
::
vector
<
lua_Integer
>
retval
;
peffect
->
get_value
(
target
,
0
,
&
retval
);
peffect
->
get_value
(
target
,
0
,
retval
);
uint32
summon_info
=
retval
.
size
()
>
0
?
retval
[
0
]
:
0
;
uint32
summon_info
=
retval
.
size
()
>
0
?
static_cast
<
uint32
>
(
retval
[
0
])
:
0
;
positions
=
target
->
get_spsummonable_position
(
peffect
,
((
summon_info
&
(
SUMMON_VALUE_SUB_TYPE
|
SUMMON_VALUE_CUSTOM_TYPE
))
|
SUMMON_TYPE_SPECIAL
),
positions
,
sumplayer
,
targetplayer
);
positions
=
target
->
get_spsummonable_position
(
peffect
,
((
summon_info
&
(
SUMMON_VALUE_SUB_TYPE
|
SUMMON_VALUE_CUSTOM_TYPE
))
|
SUMMON_TYPE_SPECIAL
),
positions
,
sumplayer
,
targetplayer
);
if
(
positions
==
0
)
if
(
positions
==
0
)
positions
=
POS_FACEUP_ATTACK
;
positions
=
POS_FACEUP_ATTACK
;
uint32
zone
=
retval
.
size
()
>
1
?
retval
[
1
]
:
0xff
;
uint32
zone
=
retval
.
size
()
>
1
?
static_cast
<
uint32
>
(
retval
[
1
])
:
0xff
;
target
->
summon_info
=
(
summon_info
&
(
SUMMON_VALUE_SUB_TYPE
|
SUMMON_VALUE_CUSTOM_TYPE
))
|
SUMMON_TYPE_SPECIAL
|
((
uint32
)
target
->
current
.
location
<<
16
);
target
->
summon_info
=
(
summon_info
&
(
SUMMON_VALUE_SUB_TYPE
|
SUMMON_VALUE_CUSTOM_TYPE
))
|
SUMMON_TYPE_SPECIAL
|
((
uint32
)
target
->
current
.
location
<<
16
);
target
->
enable_field_effect
(
false
);
target
->
enable_field_effect
(
false
);
move_to_field
(
target
,
sumplayer
,
targetplayer
,
LOCATION_MZONE
,
positions
,
FALSE
,
0
,
FALSE
,
zone
);
move_to_field
(
target
,
sumplayer
,
targetplayer
,
LOCATION_MZONE
,
positions
,
FALSE
,
0
,
FALSE
,
zone
);
...
...
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