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
xiaoye
ygopro-core
Commits
b37a2163
Commit
b37a2163
authored
Mar 16, 2025
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master'
parents
572aa80b
efab9017
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
287 additions
and
357 deletions
+287
-357
.github/workflows/build.yml
.github/workflows/build.yml
+11
-3
card.cpp
card.cpp
+128
-125
card.h
card.h
+4
-1
effect.cpp
effect.cpp
+7
-10
effect.h
effect.h
+4
-4
effectset.h
effectset.h
+2
-92
field.cpp
field.cpp
+38
-37
libcard.cpp
libcard.cpp
+5
-5
libduel.cpp
libduel.cpp
+3
-3
operations.cpp
operations.cpp
+55
-49
premake/dll.lua
premake/dll.lua
+1
-1
premake/lua.lua
premake/lua.lua
+1
-0
premake5.lua
premake5.lua
+2
-1
processor.cpp
processor.cpp
+26
-26
No files found.
.github/workflows/build.yml
View file @
b37a2163
...
...
@@ -16,16 +16,24 @@ jobs:
with
:
fetch-depth
:
0
-
name
:
Install lua
-
name
:
Download dependencies
run
:
|
bash -c " \
curl -Z --retry 5 --connect-timeout 30 --location \
--create-dirs --output-dir temp --remote-name-all \
https://www.lua.org/ftp/lua-5.4.7.tar.gz \
https://github.com/premake/premake-core/releases/download/v5.0.0-beta5/premake-5.0.0-beta5-windows.zip \
; exit 0"
-
name
:
Lua
run
:
|
bash -c "curl -Z --retry 5 --connect-timeout 30 --location --create-dirs --output-dir temp --remote-name-all https://www.lua.org/ftp/lua-5.4.7.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-windows.zip ; exit 0"
tar -xzf temp/lua-5.4.7.tar.gz
move lua-5.4.7 lua
-
name
:
Premake
run
:
|
mkdir premake-5
tar -C premake-5 -xzf temp/premake-5.0.0-beta
2
-windows.zip
tar -C premake-5 -xzf temp/premake-5.0.0-beta
5
-windows.zip
copy premake\lua.lua lua\premake5.lua
copy premake\dll.lua dll.lua
.\premake-5\premake5.exe vs2022 --file=dll.lua
...
...
card.cpp
View file @
b37a2163
This diff is collapsed.
Click to expand it.
card.h
View file @
b37a2163
...
...
@@ -170,7 +170,8 @@ public:
uint8_t
attack_controler
{};
uint64_t
cardid
{};
uint32_t
fieldid
{};
uint32_t
fieldid_r
{};
uint32_t
fieldid_r
{};
//real field id, updated when moving to new location
uint32_t
activate_count_id
{};
//updated when moving to new location or flipping
uint16_t
turnid
{};
uint16_t
turn_counter
{};
uint8_t
unique_pos
[
2
]{};
...
...
@@ -243,6 +244,8 @@ public:
uint32_t
get_level
();
uint32_t
get_rank
();
uint32_t
get_link
();
uint32_t
get_mat_level_from_effect
(
card
*
pcard
,
uint32_t
effect_code
);
uint32_t
get_mat_level
(
card
*
pcard
,
uint32_t
level_effect_code
,
uint32_t
allow_effect_code
=
0
);
uint32_t
get_synchro_level
(
card
*
pcard
);
uint32_t
get_ritual_level
(
card
*
pcard
);
uint32_t
check_xyz_level
(
card
*
pcard
,
uint32_t
lv
);
...
...
effect.cpp
View file @
b37a2163
...
...
@@ -159,9 +159,6 @@ int32_t effect::is_single_ready() {
int32_t
res
=
pduel
->
lua
->
check_condition
(
condition
,
1
);
return
res
;
}
// reset_count: count of effect reset
// count_limit: left count of activation
// count_limit_max: max count of activation
int32_t
effect
::
check_count_limit
(
uint8_t
playerid
)
{
if
(
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
))
{
if
(
count_limit
==
0
)
...
...
@@ -171,7 +168,7 @@ int32_t effect::check_count_limit(uint8_t playerid) {
uint32_t
limit_type
=
count_code
&
0xf0000000U
;
int32_t
count
=
count_limit_max
;
if
(
limit_code
==
EFFECT_COUNT_CODE_SINGLE
)
{
if
(
pduel
->
game_field
->
get_effect_code
(
limit_type
|
get_handler
()
->
field
id
,
PLAYER_NONE
)
>=
count
)
if
(
pduel
->
game_field
->
get_effect_code
(
limit_type
|
get_handler
()
->
activate_count_
id
,
PLAYER_NONE
)
>=
count
)
return
FALSE
;
}
else
{
if
(
pduel
->
game_field
->
get_effect_code
(
count_code
,
playerid
)
>=
count
)
...
...
@@ -216,7 +213,7 @@ int32_t effect::get_required_handorset_effects(effect_set* eset, uint8_t playeri
uint8_t
op
=
pduel
->
game_field
->
core
.
reason_player
;
pduel
->
game_field
->
core
.
reason_player
=
playerid
;
pduel
->
game_field
->
save_lp_cost
();
for
(
int32_t
i
=
0
;
i
<
tmp_eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
tmp_eset
.
size
();
++
i
)
{
auto
peffect
=
tmp_eset
[
i
];
if
(
peffect
->
check_count_limit
(
playerid
))
{
pduel
->
game_field
->
core
.
reason_effect
=
peffect
;
...
...
@@ -232,7 +229,7 @@ int32_t effect::get_required_handorset_effects(effect_set* eset, uint8_t playeri
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
if
(
pduel
->
lua
->
check_condition
(
peffect
->
cost
,
10
))
{
available
=
2
;
eset
->
add_item
(
peffect
);
eset
->
push_back
(
peffect
);
}
}
}
...
...
@@ -378,7 +375,7 @@ int32_t effect::is_activateable(uint8_t playerid, const tevent& e, int32_t negle
int32_t
effect
::
is_action_check
(
uint8_t
playerid
)
{
effect_set
eset
;
pduel
->
game_field
->
filter_player_effect
(
playerid
,
EFFECT_CANNOT_ACTIVATE
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
if
(
eset
[
i
]
->
check_value_condition
(
2
))
...
...
@@ -386,7 +383,7 @@ int32_t effect::is_action_check(uint8_t playerid) {
}
eset
.
clear
();
pduel
->
game_field
->
filter_player_effect
(
playerid
,
EFFECT_ACTIVATE_COST
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
eset
[
i
],
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
...
...
@@ -574,7 +571,7 @@ int32_t effect::is_player_effect_target(card* pcard) {
}
int32_t
effect
::
is_immuned
(
card
*
pcard
)
{
const
effect_set_v
&
effects
=
pcard
->
immune_effect
;
for
(
int32_t
i
=
0
;
i
<
effects
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
effects
.
size
();
++
i
)
{
effect
*
peffect
=
effects
[
i
];
if
(
peffect
->
is_available
()
&&
peffect
->
value
)
{
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_EFFECT
);
...
...
@@ -680,7 +677,7 @@ void effect::dec_count(uint8_t playerid) {
uint32_t
limit_code
=
count_code
&
MAX_CARD_ID
;
uint32_t
limit_type
=
count_code
&
0xf0000000
;
if
(
limit_code
==
EFFECT_COUNT_CODE_SINGLE
)
pduel
->
game_field
->
add_effect_code
(
limit_type
|
get_handler
()
->
field
id
,
PLAYER_NONE
);
pduel
->
game_field
->
add_effect_code
(
limit_type
|
get_handler
()
->
activate_count_
id
,
PLAYER_NONE
);
else
pduel
->
game_field
->
add_effect_code
(
count_code
,
playerid
);
}
...
...
effect.h
View file @
b37a2163
...
...
@@ -18,8 +18,6 @@ class duel;
class
group
;
class
effect
;
struct
tevent
;
struct
effect_set
;
struct
effect_set_v
;
enum
effect_flag
:
uint64_t
;
enum
effect_flag2
:
uint64_t
;
enum
effect_category
:
uint64_t
;
...
...
@@ -42,8 +40,8 @@ public:
uint16_t
range
{
0
};
uint16_t
s_range
{
0
};
uint16_t
o_range
{
0
};
uint8_t
count_limit
{
0
};
uint8_t
count_limit_max
{
0
};
uint8_t
count_limit
{
0
};
//left count of activation
uint8_t
count_limit_max
{
0
};
//max count of activation
uint16_t
status
{
0
};
int32_t
reset_count
{
0
};
uint32_t
reset_flag
{
0
};
...
...
@@ -530,6 +528,8 @@ const std::map<uint64_t, uint64_t> category_checklist{
#define EFFECT_KAISER_COLOSSEUM 370
#define EFFECT_REPLACE_DAMAGE 371
#define EFFECT_XYZ_MIN_COUNT 372
#define EFFECT_SYNCHRO_LEVEL_EX 373
#define EFFECT_RITUAL_LEVEL_EX 374
//#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
...
...
effectset.h
View file @
b37a2163
...
...
@@ -8,7 +8,6 @@
#ifndef EFFECTSET_H_
#define EFFECTSET_H_
#include <array>
#include <vector>
#include <algorithm>
...
...
@@ -16,96 +15,7 @@ class effect;
bool
effect_sort_id
(
const
effect
*
e1
,
const
effect
*
e2
);
// std::array<effect*, 64>
struct
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
;
};
using
effect_set
=
std
::
vector
<
effect
*>
;
using
effect_set_v
=
effect_set
;
#endif //EFFECTSET_H_
field.cpp
View file @
b37a2163
This diff is collapsed.
Click to expand it.
libcard.cpp
View file @
b37a2163
...
...
@@ -63,7 +63,7 @@ int32_t scriptlib::card_get_fusion_code(lua_State *L) {
return
count
;
effect_set
eset
;
pcard
->
filter_effect
(
EFFECT_ADD_FUSION_CODE
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
lua_pushinteger
(
L
,
eset
[
i
]
->
get_value
(
pcard
));
return
count
+
eset
.
size
();
}
...
...
@@ -80,7 +80,7 @@ int32_t scriptlib::card_get_link_code(lua_State *L) {
}
effect_set
eset
;
pcard
->
filter_effect
(
EFFECT_ADD_LINK_CODE
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
lua_pushinteger
(
L
,
eset
[
i
]
->
get_value
(
pcard
));
return
count
+
eset
.
size
();
}
...
...
@@ -98,7 +98,7 @@ int32_t scriptlib::card_is_fusion_code(lua_State *L) {
fcode
.
insert
(
code1
);
if
(
code2
)
fcode
.
insert
(
code2
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
fcode
.
insert
(
eset
[
i
]
->
get_value
(
pcard
));
uint32_t
count
=
lua_gettop
(
L
)
-
1
;
uint32_t
result
=
FALSE
;
...
...
@@ -128,7 +128,7 @@ int32_t scriptlib::card_is_link_code(lua_State *L) {
fcode
.
insert
(
code1
);
if
(
code2
)
fcode
.
insert
(
code2
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
fcode
.
insert
(
eset
[
i
]
->
get_value
(
pcard
));
uint32_t
count
=
lua_gettop
(
L
)
-
1
;
uint32_t
result
=
FALSE
;
...
...
@@ -1858,7 +1858,7 @@ int32_t scriptlib::card_is_has_effect(lua_State *L) {
check_player
=
PLAYER_NONE
;
}
int32_t
size
=
0
;
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
check_player
==
PLAYER_NONE
||
eset
[
i
]
->
check_count_limit
(
check_player
))
{
interpreter
::
effect2value
(
L
,
eset
[
i
]);
++
size
;
...
...
libduel.cpp
View file @
b37a2163
...
...
@@ -183,7 +183,7 @@ int32_t scriptlib::duel_get_flag_effect_label(lua_State *L) {
lua_pushnil
(
L
);
return
1
;
}
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
lua_pushinteger
(
L
,
eset
[
i
]
->
label
.
size
()
?
eset
[
i
]
->
label
[
0
]
:
0
);
return
eset
.
size
();
}
...
...
@@ -1249,7 +1249,7 @@ int32_t scriptlib::duel_is_environment(lua_State *L) {
effect_set
eset
;
pduel
->
game_field
->
filter_field_effect
(
EFFECT_CHANGE_ENVIRONMENT
,
&
eset
);
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
))
ret
=
1
;
}
...
...
@@ -4281,7 +4281,7 @@ int32_t scriptlib::duel_is_player_affected_by_effect(lua_State *L) {
effect_set
eset
;
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
int32_t
size
=
0
;
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
check_count_limit
(
playerid
))
{
interpreter
::
effect2value
(
L
,
eset
[
i
]);
++
size
;
...
...
operations.cpp
View file @
b37a2163
This diff is collapsed.
Click to expand it.
premake/dll.lua
View file @
b37a2163
...
...
@@ -35,7 +35,7 @@ workspace "ocgcoredll"
startproject
"ocgcore"
filter
{
"configurations:Release"
,
"action:vs*"
}
flags
{
"LinkTimeOptimization"
}
linktimeoptimization
"On"
staticruntime
"On"
disablewarnings
{
"4334"
}
...
...
premake/lua.lua
View file @
b37a2163
project
"lua"
kind
"StaticLib"
cppdialect
"C++14"
files
{
"src/*.c"
,
"src/*.h"
,
"src/*.hpp"
}
removefiles
{
"src/lua.c"
,
"src/luac.c"
}
...
...
premake5.lua
View file @
b37a2163
project
"ocgcore"
kind
"StaticLib"
cppdialect
"C++14"
files
{
"*.cpp"
,
"*.h"
}
links
{
LUA_LIB_NAME
}
...
...
@@ -12,7 +13,7 @@ project "ocgcore"
end
filter
"not action:vs*"
buildoptions
{
"-std=c++14"
}
buildoptions
{
}
filter
"system:bsd"
defines
{
"LUA_USE_POSIX"
}
...
...
processor.cpp
View file @
b37a2163
...
...
@@ -1233,7 +1233,7 @@ int32_t field::process_phase_event(int16_t step, int32_t phase) {
effect_set
eset
;
filter_player_effect
(
infos
.
turn_player
,
EFFECT_HAND_LIMIT
,
&
eset
);
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
();
if
(
hd
<=
limit
)
{
core
.
units
.
begin
()
->
step
=
24
;
...
...
@@ -2148,7 +2148,7 @@ int32_t field::process_idle_command(uint16_t step) {
core
.
spsummonable_cards
.
clear
();
effect_set
eset
;
filter_field_effect
(
EFFECT_SPSUMMON_PROC
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
card
*
pcard
=
eset
[
i
]
->
get_handler
();
if
(
!
eset
[
i
]
->
check_count_limit
(
pcard
->
current
.
controler
))
continue
;
...
...
@@ -2157,7 +2157,7 @@ int32_t field::process_idle_command(uint16_t step) {
}
eset
.
clear
();
filter_field_effect
(
EFFECT_SPSUMMON_PROC_G
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
card
*
pcard
=
eset
[
i
]
->
get_handler
();
if
(
!
eset
[
i
]
->
check_count_limit
(
infos
.
turn_player
))
continue
;
...
...
@@ -2526,7 +2526,7 @@ int32_t field::process_battle_command(uint16_t step) {
effect_set
eset
;
filter_player_effect
(
infos
.
turn_player
,
EFFECT_ATTACK_COST
,
&
eset
,
FALSE
);
core
.
attacker
->
filter_effect
(
EFFECT_ATTACK_COST
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
operation
)
{
core
.
attack_cancelable
=
FALSE
;
core
.
sub_solving_event
.
push_back
(
nil_event
);
...
...
@@ -3386,7 +3386,7 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
if
(
eset
.
size
())
{
pierce
=
true
;
uint8_t
dp
[
2
]
=
{};
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
dp
[
1
-
eset
[
i
]
->
get_handler_player
()]
=
1
;
if
(
dp
[
0
])
core
.
battle_damage
[
0
]
=
attacker_value
-
defender_value
;
...
...
@@ -3394,7 +3394,7 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
core
.
battle_damage
[
1
]
=
attacker_value
-
defender_value
;
bool
double_damage
=
false
;
//bool half_damage = false;
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
get_value
()
==
DOUBLE_DAMAGE
)
double_damage
=
true
;
//if(eset[i]->get_value() == HALF_DAMAGE)
...
...
@@ -3479,12 +3479,12 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
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
(
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
)
{
bool
double_dam
=
false
;
bool
half_dam
=
false
;
int32_t
dam_value
=
-
1
;
for
(
int32_t
i
=
0
;
i
<
change_effects
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
change_effects
.
size
();
++
i
)
{
int32_t
val
=
-
1
;
if
(
!
change_effects
[
i
]
->
is_flag
(
EFFECT_FLAG_PLAYER_TARGET
))
{
pduel
->
lua
->
add_param
(
p
,
PARAM_TYPE_INT
);
...
...
@@ -3600,13 +3600,13 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
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
(
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
)
{
bool
double_dam
=
false
;
bool
half_dam
=
false
;
int32_t
dam_value
=
-
1
;
int32_t
current_min
=
INT32_MAX
;
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
int32_t
val
=
-
1
;
if
(
!
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_PLAYER_TARGET
))
{
pduel
->
lua
->
add_param
(
p
,
PARAM_TYPE_INT
);
...
...
@@ -3992,7 +3992,7 @@ int32_t field::add_chain(uint16_t step) {
card
*
phandler
=
peffect
->
get_handler
();
effect_set
eset
;
filter_player_effect
(
clit
.
triggering_player
,
EFFECT_ACTIVATE_COST
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
eset
[
i
],
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
clit
.
triggering_effect
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
clit
.
triggering_player
,
PARAM_TYPE_INT
);
...
...
@@ -4163,7 +4163,7 @@ int32_t field::add_chain(uint16_t step) {
auto
peffect
=
clit
.
triggering_effect
;
auto
playerid
=
clit
.
triggering_player
;
int32_t
ceffect_unique_id
=
0
;
for
(
int32_t
i
=
0
;
i
<
clit
.
required_handorset_effects
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
clit
.
required_handorset_effects
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
peffect
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
auto
id
=
clit
.
required_handorset_effects
[
i
]
->
get_value
(
2
);
...
...
@@ -4182,7 +4182,7 @@ int32_t field::add_chain(uint16_t step) {
}
}
core
.
select_options
.
clear
();
for
(
int32_t
i
=
0
;
i
<
clit
.
required_handorset_effects
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
clit
.
required_handorset_effects
.
size
();
++
i
)
{
core
.
select_options
.
push_back
(
clit
.
required_handorset_effects
[
i
]
->
description
);
}
add_process
(
PROCESSOR_SELECT_OPTION
,
0
,
0
,
0
,
clit
.
triggering_player
,
0
);
...
...
@@ -4609,21 +4609,21 @@ void field::refresh_location_info_instant() {
player
[
0
].
disabled_location
=
0
;
player
[
1
].
disabled_location
=
0
;
filter_field_effect
(
EFFECT_DISABLE_FIELD
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
uint32_t
value
=
eset
[
i
]
->
get_value
();
player
[
0
].
disabled_location
|=
value
&
0x1f7f
;
player
[
1
].
disabled_location
|=
(
value
>>
16
)
&
0x1f7f
;
}
eset
.
clear
();
filter_field_effect
(
EFFECT_USE_EXTRA_MZONE
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
uint8_t
p
=
eset
[
i
]
->
get_handler_player
();
uint32_t
value
=
eset
[
i
]
->
get_value
();
player
[
p
].
disabled_location
|=
(
value
>>
16
)
&
0x1f
;
}
eset
.
clear
();
filter_field_effect
(
EFFECT_USE_EXTRA_SZONE
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
uint8_t
p
=
eset
[
i
]
->
get_handler_player
();
uint32_t
value
=
eset
[
i
]
->
get_value
();
player
[
p
].
disabled_location
|=
(
value
>>
8
)
&
0x1f00
;
...
...
@@ -4647,31 +4647,31 @@ int32_t field::refresh_location_info(uint16_t step) {
core
.
extra_mzone_effects
.
clear
();
core
.
extra_szone_effects
.
clear
();
filter_field_effect
(
EFFECT_DISABLE_FIELD
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
uint32_t
value
=
eset
[
i
]
->
get_value
();
if
(
value
)
{
player
[
0
].
disabled_location
|=
value
&
0x1f7f
;
player
[
1
].
disabled_location
|=
(
value
>>
16
)
&
0x1f7f
;
}
else
core
.
disfield_effects
.
add_item
(
eset
[
i
]);
core
.
disfield_effects
.
push_back
(
eset
[
i
]);
}
eset
.
clear
();
filter_field_effect
(
EFFECT_USE_EXTRA_MZONE
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
uint8_t
p
=
eset
[
i
]
->
get_handler_player
();
uint32_t
value
=
eset
[
i
]
->
get_value
();
player
[
p
].
disabled_location
|=
(
value
>>
16
)
&
0x1f
;
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
();
filter_field_effect
(
EFFECT_USE_EXTRA_SZONE
,
&
eset
);
for
(
int32_t
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
for
(
effect_set
::
size_type
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
uint8_t
p
=
eset
[
i
]
->
get_handler_player
();
uint32_t
value
=
eset
[
i
]
->
get_value
();
player
[
p
].
disabled_location
|=
(
value
>>
8
)
&
0x1f00
;
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
;
}
...
...
@@ -4682,7 +4682,7 @@ int32_t field::refresh_location_info(uint16_t step) {
}
effect
*
peffect
=
core
.
disfield_effects
[
0
];
core
.
units
.
begin
()
->
peffect
=
peffect
;
core
.
disfield_effects
.
remove_item
(
0
);
core
.
disfield_effects
.
erase
(
core
.
disfield_effects
.
begin
()
);
if
(
!
peffect
->
operation
)
{
peffect
->
value
=
0x80
;
core
.
units
.
begin
()
->
step
=
0
;
...
...
@@ -4715,7 +4715,7 @@ int32_t field::refresh_location_info(uint16_t step) {
}
effect
*
peffect
=
core
.
extra_mzone_effects
[
0
];
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
mzone_flag
=
(
player
[
p
].
disabled_location
|
player
[
p
].
used_location
)
&
0x1f
;
if
(
mzone_flag
==
0x1f
)
{
...
...
@@ -4754,7 +4754,7 @@ int32_t field::refresh_location_info(uint16_t step) {
}
effect
*
peffect
=
core
.
extra_szone_effects
[
0
];
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
szone_flag
=
((
player
[
p
].
disabled_location
|
player
[
p
].
used_location
)
>>
8
)
&
0x1f
;
if
(
szone_flag
==
0x1f
)
{
...
...
@@ -4997,7 +4997,7 @@ int32_t field::adjust_step(uint16_t step) {
eset
.
clear
();
pcard
->
filter_effect
(
EFFECT_SET_POSITION
,
&
eset
);
if
(
eset
.
size
())
{
pos
=
eset
.
get_last
()
->
get_value
();
pos
=
eset
.
back
()
->
get_value
();
if
((
pos
&
0xff
)
!=
pcard
->
current
.
position
)
{
pos_adjust
.
insert
(
pcard
);
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