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
26d9b67a
Commit
26d9b67a
authored
Sep 05, 2022
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
8df34f94
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
18 deletions
+53
-18
Classes/ocgcore/card.cpp
Classes/ocgcore/card.cpp
+30
-7
Classes/ocgcore/card.h
Classes/ocgcore/card.h
+3
-2
Classes/ocgcore/effect.h
Classes/ocgcore/effect.h
+4
-2
Classes/ocgcore/libduel.cpp
Classes/ocgcore/libduel.cpp
+10
-1
Classes/ocgcore/operations.cpp
Classes/ocgcore/operations.cpp
+6
-6
No files found.
Classes/ocgcore/card.cpp
View file @
26d9b67a
...
...
@@ -28,6 +28,28 @@ bool card_state::is_location(int32 loc) const {
return
true
;
return
false
;
}
void
card_state
::
init_state
()
{
code
=
0xffffffff
;
code2
=
0xffffffff
;
type
=
0xffffffff
;
level
=
0xffffffff
;
rank
=
0xffffffff
;
link
=
0xffffffff
;
lscale
=
0xffffffff
;
rscale
=
0xffffffff
;
attribute
=
0xffffffff
;
race
=
0xffffffff
;
attack
=
0xffffffff
;
defense
=
0xffffffff
;
base_attack
=
0xffffffff
;
base_defense
=
0xffffffff
;
controler
=
0xff
;
location
=
0xff
;
sequence
=
0xff
;
position
=
0xff
;
reason
=
0xffffffff
;
reason_player
=
0xff
;
}
bool
card
::
card_operation_sort
(
card
*
c1
,
card
*
c2
)
{
duel
*
pduel
=
c1
->
pduel
;
int32
cp1
=
c1
->
overlay_target
?
c1
->
overlay_target
->
current
.
controler
:
c1
->
current
.
controler
;
...
...
@@ -87,9 +109,9 @@ card::card(duel* pd) {
equiping_target
=
0
;
pre_equip_target
=
0
;
overlay_target
=
0
;
std
::
memset
(
&
current
,
0
,
sizeof
(
card_state
))
;
std
::
memset
(
&
previous
,
0
,
sizeof
(
card_state
))
;
std
::
memset
(
&
temp
,
0xff
,
sizeof
(
card_state
)
);
current
=
{}
;
previous
=
{}
;
temp
.
init_state
(
);
unique_pos
[
0
]
=
unique_pos
[
1
]
=
0
;
spsummon_counter
[
0
]
=
spsummon_counter
[
1
]
=
0
;
unique_code
=
0
;
...
...
@@ -380,9 +402,10 @@ int32 card::is_pre_set_card(uint32 set_code) {
setcode
=
setcode
>>
16
;
}
//add set code
setcode
=
previous
.
setcode
;
if
(
setcode
&&
(
setcode
&
0xfff
)
==
settype
&&
(
setcode
&
0xf000
&
setsubtype
)
==
setsubtype
)
return
TRUE
;
for
(
auto
&
presetcode
:
previous
.
setcode
)
{
if
(
presetcode
&&
(
presetcode
&
0xfff
)
==
settype
&&
(
presetcode
&
0xf000
&
setsubtype
)
==
setsubtype
)
return
TRUE
;
}
//another code
uint32
code2
=
previous
.
code2
;
uint64
setcode2
;
...
...
@@ -1575,7 +1598,7 @@ int32 card::add_effect(effect* peffect) {
if
(
peffect
->
type
&
EFFECT_TYPE_SINGLE
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
peffect
->
owner
==
this
&&
get_status
(
STATUS_DISABLED
)
&&
(
peffect
->
reset_flag
&
RESET_DISABLE
))
return
0
;
if
(
!
(
peffect
->
type
&
EFFECT_TYPE_CONTINUOUS
)
&&
is_continuous_event
(
peffect
->
code
))
if
(
peffect
->
type
&
EFFECT_TYPES_TRIGGER_LIKE
&&
is_continuous_event
(
peffect
->
code
))
return
0
;
// the trigger effect in phase is "once per turn" by default
if
(
peffect
->
get_code_type
()
==
CODE_PHASE
&&
peffect
->
code
&
(
PHASE_DRAW
|
PHASE_STANDBY
|
PHASE_END
)
&&
peffect
->
type
&
(
EFFECT_TYPE_TRIGGER_O
|
EFFECT_TYPE_TRIGGER_F
)
...
...
Classes/ocgcore/card.h
View file @
26d9b67a
...
...
@@ -41,12 +41,12 @@ struct card_data {
struct
card_state
{
card_state
()
:
code
(
0
),
code2
(
0
),
setcode
(
0
),
type
(
0
),
level
(
0
),
rank
(
0
),
link
(
0
),
lscale
(
0
),
rscale
(
0
),
attribute
(
0
),
race
(
0
),
attack
(
0
),
defense
(
0
),
base_attack
(
0
),
base_defense
(
0
),
:
code
(
0
),
code2
(
0
),
type
(
0
),
level
(
0
),
rank
(
0
),
link
(
0
),
lscale
(
0
),
rscale
(
0
),
attribute
(
0
),
race
(
0
),
attack
(
0
),
defense
(
0
),
base_attack
(
0
),
base_defense
(
0
),
controler
(
PLAYER_NONE
),
location
(
0
),
sequence
(
0
),
position
(
0
),
reason
(
0
),
pzone
(
false
),
reason_card
(
nullptr
),
reason_player
(
PLAYER_NONE
),
reason_effect
(
nullptr
)
{}
uint32
code
;
uint32
code2
;
uint16
setcode
;
std
::
vector
<
uint32
>
setcode
;
uint32
type
;
uint32
level
;
uint32
rank
;
...
...
@@ -69,6 +69,7 @@ struct card_state {
uint8
reason_player
;
effect
*
reason_effect
;
bool
is_location
(
int32
loc
)
const
;
void
init_state
();
};
struct
query_cache
{
...
...
Classes/ocgcore/effect.h
View file @
26d9b67a
...
...
@@ -166,6 +166,8 @@ public:
#define EFFECT_TYPE_GRANT 0x2000 //
#define EFFECT_TYPE_TARGET 0x4000 //
#define EFFECT_TYPES_TRIGGER_LIKE (EFFECT_TYPE_ACTIVATE | EFFECT_TYPE_TRIGGER_O | EFFECT_TYPE_TRIGGER_F | EFFECT_TYPE_QUICK_O | EFFECT_TYPE_QUICK_F)
//========== Flags ==========
enum
effect_flag
:
uint32
{
EFFECT_FLAG_INITIAL
=
0x0001
,
...
...
@@ -466,7 +468,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_ACTIVATION_COUNT_LIMIT 367
#define EFFECT_LIMIT_SPECIAL_SUMMON_POSITION 368
#define EVENT_STARTUP 1000
//
#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
#define EVENT_FREE_CHAIN 1002
#define EVENT_DESTROY 1010
...
...
@@ -543,7 +545,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define DOUBLE_DAMAGE 0x80000000
#define HALF_DAMAGE 0x80000001
// The type of
bit field
in code
// The type of
event
in code
#define CODE_CUSTOM 1 // header + id (28 bits)
#define CODE_COUNTER 2 // header + counter_id (16 bits)
#define CODE_PHASE 3 // header + phase_id (12 bits)
...
...
Classes/ocgcore/libduel.cpp
View file @
26d9b67a
...
...
@@ -3692,7 +3692,16 @@ int32 scriptlib::duel_select_field(lua_State* L) {
uint32
location1
=
(
uint32
)
lua_tointeger
(
L
,
3
);
uint32
location2
=
(
uint32
)
lua_tointeger
(
L
,
4
);
uint32
filter
=
(
uint32
)
lua_tointeger
(
L
,
5
);
uint16
type
=
PROCESSOR_SELECT_DISFIELD
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
lua_gettop
(
L
)
>=
6
)
{
type
=
PROCESSOR_SELECT_PLACE
;
uint32
code
=
(
uint32
)
lua_tointeger
(
L
,
6
);
pduel
->
write_buffer8
(
MSG_HINT
);
pduel
->
write_buffer8
(
HINT_SELECTMSG
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer32
(
code
);
}
uint32
flag
=
0xffffffff
;
if
(
location1
&
LOCATION_MZONE
)
{
flag
&=
0xffffffe0
;
...
...
@@ -3710,7 +3719,7 @@ int32 scriptlib::duel_select_field(lua_State* L) {
flag
&=
0xffffff9f
;
}
flag
|=
filter
|
0x00800080
;
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_DISFIELD
,
0
,
0
,
0
,
playerid
,
flag
,
count
);
pduel
->
game_field
->
add_process
(
type
,
0
,
0
,
0
,
playerid
,
flag
,
count
);
return
lua_yieldk
(
L
,
0
,
(
lua_KContext
)
pduel
,
[](
lua_State
*
L
,
int32
status
,
lua_KContext
ctx
)
{
duel
*
pduel
=
(
duel
*
)
ctx
;
int32
playerid
=
(
int32
)
lua_tointeger
(
L
,
1
);
...
...
Classes/ocgcore/operations.cpp
View file @
26d9b67a
...
...
@@ -18,7 +18,7 @@ int32 field::negate_chain(uint8 chaincount) {
if
(
chaincount
>
core
.
current_chain
.
size
()
||
chaincount
<
1
)
chaincount
=
(
uint8
)
core
.
current_chain
.
size
();
chain
&
pchain
=
core
.
current_chain
[
chaincount
-
1
];
card
*
phandler
=
pchain
.
triggering_effect
->
handler
;
card
*
phandler
=
pchain
.
triggering_effect
->
get_handler
()
;
if
(
!
(
pchain
.
flag
&
CHAIN_DISABLE_ACTIVATE
)
&&
is_chain_negatable
(
pchain
.
chain_count
)
&&
(
!
phandler
->
is_has_relation
(
pchain
)
||
phandler
->
is_affect_by_effect
(
core
.
reason_effect
)))
{
pchain
.
flag
|=
CHAIN_DISABLE_ACTIVATE
;
...
...
@@ -43,7 +43,7 @@ int32 field::disable_chain(uint8 chaincount, uint8 forced) {
if
(
chaincount
>
core
.
current_chain
.
size
()
||
chaincount
<
1
)
chaincount
=
(
uint8
)
core
.
current_chain
.
size
();
chain
&
pchain
=
core
.
current_chain
[
chaincount
-
1
];
card
*
phandler
=
pchain
.
triggering_effect
->
handler
;
card
*
phandler
=
pchain
.
triggering_effect
->
get_handler
()
;
if
(
!
(
pchain
.
flag
&
CHAIN_DISABLE_EFFECT
)
&&
is_chain_disablable
(
pchain
.
chain_count
)
&&
(
!
phandler
->
is_has_relation
(
pchain
)
||
phandler
->
is_affect_by_effect
(
core
.
reason_effect
))
&&
!
(
phandler
->
is_has_relation
(
pchain
)
&&
phandler
->
is_status
(
STATUS_DISABLED
)
&&
!
forced
))
{
...
...
@@ -3865,12 +3865,12 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard
->
previous
.
attack
=
pcard
->
data
.
attack
;
pcard
->
previous
.
defense
=
pcard
->
data
.
defense
;
}
pcard
->
previous
.
setcode
.
clear
();
effect_set
eset
;
pcard
->
filter_effect
(
EFFECT_ADD_SETCODE
,
&
eset
);
if
(
eset
.
size
())
pcard
->
previous
.
setcode
=
eset
.
get_last
()
->
get_value
(
pcard
);
else
pcard
->
previous
.
setcode
=
0
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pcard
->
previous
.
setcode
.
push_back
((
uint32
)
eset
[
i
]
->
get_value
(
pcard
));
}
}
}
if
(
leave_p
.
size
())
...
...
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