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
ad72c354
Commit
ad72c354
authored
Aug 19, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro-core
parents
1be62b3d
e09dd463
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
153 additions
and
156 deletions
+153
-156
effect.h
effect.h
+1
-3
field.cpp
field.cpp
+24
-27
field.h
field.h
+7
-6
operations.cpp
operations.cpp
+5
-10
processor.cpp
processor.cpp
+116
-110
No files found.
effect.h
View file @
ad72c354
...
@@ -351,7 +351,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
...
@@ -351,7 +351,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_FIRST_ATTACK 192
#define EFFECT_FIRST_ATTACK 192
#define EFFECT_ATTACK_ALL 193
#define EFFECT_ATTACK_ALL 193
#define EFFECT_EXTRA_ATTACK 194
#define EFFECT_EXTRA_ATTACK 194
#define EFFECT_MUST_BE_ATTACKED 195
//
#define EFFECT_MUST_BE_ATTACKED 195
#define EFFECT_ONLY_BE_ATTACKED 196
#define EFFECT_ONLY_BE_ATTACKED 196
#define EFFECT_ATTACK_DISABLED 197
#define EFFECT_ATTACK_DISABLED 197
#define EFFECT_NO_BATTLE_DAMAGE 200
#define EFFECT_NO_BATTLE_DAMAGE 200
...
@@ -418,12 +418,10 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
...
@@ -418,12 +418,10 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_ADD_SETCODE 334
#define EFFECT_ADD_SETCODE 334
#define EFFECT_NO_EFFECT_DAMAGE 335
#define EFFECT_NO_EFFECT_DAMAGE 335
#define EFFECT_UNSUMMONABLE_CARD 336
#define EFFECT_UNSUMMONABLE_CARD 336
//#define EFFECT_DISABLE_CHAIN_FIELD 337
#define EFFECT_DISCARD_COST_CHANGE 338
#define EFFECT_DISCARD_COST_CHANGE 338
#define EFFECT_HAND_SYNCHRO 339
#define EFFECT_HAND_SYNCHRO 339
#define EFFECT_ADD_FUSION_CODE 340
#define EFFECT_ADD_FUSION_CODE 340
#define EFFECT_ADD_FUSION_SETCODE 341
#define EFFECT_ADD_FUSION_SETCODE 341
#define EFFECT_RISE_TO_FULL_HEIGHT 342
#define EFFECT_ONLY_ATTACK_MONSTER 343
#define EFFECT_ONLY_ATTACK_MONSTER 343
#define EFFECT_MUST_ATTACK_MONSTER 344
#define EFFECT_MUST_ATTACK_MONSTER 344
#define EFFECT_PATRICIAN_OF_DARKNESS 345
#define EFFECT_PATRICIAN_OF_DARKNESS 345
...
...
field.cpp
View file @
ad72c354
...
@@ -2256,40 +2256,38 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
...
@@ -2256,40 +2256,38 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
effect
*
peffect
;
effect
*
peffect
;
card_vector
*
pv
=
NULL
;
card_vector
*
pv
=
NULL
;
int32
atype
=
0
;
int32
atype
=
0
;
card_vector
must_
be_
attack
;
card_vector
must_attack
;
card_vector
only_be_attack
;
card_vector
only_be_attack
;
effect_set
eset
;
card_vector
only_attack
;
// find the universal set pv
// find the universal set pv
pcard
->
direct_attackable
=
0
;
pcard
->
direct_attackable
=
0
;
for
(
auto
cit
=
player
[
1
-
p
].
list_mzone
.
begin
();
cit
!=
player
[
1
-
p
].
list_mzone
.
end
();
++
cit
)
{
for
(
auto
cit
=
player
[
1
-
p
].
list_mzone
.
begin
();
cit
!=
player
[
1
-
p
].
list_mzone
.
end
();
++
cit
)
{
card
*
atarget
=
*
cit
;
card
*
atarget
=
*
cit
;
if
(
atarget
)
{
if
(
atarget
)
{
if
(
atarget
->
is_affected_by_effect
(
EFFECT_MUST_BE_ATTACKED
,
pcard
))
must_be_attack
.
push_back
(
atarget
);
if
(
atarget
->
is_affected_by_effect
(
EFFECT_ONLY_BE_ATTACKED
))
if
(
atarget
->
is_affected_by_effect
(
EFFECT_ONLY_BE_ATTACKED
))
only_be_attack
.
push_back
(
atarget
);
only_be_attack
.
push_back
(
atarget
);
if
(
pcard
->
is_affected_by_effect
(
EFFECT_MUST_ATTACK_MONSTER
,
atarget
))
must_attack
.
push_back
(
atarget
);
if
(
pcard
->
is_affected_by_effect
(
EFFECT_ONLY_ATTACK_MONSTER
,
atarget
))
only_attack
.
push_back
(
atarget
);
}
}
}
}
pcard
->
filter_effect
(
EFFECT_RISE_TO_FULL_HEIGHT
,
&
eset
);
if
(
only_be_attack
.
size
())
{
if
(
eset
.
size
())
{
atype
=
1
;
atype
=
1
;
std
::
set
<
uint32
>
idset
;
if
(
only_be_attack
.
size
()
==
1
)
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
idset
.
insert
(
eset
[
i
]
->
label
);
if
(
idset
.
size
()
==
1
&&
only_be_attack
.
size
()
==
1
&&
only_be_attack
.
front
()
->
fieldid_r
==
*
idset
.
begin
())
pv
=
&
only_be_attack
;
pv
=
&
only_be_attack
;
else
else
return
atype
;
return
atype
;
}
else
if
(
pcard
->
is_affected_by_effect
(
EFFECT_ONLY_ATTACK_MONSTER
))
{
}
else
if
(
pcard
->
is_affected_by_effect
(
EFFECT_ONLY_ATTACK_MONSTER
))
{
atype
=
2
;
atype
=
2
;
if
(
only_
be_
attack
.
size
()
==
1
)
if
(
only_attack
.
size
()
==
1
)
pv
=
&
only_
be_
attack
;
pv
=
&
only_attack
;
else
else
return
atype
;
return
atype
;
}
else
if
(
pcard
->
is_affected_by_effect
(
EFFECT_MUST_ATTACK_MONSTER
))
{
}
else
if
(
pcard
->
is_affected_by_effect
(
EFFECT_MUST_ATTACK_MONSTER
))
{
atype
=
3
;
atype
=
3
;
if
(
must_
be_
attack
.
size
())
if
(
must_attack
.
size
())
pv
=
&
must_
be_
attack
;
pv
=
&
must_attack
;
else
else
return
atype
;
return
atype
;
}
else
{
}
else
{
...
@@ -2429,40 +2427,39 @@ bool field::confirm_attack_target() {
...
@@ -2429,40 +2427,39 @@ bool field::confirm_attack_target() {
effect
*
peffect
;
effect
*
peffect
;
card_vector
*
pv
=
NULL
;
card_vector
*
pv
=
NULL
;
int32
atype
=
0
;
int32
atype
=
0
;
card_vector
must_
be_
attack
;
card_vector
must_attack
;
card_vector
only_be_attack
;
card_vector
only_be_attack
;
card_vector
only_attack
;
effect_set
eset
;
effect_set
eset
;
// find the universal set
// find the universal set
for
(
auto
cit
=
player
[
1
-
p
].
list_mzone
.
begin
();
cit
!=
player
[
1
-
p
].
list_mzone
.
end
();
++
cit
)
{
for
(
auto
cit
=
player
[
1
-
p
].
list_mzone
.
begin
();
cit
!=
player
[
1
-
p
].
list_mzone
.
end
();
++
cit
)
{
card
*
atarget
=
*
cit
;
card
*
atarget
=
*
cit
;
if
(
atarget
)
{
if
(
atarget
)
{
if
(
atarget
->
is_affected_by_effect
(
EFFECT_MUST_BE_ATTACKED
,
pcard
))
must_be_attack
.
push_back
(
atarget
);
if
(
atarget
->
is_affected_by_effect
(
EFFECT_ONLY_BE_ATTACKED
))
if
(
atarget
->
is_affected_by_effect
(
EFFECT_ONLY_BE_ATTACKED
))
only_be_attack
.
push_back
(
atarget
);
only_be_attack
.
push_back
(
atarget
);
if
(
pcard
->
is_affected_by_effect
(
EFFECT_MUST_ATTACK_MONSTER
,
atarget
))
must_attack
.
push_back
(
atarget
);
if
(
pcard
->
is_affected_by_effect
(
EFFECT_ONLY_ATTACK_MONSTER
,
atarget
))
only_attack
.
push_back
(
atarget
);
}
}
}
}
pcard
->
filter_effect
(
EFFECT_RISE_TO_FULL_HEIGHT
,
&
eset
);
if
(
only_be_attack
.
size
())
{
if
(
eset
.
size
())
{
atype
=
1
;
atype
=
1
;
std
::
set
<
uint32
>
idset
;
if
(
only_be_attack
.
size
()
==
1
)
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
idset
.
insert
(
eset
[
i
]
->
label
);
if
(
idset
.
size
()
==
1
&&
only_be_attack
.
size
()
==
1
&&
only_be_attack
.
front
()
->
fieldid_r
==
*
idset
.
begin
())
pv
=
&
only_be_attack
;
pv
=
&
only_be_attack
;
else
else
return
false
;
return
false
;
}
else
if
(
pcard
->
is_affected_by_effect
(
EFFECT_ONLY_ATTACK_MONSTER
))
{
}
else
if
(
pcard
->
is_affected_by_effect
(
EFFECT_ONLY_ATTACK_MONSTER
))
{
atype
=
2
;
atype
=
2
;
if
(
only_
be_
attack
.
size
()
==
1
)
if
(
only_attack
.
size
()
==
1
)
pv
=
&
only_
be_
attack
;
pv
=
&
only_attack
;
else
else
return
false
;
return
false
;
}
else
if
(
pcard
->
is_affected_by_effect
(
EFFECT_MUST_ATTACK_MONSTER
))
{
}
else
if
(
pcard
->
is_affected_by_effect
(
EFFECT_MUST_ATTACK_MONSTER
))
{
atype
=
3
;
atype
=
3
;
if
(
must_
be_
attack
.
size
())
if
(
must_attack
.
size
())
pv
=
&
must_
be_
attack
;
pv
=
&
must_attack
;
else
else
return
false
;
return
false
;
}
else
{
}
else
{
...
...
field.h
View file @
ad72c354
...
@@ -193,6 +193,10 @@ struct processor {
...
@@ -193,6 +193,10 @@ struct processor {
chain_array
select_chains
;
chain_array
select_chains
;
chain_array
current_chain
;
chain_array
current_chain
;
chain_list
continuous_chain
;
chain_list
continuous_chain
;
chain_list
solving_continuous
;
chain_list
sub_solving_continuous
;
chain_list
delayed_continuous_tp
;
chain_list
delayed_continuous_ntp
;
chain_list
desrep_chain
;
chain_list
desrep_chain
;
chain_list
new_fchain
;
chain_list
new_fchain
;
chain_list
new_fchain_s
;
chain_list
new_fchain_s
;
...
@@ -231,10 +235,6 @@ struct processor {
...
@@ -231,10 +235,6 @@ struct processor {
effect_set_v
extram_effects
;
effect_set_v
extram_effects
;
effect_set_v
extras_effects
;
effect_set_v
extras_effects
;
std
::
set
<
effect
*>
reseted_effects
;
std
::
set
<
effect
*>
reseted_effects
;
std
::
list
<
effect
*>
delayed_tp
;
std
::
list
<
effect
*>
delayed_ntp
;
event_list
delayed_tev
;
event_list
delayed_ntev
;
std
::
unordered_map
<
card
*
,
uint32
>
readjust_map
;
std
::
unordered_map
<
card
*
,
uint32
>
readjust_map
;
std
::
unordered_set
<
card
*>
unique_cards
[
2
];
std
::
unordered_set
<
card
*>
unique_cards
[
2
];
std
::
unordered_map
<
uint32
,
uint32
>
effect_count_code
;
std
::
unordered_map
<
uint32
,
uint32
>
effect_count_code
;
...
@@ -488,7 +488,7 @@ public:
...
@@ -488,7 +488,7 @@ public:
int32
process_quick_effect
(
int16
step
,
int32
skip_freechain
,
uint8
priority
);
int32
process_quick_effect
(
int16
step
,
int32
skip_freechain
,
uint8
priority
);
int32
process_instant_event
();
int32
process_instant_event
();
int32
process_single_event
();
int32
process_single_event
();
int32
process_single_event
(
effect
*
peffect
,
const
tevent
&
e
,
effect_vector
&
tp
,
effect_vector
&
ntp
,
event_list
&
tev
,
event_list
&
ntev
);
int32
process_single_event
(
effect
*
peffect
,
const
tevent
&
e
,
chain_list
&
tp
,
chain_list
&
ntp
);
int32
process_idle_command
(
uint16
step
);
int32
process_idle_command
(
uint16
step
);
int32
process_battle_command
(
uint16
step
);
int32
process_battle_command
(
uint16
step
);
int32
process_damage_step
(
uint16
step
,
uint32
new_attack
);
int32
process_damage_step
(
uint16
step
,
uint32
new_attack
);
...
@@ -496,7 +496,8 @@ public:
...
@@ -496,7 +496,8 @@ public:
int32
process_turn
(
uint16
step
,
uint8
turn_player
);
int32
process_turn
(
uint16
step
,
uint8
turn_player
);
int32
add_chain
(
uint16
step
);
int32
add_chain
(
uint16
step
);
int32
solve_continuous
(
uint16
step
,
effect
*
peffect
,
uint8
triggering_player
);
void
solve_continuous
(
uint8
playerid
,
effect
*
peffect
,
const
tevent
&
e
);
int32
solve_continuous
(
uint16
step
);
int32
solve_chain
(
uint16
step
,
uint32
chainend_arg1
,
uint32
chainend_arg2
);
int32
solve_chain
(
uint16
step
,
uint32
chainend_arg1
,
uint32
chainend_arg2
);
int32
break_effect
();
int32
break_effect
();
void
adjust_instant
();
void
adjust_instant
();
...
...
operations.cpp
View file @
ad72c354
...
@@ -657,8 +657,7 @@ int32 field::pay_lp_cost(uint32 step, uint8 playerid, uint32 cost) {
...
@@ -657,8 +657,7 @@ int32 field::pay_lp_cost(uint32 step, uint8 playerid, uint32 cost) {
e
.
reason
=
0
;
e
.
reason
=
0
;
e
.
reason_effect
=
core
.
reason_effect
;
e
.
reason_effect
=
core
.
reason_effect
;
e
.
reason_player
=
playerid
;
e
.
reason_player
=
playerid
;
core
.
sub_solving_event
.
push_back
(
e
);
solve_continuous
(
playerid
,
peffect
,
e
);
add_process
(
PROCESSOR_SOLVE_CONTINUOUS
,
0
,
peffect
,
0
,
playerid
,
0
);
return
TRUE
;
return
TRUE
;
}
}
}
}
...
@@ -714,8 +713,7 @@ int32 field::remove_counter(uint16 step, uint32 reason, card* pcard, uint8 rplay
...
@@ -714,8 +713,7 @@ int32 field::remove_counter(uint16 step, uint32 reason, card* pcard, uint8 rplay
e
.
reason
=
reason
;
e
.
reason
=
reason
;
e
.
reason_effect
=
core
.
reason_effect
;
e
.
reason_effect
=
core
.
reason_effect
;
e
.
reason_player
=
rplayer
;
e
.
reason_player
=
rplayer
;
core
.
sub_solving_event
.
push_back
(
e
);
solve_continuous
(
rplayer
,
peffect
,
e
);
add_process
(
PROCESSOR_SOLVE_CONTINUOUS
,
0
,
peffect
,
0
,
rplayer
,
0
);
core
.
units
.
begin
()
->
step
=
3
;
core
.
units
.
begin
()
->
step
=
3
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -791,8 +789,7 @@ int32 field::remove_overlay_card(uint16 step, uint32 reason, card* pcard, uint8
...
@@ -791,8 +789,7 @@ int32 field::remove_overlay_card(uint16 step, uint32 reason, card* pcard, uint8
e
.
reason
=
reason
;
e
.
reason
=
reason
;
e
.
reason_effect
=
core
.
reason_effect
;
e
.
reason_effect
=
core
.
reason_effect
;
e
.
reason_player
=
rplayer
;
e
.
reason_player
=
rplayer
;
core
.
sub_solving_event
.
push_back
(
e
);
solve_continuous
(
rplayer
,
peffect
,
e
);
add_process
(
PROCESSOR_SOLVE_CONTINUOUS
,
0
,
peffect
,
0
,
rplayer
,
0
);
core
.
units
.
begin
()
->
step
=
3
;
core
.
units
.
begin
()
->
step
=
3
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -5952,8 +5949,7 @@ int32 field::toss_coin(uint16 step, effect * reason_effect, uint8 reason_player,
...
@@ -5952,8 +5949,7 @@ int32 field::toss_coin(uint16 step, effect * reason_effect, uint8 reason_player,
process_instant_event
();
process_instant_event
();
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
core
.
sub_solving_event
.
push_back
(
e
);
solve_continuous
(
peffect
->
get_handler_player
(),
peffect
,
e
);
add_process
(
PROCESSOR_SOLVE_CONTINUOUS
,
0
,
peffect
,
0
,
peffect
->
get_handler_player
(),
0
);
return
TRUE
;
return
TRUE
;
}
}
}
}
...
@@ -6006,8 +6002,7 @@ int32 field::toss_dice(uint16 step, effect * reason_effect, uint8 reason_player,
...
@@ -6006,8 +6002,7 @@ int32 field::toss_dice(uint16 step, effect * reason_effect, uint8 reason_player,
process_instant_event
();
process_instant_event
();
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
core
.
sub_solving_event
.
push_back
(
e
);
solve_continuous
(
peffect
->
get_handler_player
(),
peffect
,
e
);
add_process
(
PROCESSOR_SOLVE_CONTINUOUS
,
0
,
peffect
,
0
,
peffect
->
get_handler_player
(),
0
);
return
TRUE
;
return
TRUE
;
}
}
}
}
...
...
processor.cpp
View file @
ad72c354
This diff is collapsed.
Click to expand it.
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