Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-core
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
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
MyCard
ygopro-core
Commits
d4e39064
Commit
d4e39064
authored
Nov 25, 2018
by
DailyShana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
8ec990d5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
72 deletions
+67
-72
field.cpp
field.cpp
+54
-0
field.h
field.h
+4
-0
processor.cpp
processor.cpp
+9
-72
No files found.
field.cpp
View file @
d4e39064
...
...
@@ -3281,6 +3281,60 @@ int32 field::check_cteffect_hint(effect* peffect, uint8 playerid) {
}
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
()
{
return
((
core
.
duel_options
&
DUEL_ATTACK_FIRST_TURN
)
||
infos
.
turn_id
!=
1
)
&&
infos
.
phase
<
PHASE_BATTLE_START
...
...
field.h
View file @
d4e39064
...
...
@@ -469,6 +469,10 @@ public:
int32
get_cteffect
(
effect
*
peffect
,
int32
playerid
,
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_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
();
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
);
...
...
processor.cpp
View file @
d4e39064
...
...
@@ -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
();
)
{
effect
*
peffect
=
clit
->
triggering_effect
;
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
);
uint8
tp
=
clit
->
triggering_player
;
bool
act
=
true
;
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
)))
{
}
else
act
=
false
;
if
(
act
)
{
if
(
check_deck_effect
(
*
clit
)
&&
check_trigger_effect
(
*
clit
)
&&
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
TRUE
))
{
if
(
tp
==
core
.
current_player
)
core
.
select_chains
.
push_back
(
*
clit
);
}
else
{
...
...
@@ -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
();
)
{
effect
*
peffect
=
clit
->
triggering_effect
;
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
);
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
&&
(
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
clit
->
set_triggering_place
(
phandler
);
}
uint8
tp
=
clit
->
triggering_player
;
bool
act
=
true
;
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
((
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
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
(
check_hand_trigger
(
*
clit
)
&&
check_deck_effect
(
*
clit
)
&&
check_trigger_effect
(
*
clit
)
&&
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
TRUE
)
&&
check_spself_from_hand_trigger
(
*
clit
))
{
if
(
tp
==
core
.
current_player
)
core
.
select_chains
.
push_back
(
*
clit
);
}
else
{
...
...
@@ -2082,22 +2031,10 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori
ch
.
triggering_player
=
phandler
->
current
.
controler
;
ch
.
set_triggering_place
(
phandler
);
}
bool
act
=
true
;
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
)
&&
peffect
->
is_chainable
(
priority
)
&&
peffect
->
is_activateable
(
priority
,
ch
.
evt
,
TRUE
))
{
if
(
peffect
->
status
&
EFFECT_STATUS_SPSELF
)
{
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
)
&&
peffect
->
is_chainable
(
priority
)
&&
peffect
->
is_activateable
(
priority
,
ch
.
evt
,
TRUE
)
&&
check_spself_from_hand_trigger
(
ch
))
core
.
select_chains
.
push_back
(
ch
);
}
//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