Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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-2pick
Commits
caae9f2b
Commit
caae9f2b
authored
Dec 17, 2017
by
Momobako
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update_core
parent
1d87a121
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
202 deletions
+96
-202
ocgcore/processor.cpp
ocgcore/processor.cpp
+96
-202
No files found.
ocgcore/processor.cpp
View file @
caae9f2b
...
...
@@ -1654,7 +1654,8 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
}
case 2: {
//forced trigger
for
(
auto
clit
=
core
.
new_fchain_s
.
begin
();
clit
!=
core
.
new_fchain_s
.
end
();
++
clit
)
{
core.select_chains.clear();
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(!peffect->is_flag(EFFECT_FLAG_EVENT_PLAYER | EFFECT_FLAG_BOTH_SIDE) && phandler->is_has_relation(*clit)) {
...
...
@@ -1664,71 +1665,63 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
uint8 tp = clit->triggering_player;
bool act = true;
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
)))
{
&& (!(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_CHAIN_UNIQUE)) {
if
(
tp
==
infos
.
turn_player
)
{
for
(
auto
tpit
=
core
.
tpchain
.
begin
();
tpit
!=
core
.
tpchain
.
end
();
++
tpit
)
{
if
(
tpit
->
triggering_effect
->
get_handler
()
->
data
.
code
==
phandler
->
data
.
code
)
{
act
=
false
;
break
;
}
}
}
else
{
for
(
auto
ntpit
=
core
.
ntpchain
.
begin
();
ntpit
!=
core
.
ntpchain
.
end
();
++
ntpit
)
{
if
(
ntpit
->
triggering_effect
->
get_handler
()
->
data
.
code
==
phandler
->
data
.
code
)
{
act
=
false
;
break
;
}
for(auto tpit = core.new_chains.begin(); tpit != core.new_chains.end(); ++tpit) {
if(tpit->triggering_effect->get_handler()->data.code == phandler->data.code && tpit->triggering_player == tp) {
act = false;
break;
}
}
}
} else
act = false;
if(act) {
if
(
tp
==
infos
.
turn_player
)
core
.
tpchain
.
push_back
(
*
clit
);
else
core
.
ntpchain
.
push_back
(
*
clit
);
phandler
->
set_status
(
STATUS_CHAINING
,
TRUE
);
peffect
->
dec_count
(
tp
);
if
(
peffect
->
is_flag
(
EFFECT_FLAG_CVAL_CHECK
))
peffect
->
get_value
();
if(tp == core.current_player)
core.select_chains.push_back(*clit);
} else {
core.new_fchain_s.erase(clit++);
continue;
}
++clit;
}
core
.
new_fchain_s
.
clear
();
if
(
core
.
current_player
==
infos
.
turn_player
)
{
if
(
core
.
tpchain
.
size
()
>
1
)
add_process
(
PROCESSOR_SORT_CHAIN
,
0
,
0
,
0
,
1
,
infos
.
turn_player
)
;
if(core.select_chains.size() == 0) {
returns.ivalue[0] = -1;
} else if(core.select_chains.size() == 1) {
returns.ivalue[0] = 0
;
} else {
if
(
core
.
ntpchain
.
size
()
>
1
)
add_process
(
PROCESSOR_SORT_CHAIN
,
0
,
0
,
0
,
0
,
infos
.
turn_player
);
add_process(PROCESSOR_SELECT_CHAIN, 0, 0, 0, core.current_player, 0x7f | 0x10000);
}
return FALSE;
}
case 3: {
if
(
core
.
current_player
==
infos
.
turn_player
)
{
core
.
new_chains
.
splice
(
core
.
new_chains
.
end
(),
core
.
tpchain
);
if
(
core
.
new_chains
.
size
())
add_process
(
PROCESSOR_ADD_CHAIN
,
0
,
0
,
0
,
0
,
0
);
core
.
current_player
=
1
-
infos
.
turn_player
;
core
.
units
.
begin
()
->
step
=
1
;
}
else
{
core
.
new_chains
.
splice
(
core
.
new_chains
.
end
(),
core
.
ntpchain
);
if
(
core
.
new_chains
.
size
())
add_process
(
PROCESSOR_ADD_CHAIN
,
0
,
0
,
0
,
0
,
0
);
if(returns.ivalue[0] == -1) {
if(core.new_fchain_s.size()) {
core.current_player = 1 - infos.turn_player;
core.units.begin()->step = 1;
} else {
core.current_player = infos.turn_player;
}
return FALSE;
}
chain newchain = core.select_chains[returns.ivalue[0]];
effect* peffect = newchain.triggering_effect;
uint8 tp = newchain.triggering_player;
peffect->get_handler()->set_status(STATUS_CHAINING, TRUE);
peffect->dec_count(tp);
core.new_chains.push_back(newchain);
add_process(PROCESSOR_ADD_CHAIN, 0, 0, 0, 0, 0);
core.new_fchain_s.remove_if([=](chain ch) { return ch.chain_id == newchain.chain_id; });
core.units.begin()->step = 1;
return FALSE;
}
case 4: {
//optional trigger
if
(
core
.
new_ochain_s
.
size
()
==
0
)
{
core
.
units
.
begin
()
->
step
=
6
;
return
FALSE
;
}
for
(
auto
clit
=
core
.
new_ochain_s
.
begin
();
clit
!=
core
.
new_ochain_s
.
end
();
++
clit
)
{
core.select_chains.clear();
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((!peffect->is_flag(EFFECT_FLAG_EVENT_PLAYER | EFFECT_FLAG_BOTH_SIDE) && phandler->is_has_relation(*clit))
...
...
@@ -1739,164 +1732,83 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
clit->triggering_player = phandler->current.controler;
clit->set_triggering_place(phandler);
}
if
(
clit
->
triggering_player
==
infos
.
turn_player
)
core
.
tpchain
.
push_back
(
*
clit
);
else
core
.
ntpchain
.
push_back
(
*
clit
);
}
core
.
new_ochain_s
.
clear
();
core
.
new_ochain_s
.
splice
(
core
.
new_ochain_s
.
end
(),
core
.
tpchain
);
core
.
new_ochain_s
.
splice
(
core
.
new_ochain_s
.
end
(),
core
.
ntpchain
);
core
.
new_ochain_h
.
clear
();
core
.
tmp_chain
.
clear
();
core
.
current_player
=
infos
.
turn_player
;
return
FALSE
;
}
case
5
:
{
if
(
core
.
new_ochain_s
.
size
()
==
0
)
{
if
(
core
.
current_player
==
infos
.
turn_player
)
{
if
(
core
.
tpchain
.
size
()
>
1
)
add_process
(
PROCESSOR_SORT_CHAIN
,
0
,
0
,
0
,
1
,
infos
.
turn_player
);
core
.
new_ochain_s
.
splice
(
core
.
new_ochain_s
.
end
(),
core
.
tmp_chain
);
}
else
{
if
(
core
.
ntpchain
.
size
()
>
1
)
add_process
(
PROCESSOR_SORT_CHAIN
,
0
,
0
,
0
,
0
,
infos
.
turn_player
);
}
core
.
units
.
begin
()
->
step
=
6
;
return
FALSE
;
}
auto
clit
=
core
.
new_ochain_s
.
begin
();
effect
*
peffect
=
clit
->
triggering_effect
;
card
*
phandler
=
peffect
->
get_handler
();
uint8
tp
=
clit
->
triggering_player
;
bool
act
=
true
;
if
(
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
TRUE
)
uint8 tp = clit->triggering_player;
bool act = true;
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
)
&&
clit
->
triggering_location
==
LOCATION_HAND
&&
(
peffect
->
range
&
LOCATION_HAND
))
{
core
.
new_ochain_h
.
push_back
(
*
clit
);
act
=
false
;
}
else
if
(
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
||
!
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
||
peffect
->
in_range
(
*
clit
))
{
if
(
peffect
->
is_flag
(
EFFECT_FLAG_CHAIN_UNIQUE
))
{
if
(
tp
==
infos
.
turn_player
)
{
for
(
auto
tpit
=
core
.
tpchain
.
begin
();
tpit
!=
core
.
tpchain
.
end
();
++
tpit
)
{
if
(
tpit
->
triggering_effect
->
get_handler
()
->
data
.
code
==
phandler
->
data
.
code
)
{
act
=
false
;
break
;
}
}
}
else
{
for
(
auto
ntpit
=
core
.
ntpchain
.
begin
();
ntpit
!=
core
.
ntpchain
.
end
();
++
ntpit
)
{
if
(
ntpit
->
triggering_effect
->
get_handler
()
->
data
.
code
==
phandler
->
data
.
code
)
{
if(!peffect->is_flag(EFFECT_FLAG_FIELD_ONLY) && clit->triggering_location == LOCATION_HAND
&& (((peffect->type & EFFECT_TYPE_SINGLE) && !peffect->is_flag(EFFECT_FLAG_SINGLE_RANGE) && phandler->is_has_relation(*clit))
|| (peffect->range & LOCATION_HAND))) {
core.new_ochain_h.push_back(*clit);
act = false;
} else if(peffect->is_flag(EFFECT_FLAG_FIELD_ONLY) || !(peffect->type & EFFECT_TYPE_FIELD) || peffect->in_range(*clit)) {
if(peffect->is_flag(EFFECT_FLAG_CHAIN_UNIQUE)) {
for(auto tpit = core.new_chains.begin(); tpit != core.new_chains.end(); ++tpit) {
if(tpit->triggering_effect->get_handler()->data.code == phandler->data.code && tpit->triggering_player == tp) {
act = false;
break;
}
}
}
}
}
else
act
=
false
;
}
else
act
=
false
;
if
(
act
)
{
if
(
tp
==
core
.
current_player
)
add_process
(
PROCESSOR_SELECT_EFFECTYN
,
0
,
0
,
(
group
*
)
phandler
,
tp
,
0
);
else
{
core
.
tmp_chain
.
push_back
(
*
clit
);
returns
.
ivalue
[
0
]
=
FALSE
;
} else
act = false;
} else act = false;
if(act) {
if(tp == core.current_player)
core.select_chains.push_back(*clit);
} else {
core.new_ochain_s.erase(clit++);
continue;
}
}
else
returns
.
ivalue
[
0
]
=
FALSE
;
++clit;
}
if(core.select_chains.size() == 0) {
returns.ivalue[0] = -1;
core.units.begin()->step = 5;
return FALSE;
} else if(core.select_chains.size() == 1 && !core.current_chain.size()) {
add_process(PROCESSOR_SELECT_EFFECTYN, 0, 0, (group*)core.select_chains[0].triggering_effect->get_handler(), core.current_player, 0);
return FALSE;
} else {
add_process(PROCESSOR_SELECT_CHAIN, 0, 0, 0, core.current_player, 0x7f);
core.units.begin()->step = 5;
return FALSE;
}
return FALSE;
}
case 5: {
returns.ivalue[0]--;
return FALSE;
}
case 6: {
if
(
!
returns
.
ivalue
[
0
])
{
core
.
new_ochain_s
.
pop_front
();
core
.
units
.
begin
()
->
step
=
4
;
return
FALSE
;
}
auto
clit
=
core
.
new_ochain_s
.
begin
();
effect
*
peffect
=
clit
->
triggering_effect
;
card
*
pcard
=
peffect
->
get_handler
();
uint8
tp
=
clit
->
triggering_player
;
core
.
select_effects
.
clear
();
core
.
select_options
.
clear
();
uintptr_t
index
=
0
;
core
.
select_effects
.
push_back
((
effect
*
)
index
);
core
.
select_options
.
push_back
(
peffect
->
description
);
while
(
++
clit
!=
core
.
new_ochain_s
.
end
())
{
++
index
;
peffect
=
clit
->
triggering_effect
;
card
*
phandler
=
peffect
->
get_handler
();
if
(
pcard
!=
phandler
)
continue
;
bool
act
=
true
;
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
)
&&
clit
->
triggering_location
==
LOCATION_HAND
&&
(
peffect
->
range
&
LOCATION_HAND
))
{
continue
;
}
else
if
(
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
||
!
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
||
peffect
->
in_range
(
*
clit
))
{
if
(
peffect
->
is_flag
(
EFFECT_FLAG_CHAIN_UNIQUE
))
{
if
(
tp
==
infos
.
turn_player
)
{
for
(
auto
tpit
=
core
.
tpchain
.
begin
();
tpit
!=
core
.
tpchain
.
end
();
++
tpit
)
{
if
(
tpit
->
triggering_effect
->
get_handler
()
->
data
.
code
==
phandler
->
data
.
code
)
{
act
=
false
;
break
;
}
}
}
else
{
for
(
auto
ntpit
=
core
.
ntpchain
.
begin
();
ntpit
!=
core
.
ntpchain
.
end
();
++
ntpit
)
{
if
(
ntpit
->
triggering_effect
->
get_handler
()
->
data
.
code
==
phandler
->
data
.
code
)
{
act
=
false
;
break
;
}
}
}
}
}
else
continue
;
}
else
continue
;
if
(
act
)
{
core
.
select_effects
.
push_back
((
effect
*
)
index
);
core
.
select_options
.
push_back
(
peffect
->
description
);
if(returns.ivalue[0] == -1) {
for(auto cit = core.select_chains.begin(); cit != core.select_chains.end(); ++cit)
core.new_ochain_s.remove_if([=](chain ch) { return ch.chain_id == cit->chain_id; });
if(core.new_ochain_s.size()) {
core.current_player = 1 - infos.turn_player;
core.units.begin()->step = 3;
} else {
core.current_player = infos.turn_player;
core.units.begin()->step = 6;
}
}
if
(
core
.
select_options
.
size
()
>
1
)
{
add_process
(
PROCESSOR_SELECT_OPTION
,
0
,
0
,
0
,
tp
,
0
);
core
.
units
.
begin
()
->
step
=
19
;
return FALSE;
}
clit
=
core
.
new_ochain_s
.
begin
();
peffect
=
clit
->
triggering_effect
;
chain newchain = core.select_chains[returns.ivalue[0]];
effect* peffect = newchain.triggering_effect;
uint8 tp = newchain.triggering_player;
peffect->get_handler()->set_status(STATUS_CHAINING, TRUE);
peffect->dec_count(tp);
if
(
tp
==
infos
.
turn_player
)
core
.
tpchain
.
push_back
(
*
clit
);
else
core
.
ntpchain
.
push_back
(
*
clit
);
if
(
peffect
->
is_flag
(
EFFECT_FLAG_CVAL_CHECK
))
peffect
->
get_value
();
core
.
new_ochain_s
.
pop_front
();
core
.
units
.
begin
()
->
step
=
4
;
core.new_chains.push_back(newchain);
add_process(PROCESSOR_ADD_CHAIN, 0, 0, 0, 0, 0);
core.new_ochain_s.remove_if([=](chain ch) { return ch.chain_id == newchain.chain_id; });
core.units.begin()->step = 3;
return FALSE;
}
case 7: {
if
(
core
.
current_player
==
infos
.
turn_player
)
{
core
.
new_chains
.
splice
(
core
.
new_chains
.
end
(),
core
.
tpchain
);
if
(
core
.
new_chains
.
size
())
add_process
(
PROCESSOR_ADD_CHAIN
,
0
,
0
,
0
,
0
,
0
);
core
.
current_player
=
1
-
infos
.
turn_player
;
core
.
units
.
begin
()
->
step
=
4
;
}
else
{
core
.
new_chains
.
splice
(
core
.
new_chains
.
end
(),
core
.
ntpchain
);
if
(
core
.
new_chains
.
size
())
add_process
(
PROCESSOR_ADD_CHAIN
,
0
,
0
,
0
,
0
,
0
);
}
core.select_chains.clear();
return FALSE;
}
case 8: {
...
...
@@ -1963,24 +1875,6 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
}
return TRUE;
}
case
20
:
{
uintptr_t
index
=
(
uintptr_t
)
core
.
select_effects
[
returns
.
ivalue
[
0
]];
auto
clit
=
core
.
new_ochain_s
.
begin
();
std
::
advance
(
clit
,
index
);
effect
*
peffect
=
clit
->
triggering_effect
;
uint8
tp
=
clit
->
triggering_player
;
peffect
->
get_handler
()
->
set_status
(
STATUS_CHAINING
,
TRUE
);
peffect
->
dec_count
(
tp
);
if
(
tp
==
infos
.
turn_player
)
core
.
tpchain
.
push_back
(
*
clit
);
else
core
.
ntpchain
.
push_back
(
*
clit
);
if
(
peffect
->
is_flag
(
EFFECT_FLAG_CVAL_CHECK
))
peffect
->
get_value
();
core
.
new_ochain_s
.
erase
(
clit
);
core
.
units
.
begin
()
->
step
=
4
;
return
FALSE
;
}
case 30: {
int32 check_player = infos.turn_player;
nil_event.event_code = EVENT_FREE_CHAIN;
...
...
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