Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
Commits
7624c5c7
Commit
7624c5c7
authored
Jan 10, 2024
by
Dark Zane
Committed by
GitHub
Jan 10, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fallenstardust:master' into master
parents
11121cbb
51cfd16c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
92 additions
and
92 deletions
+92
-92
Classes/ocgcore/card.cpp
Classes/ocgcore/card.cpp
+44
-26
Classes/ocgcore/card.h
Classes/ocgcore/card.h
+15
-6
Classes/ocgcore/common.h
Classes/ocgcore/common.h
+0
-4
Classes/ocgcore/duel.cpp
Classes/ocgcore/duel.cpp
+1
-1
Classes/ocgcore/effect.cpp
Classes/ocgcore/effect.cpp
+0
-2
Classes/ocgcore/field.cpp
Classes/ocgcore/field.cpp
+3
-3
Classes/ocgcore/libcard.cpp
Classes/ocgcore/libcard.cpp
+17
-35
Classes/ocgcore/operations.cpp
Classes/ocgcore/operations.cpp
+8
-15
Classes/ocgcore/scriptlib.h
Classes/ocgcore/scriptlib.h
+4
-0
No files found.
Classes/ocgcore/card.cpp
View file @
7624c5c7
...
@@ -14,6 +14,14 @@
...
@@ -14,6 +14,14 @@
#include "ocgapi.h"
#include "ocgapi.h"
#include <algorithm>
#include <algorithm>
const
std
::
unordered_map
<
uint32
,
uint32
>
card
::
second_code
=
{
{
CARD_MARINE_DOLPHIN
,
17955766u
},
{
CARD_TWINKLE_MOSS
,
17732278u
},
{
CARD_TIMAEUS
,
10000050u
},
{
CARD_CRITIAS
,
10000060u
},
{
CARD_HERMOS
,
10000070u
}
};
bool
card_sort
::
operator
()(
void
*
const
&
p1
,
void
*
const
&
p2
)
const
{
bool
card_sort
::
operator
()(
void
*
const
&
p1
,
void
*
const
&
p2
)
const
{
card
*
c1
=
(
card
*
)
p1
;
card
*
c1
=
(
card
*
)
p1
;
card
*
c2
=
(
card
*
)
p2
;
card
*
c2
=
(
card
*
)
p2
;
...
@@ -411,55 +419,60 @@ uint32 card::get_info_location() {
...
@@ -411,55 +419,60 @@ uint32 card::get_info_location() {
return
c
+
(
l
<<
8
)
+
(
s
<<
16
)
+
(
ss
<<
24
);
return
c
+
(
l
<<
8
)
+
(
s
<<
16
)
+
(
ss
<<
24
);
}
}
}
}
// mapping of double-name cards
// get the printed code on card
uint32
card
::
second_code
(
uint32
code
){
uint32
card
::
get_original_code
()
const
{
switch
(
code
){
if
(
data
.
alias
&&
(
data
.
alias
<
data
.
code
+
CARD_ARTWORK_VERSIONS_OFFSET
)
&&
(
data
.
code
<
data
.
alias
+
CARD_ARTWORK_VERSIONS_OFFSET
))
case
CARD_MARINE_DOLPHIN
:
return
data
.
alias
;
return
17955766u
;
else
case
CARD_TWINKLE_MOSS
:
return
data
.
code
;
return
17732278u
;
}
default:
// get the original code in duel (can be different from printed code)
return
0
;
std
::
tuple
<
uint32
,
uint32
>
card
::
get_original_code_rule
()
const
{
auto
it
=
second_code
.
find
(
data
.
code
);
if
(
it
!=
second_code
.
end
())
{
return
std
::
make_tuple
(
data
.
code
,
it
->
second
);
}
else
{
if
(
data
.
alias
)
return
std
::
make_tuple
(
data
.
alias
,
0
);
else
return
std
::
make_tuple
(
data
.
code
,
0
);
}
}
}
}
// return: the current card name
// return: the current card name
// for double-name card, it returns printed name
// for double-name card
s
, it returns printed name
uint32
card
::
get_code
()
{
uint32
card
::
get_code
()
{
if
(
assume_type
==
ASSUME_CODE
)
if
(
assume_type
==
ASSUME_CODE
)
return
assume_value
;
return
assume_value
;
if
(
temp
.
code
!=
0xffffffff
)
if
(
temp
.
code
!=
0xffffffff
)
return
temp
.
code
;
return
temp
.
code
;
effect_set
effects
;
effect_set
effects
;
uint32
code
=
data
.
code
;
uint32
code
=
std
::
get
<
0
>
(
get_original_code_rule
())
;
temp
.
code
=
data
.
code
;
temp
.
code
=
code
;
filter_effect
(
EFFECT_CHANGE_CODE
,
&
effects
);
filter_effect
(
EFFECT_CHANGE_CODE
,
&
effects
);
if
(
effects
.
size
())
if
(
effects
.
size
())
code
=
effects
.
get_last
()
->
get_value
(
this
);
code
=
effects
.
get_last
()
->
get_value
(
this
);
temp
.
code
=
0xffffffff
;
temp
.
code
=
0xffffffff
;
if
(
code
==
data
.
code
)
{
if
(
data
.
alias
&&
!
is_affected_by_effect
(
EFFECT_ADD_CODE
))
code
=
data
.
alias
;
}
else
{
card_data
dat
;
read_card
(
code
,
&
dat
);
if
(
dat
.
alias
&&
!
second_code
(
code
))
code
=
dat
.
alias
;
}
return
code
;
return
code
;
}
}
// return: the current second card name
// return: the current second card name
// for double-name cards, it returns the name in description
// for double-name cards, it returns the name in description
uint32
card
::
get_another_code
()
{
uint32
card
::
get_another_code
()
{
uint32
code
=
get_code
();
uint32
code1
=
get_code
();
if
(
code
!=
data
.
code
){
if
(
is_affected_by_effect
(
EFFECT_CHANGE_CODE
))
{
return
second_code
(
code
);
auto
it
=
second_code
.
find
(
code1
);
if
(
it
!=
second_code
.
end
())
return
it
->
second
;
else
return
0
;
}
}
uint32
code2
=
std
::
get
<
1
>
(
get_original_code_rule
());
effect_set
eset
;
effect_set
eset
;
filter_effect
(
EFFECT_ADD_CODE
,
&
eset
);
filter_effect
(
EFFECT_ADD_CODE
,
&
eset
);
if
(
!
eset
.
size
())
if
(
!
eset
.
size
())
return
0
;
return
code2
;
uint32
otcode
=
eset
.
get_last
()
->
get_value
(
this
);
uint32
otcode
=
eset
.
get_last
()
->
get_value
(
this
);
if
(
code
!=
otcode
)
if
(
code
1
!=
otcode
)
return
otcode
;
return
otcode
;
return
0
;
return
0
;
}
}
...
@@ -2578,6 +2591,7 @@ void card::set_special_summon_status(effect* peffect) {
...
@@ -2578,6 +2591,7 @@ void card::set_special_summon_status(effect* peffect) {
spsummon
.
defense
=
0
;
spsummon
.
defense
=
0
;
spsummon
.
setcode
.
clear
();
spsummon
.
setcode
.
clear
();
spsummon
.
reason_effect
=
nullptr
;
spsummon
.
reason_effect
=
nullptr
;
spsummon
.
reason_player
=
PLAYER_NONE
;
return
;
return
;
}
}
card
*
pcard
=
peffect
->
get_handler
();
card
*
pcard
=
peffect
->
get_handler
();
...
@@ -2600,6 +2614,7 @@ void card::set_special_summon_status(effect* peffect) {
...
@@ -2600,6 +2614,7 @@ void card::set_special_summon_status(effect* peffect) {
spsummon
.
setcode
.
push_back
((
uint32
)
eset
[
i
]
->
get_value
(
pcard
));
spsummon
.
setcode
.
push_back
((
uint32
)
eset
[
i
]
->
get_value
(
pcard
));
}
}
spsummon
.
reason_effect
=
peffect
;
spsummon
.
reason_effect
=
peffect
;
spsummon
.
reason_player
=
peffect
->
get_handler_player
();
}
else
{
}
else
{
pcard
=
cait
->
triggering_effect
->
get_handler
();
pcard
=
cait
->
triggering_effect
->
get_handler
();
spsummon
.
code
=
cait
->
triggering_state
.
code
;
spsummon
.
code
=
cait
->
triggering_state
.
code
;
...
@@ -2618,6 +2633,7 @@ void card::set_special_summon_status(effect* peffect) {
...
@@ -2618,6 +2633,7 @@ void card::set_special_summon_status(effect* peffect) {
spsummon
.
setcode
.
push_back
((
uint32
)
eset
[
i
]
->
get_value
(
pcard
));
spsummon
.
setcode
.
push_back
((
uint32
)
eset
[
i
]
->
get_value
(
pcard
));
}
}
spsummon
.
reason_effect
=
cait
->
triggering_effect
;
spsummon
.
reason_effect
=
cait
->
triggering_effect
;
spsummon
.
reason_player
=
cait
->
triggering_player
;
}
}
}
}
void
card
::
filter_effect
(
int32
code
,
effect_set
*
eset
,
uint8
sort
)
{
void
card
::
filter_effect
(
int32
code
,
effect_set
*
eset
,
uint8
sort
)
{
...
@@ -3312,6 +3328,8 @@ int32 card::is_spsummonable_card() {
...
@@ -3312,6 +3328,8 @@ int32 card::is_spsummonable_card() {
int32
card
::
is_fusion_summonable_card
(
uint32
summon_type
)
{
int32
card
::
is_fusion_summonable_card
(
uint32
summon_type
)
{
if
(
!
(
data
.
type
&
TYPE_FUSION
))
if
(
!
(
data
.
type
&
TYPE_FUSION
))
return
FALSE
;
return
FALSE
;
if
((
data
.
type
&
TYPE_PENDULUM
)
&&
current
.
location
==
LOCATION_EXTRA
&&
(
current
.
position
&
POS_FACEUP
))
return
FALSE
;
summon_type
|=
SUMMON_TYPE_FUSION
;
summon_type
|=
SUMMON_TYPE_FUSION
;
effect_set
eset
;
effect_set
eset
;
filter_effect
(
EFFECT_SPSUMMON_CONDITION
,
&
eset
);
filter_effect
(
EFFECT_SPSUMMON_CONDITION
,
&
eset
);
...
...
Classes/ocgcore/card.h
View file @
7624c5c7
...
@@ -99,6 +99,12 @@ struct material_info {
...
@@ -99,6 +99,12 @@ struct material_info {
};
};
const
material_info
null_info
;
const
material_info
null_info
;
constexpr
uint32
CARD_MARINE_DOLPHIN
=
78734254
;
constexpr
uint32
CARD_TWINKLE_MOSS
=
13857930
;
constexpr
uint32
CARD_TIMAEUS
=
1784686
;
constexpr
uint32
CARD_CRITIAS
=
11082056
;
constexpr
uint32
CARD_HERMOS
=
46232525
;
class
card
{
class
card
{
public:
public:
struct
effect_relation_hash
{
struct
effect_relation_hash
{
...
@@ -137,6 +143,8 @@ public:
...
@@ -137,6 +143,8 @@ public:
uint8
location
{
0
};
uint8
location
{
0
};
uint8
sequence
{
0
};
uint8
sequence
{
0
};
};
};
static
const
std
::
unordered_map
<
uint32
,
uint32
>
second_code
;
int32
ref_handle
;
int32
ref_handle
;
duel
*
pduel
;
duel
*
pduel
;
card_data
data
;
card_data
data
;
...
@@ -206,7 +214,8 @@ public:
...
@@ -206,7 +214,8 @@ public:
int32
get_infos
(
byte
*
buf
,
uint32
query_flag
,
int32
use_cache
=
TRUE
);
int32
get_infos
(
byte
*
buf
,
uint32
query_flag
,
int32
use_cache
=
TRUE
);
uint32
get_info_location
();
uint32
get_info_location
();
uint32
second_code
(
uint32
code
);
uint32
get_original_code
()
const
;
std
::
tuple
<
uint32
,
uint32
>
get_original_code_rule
()
const
;
uint32
get_code
();
uint32
get_code
();
uint32
get_another_code
();
uint32
get_another_code
();
int32
is_set_card
(
uint32
set_code
);
int32
is_set_card
(
uint32
set_code
);
...
@@ -389,6 +398,9 @@ public:
...
@@ -389,6 +398,9 @@ public:
#define SUMMON_TYPE_PENDULUM 0x4a000000
#define SUMMON_TYPE_PENDULUM 0x4a000000
#define SUMMON_TYPE_LINK 0x4c000000
#define SUMMON_TYPE_LINK 0x4c000000
#define SUMMON_TYPE_MAIN 0xf0000000
#define SUMMON_TYPE_LOCATION 0x00ff0000
//Counter
//Counter
#define COUNTER_WITHOUT_PERMIT 0x1000
#define COUNTER_WITHOUT_PERMIT 0x1000
//#define COUNTER_NEED_ENABLE 0x2000
//#define COUNTER_NEED_ENABLE 0x2000
...
@@ -403,7 +415,7 @@ public:
...
@@ -403,7 +415,7 @@ public:
#define ASSUME_ATTACK 7
#define ASSUME_ATTACK 7
#define ASSUME_DEFENSE 8
#define ASSUME_DEFENSE 8
//S
ummon
info
//S
pecial Summon effect
info
#define SUMMON_INFO_CODE 0x01
#define SUMMON_INFO_CODE 0x01
#define SUMMON_INFO_CODE2 0x02
#define SUMMON_INFO_CODE2 0x02
#define SUMMON_INFO_TYPE 0x04
#define SUMMON_INFO_TYPE 0x04
...
@@ -414,10 +426,7 @@ public:
...
@@ -414,10 +426,7 @@ public:
#define SUMMON_INFO_ATTACK 0x80
#define SUMMON_INFO_ATTACK 0x80
#define SUMMON_INFO_DEFENSE 0x100
#define SUMMON_INFO_DEFENSE 0x100
#define SUMMON_INFO_REASON_EFFECT 0x200
#define SUMMON_INFO_REASON_EFFECT 0x200
#define SUMMON_INFO_REASON_PLAYER 0x400
//double-name cards
#define CARD_MARINE_DOLPHIN 78734254
#define CARD_TWINKLE_MOSS 13857930
#define CARD_ARTWORK_VERSIONS_OFFSET 10
#define CARD_ARTWORK_VERSIONS_OFFSET 10
...
...
Classes/ocgcore/common.h
View file @
7624c5c7
...
@@ -24,10 +24,6 @@ typedef signed char int8;
...
@@ -24,10 +24,6 @@ typedef signed char int8;
#define ADD_BIT(x,y) ((x)|=(y))
#define ADD_BIT(x,y) ((x)|=(y))
#define REMOVE_BIT(x,y) ((x)&=~(y))
#define REMOVE_BIT(x,y) ((x)&=~(y))
constexpr
bool
match_all
(
uint32
x
,
uint32
y
)
{
return
(
x
&
y
)
==
y
;
}
#define OPERATION_SUCCESS 1
#define OPERATION_SUCCESS 1
#define OPERATION_FAIL 0
#define OPERATION_FAIL 0
#define OPERATION_CANCELED -1
#define OPERATION_CANCELED -1
...
...
Classes/ocgcore/duel.cpp
View file @
7624c5c7
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
#include "group.h"
#include "group.h"
#include "ocgapi.h"
#include "ocgapi.h"
inline
void
write_buffer_vector
(
std
::
vector
<
byte
>&
buffer
,
const
void
*
data
,
int
size
)
{
inline
void
write_buffer_vector
(
std
::
vector
<
byte
>&
buffer
,
const
void
*
&
data
,
int
size
)
{
if
(
size
>
0
)
{
if
(
size
>
0
)
{
const
auto
len
=
buffer
.
size
();
const
auto
len
=
buffer
.
size
();
buffer
.
resize
(
len
+
size
);
buffer
.
resize
(
len
+
size
);
...
...
Classes/ocgcore/effect.cpp
View file @
7624c5c7
...
@@ -43,8 +43,6 @@ int32 effect::is_self_destroy_related() {
...
@@ -43,8 +43,6 @@ int32 effect::is_self_destroy_related() {
int32
effect
::
is_can_be_forbidden
()
{
int32
effect
::
is_can_be_forbidden
()
{
if
(
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
)
&&
!
is_flag
(
EFFECT_FLAG_CANNOT_NEGATE
))
if
(
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
)
&&
!
is_flag
(
EFFECT_FLAG_CANNOT_NEGATE
))
return
FALSE
;
return
FALSE
;
if
(
code
==
EFFECT_CHANGE_CODE
)
return
FALSE
;
return
TRUE
;
return
TRUE
;
}
}
// check if a single/field/equip effect is available
// check if a single/field/equip effect is available
...
...
Classes/ocgcore/field.cpp
View file @
7624c5c7
...
@@ -533,10 +533,10 @@ card* field::get_field_card(uint32 playerid, uint32 location, uint32 sequence) {
...
@@ -533,10 +533,10 @@ card* field::get_field_card(uint32 playerid, uint32 location, uint32 sequence) {
case
LOCATION_PZONE
:
{
case
LOCATION_PZONE
:
{
if
(
sequence
==
0
)
{
if
(
sequence
==
0
)
{
card
*
pcard
=
player
[
playerid
].
list_szone
[
core
.
duel_rule
>=
4
?
0
:
6
];
card
*
pcard
=
player
[
playerid
].
list_szone
[
core
.
duel_rule
>=
4
?
0
:
6
];
return
pcard
&&
pcard
->
current
.
pzone
?
pcard
:
0
;
return
(
pcard
&&
pcard
->
current
.
pzone
)
?
pcard
:
0
;
}
else
if
(
sequence
==
1
)
{
}
else
if
(
sequence
==
1
)
{
card
*
pcard
=
player
[
playerid
].
list_szone
[
core
.
duel_rule
>=
4
?
4
:
7
];
card
*
pcard
=
player
[
playerid
].
list_szone
[
core
.
duel_rule
>=
4
?
4
:
7
];
return
pcard
&&
pcard
->
current
.
pzone
?
pcard
:
0
;
return
(
pcard
&&
pcard
->
current
.
pzone
)
?
pcard
:
0
;
}
else
}
else
return
nullptr
;
return
nullptr
;
break
;
break
;
...
@@ -1894,7 +1894,7 @@ void field::get_ritual_material(uint8 playerid, effect* peffect, card_set* mater
...
@@ -1894,7 +1894,7 @@ void field::get_ritual_material(uint8 playerid, effect* peffect, card_set* mater
void
field
::
get_fusion_material
(
uint8
playerid
,
card_set
*
material_all
,
card_set
*
material_base
,
uint32
location
)
{
void
field
::
get_fusion_material
(
uint8
playerid
,
card_set
*
material_all
,
card_set
*
material_base
,
uint32
location
)
{
if
(
location
&
LOCATION_MZONE
)
{
if
(
location
&
LOCATION_MZONE
)
{
for
(
auto
&
pcard
:
player
[
playerid
].
list_mzone
)
{
for
(
auto
&
pcard
:
player
[
playerid
].
list_mzone
)
{
if
(
pcard
)
if
(
pcard
&&
!
pcard
->
is_status
(
STATUS_SUMMONING
)
)
material_base
->
insert
(
pcard
);
material_base
->
insert
(
pcard
);
}
}
}
}
...
...
Classes/ocgcore/libcard.cpp
View file @
7624c5c7
...
@@ -24,40 +24,29 @@ int32 scriptlib::card_get_code(lua_State *L) {
...
@@ -24,40 +24,29 @@ int32 scriptlib::card_get_code(lua_State *L) {
}
}
return
1
;
return
1
;
}
}
// GetOriginalCode(): get the original code printed on card
// return: 1 int
int32
scriptlib
::
card_get_origin_code
(
lua_State
*
L
)
{
int32
scriptlib
::
card_get_origin_code
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
if
(
pcard
->
data
.
alias
)
{
lua_pushinteger
(
L
,
pcard
->
get_original_code
());
if
((
pcard
->
data
.
alias
<
pcard
->
data
.
code
+
CARD_ARTWORK_VERSIONS_OFFSET
)
&&
(
pcard
->
data
.
code
<
pcard
->
data
.
alias
+
CARD_ARTWORK_VERSIONS_OFFSET
))
lua_pushinteger
(
L
,
pcard
->
data
.
alias
);
else
lua_pushinteger
(
L
,
pcard
->
data
.
code
);
}
else
lua_pushinteger
(
L
,
pcard
->
data
.
code
);
return
1
;
return
1
;
}
}
// GetOriginalCodeRule(): get the original code in duel (can be different from printed code)
// return: 1-2 int
int32
scriptlib
::
card_get_origin_code_rule
(
lua_State
*
L
)
{
int32
scriptlib
::
card_get_origin_code_rule
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
effect_set
eset
;
auto
codes
=
pcard
->
get_original_code_rule
();
pcard
->
filter_effect
(
EFFECT_ADD_CODE
,
&
eset
);
uint32
code1
=
std
::
get
<
0
>
(
codes
);
if
(
pcard
->
data
.
alias
&&
!
eset
.
size
())
uint32
code2
=
std
::
get
<
1
>
(
codes
);
lua_pushinteger
(
L
,
pcard
->
data
.
alias
);
if
(
code2
)
{
lua_pushinteger
(
L
,
code1
);
lua_pushinteger
(
L
,
code2
);
return
2
;
}
else
{
else
{
lua_pushinteger
(
L
,
pcard
->
data
.
code
);
lua_pushinteger
(
L
,
code1
);
if
(
eset
.
size
())
{
return
1
;
uint32
otcode
=
eset
.
get_last
()
->
get_value
(
pcard
);
lua_pushinteger
(
L
,
otcode
);
return
2
;
}
}
}
return
1
;
}
}
int32
scriptlib
::
card_get_fusion_code
(
lua_State
*
L
)
{
int32
scriptlib
::
card_get_fusion_code
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
...
@@ -921,6 +910,9 @@ int32 scriptlib::card_get_special_summon_info(lua_State *L) {
...
@@ -921,6 +910,9 @@ int32 scriptlib::card_get_special_summon_info(lua_State *L) {
case
SUMMON_INFO_REASON_EFFECT
:
case
SUMMON_INFO_REASON_EFFECT
:
interpreter
::
effect2value
(
L
,
pcard
->
spsummon
.
reason_effect
);
interpreter
::
effect2value
(
L
,
pcard
->
spsummon
.
reason_effect
);
break
;
break
;
case
SUMMON_INFO_REASON_PLAYER
:
lua_pushinteger
(
L
,
pcard
->
spsummon
.
reason_player
);
break
;
default:
default:
lua_pushnil
(
L
);
lua_pushnil
(
L
);
break
;
break
;
...
@@ -967,19 +959,9 @@ int32 scriptlib::card_is_origin_code_rule(lua_State *L) {
...
@@ -967,19 +959,9 @@ int32 scriptlib::card_is_origin_code_rule(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code1
=
0
;
auto
codes
=
pcard
->
get_original_code_rule
();
uint32
code2
=
0
;
uint32
code1
=
std
::
get
<
0
>
(
codes
);
effect_set
eset
;
uint32
code2
=
std
::
get
<
1
>
(
codes
);
pcard
->
filter_effect
(
EFFECT_ADD_CODE
,
&
eset
);
if
(
pcard
->
data
.
alias
&&
!
eset
.
size
()){
code1
=
pcard
->
data
.
alias
;
code2
=
0
;
}
else
{
code1
=
pcard
->
data
.
code
;
if
(
eset
.
size
())
code2
=
eset
.
get_last
()
->
get_value
(
pcard
);
}
uint32
count
=
lua_gettop
(
L
)
-
1
;
uint32
count
=
lua_gettop
(
L
)
-
1
;
uint32
result
=
FALSE
;
uint32
result
=
FALSE
;
for
(
uint32
i
=
0
;
i
<
count
;
++
i
)
{
for
(
uint32
i
=
0
;
i
<
count
;
++
i
)
{
...
...
Classes/ocgcore/operations.cpp
View file @
7624c5c7
...
@@ -1913,7 +1913,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
...
@@ -1913,7 +1913,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
core
.
units
.
begin
()
->
ptr2
=
0
;
core
.
units
.
begin
()
->
ptr2
=
0
;
}
}
if
(
target
->
current
.
location
==
LOCATION_MZONE
)
if
(
target
->
current
.
location
==
LOCATION_MZONE
)
send_to
(
target
,
0
,
REASON_RULE
,
sumplayer
,
sumplayer
,
LOCATION_GRAVE
,
0
,
0
);
send_to
(
target
,
0
,
REASON_RULE
,
PLAYER_NONE
,
sumplayer
,
LOCATION_GRAVE
,
0
,
0
);
adjust_instant
();
adjust_instant
();
add_process
(
PROCESSOR_POINT_EVENT
,
0
,
0
,
0
,
FALSE
,
0
);
add_process
(
PROCESSOR_POINT_EVENT
,
0
,
0
,
0
,
FALSE
,
0
);
return
TRUE
;
return
TRUE
;
...
@@ -2020,7 +2020,7 @@ int32 field::flip_summon(uint16 step, uint8 sumplayer, card * target) {
...
@@ -2020,7 +2020,7 @@ int32 field::flip_summon(uint16 step, uint8 sumplayer, card * target) {
core
.
units
.
begin
()
->
ptr1
=
0
;
core
.
units
.
begin
()
->
ptr1
=
0
;
}
}
if
(
target
->
current
.
location
==
LOCATION_MZONE
)
if
(
target
->
current
.
location
==
LOCATION_MZONE
)
send_to
(
target
,
0
,
REASON_RULE
,
sumplayer
,
sumplayer
,
LOCATION_GRAVE
,
0
,
0
);
send_to
(
target
,
0
,
REASON_RULE
,
PLAYER_NONE
,
sumplayer
,
LOCATION_GRAVE
,
0
,
0
);
add_process
(
PROCESSOR_POINT_EVENT
,
0
,
0
,
0
,
FALSE
,
0
);
add_process
(
PROCESSOR_POINT_EVENT
,
0
,
0
,
0
,
FALSE
,
0
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -2902,7 +2902,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
...
@@ -2902,7 +2902,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
core
.
units
.
begin
()
->
ptr1
=
0
;
core
.
units
.
begin
()
->
ptr1
=
0
;
}
}
if
(
target
->
current
.
location
==
LOCATION_MZONE
)
if
(
target
->
current
.
location
==
LOCATION_MZONE
)
send_to
(
target
,
0
,
REASON_RULE
,
sumplayer
,
sumplayer
,
LOCATION_GRAVE
,
0
,
0
);
send_to
(
target
,
0
,
REASON_RULE
,
PLAYER_NONE
,
sumplayer
,
LOCATION_GRAVE
,
0
,
0
);
adjust_instant
();
adjust_instant
();
add_process
(
PROCESSOR_POINT_EVENT
,
0
,
0
,
0
,
FALSE
,
0
);
add_process
(
PROCESSOR_POINT_EVENT
,
0
,
0
,
0
,
FALSE
,
0
);
return
TRUE
;
return
TRUE
;
...
@@ -2981,7 +2981,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
...
@@ -2981,7 +2981,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
||
check_unique_onfield
(
pcard
,
sumplayer
,
LOCATION_MZONE
)
||
check_unique_onfield
(
pcard
,
sumplayer
,
LOCATION_MZONE
)
||
pcard
->
is_affected_by_effect
(
EFFECT_CANNOT_SPECIAL_SUMMON
))
{
||
pcard
->
is_affected_by_effect
(
EFFECT_CANNOT_SPECIAL_SUMMON
))
{
cit
=
pgroup
->
container
.
erase
(
cit
);
cit
=
pgroup
->
container
.
erase
(
cit
);
continue
;
continue
;
}
}
effect_set
eset
;
effect_set
eset
;
pcard
->
filter_effect
(
EFFECT_SPSUMMON_COST
,
&
eset
);
pcard
->
filter_effect
(
EFFECT_SPSUMMON_COST
,
&
eset
);
...
@@ -3091,7 +3091,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
...
@@ -3091,7 +3091,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
++
cit
;
++
cit
;
}
}
if
(
cset
.
size
())
{
if
(
cset
.
size
())
{
send_to
(
&
cset
,
0
,
REASON_RULE
,
sumplayer
,
sumplayer
,
LOCATION_GRAVE
,
0
,
0
);
send_to
(
&
cset
,
0
,
REASON_RULE
,
PLAYER_NONE
,
sumplayer
,
LOCATION_GRAVE
,
0
,
0
);
adjust_instant
();
adjust_instant
();
}
}
if
(
pgroup
->
container
.
size
()
==
0
)
{
if
(
pgroup
->
container
.
size
()
==
0
)
{
...
@@ -3931,16 +3931,9 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
...
@@ -3931,16 +3931,9 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard
->
previous
.
defense
=
atk_def
.
second
;
pcard
->
previous
.
defense
=
atk_def
.
second
;
}
}
}
else
{
}
else
{
effect_set
eset
;
auto
codes
=
pcard
->
get_original_code_rule
();
pcard
->
filter_effect
(
EFFECT_ADD_CODE
,
&
eset
);
pcard
->
previous
.
code
=
std
::
get
<
0
>
(
codes
);
if
(
pcard
->
data
.
alias
&&
!
eset
.
size
())
pcard
->
previous
.
code2
=
std
::
get
<
1
>
(
codes
);
pcard
->
previous
.
code
=
pcard
->
data
.
alias
;
else
pcard
->
previous
.
code
=
pcard
->
data
.
code
;
if
(
eset
.
size
())
pcard
->
previous
.
code2
=
eset
.
get_last
()
->
get_value
(
pcard
);
else
pcard
->
previous
.
code2
=
0
;
pcard
->
previous
.
type
=
pcard
->
data
.
type
;
pcard
->
previous
.
type
=
pcard
->
data
.
type
;
pcard
->
previous
.
level
=
pcard
->
data
.
level
;
pcard
->
previous
.
level
=
pcard
->
data
.
level
;
pcard
->
previous
.
rank
=
pcard
->
data
.
level
;
pcard
->
previous
.
rank
=
pcard
->
data
.
level
;
...
...
Classes/ocgcore/scriptlib.h
View file @
7624c5c7
...
@@ -11,6 +11,10 @@
...
@@ -11,6 +11,10 @@
#include "common.h"
#include "common.h"
#include "interpreter.h"
#include "interpreter.h"
constexpr
bool
match_all
(
uint32
x
,
uint32
y
)
{
return
(
x
&
y
)
==
y
;
}
class
scriptlib
{
class
scriptlib
{
public:
public:
static
int32
check_param
(
lua_State
*
L
,
int32
param_type
,
int32
index
,
int32
retfalse
=
FALSE
);
static
int32
check_param
(
lua_State
*
L
,
int32
param_type
,
int32
index
,
int32
retfalse
=
FALSE
);
...
...
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