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
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
nanahira
ygopro-core
Commits
0e599a06
Commit
0e599a06
authored
Feb 01, 2025
by
salix5
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using effect_set = std::vector<effect*>
parent
6812551e
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
142 deletions
+50
-142
card.cpp
card.cpp
+32
-32
effect.cpp
effect.cpp
+1
-1
effect.h
effect.h
+0
-2
effectset.h
effectset.h
+2
-92
field.cpp
field.cpp
+4
-4
libduel.cpp
libduel.cpp
+1
-1
processor.cpp
processor.cpp
+10
-10
No files found.
card.cpp
View file @
0e599a06
This diff is collapsed.
Click to expand it.
effect.cpp
View file @
0e599a06
...
@@ -232,7 +232,7 @@ int32_t effect::get_required_handorset_effects(effect_set* eset, uint8_t playeri
...
@@ -232,7 +232,7 @@ int32_t effect::get_required_handorset_effects(effect_set* eset, uint8_t playeri
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
if
(
pduel
->
lua
->
check_condition
(
peffect
->
cost
,
10
))
{
if
(
pduel
->
lua
->
check_condition
(
peffect
->
cost
,
10
))
{
available
=
2
;
available
=
2
;
eset
->
add_item
(
peffect
);
eset
->
push_back
(
peffect
);
}
}
}
}
}
}
...
...
effect.h
View file @
0e599a06
...
@@ -18,8 +18,6 @@ class duel;
...
@@ -18,8 +18,6 @@ class duel;
class
group
;
class
group
;
class
effect
;
class
effect
;
struct
tevent
;
struct
tevent
;
struct
effect_set
;
struct
effect_set_v
;
enum
effect_flag
:
uint64_t
;
enum
effect_flag
:
uint64_t
;
enum
effect_flag2
:
uint64_t
;
enum
effect_flag2
:
uint64_t
;
enum
effect_category
:
uint64_t
;
enum
effect_category
:
uint64_t
;
...
...
effectset.h
View file @
0e599a06
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
#ifndef EFFECTSET_H_
#ifndef EFFECTSET_H_
#define EFFECTSET_H_
#define EFFECTSET_H_
#include <array>
#include <vector>
#include <vector>
#include <algorithm>
#include <algorithm>
...
@@ -16,96 +15,7 @@ class effect;
...
@@ -16,96 +15,7 @@ class effect;
bool
effect_sort_id
(
const
effect
*
e1
,
const
effect
*
e2
);
bool
effect_sort_id
(
const
effect
*
e1
,
const
effect
*
e2
);
// std::array<effect*, 64>
using
effect_set
=
std
::
vector
<
effect
*>
;
struct
effect_set
{
using
effect_set_v
=
effect_set
;
void
add_item
(
effect
*
peffect
)
{
if
(
count
>=
64
)
return
;
container
[
count
++
]
=
peffect
;
}
void
remove_item
(
int
index
)
{
if
(
index
<
0
||
index
>=
count
)
return
;
for
(
int
i
=
index
;
i
<
count
-
1
;
++
i
)
container
[
i
]
=
container
[
i
+
1
];
--
count
;
}
void
clear
()
{
count
=
0
;
}
int
size
()
const
{
return
count
;
}
void
sort
()
{
if
(
count
<
2
)
return
;
std
::
sort
(
container
.
begin
(),
container
.
begin
()
+
count
,
effect_sort_id
);
}
effect
*
const
&
get_last
()
const
{
assert
(
count
);
return
container
[
count
-
1
];
}
effect
*&
get_last
()
{
assert
(
count
);
return
container
[
count
-
1
];
}
effect
*
const
&
operator
[]
(
int
index
)
const
{
return
container
[
index
];
}
effect
*&
operator
[]
(
int
index
)
{
return
container
[
index
];
}
effect
*
const
&
at
(
int
index
)
const
{
return
container
[
index
];
}
effect
*&
at
(
int
index
)
{
return
container
[
index
];
}
private:
std
::
array
<
effect
*
,
64
>
container
{
nullptr
};
int
count
{
0
};
};
struct
effect_set_v
{
void
add_item
(
effect
*
peffect
)
{
container
.
push_back
(
peffect
);
}
void
remove_item
(
int
index
)
{
if
(
index
<
0
||
index
>=
(
int
)
container
.
size
())
return
;
container
.
erase
(
container
.
begin
()
+
index
);
}
void
clear
()
{
container
.
clear
();
}
int
size
()
const
{
return
(
int
)
container
.
size
();
}
void
sort
()
{
std
::
sort
(
container
.
begin
(),
container
.
end
(),
effect_sort_id
);
}
effect
*
const
&
get_last
()
const
{
assert
(
container
.
size
());
return
container
.
back
();
}
effect
*&
get_last
()
{
assert
(
container
.
size
());
return
container
.
back
();
}
effect
*
const
&
operator
[]
(
int
index
)
const
{
return
container
[
index
];
}
effect
*&
operator
[]
(
int
index
)
{
return
container
[
index
];
}
effect
*
const
&
at
(
int
index
)
const
{
return
container
[
index
];
}
effect
*&
at
(
int
index
)
{
return
container
[
index
];
}
private:
std
::
vector
<
effect
*>
container
;
};
#endif //EFFECTSET_H_
#endif //EFFECTSET_H_
field.cpp
View file @
0e599a06
...
@@ -1372,10 +1372,10 @@ void field::filter_field_effect(uint32_t code, effect_set* eset, uint8_t sort) {
...
@@ -1372,10 +1372,10 @@ void field::filter_field_effect(uint32_t code, effect_set* eset, uint8_t sort) {
effect
*
peffect
=
rg
.
first
->
second
;
effect
*
peffect
=
rg
.
first
->
second
;
++
rg
.
first
;
++
rg
.
first
;
if
(
peffect
->
is_available
())
if
(
peffect
->
is_available
())
eset
->
add_item
(
peffect
);
eset
->
push_back
(
peffect
);
}
}
if
(
sort
)
if
(
sort
)
eset
->
sort
(
);
std
::
sort
(
eset
->
begin
(),
eset
->
end
(),
effect_sort_id
);
}
}
//Get all cards in the target range of a EFFECT_TYPE_FIELD effect
//Get all cards in the target range of a EFFECT_TYPE_FIELD effect
void
field
::
filter_affected_cards
(
effect
*
peffect
,
card_set
*
cset
)
{
void
field
::
filter_affected_cards
(
effect
*
peffect
,
card_set
*
cset
)
{
...
@@ -1451,10 +1451,10 @@ void field::filter_player_effect(uint8_t playerid, uint32_t code, effect_set* es
...
@@ -1451,10 +1451,10 @@ void field::filter_player_effect(uint8_t playerid, uint32_t code, effect_set* es
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
effect
*
peffect
=
rg
.
first
->
second
;
effect
*
peffect
=
rg
.
first
->
second
;
if
(
peffect
->
is_target_player
(
playerid
)
&&
peffect
->
is_available
())
if
(
peffect
->
is_target_player
(
playerid
)
&&
peffect
->
is_available
())
eset
->
add_item
(
peffect
);
eset
->
push_back
(
peffect
);
}
}
if
(
sort
)
if
(
sort
)
eset
->
sort
(
);
std
::
sort
(
eset
->
begin
(),
eset
->
end
(),
effect_sort_id
);
}
}
int32_t
field
::
filter_matching_card
(
lua_State
*
L
,
int32_t
findex
,
uint8_t
self
,
uint32_t
location1
,
uint32_t
location2
,
group
*
pgroup
,
card
*
pexception
,
group
*
pexgroup
,
uint32_t
extraargs
,
card
**
pret
,
int32_t
fcount
,
int32_t
is_target
)
{
int32_t
field
::
filter_matching_card
(
lua_State
*
L
,
int32_t
findex
,
uint8_t
self
,
uint32_t
location1
,
uint32_t
location2
,
group
*
pgroup
,
card
*
pexception
,
group
*
pexgroup
,
uint32_t
extraargs
,
card
**
pret
,
int32_t
fcount
,
int32_t
is_target
)
{
if
(
self
!=
0
&&
self
!=
1
)
if
(
self
!=
0
&&
self
!=
1
)
...
...
libduel.cpp
View file @
0e599a06
...
@@ -1249,7 +1249,7 @@ int32_t scriptlib::duel_is_environment(lua_State *L) {
...
@@ -1249,7 +1249,7 @@ int32_t scriptlib::duel_is_environment(lua_State *L) {
effect_set
eset
;
effect_set
eset
;
pduel
->
game_field
->
filter_field_effect
(
EFFECT_CHANGE_ENVIRONMENT
,
&
eset
);
pduel
->
game_field
->
filter_field_effect
(
EFFECT_CHANGE_ENVIRONMENT
,
&
eset
);
if
(
eset
.
size
())
{
if
(
eset
.
size
())
{
effect
*
peffect
=
eset
.
get_last
();
effect
*
peffect
=
eset
.
back
();
if
(
code
==
(
uint32_t
)
peffect
->
get_value
()
&&
(
playerid
==
peffect
->
get_handler_player
()
||
playerid
==
PLAYER_ALL
))
if
(
code
==
(
uint32_t
)
peffect
->
get_value
()
&&
(
playerid
==
peffect
->
get_handler_player
()
||
playerid
==
PLAYER_ALL
))
ret
=
1
;
ret
=
1
;
}
}
...
...
processor.cpp
View file @
0e599a06
...
@@ -1233,7 +1233,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
...
@@ -1233,7 +1233,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
effect_set
eset
;
effect_set
eset
;
filter_player_effect
(
infos
.
turn_player
,
EFFECT_HAND_LIMIT
,
&
eset
);
filter_player_effect
(
infos
.
turn_player
,
EFFECT_HAND_LIMIT
,
&
eset
);
if
(
eset
.
size
())
if
(
eset
.
size
())
limit
=
eset
.
get_last
()
->
get_value
();
limit
=
eset
.
back
()
->
get_value
();
int32_t
hd
=
(
int32_t
)
player
[
infos
.
turn_player
].
list_hand
.
size
();
int32_t
hd
=
(
int32_t
)
player
[
infos
.
turn_player
].
list_hand
.
size
();
if
(
hd
<=
limit
)
{
if
(
hd
<=
limit
)
{
core
.
units
.
begin
()
->
step
=
24
;
core
.
units
.
begin
()
->
step
=
24
;
...
@@ -3479,7 +3479,7 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
...
@@ -3479,7 +3479,7 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
core
.
attack_target
->
filter_effect
(
EFFECT_CHANGE_INVOLVING_BATTLE_DAMAGE
,
&
change_effects
,
FALSE
);
core
.
attack_target
->
filter_effect
(
EFFECT_CHANGE_INVOLVING_BATTLE_DAMAGE
,
&
change_effects
,
FALSE
);
filter_player_effect
(
pa
,
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
change_effects
,
FALSE
);
filter_player_effect
(
pa
,
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
change_effects
,
FALSE
);
filter_player_effect
(
1
-
pa
,
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
change_effects
,
FALSE
);
filter_player_effect
(
1
-
pa
,
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
change_effects
,
FALSE
);
change_effects
.
sort
(
);
std
::
sort
(
change_effects
.
begin
(),
change_effects
.
end
(),
effect_sort_id
);
for
(
uint8_t
p
=
0
;
p
<
2
;
++
p
)
{
for
(
uint8_t
p
=
0
;
p
<
2
;
++
p
)
{
bool
double_dam
=
false
;
bool
double_dam
=
false
;
bool
half_dam
=
false
;
bool
half_dam
=
false
;
...
@@ -3600,7 +3600,7 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
...
@@ -3600,7 +3600,7 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
dam_card
->
filter_effect
(
EFFECT_CHANGE_INVOLVING_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
dam_card
->
filter_effect
(
EFFECT_CHANGE_INVOLVING_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
filter_player_effect
(
damaged_player
,
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
filter_player_effect
(
damaged_player
,
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
filter_player_effect
(
1
-
damaged_player
,
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
filter_player_effect
(
1
-
damaged_player
,
EFFECT_CHANGE_BATTLE_DAMAGE
,
&
eset
,
FALSE
);
eset
.
sort
(
);
std
::
sort
(
eset
.
begin
(),
eset
.
end
(),
effect_sort_id
);
for
(
uint8_t
p
=
0
;
p
<
2
;
++
p
)
{
for
(
uint8_t
p
=
0
;
p
<
2
;
++
p
)
{
bool
double_dam
=
false
;
bool
double_dam
=
false
;
bool
half_dam
=
false
;
bool
half_dam
=
false
;
...
@@ -4653,7 +4653,7 @@ int32_t field::refresh_location_info(uint16_t step) {
...
@@ -4653,7 +4653,7 @@ int32_t field::refresh_location_info(uint16_t step) {
player
[
0
].
disabled_location
|=
value
&
0x1f7f
;
player
[
0
].
disabled_location
|=
value
&
0x1f7f
;
player
[
1
].
disabled_location
|=
(
value
>>
16
)
&
0x1f7f
;
player
[
1
].
disabled_location
|=
(
value
>>
16
)
&
0x1f7f
;
}
else
}
else
core
.
disfield_effects
.
add_item
(
eset
[
i
]);
core
.
disfield_effects
.
push_back
(
eset
[
i
]);
}
}
eset
.
clear
();
eset
.
clear
();
filter_field_effect
(
EFFECT_USE_EXTRA_MZONE
,
&
eset
);
filter_field_effect
(
EFFECT_USE_EXTRA_MZONE
,
&
eset
);
...
@@ -4662,7 +4662,7 @@ int32_t field::refresh_location_info(uint16_t step) {
...
@@ -4662,7 +4662,7 @@ int32_t field::refresh_location_info(uint16_t step) {
uint32_t
value
=
eset
[
i
]
->
get_value
();
uint32_t
value
=
eset
[
i
]
->
get_value
();
player
[
p
].
disabled_location
|=
(
value
>>
16
)
&
0x1f
;
player
[
p
].
disabled_location
|=
(
value
>>
16
)
&
0x1f
;
if
((
uint32_t
)
field_used_count
[(
value
>>
16
)
&
0x1f
]
<
(
value
&
0xffff
))
if
((
uint32_t
)
field_used_count
[(
value
>>
16
)
&
0x1f
]
<
(
value
&
0xffff
))
core
.
extra_mzone_effects
.
add_item
(
eset
[
i
]);
core
.
extra_mzone_effects
.
push_back
(
eset
[
i
]);
}
}
eset
.
clear
();
eset
.
clear
();
filter_field_effect
(
EFFECT_USE_EXTRA_SZONE
,
&
eset
);
filter_field_effect
(
EFFECT_USE_EXTRA_SZONE
,
&
eset
);
...
@@ -4671,7 +4671,7 @@ int32_t field::refresh_location_info(uint16_t step) {
...
@@ -4671,7 +4671,7 @@ int32_t field::refresh_location_info(uint16_t step) {
uint32_t
value
=
eset
[
i
]
->
get_value
();
uint32_t
value
=
eset
[
i
]
->
get_value
();
player
[
p
].
disabled_location
|=
(
value
>>
8
)
&
0x1f00
;
player
[
p
].
disabled_location
|=
(
value
>>
8
)
&
0x1f00
;
if
((
uint32_t
)
field_used_count
[(
value
>>
16
)
&
0x1f
]
<
(
value
&
0xffff
))
if
((
uint32_t
)
field_used_count
[(
value
>>
16
)
&
0x1f
]
<
(
value
&
0xffff
))
core
.
extra_szone_effects
.
add_item
(
eset
[
i
]);
core
.
extra_szone_effects
.
push_back
(
eset
[
i
]);
}
}
return
FALSE
;
return
FALSE
;
}
}
...
@@ -4682,7 +4682,7 @@ int32_t field::refresh_location_info(uint16_t step) {
...
@@ -4682,7 +4682,7 @@ int32_t field::refresh_location_info(uint16_t step) {
}
}
effect
*
peffect
=
core
.
disfield_effects
[
0
];
effect
*
peffect
=
core
.
disfield_effects
[
0
];
core
.
units
.
begin
()
->
peffect
=
peffect
;
core
.
units
.
begin
()
->
peffect
=
peffect
;
core
.
disfield_effects
.
remove_item
(
0
);
core
.
disfield_effects
.
erase
(
core
.
disfield_effects
.
begin
()
);
if
(
!
peffect
->
operation
)
{
if
(
!
peffect
->
operation
)
{
peffect
->
value
=
0x80
;
peffect
->
value
=
0x80
;
core
.
units
.
begin
()
->
step
=
0
;
core
.
units
.
begin
()
->
step
=
0
;
...
@@ -4715,7 +4715,7 @@ int32_t field::refresh_location_info(uint16_t step) {
...
@@ -4715,7 +4715,7 @@ int32_t field::refresh_location_info(uint16_t step) {
}
}
effect
*
peffect
=
core
.
extra_mzone_effects
[
0
];
effect
*
peffect
=
core
.
extra_mzone_effects
[
0
];
core
.
units
.
begin
()
->
peffect
=
peffect
;
core
.
units
.
begin
()
->
peffect
=
peffect
;
core
.
extra_mzone_effects
.
remove_item
(
0
);
core
.
extra_mzone_effects
.
erase
(
core
.
extra_mzone_effects
.
begin
()
);
uint32_t
p
=
peffect
->
get_handler_player
();
uint32_t
p
=
peffect
->
get_handler_player
();
uint32_t
mzone_flag
=
(
player
[
p
].
disabled_location
|
player
[
p
].
used_location
)
&
0x1f
;
uint32_t
mzone_flag
=
(
player
[
p
].
disabled_location
|
player
[
p
].
used_location
)
&
0x1f
;
if
(
mzone_flag
==
0x1f
)
{
if
(
mzone_flag
==
0x1f
)
{
...
@@ -4754,7 +4754,7 @@ int32_t field::refresh_location_info(uint16_t step) {
...
@@ -4754,7 +4754,7 @@ int32_t field::refresh_location_info(uint16_t step) {
}
}
effect
*
peffect
=
core
.
extra_szone_effects
[
0
];
effect
*
peffect
=
core
.
extra_szone_effects
[
0
];
core
.
units
.
begin
()
->
peffect
=
peffect
;
core
.
units
.
begin
()
->
peffect
=
peffect
;
core
.
extra_szone_effects
.
remove_item
(
0
);
core
.
extra_szone_effects
.
erase
(
core
.
extra_szone_effects
.
begin
()
);
uint32_t
p
=
peffect
->
get_handler_player
();
uint32_t
p
=
peffect
->
get_handler_player
();
uint32_t
szone_flag
=
((
player
[
p
].
disabled_location
|
player
[
p
].
used_location
)
>>
8
)
&
0x1f
;
uint32_t
szone_flag
=
((
player
[
p
].
disabled_location
|
player
[
p
].
used_location
)
>>
8
)
&
0x1f
;
if
(
szone_flag
==
0x1f
)
{
if
(
szone_flag
==
0x1f
)
{
...
@@ -4997,7 +4997,7 @@ int32_t field::adjust_step(uint16_t step) {
...
@@ -4997,7 +4997,7 @@ int32_t field::adjust_step(uint16_t step) {
eset
.
clear
();
eset
.
clear
();
pcard
->
filter_effect
(
EFFECT_SET_POSITION
,
&
eset
);
pcard
->
filter_effect
(
EFFECT_SET_POSITION
,
&
eset
);
if
(
eset
.
size
())
{
if
(
eset
.
size
())
{
pos
=
eset
.
get_last
()
->
get_value
();
pos
=
eset
.
back
()
->
get_value
();
if
((
pos
&
0xff
)
!=
pcard
->
current
.
position
)
{
if
((
pos
&
0xff
)
!=
pcard
->
current
.
position
)
{
pos_adjust
.
insert
(
pcard
);
pos_adjust
.
insert
(
pcard
);
pcard
->
position_param
=
pos
;
pcard
->
position_param
=
pos
;
...
...
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