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
d651f93c
Commit
d651f93c
authored
Nov 27, 2018
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
1739e544
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
76 deletions
+71
-76
Classes/gframe/deck_con.cpp
Classes/gframe/deck_con.cpp
+4
-4
Classes/ocgcore/field.cpp
Classes/ocgcore/field.cpp
+54
-0
Classes/ocgcore/field.h
Classes/ocgcore/field.h
+4
-0
Classes/ocgcore/processor.cpp
Classes/ocgcore/processor.cpp
+9
-72
No files found.
Classes/gframe/deck_con.cpp
View file @
d651f93c
...
@@ -735,14 +735,14 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -735,14 +735,14 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
return
false
;
return
false
;
}
}
void
DeckBuilder
::
GetHoveredCard
()
{
void
DeckBuilder
::
GetHoveredCard
()
{
int
pre_code
=
hovered_code
;
hovered_pos
=
0
;
hovered_code
=
0
;
irr
::
gui
::
IGUIElement
*
root
=
mainGame
->
env
->
getRootGUIElement
();
irr
::
gui
::
IGUIElement
*
root
=
mainGame
->
env
->
getRootGUIElement
();
if
(
root
->
getElementFromPoint
(
mouse_pos
)
!=
root
)
if
(
root
->
getElementFromPoint
(
mouse_pos
)
!=
root
)
return
;
return
;
int
x
=
mouse_pos
.
X
;
int
x
=
mouse_pos
.
X
;
int
y
=
mouse_pos
.
Y
;
int
y
=
mouse_pos
.
Y
;
int
pre_code
=
hovered_code
;
hovered_pos
=
0
;
hovered_code
=
0
;
is_lastcard
=
0
;
is_lastcard
=
0
;
if
(
x
>=
314
*
mainGame
->
xScale
&&
x
<=
794
*
mainGame
->
xScale
)
{
if
(
x
>=
314
*
mainGame
->
xScale
&&
x
<=
794
*
mainGame
->
xScale
)
{
if
(
y
>=
164
*
mainGame
->
yScale
&&
y
<=
435
*
mainGame
->
yScale
)
{
if
(
y
>=
164
*
mainGame
->
yScale
&&
y
<=
435
*
mainGame
->
yScale
)
{
...
@@ -901,8 +901,8 @@ void DeckBuilder::FilterCards() {
...
@@ -901,8 +901,8 @@ void DeckBuilder::FilterCards() {
element_start
++
;
element_start
++
;
}
}
if
(
element_start
<
str
.
size
())
{
if
(
element_start
<
str
.
size
())
{
element
.
setcode
=
dataManager
.
GetSetCode
(
element
.
keyword
.
c_str
());
element
.
keyword
=
str
.
substr
(
element_start
);
element
.
keyword
=
str
.
substr
(
element_start
);
element
.
setcode
=
dataManager
.
GetSetCode
(
element
.
keyword
.
c_str
());
query_elements
.
push_back
(
element
);
query_elements
.
push_back
(
element
);
}
}
}
}
...
...
Classes/ocgcore/field.cpp
View file @
d651f93c
...
@@ -3284,6 +3284,60 @@ int32 field::check_cteffect_hint(effect* peffect, uint8 playerid) {
...
@@ -3284,6 +3284,60 @@ int32 field::check_cteffect_hint(effect* peffect, uint8 playerid) {
}
}
return
FALSE
;
return
FALSE
;
}
}
int32
field
::
check_deck_effect
(
chain
&
ch
)
const
{
effect
*
peffect
=
ch
.
triggering_effect
;
card
*
phandler
=
peffect
->
get_handler
();
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
ch
.
triggering_location
==
LOCATION_DECK
&&
(
phandler
->
current
.
location
&
LOCATION_DECK
))
{
if
((
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
peffect
->
code
==
EVENT_TO_DECK
||
(
peffect
->
range
&
LOCATION_DECK
))
{
ch
.
flag
|=
CHAIN_DECK_EFFECT
;
}
else
return
FALSE
;
}
return
TRUE
;
}
int32
field
::
check_hand_trigger
(
chain
&
ch
)
{
effect
*
peffect
=
ch
.
triggering_effect
;
card
*
phandler
=
peffect
->
get_handler
();
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
((
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
phandler
->
is_has_relation
(
ch
)
&&
ch
.
triggering_location
==
LOCATION_HAND
||
(
peffect
->
range
&
LOCATION_HAND
)))
{
ch
.
flag
|=
CHAIN_HAND_TRIGGER
;
core
.
new_ochain_h
.
push_back
(
ch
);
if
(
ch
.
triggering_location
==
LOCATION_HAND
&&
phandler
->
is_position
(
POS_FACEDOWN
)
||
peffect
->
range
&&
!
peffect
->
in_range
(
ch
))
return
FALSE
;
}
return
TRUE
;
}
int32
field
::
check_trigger_effect
(
const
chain
&
ch
)
const
{
effect
*
peffect
=
ch
.
triggering_effect
;
card
*
phandler
=
peffect
->
get_handler
();
if
((
peffect
->
type
&
EFFECT_TYPE_FIELD
)
&&
!
phandler
->
is_has_relation
(
ch
))
return
FALSE
;
if
(
peffect
->
code
==
EVENT_FLIP
&&
infos
.
phase
==
PHASE_DAMAGE
)
return
TRUE
;
if
((
ch
.
triggering_location
&
(
LOCATION_DECK
|
LOCATION_HAND
|
LOCATION_EXTRA
))
&&
(
ch
.
triggering_position
&
POS_FACEDOWN
))
return
TRUE
;
if
(
!
(
phandler
->
current
.
location
&
(
LOCATION_DECK
|
LOCATION_HAND
|
LOCATION_EXTRA
))
||
phandler
->
is_position
(
POS_FACEUP
))
return
TRUE
;
return
FALSE
;
}
int32
field
::
check_spself_from_hand_trigger
(
const
chain
&
ch
)
const
{
effect
*
peffect
=
ch
.
triggering_effect
;
uint8
tp
=
ch
.
triggering_player
;
if
((
peffect
->
status
&
EFFECT_STATUS_SPSELF
)
&&
(
ch
.
flag
&
CHAIN_HAND_TRIGGER
))
{
return
std
::
none_of
(
core
.
current_chain
.
begin
(),
core
.
current_chain
.
end
(),
[
tp
](
chain
ch
)
{
return
ch
.
triggering_player
==
tp
&&
(
ch
.
triggering_effect
->
status
&
EFFECT_STATUS_SPSELF
)
&&
(
ch
.
flag
&
CHAIN_HAND_TRIGGER
);
});
}
return
TRUE
;
}
int32
field
::
is_able_to_enter_bp
()
{
int32
field
::
is_able_to_enter_bp
()
{
return
((
core
.
duel_options
&
DUEL_ATTACK_FIRST_TURN
)
||
infos
.
turn_id
!=
1
)
return
((
core
.
duel_options
&
DUEL_ATTACK_FIRST_TURN
)
||
infos
.
turn_id
!=
1
)
&&
infos
.
phase
<
PHASE_BATTLE_START
&&
infos
.
phase
<
PHASE_BATTLE_START
...
...
Classes/ocgcore/field.h
View file @
d651f93c
...
@@ -469,6 +469,10 @@ public:
...
@@ -469,6 +469,10 @@ public:
int32
get_cteffect
(
effect
*
peffect
,
int32
playerid
,
int32
store
);
int32
get_cteffect
(
effect
*
peffect
,
int32
playerid
,
int32
store
);
int32
get_cteffect_evt
(
effect
*
feffect
,
int32
playerid
,
const
tevent
&
e
,
int32
store
);
int32
get_cteffect_evt
(
effect
*
feffect
,
int32
playerid
,
const
tevent
&
e
,
int32
store
);
int32
check_cteffect_hint
(
effect
*
peffect
,
uint8
playerid
);
int32
check_cteffect_hint
(
effect
*
peffect
,
uint8
playerid
);
int32
check_deck_effect
(
chain
&
ch
)
const
;
int32
check_hand_trigger
(
chain
&
ch
);
int32
check_trigger_effect
(
const
chain
&
ch
)
const
;
int32
check_spself_from_hand_trigger
(
const
chain
&
ch
)
const
;
int32
is_able_to_enter_bp
();
int32
is_able_to_enter_bp
();
void
add_process
(
uint16
type
,
uint16
step
,
effect
*
peffect
,
group
*
target
,
ptr
arg1
,
ptr
arg2
,
ptr
arg3
=
0
,
ptr
arg4
=
0
,
void
*
ptr1
=
NULL
,
void
*
ptr2
=
NULL
);
void
add_process
(
uint16
type
,
uint16
step
,
effect
*
peffect
,
group
*
target
,
ptr
arg1
,
ptr
arg2
,
ptr
arg3
=
0
,
ptr
arg4
=
0
,
void
*
ptr1
=
NULL
,
void
*
ptr2
=
NULL
);
...
...
Classes/ocgcore/processor.cpp
View file @
d651f93c
...
@@ -1670,27 +1670,11 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
...
@@ -1670,27 +1670,11 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
for
(
auto
clit
=
core
.
new_fchain_s
.
begin
();
clit
!=
core
.
new_fchain_s
.
end
();
)
{
for
(
auto
clit
=
core
.
new_fchain_s
.
begin
();
clit
!=
core
.
new_fchain_s
.
end
();
)
{
effect
*
peffect
=
clit
->
triggering_effect
;
effect
*
peffect
=
clit
->
triggering_effect
;
card
*
phandler
=
peffect
->
get_handler
();
card
*
phandler
=
peffect
->
get_handler
();
if
(
phandler
->
is_has_relation
(
*
clit
))
if
(
phandler
->
is_has_relation
(
*
clit
))
//work around: position and control should be refreshed before raising event
clit
->
set_triggering_place
(
phandler
);
clit
->
set_triggering_place
(
phandler
);
uint8
tp
=
clit
->
triggering_player
;
uint8
tp
=
clit
->
triggering_player
;
bool
act
=
true
;
if
(
check_deck_effect
(
*
clit
)
&&
check_trigger_effect
(
*
clit
)
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
TRUE
))
{
&&
clit
->
triggering_location
==
LOCATION_DECK
&&
(
phandler
->
current
.
location
&
LOCATION_DECK
))
{
if
((
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
peffect
->
code
==
EVENT_TO_DECK
||
(
peffect
->
range
&
LOCATION_DECK
))
clit
->
flag
|=
CHAIN_DECK_EFFECT
;
else
act
=
false
;
}
if
(
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
TRUE
)
&&
(
!
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
||
phandler
->
is_has_relation
(
*
clit
))
&&
(
peffect
->
code
==
EVENT_FLIP
&&
infos
.
phase
==
PHASE_DAMAGE
||
(
clit
->
triggering_location
&
0x43
)
&&
(
clit
->
triggering_position
&
POS_FACEDOWN
)
||
!
(
phandler
->
current
.
location
&
0x43
)
||
phandler
->
is_position
(
POS_FACEUP
)))
{
}
else
act
=
false
;
if
(
act
)
{
if
(
tp
==
core
.
current_player
)
if
(
tp
==
core
.
current_player
)
core
.
select_chains
.
push_back
(
*
clit
);
core
.
select_chains
.
push_back
(
*
clit
);
}
else
{
}
else
{
...
@@ -1736,7 +1720,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
...
@@ -1736,7 +1720,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
for
(
auto
clit
=
core
.
new_ochain_s
.
begin
();
clit
!=
core
.
new_ochain_s
.
end
();
)
{
for
(
auto
clit
=
core
.
new_ochain_s
.
begin
();
clit
!=
core
.
new_ochain_s
.
end
();
)
{
effect
*
peffect
=
clit
->
triggering_effect
;
effect
*
peffect
=
clit
->
triggering_effect
;
card
*
phandler
=
peffect
->
get_handler
();
card
*
phandler
=
peffect
->
get_handler
();
if
(
phandler
->
is_has_relation
(
*
clit
))
if
(
phandler
->
is_has_relation
(
*
clit
))
//work around: position and control should be refreshed before raising event
clit
->
set_triggering_place
(
phandler
);
clit
->
set_triggering_place
(
phandler
);
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
&&
(
peffect
->
range
&
LOCATION_HAND
)
&&
phandler
->
current
.
location
==
LOCATION_HAND
)
{
&&
(
peffect
->
range
&
LOCATION_HAND
)
&&
phandler
->
current
.
location
==
LOCATION_HAND
)
{
...
@@ -1747,44 +1731,9 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
...
@@ -1747,44 +1731,9 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
clit
->
set_triggering_place
(
phandler
);
clit
->
set_triggering_place
(
phandler
);
}
}
uint8
tp
=
clit
->
triggering_player
;
uint8
tp
=
clit
->
triggering_player
;
bool
act
=
true
;
if
(
check_hand_trigger
(
*
clit
)
&&
check_deck_effect
(
*
clit
)
&&
check_trigger_effect
(
*
clit
)
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
TRUE
)
&&
((
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
check_spself_from_hand_trigger
(
*
clit
))
{
&&
phandler
->
is_has_relation
(
*
clit
)
&&
clit
->
triggering_location
==
LOCATION_HAND
||
(
peffect
->
range
&
LOCATION_HAND
)))
{
clit
->
flag
|=
CHAIN_HAND_TRIGGER
;
core
.
new_ochain_h
.
push_back
(
*
clit
);
if
(
clit
->
triggering_location
==
LOCATION_HAND
&&
phandler
->
is_position
(
POS_FACEDOWN
)
||
peffect
->
range
&&
!
peffect
->
in_range
(
*
clit
))
act
=
false
;
}
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
clit
->
triggering_location
==
LOCATION_DECK
&&
(
phandler
->
current
.
location
&
LOCATION_DECK
))
{
if
((
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
peffect
->
code
==
EVENT_TO_DECK
||
(
peffect
->
range
&
LOCATION_DECK
))
clit
->
flag
|=
CHAIN_DECK_EFFECT
;
else
act
=
false
;
}
if
(
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
TRUE
)
&&
(
!
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
||
phandler
->
is_has_relation
(
*
clit
))
&&
(
peffect
->
code
==
EVENT_FLIP
&&
infos
.
phase
==
PHASE_DAMAGE
||
(
clit
->
triggering_location
&
0x43
)
&&
(
clit
->
triggering_position
&
POS_FACEDOWN
)
||
!
(
phandler
->
current
.
location
&
0x43
)
||
phandler
->
is_position
(
POS_FACEUP
)))
{
if
(
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
||
!
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
||
peffect
->
in_range
(
*
clit
))
{
if
((
peffect
->
status
&
EFFECT_STATUS_SPSELF
)
&&
(
clit
->
flag
&
CHAIN_HAND_TRIGGER
))
{
for
(
const
auto
&
cur_ch
:
core
.
current_chain
)
{
if
(
cur_ch
.
triggering_player
==
tp
&&
(
cur_ch
.
triggering_effect
->
status
&
EFFECT_STATUS_SPSELF
)
&&
(
cur_ch
.
flag
&
CHAIN_HAND_TRIGGER
))
{
act
=
false
;
break
;
}
}
}
}
else
act
=
false
;
}
else
act
=
false
;
if
(
act
)
{
if
(
tp
==
core
.
current_player
)
if
(
tp
==
core
.
current_player
)
core
.
select_chains
.
push_back
(
*
clit
);
core
.
select_chains
.
push_back
(
*
clit
);
}
else
{
}
else
{
...
@@ -2082,22 +2031,10 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori
...
@@ -2082,22 +2031,10 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori
ch
.
triggering_player
=
phandler
->
current
.
controler
;
ch
.
triggering_player
=
phandler
->
current
.
controler
;
ch
.
set_triggering_place
(
phandler
);
ch
.
set_triggering_place
(
phandler
);
}
}
bool
act
=
true
;
if
(
ch
.
triggering_player
==
priority
&&
ch
.
triggering_location
==
LOCATION_HAND
if
(
ch
.
triggering_player
==
priority
&&
ch
.
triggering_location
==
LOCATION_HAND
&&
phandler
->
is_position
(
POS_FACEDOWN
)
&&
!
phandler
->
is_status
(
STATUS_CHAINING
)
&&
phandler
->
is_has_relation
(
ch
)
&&
phandler
->
is_position
(
POS_FACEDOWN
)
&&
!
phandler
->
is_status
(
STATUS_CHAINING
)
&&
phandler
->
is_has_relation
(
ch
)
&&
peffect
->
is_chainable
(
priority
)
&&
peffect
->
is_activateable
(
priority
,
ch
.
evt
,
TRUE
))
{
&&
peffect
->
is_chainable
(
priority
)
&&
peffect
->
is_activateable
(
priority
,
ch
.
evt
,
TRUE
)
if
(
peffect
->
status
&
EFFECT_STATUS_SPSELF
)
{
&&
check_spself_from_hand_trigger
(
ch
))
for
(
const
auto
&
cur_ch
:
core
.
current_chain
)
{
if
(
cur_ch
.
triggering_player
==
priority
&&
(
cur_ch
.
triggering_effect
->
status
&
EFFECT_STATUS_SPSELF
)
&&
(
cur_ch
.
flag
&
CHAIN_HAND_TRIGGER
))
{
act
=
false
;
break
;
}
}
}
}
else
act
=
false
;
if
(
act
)
core
.
select_chains
.
push_back
(
ch
);
core
.
select_chains
.
push_back
(
ch
);
}
}
//delayed activate
//delayed activate
...
...
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