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
8cf2c0e2
Commit
8cf2c0e2
authored
May 09, 2024
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
73271852
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
126 additions
and
67 deletions
+126
-67
Classes/ocgcore/effect.cpp
Classes/ocgcore/effect.cpp
+53
-29
Classes/ocgcore/effect.h
Classes/ocgcore/effect.h
+3
-1
Classes/ocgcore/field.cpp
Classes/ocgcore/field.cpp
+9
-4
Classes/ocgcore/field.h
Classes/ocgcore/field.h
+1
-0
Classes/ocgcore/processor.cpp
Classes/ocgcore/processor.cpp
+60
-33
No files found.
Classes/ocgcore/effect.cpp
View file @
8cf2c0e2
...
...
@@ -177,6 +177,56 @@ int32 effect::check_count_limit(uint8 playerid) {
}
return
TRUE
;
}
// check activate in hand/in set turn
int32
effect
::
get_required_handorset_effects
(
effect_set
*
eset
,
uint8
playerid
,
const
tevent
&
e
,
int32
neglect_loc
)
{
eset
->
clear
();
if
(
!
(
type
&
EFFECT_TYPE_ACTIVATE
))
return
1
;
int32
ecode
=
0
;
if
(
handler
->
current
.
location
==
LOCATION_HAND
&&
!
neglect_loc
)
{
if
(
handler
->
data
.
type
&
TYPE_TRAP
)
ecode
=
EFFECT_TRAP_ACT_IN_HAND
;
else
if
((
handler
->
data
.
type
&
TYPE_SPELL
)
&&
pduel
->
game_field
->
infos
.
turn_player
!=
playerid
)
{
if
(
handler
->
data
.
type
&
TYPE_QUICKPLAY
)
ecode
=
EFFECT_QP_ACT_IN_NTPHAND
;
else
return
FALSE
;
}
}
else
if
(
handler
->
current
.
location
==
LOCATION_SZONE
)
{
if
((
handler
->
data
.
type
&
TYPE_TRAP
)
&&
handler
->
get_status
(
STATUS_SET_TURN
))
ecode
=
EFFECT_TRAP_ACT_IN_SET_TURN
;
if
((
handler
->
data
.
type
&
TYPE_SPELL
)
&&
(
handler
->
data
.
type
&
TYPE_QUICKPLAY
)
&&
handler
->
get_status
(
STATUS_SET_TURN
))
ecode
=
EFFECT_QP_ACT_IN_SET_TURN
;
}
if
(
!
ecode
)
return
1
;
int32
available
=
0
;
effect_set
tmp_eset
;
handler
->
filter_effect
(
ecode
,
&
tmp_eset
);
for
(
int32
i
=
0
;
i
<
tmp_eset
.
size
();
++
i
)
{
auto
peffect
=
tmp_eset
[
i
];
if
(
peffect
->
check_count_limit
(
playerid
))
{
pduel
->
lua
->
add_param
(
peffect
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
e
.
event_cards
,
PARAM_TYPE_GROUP
);
pduel
->
lua
->
add_param
(
e
.
event_player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
e
.
event_value
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
e
.
reason_effect
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
e
.
reason
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
e
.
reason_player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
0
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
if
(
pduel
->
lua
->
check_condition
(
peffect
->
cost
,
10
))
{
available
=
2
;
eset
->
add_item
(
peffect
);
}
}
}
return
available
;
}
// check if an EFFECT_TYPE_ACTIONS effect can be activated
// for triggering effects, it checks EFFECT_FLAG_DAMAGE_STEP, EFFECT_FLAG_SET_AVAILABLE
int32
effect
::
is_activateable
(
uint8
playerid
,
const
tevent
&
e
,
int32
neglect_cond
,
int32
neglect_cost
,
int32
neglect_target
,
int32
neglect_loc
,
int32
neglect_faceup
)
{
...
...
@@ -230,35 +280,9 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
return
FALSE
;
}
// check activate in hand/in set turn
int32
ecode
=
0
;
if
(
handler
->
current
.
location
==
LOCATION_HAND
&&
!
neglect_loc
)
{
if
(
handler
->
data
.
type
&
TYPE_TRAP
)
ecode
=
EFFECT_TRAP_ACT_IN_HAND
;
else
if
((
handler
->
data
.
type
&
TYPE_SPELL
)
&&
pduel
->
game_field
->
infos
.
turn_player
!=
playerid
)
{
if
(
handler
->
data
.
type
&
TYPE_QUICKPLAY
)
ecode
=
EFFECT_QP_ACT_IN_NTPHAND
;
else
return
FALSE
;
}
}
else
if
(
handler
->
current
.
location
==
LOCATION_SZONE
)
{
if
((
handler
->
data
.
type
&
TYPE_TRAP
)
&&
handler
->
get_status
(
STATUS_SET_TURN
))
ecode
=
EFFECT_TRAP_ACT_IN_SET_TURN
;
if
((
handler
->
data
.
type
&
TYPE_SPELL
)
&&
(
handler
->
data
.
type
&
TYPE_QUICKPLAY
)
&&
handler
->
get_status
(
STATUS_SET_TURN
))
ecode
=
EFFECT_QP_ACT_IN_SET_TURN
;
}
if
(
ecode
)
{
bool
available
=
false
;
effect_set
eset
;
handler
->
filter_effect
(
ecode
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
check_count_limit
(
playerid
))
{
available
=
true
;
break
;
}
}
if
(
!
available
)
return
FALSE
;
}
effect_set
eset
;
if
(
!
get_required_handorset_effects
(
&
eset
,
playerid
,
e
,
neglect_loc
))
return
FALSE
;
if
(
handler
->
is_status
(
STATUS_FORBIDDEN
))
return
FALSE
;
if
(
handler
->
is_affected_by_effect
(
EFFECT_CANNOT_TRIGGER
))
...
...
Classes/ocgcore/effect.h
View file @
8cf2c0e2
...
...
@@ -62,6 +62,7 @@ public:
int32
value
{
0
};
int32
operation
{
0
};
uint8
cost_checked
{
FALSE
};
effect_set
required_handorset_effects
;
explicit
effect
(
duel
*
pd
);
~
effect
()
=
default
;
...
...
@@ -73,7 +74,8 @@ public:
int32
limit_counter_is_available
();
int32
is_single_ready
();
int32
check_count_limit
(
uint8
playerid
);
int32
is_activateable
(
uint8
playerid
,
const
tevent
&
e
,
int32
neglect_cond
=
FALSE
,
int32
neglect_cost
=
FALSE
,
int32
neglect_target
=
FALSE
,
int32
neglect_loc
=
FALSE
,
int32
neglect_faceup
=
FALSE
);
int32
get_required_handorset_effects
(
effect_set
*
eset
,
uint8
playerid
,
const
tevent
&
e
,
int32
neglect_loc
=
FALSE
);
int32
is_activateable
(
uint8
playerid
,
const
tevent
&
e
,
int32
neglect_cond
=
FALSE
,
int32
neglect_cost
=
FALSE
,
int32
neglect_target
=
FALSE
,
int32
neglect_loc
=
FALSE
,
int32
neglect_faceup
=
FALSE
);
int32
is_action_check
(
uint8
playerid
);
int32
is_activate_ready
(
effect
*
reason_effect
,
uint8
playerid
,
const
tevent
&
e
,
int32
neglect_cond
=
FALSE
,
int32
neglect_cost
=
FALSE
,
int32
neglect_target
=
FALSE
);
int32
is_activate_ready
(
uint8
playerid
,
const
tevent
&
e
,
int32
neglect_cond
=
FALSE
,
int32
neglect_cost
=
FALSE
,
int32
neglect_target
=
FALSE
);
...
...
Classes/ocgcore/field.cpp
View file @
8cf2c0e2
...
...
@@ -16,10 +16,15 @@
int32
field
::
field_used_count
[
32
]
=
{
0
,
1
,
1
,
2
,
1
,
2
,
2
,
3
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
};
bool
chain
::
chain_operation_sort
(
const
chain
&
c1
,
const
chain
&
c2
)
{
if
(
c1
.
triggering_effect
&&
c2
.
triggering_effect
&&
c1
.
triggering_effect
->
id
!=
c2
.
triggering_effect
->
id
)
return
c1
.
triggering_effect
->
id
<
c2
.
triggering_effect
->
id
;
else
return
c1
.
chain_id
<
c2
.
chain_id
;
auto
e1
=
c1
.
triggering_effect
;
auto
e2
=
c2
.
triggering_effect
;
if
(
e1
&&
e2
)
{
if
(
e1
->
handler
==
e2
->
handler
&&
e1
->
description
!=
e2
->
description
)
return
e1
->
description
<
e2
->
description
;
if
(
e1
->
id
!=
e2
->
id
)
return
e1
->
id
<
e2
->
id
;
}
return
c1
.
chain_id
<
c2
.
chain_id
;
}
void
chain
::
set_triggering_state
(
card
*
pcard
)
{
triggering_controler
=
pcard
->
current
.
controler
;
...
...
Classes/ocgcore/field.h
View file @
8cf2c0e2
...
...
@@ -70,6 +70,7 @@ struct chain {
tevent
evt
;
opmap
opinfos
;
uint32
flag
{
0
};
effect_set
required_handorset_effects
;
static
bool
chain_operation_sort
(
const
chain
&
c1
,
const
chain
&
c2
);
void
set_triggering_state
(
card
*
pcard
);
...
...
Classes/ocgcore/processor.cpp
View file @
8cf2c0e2
...
...
@@ -4000,37 +4000,8 @@ int32 field::add_chain(uint16 step) {
}
}
if
(
peffect
->
type
&
EFFECT_TYPE_ACTIVATE
)
{
int32
ecode
=
0
;
if
(
phandler
->
current
.
location
==
LOCATION_HAND
)
{
if
(
phandler
->
data
.
type
&
TYPE_TRAP
)
ecode
=
EFFECT_TRAP_ACT_IN_HAND
;
else
if
((
phandler
->
data
.
type
&
TYPE_SPELL
)
&&
(
phandler
->
data
.
type
&
TYPE_QUICKPLAY
)
&&
infos
.
turn_player
!=
phandler
->
current
.
controler
)
ecode
=
EFFECT_QP_ACT_IN_NTPHAND
;
}
else
if
(
phandler
->
current
.
location
==
LOCATION_SZONE
)
{
if
((
phandler
->
data
.
type
&
TYPE_TRAP
)
&&
phandler
->
get_status
(
STATUS_SET_TURN
))
ecode
=
EFFECT_TRAP_ACT_IN_SET_TURN
;
if
((
phandler
->
data
.
type
&
TYPE_SPELL
)
&&
(
phandler
->
data
.
type
&
TYPE_QUICKPLAY
)
&&
phandler
->
get_status
(
STATUS_SET_TURN
))
ecode
=
EFFECT_QP_ACT_IN_SET_TURN
;
}
if
(
ecode
)
{
eset
.
clear
();
phandler
->
filter_effect
(
ecode
,
&
eset
);
effect
*
pactin
=
nullptr
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
))
{
pactin
=
eset
[
i
];
break
;
}
}
if
(
!
pactin
)
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
check_count_limit
(
phandler
->
current
.
controler
))
{
eset
[
i
]
->
dec_count
(
phandler
->
current
.
controler
);
break
;
}
}
}
if
(
peffect
->
get_required_handorset_effects
(
&
clit
.
required_handorset_effects
,
clit
.
triggering_player
,
clit
.
evt
)
!=
2
)
{
clit
.
required_handorset_effects
.
clear
();
}
if
(
phandler
->
current
.
location
==
LOCATION_HAND
)
{
uint32
zone
=
0xff
;
...
...
@@ -4175,6 +4146,62 @@ int32 field::add_chain(uint16 step) {
return
FALSE
;
}
case
5
:
{
auto
&
clit
=
core
.
current_chain
.
back
();
if
(
!
clit
.
required_handorset_effects
.
size
())
{
core
.
units
.
begin
()
->
step
=
6
;
return
FALSE
;
}
if
(
clit
.
required_handorset_effects
.
size
()
==
1
)
{
returns
.
ivalue
[
0
]
=
0
;
return
FALSE
;
}
else
{
// check if there's only one type of ceffects
auto
peffect
=
clit
.
triggering_effect
;
auto
playerid
=
clit
.
triggering_player
;
int32
ceffect_unique_id
=
0
;
for
(
int32
i
=
0
;
i
<
clit
.
required_handorset_effects
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
peffect
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
auto
id
=
clit
.
required_handorset_effects
[
i
]
->
get_value
(
2
);
if
(
!
id
||
ceffect_unique_id
!=
id
)
{
ceffect_unique_id
=
0
;
break
;
}
if
(
!
ceffect_unique_id
)
{
ceffect_unique_id
=
id
;
}
}
if
(
ceffect_unique_id
)
{
// all ceffects are the same type, so skip asking
returns
.
ivalue
[
0
]
=
0
;
return
FALSE
;
}
}
core
.
select_options
.
clear
();
for
(
int32
i
=
0
;
i
<
clit
.
required_handorset_effects
.
size
();
++
i
)
{
core
.
select_options
.
push_back
(
clit
.
required_handorset_effects
[
i
]
->
description
);
}
add_process
(
PROCESSOR_SELECT_OPTION
,
0
,
0
,
0
,
clit
.
triggering_player
,
0
);
return
FALSE
;
}
case
6
:
{
auto
&
clit
=
core
.
current_chain
.
back
();
auto
ceffect
=
clit
.
required_handorset_effects
[
returns
.
ivalue
[
0
]];
ceffect
->
dec_count
(
clit
.
triggering_player
);
if
(
ceffect
->
description
)
{
pduel
->
write_buffer8
(
MSG_HINT
);
pduel
->
write_buffer8
(
HINT_OPSELECTED
);
pduel
->
write_buffer8
(
clit
.
triggering_player
);
pduel
->
write_buffer32
(
ceffect
->
description
);
}
if
(
ceffect
->
cost
)
{
pduel
->
lua
->
add_param
(
clit
.
triggering_effect
,
PARAM_TYPE_EFFECT
);
core
.
sub_solving_event
.
push_back
(
clit
.
evt
);
add_process
(
PROCESSOR_EXECUTE_COST
,
0
,
ceffect
,
0
,
clit
.
triggering_player
,
0
);
}
return
FALSE
;
}
case
7
:
{
auto
&
clit
=
core
.
current_chain
.
back
();
effect
*
peffect
=
clit
.
triggering_effect
;
peffect
->
cost_checked
=
TRUE
;
...
...
@@ -4184,7 +4211,7 @@ int32 field::add_chain(uint16 step) {
}
return
FALSE
;
}
case
6
:
{
case
8
:
{
auto
&
clit
=
core
.
current_chain
.
back
();
effect
*
peffect
=
clit
.
triggering_effect
;
if
(
peffect
->
target
)
{
...
...
@@ -4193,7 +4220,7 @@ int32 field::add_chain(uint16 step) {
}
return
FALSE
;
}
case
7
:
{
case
9
:
{
break_effect
();
core
.
is_target_ready
=
true
;
auto
&
clit
=
core
.
current_chain
.
back
();
...
...
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