Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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
fallenstardust
YGOMobile-Cn-Ko-En
Commits
e0395b91
Commit
e0395b91
authored
Jan 05, 2020
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
3d6b8f35
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
109 additions
and
84 deletions
+109
-84
Classes/ocgcore/field.cpp
Classes/ocgcore/field.cpp
+55
-59
Classes/ocgcore/field.h
Classes/ocgcore/field.h
+2
-0
Classes/ocgcore/libduel.cpp
Classes/ocgcore/libduel.cpp
+20
-3
Classes/ocgcore/operations.cpp
Classes/ocgcore/operations.cpp
+28
-22
Classes/ocgcore/processor.cpp
Classes/ocgcore/processor.cpp
+4
-0
No files found.
Classes/ocgcore/field.cpp
View file @
e0395b91
...
@@ -632,28 +632,7 @@ int32 field::get_tofield_count(card* pcard, uint8 playerid, uint8 location, uint
...
@@ -632,28 +632,7 @@ int32 field::get_tofield_count(card* pcard, uint8 playerid, uint8 location, uint
return
0
;
return
0
;
uint32
flag
=
player
[
playerid
].
disabled_location
|
player
[
playerid
].
used_location
;
uint32
flag
=
player
[
playerid
].
disabled_location
|
player
[
playerid
].
used_location
;
if
(
location
==
LOCATION_MZONE
&&
(
reason
&
LOCATION_REASON_TOFIELD
))
{
if
(
location
==
LOCATION_MZONE
&&
(
reason
&
LOCATION_REASON_TOFIELD
))
{
effect_set
eset
;
filter_must_use_mzone
(
playerid
,
uplayer
,
reason
,
pcard
,
&
flag
);
if
(
uplayer
<
2
)
filter_player_effect
(
uplayer
,
EFFECT_MUST_USE_MZONE
,
&
eset
);
if
(
pcard
)
pcard
->
filter_effect
(
EFFECT_MUST_USE_MZONE
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
&&
eset
[
i
]
->
count_limit
==
0
)
continue
;
uint32
value
=
0x1f
;
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_PLAYER_TARGET
))
value
=
eset
[
i
]
->
get_value
();
else
{
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
uplayer
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason
,
PARAM_TYPE_INT
);
value
=
eset
[
i
]
->
get_value
(
pcard
,
3
);
}
if
(
eset
[
i
]
->
get_handler_player
()
==
playerid
)
flag
|=
~
value
&
0x1f
;
else
flag
|=
~
(
value
>>
16
)
&
0x1f
;
}
}
}
if
(
location
==
LOCATION_MZONE
)
if
(
location
==
LOCATION_MZONE
)
flag
=
(
flag
|
~
zone
)
&
0x1f
;
flag
=
(
flag
|
~
zone
)
&
0x1f
;
...
@@ -675,29 +654,7 @@ int32 field::get_useable_count_fromex_rule4(card* pcard, uint8 playerid, uint8 u
...
@@ -675,29 +654,7 @@ int32 field::get_useable_count_fromex_rule4(card* pcard, uint8 playerid, uint8 u
}
}
int32
field
::
get_spsummonable_count_fromex_rule4
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
,
uint32
*
list
)
{
int32
field
::
get_spsummonable_count_fromex_rule4
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
,
uint32
*
list
)
{
uint32
flag
=
player
[
playerid
].
disabled_location
|
player
[
playerid
].
used_location
;
uint32
flag
=
player
[
playerid
].
disabled_location
|
player
[
playerid
].
used_location
;
effect_set
eset
;
filter_must_use_mzone
(
playerid
,
uplayer
,
LOCATION_REASON_TOFIELD
,
pcard
,
&
flag
);
if
(
uplayer
<
2
)
filter_player_effect
(
uplayer
,
EFFECT_MUST_USE_MZONE
,
&
eset
);
if
(
pcard
)
pcard
->
filter_effect
(
EFFECT_MUST_USE_MZONE
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
&&
eset
[
i
]
->
count_limit
==
0
)
continue
;
uint32
value
=
0x1f
;
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_PLAYER_TARGET
))
value
=
eset
[
i
]
->
get_value
();
else
{
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
uplayer
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
LOCATION_REASON_TOFIELD
,
PARAM_TYPE_INT
);
value
=
eset
[
i
]
->
get_value
(
pcard
,
3
);
}
if
(
eset
[
i
]
->
get_handler_player
()
==
playerid
)
flag
|=
~
value
&
0x7f
;
else
flag
|=
~
(
value
>>
16
)
&
0x7f
;
}
uint32
linked_zone
=
get_linked_zone
(
playerid
)
|
(
1u
<<
5
)
|
(
1u
<<
6
);
if
(
player
[
playerid
].
list_mzone
[
5
]
&&
is_location_useable
(
playerid
,
LOCATION_MZONE
,
6
)
if
(
player
[
playerid
].
list_mzone
[
5
]
&&
is_location_useable
(
playerid
,
LOCATION_MZONE
,
6
)
&&
check_extra_link
(
playerid
,
pcard
,
6
))
{
&&
check_extra_link
(
playerid
,
pcard
,
6
))
{
flag
|=
1u
<<
5
;
flag
|=
1u
<<
5
;
...
@@ -712,7 +669,8 @@ int32 field::get_spsummonable_count_fromex_rule4(card* pcard, uint8 playerid, ui
...
@@ -712,7 +669,8 @@ int32 field::get_spsummonable_count_fromex_rule4(card* pcard, uint8 playerid, ui
if
(
!
is_location_useable
(
playerid
,
LOCATION_MZONE
,
6
))
if
(
!
is_location_useable
(
playerid
,
LOCATION_MZONE
,
6
))
flag
|=
1u
<<
6
;
flag
|=
1u
<<
6
;
}
}
flag
=
flag
|
~
zone
|
~
linked_zone
;
uint32
rule_zone
=
get_rule_zone_fromex
(
playerid
,
pcard
);
flag
=
flag
|
~
zone
|
~
rule_zone
;
if
(
list
)
if
(
list
)
*
list
=
flag
&
0x7f
;
*
list
=
flag
&
0x7f
;
int32
count
=
5
-
field_used_count
[
flag
&
0x1f
];
int32
count
=
5
-
field_used_count
[
flag
&
0x1f
];
...
@@ -776,6 +734,40 @@ uint32 field::get_linked_zone(int32 playerid) {
...
@@ -776,6 +734,40 @@ uint32 field::get_linked_zone(int32 playerid) {
}
}
return
zones
;
return
zones
;
}
}
uint32
field
::
get_rule_zone_fromex
(
int32
playerid
,
card
*
pcard
)
{
if
(
core
.
duel_rule
>=
4
)
{
if
(
core
.
duel_rule
>=
5
&&
pcard
&&
pcard
->
is_position
(
POS_FACEDOWN
)
&&
(
pcard
->
data
.
type
&
(
TYPE_FUSION
|
TYPE_SYNCHRO
|
TYPE_XYZ
)))
return
0x7f
;
else
return
get_linked_zone
(
playerid
)
|
(
1u
<<
5
)
|
(
1u
<<
6
);
}
else
{
return
0x1f
;
}
}
void
field
::
filter_must_use_mzone
(
uint8
playerid
,
uint8
uplayer
,
uint32
reason
,
card
*
pcard
,
uint32
*
flag
)
{
effect_set
eset
;
if
(
uplayer
<
2
)
filter_player_effect
(
uplayer
,
EFFECT_MUST_USE_MZONE
,
&
eset
);
if
(
pcard
)
pcard
->
filter_effect
(
EFFECT_MUST_USE_MZONE
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_COUNT_LIMIT
)
&&
eset
[
i
]
->
count_limit
==
0
)
continue
;
uint32
value
=
0x1f
;
if
(
eset
[
i
]
->
is_flag
(
EFFECT_FLAG_PLAYER_TARGET
))
value
=
eset
[
i
]
->
get_value
();
else
{
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
uplayer
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason
,
PARAM_TYPE_INT
);
value
=
eset
[
i
]
->
get_value
(
pcard
,
3
);
}
if
(
eset
[
i
]
->
get_handler_player
()
==
playerid
)
*
flag
|=
~
value
&
0x7f
;
else
*
flag
|=
~
(
value
>>
16
)
&
0x7f
;
}
}
void
field
::
get_linked_cards
(
uint8
self
,
uint8
s
,
uint8
o
,
card_set
*
cset
)
{
void
field
::
get_linked_cards
(
uint8
self
,
uint8
s
,
uint8
o
,
card_set
*
cset
)
{
cset
->
clear
();
cset
->
clear
();
uint8
c
=
s
;
uint8
c
=
s
;
...
@@ -2396,11 +2388,13 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
...
@@ -2396,11 +2388,13 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
}
}
int32
playerid
=
pcard
->
current
.
controler
;
int32
playerid
=
pcard
->
current
.
controler
;
int32
ct
=
get_spsummonable_count
(
pcard
,
playerid
);
int32
ct
=
get_spsummonable_count
(
pcard
,
playerid
);
card_set
linked
_cards
;
card_set
handover_zone
_cards
;
if
(
ct
<=
0
)
{
if
(
ct
<=
0
)
{
uint32
linked_zone
=
core
.
duel_rule
>=
4
?
get_linked_zone
(
playerid
)
|
(
1u
<<
5
)
|
(
1u
<<
6
)
:
0x1f
;
uint32
must_use_zone_flag
=
0
;
get_cards_in_zone
(
&
linked_cards
,
linked_zone
,
playerid
,
LOCATION_MZONE
);
filter_must_use_mzone
(
playerid
,
playerid
,
LOCATION_REASON_TOFIELD
,
pcard
,
&
must_use_zone_flag
);
if
(
linked_cards
.
find
(
tuner
)
!=
linked_cards
.
end
())
uint32
handover_zone
=
get_rule_zone_fromex
(
playerid
,
pcard
)
&
~
must_use_zone_flag
;
get_cards_in_zone
(
&
handover_zone_cards
,
handover_zone
,
playerid
,
LOCATION_MZONE
);
if
(
handover_zone_cards
.
find
(
tuner
)
!=
handover_zone_cards
.
end
())
ct
++
;
ct
++
;
}
}
int32
location
=
LOCATION_MZONE
;
int32
location
=
LOCATION_MZONE
;
...
@@ -2457,7 +2451,7 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
...
@@ -2457,7 +2451,7 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
smat
->
sum_param
=
smat
->
get_synchro_level
(
pcard
);
smat
->
sum_param
=
smat
->
get_synchro_level
(
pcard
);
mcount
++
;
mcount
++
;
if
(
ct
<=
0
)
{
if
(
ct
<=
0
)
{
if
(
linked_cards
.
find
(
smat
)
!=
linked
_cards
.
end
())
if
(
handover_zone_cards
.
find
(
smat
)
!=
handover_zone
_cards
.
end
())
ct
++
;
ct
++
;
}
}
if
(
min
==
0
)
{
if
(
min
==
0
)
{
...
@@ -2525,7 +2519,7 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
...
@@ -2525,7 +2519,7 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
auto
start
=
nsyn
.
begin
()
+
mcount
;
auto
start
=
nsyn
.
begin
()
+
mcount
;
for
(
auto
cit
=
start
;
cit
!=
nsyn
.
end
();
++
cit
)
{
for
(
auto
cit
=
start
;
cit
!=
nsyn
.
end
();
++
cit
)
{
card
*
pm
=
*
cit
;
card
*
pm
=
*
cit
;
if
(
linked_cards
.
find
(
pm
)
==
linked
_cards
.
end
())
if
(
handover_zone_cards
.
find
(
pm
)
==
handover_zone
_cards
.
end
())
continue
;
continue
;
if
(
start
!=
cit
)
if
(
start
!=
cit
)
std
::
iter_swap
(
start
,
cit
);
std
::
iter_swap
(
start
,
cit
);
...
@@ -2691,14 +2685,16 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
...
@@ -2691,14 +2685,16 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
get_xyz_material
(
scard
,
findex
,
lv
,
max
,
mg
);
get_xyz_material
(
scard
,
findex
,
lv
,
max
,
mg
);
int32
playerid
=
scard
->
current
.
controler
;
int32
playerid
=
scard
->
current
.
controler
;
int32
ct
=
get_spsummonable_count
(
scard
,
playerid
);
int32
ct
=
get_spsummonable_count
(
scard
,
playerid
);
card_set
linked
_cards
;
card_set
handover_zone
_cards
;
if
(
ct
<=
0
)
{
if
(
ct
<=
0
)
{
int32
ft
=
ct
;
int32
ft
=
ct
;
uint32
linked_zone
=
core
.
duel_rule
>=
4
?
get_linked_zone
(
playerid
)
|
(
1u
<<
5
)
|
(
1u
<<
6
)
:
0x1f
;
uint32
must_use_zone_flag
=
0
;
get_cards_in_zone
(
&
linked_cards
,
linked_zone
,
playerid
,
LOCATION_MZONE
);
filter_must_use_mzone
(
playerid
,
playerid
,
LOCATION_REASON_TOFIELD
,
scard
,
&
must_use_zone_flag
);
uint32
handover_zone
=
get_rule_zone_fromex
(
playerid
,
scard
)
&
~
must_use_zone_flag
;
get_cards_in_zone
(
&
handover_zone_cards
,
handover_zone
,
playerid
,
LOCATION_MZONE
);
for
(
auto
cit
=
core
.
xmaterial_lst
.
begin
();
cit
!=
core
.
xmaterial_lst
.
end
();
++
cit
)
{
for
(
auto
cit
=
core
.
xmaterial_lst
.
begin
();
cit
!=
core
.
xmaterial_lst
.
end
();
++
cit
)
{
card
*
pcard
=
cit
->
second
;
card
*
pcard
=
cit
->
second
;
if
(
linked_cards
.
find
(
pcard
)
!=
linked
_cards
.
end
())
if
(
handover_zone_cards
.
find
(
pcard
)
!=
handover_zone
_cards
.
end
())
ft
++
;
ft
++
;
}
}
if
(
ft
<=
0
)
if
(
ft
<=
0
)
...
@@ -2712,7 +2708,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
...
@@ -2712,7 +2708,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
int32
mct
=
mcset
.
size
();
int32
mct
=
mcset
.
size
();
if
(
mct
>
0
)
{
if
(
mct
>
0
)
{
if
(
ct
==
0
&&
std
::
none_of
(
mcset
.
begin
(),
mcset
.
end
(),
if
(
ct
==
0
&&
std
::
none_of
(
mcset
.
begin
(),
mcset
.
end
(),
[
=
](
card
*
pcard
)
{
return
linked_cards
.
find
(
pcard
)
!=
linked
_cards
.
end
();
}))
[
=
](
card
*
pcard
)
{
return
handover_zone_cards
.
find
(
pcard
)
!=
handover_zone
_cards
.
end
();
}))
mct
++
;
mct
++
;
if
(
mct
>
max
)
if
(
mct
>
max
)
return
FALSE
;
return
FALSE
;
...
@@ -2767,7 +2763,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
...
@@ -2767,7 +2763,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
++
cit
;
++
cit
;
}
}
ct
+=
std
::
count_if
(
mcset
.
begin
(),
mcset
.
end
(),
ct
+=
std
::
count_if
(
mcset
.
begin
(),
mcset
.
end
(),
[
=
](
card
*
pcard
)
{
return
linked_cards
.
find
(
pcard
)
!=
linked
_cards
.
end
();
});
[
=
](
card
*
pcard
)
{
return
handover_zone_cards
.
find
(
pcard
)
!=
handover_zone
_cards
.
end
();
});
std
::
multimap
<
int32
,
card
*
,
std
::
greater
<
int32
>>
mat
;
std
::
multimap
<
int32
,
card
*
,
std
::
greater
<
int32
>>
mat
;
for
(
int32
icheck
=
1
;
icheck
<=
digit
;
icheck
<<=
1
)
{
for
(
int32
icheck
=
1
;
icheck
<=
digit
;
icheck
<<=
1
)
{
mat
.
clear
();
mat
.
clear
();
...
@@ -2784,7 +2780,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
...
@@ -2784,7 +2780,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
int32
ft
=
ct
;
int32
ft
=
ct
;
for
(
auto
cit
=
mat
.
begin
();
cit
!=
mat
.
end
();
++
cit
)
{
for
(
auto
cit
=
mat
.
begin
();
cit
!=
mat
.
end
();
++
cit
)
{
card
*
pcard
=
cit
->
second
;
card
*
pcard
=
cit
->
second
;
if
(
linked_cards
.
find
(
pcard
)
!=
linked
_cards
.
end
())
if
(
handover_zone_cards
.
find
(
pcard
)
!=
handover_zone
_cards
.
end
())
ft
++
;
ft
++
;
}
}
if
(
ft
<=
0
)
if
(
ft
<=
0
)
...
...
Classes/ocgcore/field.h
View file @
e0395b91
...
@@ -378,6 +378,8 @@ public:
...
@@ -378,6 +378,8 @@ public:
int32
get_mzone_limit
(
uint8
playerid
,
uint8
uplayer
,
uint32
reason
);
int32
get_mzone_limit
(
uint8
playerid
,
uint8
uplayer
,
uint32
reason
);
int32
get_szone_limit
(
uint8
playerid
,
uint8
uplayer
,
uint32
reason
);
int32
get_szone_limit
(
uint8
playerid
,
uint8
uplayer
,
uint32
reason
);
uint32
get_linked_zone
(
int32
playerid
);
uint32
get_linked_zone
(
int32
playerid
);
uint32
get_rule_zone_fromex
(
int32
playerid
,
card
*
pcard
);
void
filter_must_use_mzone
(
uint8
playerid
,
uint8
uplayer
,
uint32
reason
,
card
*
pcard
,
uint32
*
flag
);
void
get_linked_cards
(
uint8
self
,
uint8
s
,
uint8
o
,
card_set
*
cset
);
void
get_linked_cards
(
uint8
self
,
uint8
s
,
uint8
o
,
card_set
*
cset
);
int32
check_extra_link
(
int32
playerid
);
int32
check_extra_link
(
int32
playerid
);
int32
check_extra_link
(
int32
playerid
,
card
*
pcard
,
int32
sequence
);
int32
check_extra_link
(
int32
playerid
,
card
*
pcard
,
int32
sequence
);
...
...
Classes/ocgcore/libduel.cpp
View file @
e0395b91
...
@@ -1899,10 +1899,22 @@ int32 scriptlib::duel_get_location_count_fromex(lua_State *L) {
...
@@ -1899,10 +1899,22 @@ int32 scriptlib::duel_get_location_count_fromex(lua_State *L) {
}
}
swapped
=
true
;
swapped
=
true
;
}
}
bool
use_temp_card
=
false
;
card
*
scard
=
0
;
card
*
scard
=
0
;
if
(
lua_gettop
(
L
)
>=
4
)
{
if
(
lua_gettop
(
L
)
>=
4
&&
!
lua_isnil
(
L
,
4
))
{
check_param
(
L
,
PARAM_TYPE_CARD
,
4
);
if
(
check_param
(
L
,
PARAM_TYPE_CARD
,
4
,
TRUE
))
{
scard
=
*
(
card
**
)
lua_touserdata
(
L
,
4
);
scard
=
*
(
card
**
)
lua_touserdata
(
L
,
4
);
}
else
{
use_temp_card
=
true
;
uint32
type
=
lua_tointeger
(
L
,
4
);
scard
=
pduel
->
game_field
->
temp_card
;
scard
->
current
.
location
=
LOCATION_EXTRA
;
scard
->
data
.
type
=
TYPE_MONSTER
|
type
;
if
(
type
&
TYPE_PENDULUM
)
scard
->
current
.
position
=
POS_FACEUP_DEFENSE
;
else
scard
->
current
.
position
=
POS_FACEDOWN_DEFENSE
;
}
}
}
uint32
zone
=
0xff
;
uint32
zone
=
0xff
;
if
(
lua_gettop
(
L
)
>=
5
)
if
(
lua_gettop
(
L
)
>=
5
)
...
@@ -1916,6 +1928,11 @@ int32 scriptlib::duel_get_location_count_fromex(lua_State *L) {
...
@@ -1916,6 +1928,11 @@ int32 scriptlib::duel_get_location_count_fromex(lua_State *L) {
pduel
->
game_field
->
player
[
0
].
list_mzone
.
swap
(
list_mzone
[
0
]);
pduel
->
game_field
->
player
[
0
].
list_mzone
.
swap
(
list_mzone
[
0
]);
pduel
->
game_field
->
player
[
1
].
list_mzone
.
swap
(
list_mzone
[
1
]);
pduel
->
game_field
->
player
[
1
].
list_mzone
.
swap
(
list_mzone
[
1
]);
}
}
if
(
use_temp_card
)
{
scard
->
current
.
location
=
0
;
scard
->
data
.
type
=
0
;
scard
->
current
.
position
=
0
;
}
return
2
;
return
2
;
}
}
int32
scriptlib
::
duel_get_usable_mzone_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_usable_mzone_count
(
lua_State
*
L
)
{
...
...
Classes/ocgcore/operations.cpp
View file @
e0395b91
...
@@ -189,8 +189,6 @@ void field::special_summon_step(card* target, uint32 sumtype, uint32 sumplayer,
...
@@ -189,8 +189,6 @@ void field::special_summon_step(card* target, uint32 sumtype, uint32 sumplayer,
add_process
(
PROCESSOR_SPSUMMON_STEP
,
0
,
core
.
reason_effect
,
NULL
,
zone
,
0
,
0
,
0
,
target
);
add_process
(
PROCESSOR_SPSUMMON_STEP
,
0
,
core
.
reason_effect
,
NULL
,
zone
,
0
,
0
,
0
,
target
);
}
}
void
field
::
special_summon_complete
(
effect
*
reason_effect
,
uint8
reason_player
)
{
void
field
::
special_summon_complete
(
effect
*
reason_effect
,
uint8
reason_player
)
{
if
(
core
.
special_summoning
.
size
()
==
0
)
return
;
group
*
ng
=
pduel
->
new_group
();
group
*
ng
=
pduel
->
new_group
();
ng
->
container
.
swap
(
core
.
special_summoning
);
ng
->
container
.
swap
(
core
.
special_summoning
);
ng
->
is_readonly
=
TRUE
;
ng
->
is_readonly
=
TRUE
;
...
@@ -5181,12 +5179,14 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in
...
@@ -5181,12 +5179,14 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in
core
.
units
.
begin
()
->
step
=
6
;
core
.
units
.
begin
()
->
step
=
6
;
return
FALSE
;
return
FALSE
;
}
}
card_set
linked_cards
;
card_set
handover_zone_cards
;
uint32
linked_zone
=
core
.
duel_rule
>=
4
?
get_linked_zone
(
playerid
)
|
(
1u
<<
5
)
|
(
1u
<<
6
)
:
0x1f
;
uint32
must_use_zone_flag
=
0
;
get_cards_in_zone
(
&
linked_cards
,
linked_zone
,
playerid
,
LOCATION_MZONE
);
filter_must_use_mzone
(
playerid
,
playerid
,
LOCATION_REASON_TOFIELD
,
pcard
,
&
must_use_zone_flag
);
if
(
linked_cards
.
find
(
tuner
)
!=
linked_cards
.
end
())
uint32
handover_zone
=
get_rule_zone_fromex
(
playerid
,
pcard
)
&
~
must_use_zone_flag
;
get_cards_in_zone
(
&
handover_zone_cards
,
handover_zone
,
playerid
,
LOCATION_MZONE
);
if
(
handover_zone_cards
.
find
(
tuner
)
!=
handover_zone_cards
.
end
())
ct
++
;
ct
++
;
if
(
smat
&&
linked_cards
.
find
(
smat
)
!=
linked
_cards
.
end
())
if
(
smat
&&
handover_zone_cards
.
find
(
smat
)
!=
handover_zone
_cards
.
end
())
ct
++
;
ct
++
;
if
(
ct
>
0
)
{
if
(
ct
>
0
)
{
core
.
units
.
begin
()
->
step
=
6
;
core
.
units
.
begin
()
->
step
=
6
;
...
@@ -5194,7 +5194,7 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in
...
@@ -5194,7 +5194,7 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in
}
}
card_vector
*
select_cards
=
new
card_vector
;
card_vector
*
select_cards
=
new
card_vector
;
for
(
auto
&
pm
:
core
.
select_cards
)
{
for
(
auto
&
pm
:
core
.
select_cards
)
{
if
(
linked_cards
.
find
(
pm
)
!=
linked
_cards
.
end
())
if
(
handover_zone_cards
.
find
(
pm
)
!=
handover_zone
_cards
.
end
())
select_cards
->
push_back
(
pm
);
select_cards
->
push_back
(
pm
);
}
}
if
(
select_cards
->
size
()
==
core
.
select_cards
.
size
())
{
if
(
select_cards
->
size
()
==
core
.
select_cards
.
size
())
{
...
@@ -5408,10 +5408,12 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
...
@@ -5408,10 +5408,12 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
if
(
!
(
core
.
global_flag
&
GLOBALFLAG_TUNE_MAGICIAN
))
if
(
!
(
core
.
global_flag
&
GLOBALFLAG_TUNE_MAGICIAN
))
return
FALSE
;
return
FALSE
;
int32
ct
=
get_spsummonable_count
(
scard
,
playerid
);
int32
ct
=
get_spsummonable_count
(
scard
,
playerid
);
card_set
linked
_cards
;
card_set
handover_zone
_cards
;
if
(
ct
<=
0
)
{
if
(
ct
<=
0
)
{
uint32
linked_zone
=
core
.
duel_rule
>=
4
?
get_linked_zone
(
playerid
)
|
(
1u
<<
5
)
|
(
1u
<<
6
)
:
0x1f
;
uint32
must_use_zone_flag
=
0
;
get_cards_in_zone
(
&
linked_cards
,
linked_zone
,
playerid
,
LOCATION_MZONE
);
filter_must_use_mzone
(
playerid
,
playerid
,
LOCATION_REASON_TOFIELD
,
scard
,
&
must_use_zone_flag
);
uint32
handover_zone
=
get_rule_zone_fromex
(
playerid
,
scard
)
&
~
must_use_zone_flag
;
get_cards_in_zone
(
&
handover_zone_cards
,
handover_zone
,
playerid
,
LOCATION_MZONE
);
}
}
for
(
auto
&
pcard
:
core
.
operated_set
)
{
for
(
auto
&
pcard
:
core
.
operated_set
)
{
effect
*
peffect
=
pcard
->
is_affected_by_effect
(
EFFECT_TUNE_MAGICIAN_X
);
effect
*
peffect
=
pcard
->
is_affected_by_effect
(
EFFECT_TUNE_MAGICIAN_X
);
...
@@ -5463,7 +5465,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
...
@@ -5463,7 +5465,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
int32
ft
=
ct
;
int32
ft
=
ct
;
for
(
auto
cit
=
mat
.
begin
();
cit
!=
mat
.
end
();
++
cit
)
{
for
(
auto
cit
=
mat
.
begin
();
cit
!=
mat
.
end
();
++
cit
)
{
card
*
pcard
=
cit
->
second
;
card
*
pcard
=
cit
->
second
;
if
(
linked_cards
.
find
(
pcard
)
!=
linked
_cards
.
end
())
if
(
handover_zone_cards
.
find
(
pcard
)
!=
handover_zone
_cards
.
end
())
ft
++
;
ft
++
;
}
}
if
(
ft
<=
0
)
if
(
ft
<=
0
)
...
@@ -5494,11 +5496,13 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
...
@@ -5494,11 +5496,13 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
core
.
units
.
begin
()
->
step
=
4
;
core
.
units
.
begin
()
->
step
=
4
;
return
FALSE
;
return
FALSE
;
}
}
card_set
linked_cards
;
card_set
handover_zone_cards
;
uint32
linked_zone
=
core
.
duel_rule
>=
4
?
get_linked_zone
(
playerid
)
|
(
1u
<<
5
)
|
(
1u
<<
6
)
:
0x1f
;
uint32
must_use_zone_flag
=
0
;
get_cards_in_zone
(
&
linked_cards
,
linked_zone
,
playerid
,
LOCATION_MZONE
);
filter_must_use_mzone
(
playerid
,
playerid
,
LOCATION_REASON_TOFIELD
,
scard
,
&
must_use_zone_flag
);
uint32
handover_zone
=
get_rule_zone_fromex
(
playerid
,
scard
)
&
~
must_use_zone_flag
;
get_cards_in_zone
(
&
handover_zone_cards
,
handover_zone
,
playerid
,
LOCATION_MZONE
);
int32
ft
=
ct
+
std
::
count_if
(
core
.
operated_set
.
begin
(),
core
.
operated_set
.
end
(),
int32
ft
=
ct
+
std
::
count_if
(
core
.
operated_set
.
begin
(),
core
.
operated_set
.
end
(),
[
=
](
card
*
pcard
)
{
return
linked_cards
.
find
(
pcard
)
!=
linked
_cards
.
end
();
});
[
=
](
card
*
pcard
)
{
return
handover_zone_cards
.
find
(
pcard
)
!=
handover_zone
_cards
.
end
();
});
if
(
ft
>
0
)
{
if
(
ft
>
0
)
{
returns
.
ivalue
[
0
]
=
1
;
returns
.
ivalue
[
0
]
=
1
;
core
.
units
.
begin
()
->
step
=
4
;
core
.
units
.
begin
()
->
step
=
4
;
...
@@ -5508,7 +5512,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
...
@@ -5508,7 +5512,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
core
.
select_cards
.
clear
();
core
.
select_cards
.
clear
();
for
(
auto
iter
=
core
.
xmaterial_lst
.
begin
();
iter
!=
core
.
xmaterial_lst
.
end
();
++
iter
)
{
for
(
auto
iter
=
core
.
xmaterial_lst
.
begin
();
iter
!=
core
.
xmaterial_lst
.
end
();
++
iter
)
{
card
*
pcard
=
iter
->
second
;
card
*
pcard
=
iter
->
second
;
if
(
linked_cards
.
find
(
pcard
)
!=
linked
_cards
.
end
())
if
(
handover_zone_cards
.
find
(
pcard
)
!=
handover_zone
_cards
.
end
())
core
.
select_cards
.
push_back
(
pcard
);
core
.
select_cards
.
push_back
(
pcard
);
else
else
mmax
++
;
mmax
++
;
...
@@ -5677,17 +5681,19 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
...
@@ -5677,17 +5681,19 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
int32
ct
=
get_spsummonable_count
(
scard
,
playerid
);
int32
ct
=
get_spsummonable_count
(
scard
,
playerid
);
if
(
ct
>
0
)
if
(
ct
>
0
)
return
FALSE
;
return
FALSE
;
card_set
linked_cards
;
card_set
handover_zone_cards
;
uint32
linked_zone
=
core
.
duel_rule
>=
4
?
get_linked_zone
(
playerid
)
|
(
1u
<<
5
)
|
(
1u
<<
6
)
:
0x1f
;
uint32
must_use_zone_flag
=
0
;
get_cards_in_zone
(
&
linked_cards
,
linked_zone
,
playerid
,
LOCATION_MZONE
);
filter_must_use_mzone
(
playerid
,
playerid
,
LOCATION_REASON_TOFIELD
,
scard
,
&
must_use_zone_flag
);
uint32
handover_zone
=
get_rule_zone_fromex
(
playerid
,
scard
)
&
~
must_use_zone_flag
;
get_cards_in_zone
(
&
handover_zone_cards
,
handover_zone
,
playerid
,
LOCATION_MZONE
);
int32
ft
=
ct
+
std
::
count_if
(
core
.
operated_set
.
begin
(),
core
.
operated_set
.
end
(),
int32
ft
=
ct
+
std
::
count_if
(
core
.
operated_set
.
begin
(),
core
.
operated_set
.
end
(),
[
=
](
card
*
pcard
)
{
return
linked_cards
.
find
(
pcard
)
!=
linked
_cards
.
end
();
});
[
=
](
card
*
pcard
)
{
return
handover_zone_cards
.
find
(
pcard
)
!=
handover_zone
_cards
.
end
();
});
if
(
ft
>
0
)
if
(
ft
>
0
)
return
FALSE
;
return
FALSE
;
core
.
select_cards
.
clear
();
core
.
select_cards
.
clear
();
for
(
auto
iter
=
core
.
xmaterial_lst
.
begin
();
iter
!=
core
.
xmaterial_lst
.
end
();
++
iter
)
{
for
(
auto
iter
=
core
.
xmaterial_lst
.
begin
();
iter
!=
core
.
xmaterial_lst
.
end
();
++
iter
)
{
card
*
pcard
=
iter
->
second
;
card
*
pcard
=
iter
->
second
;
if
(
linked_cards
.
find
(
pcard
)
!=
linked
_cards
.
end
())
if
(
handover_zone_cards
.
find
(
pcard
)
!=
handover_zone
_cards
.
end
())
core
.
select_cards
.
push_back
(
pcard
);
core
.
select_cards
.
push_back
(
pcard
);
}
}
pduel
->
write_buffer8
(
MSG_HINT
);
pduel
->
write_buffer8
(
MSG_HINT
);
...
...
Classes/ocgcore/processor.cpp
View file @
e0395b91
...
@@ -1783,6 +1783,8 @@ int32 field::process_instant_event() {
...
@@ -1783,6 +1783,8 @@ int32 field::process_instant_event() {
effect
*
peffect
=
eit
->
second
;
effect
*
peffect
=
eit
->
second
;
++
eit
;
++
eit
;
uint8
owner_player
=
peffect
->
get_handler_player
();
uint8
owner_player
=
peffect
->
get_handler_player
();
if
(
peffect
->
is_flag
(
EFFECT_FLAG_EVENT_PLAYER
)
&&
(
ev
.
event_player
==
0
||
ev
.
event_player
==
1
))
owner_player
=
ev
.
event_player
;
if
(
peffect
->
is_activateable
(
owner_player
,
ev
))
{
if
(
peffect
->
is_activateable
(
owner_player
,
ev
))
{
newchain
.
chain_id
=
0
;
newchain
.
chain_id
=
0
;
newchain
.
chain_count
=
0
;
newchain
.
chain_count
=
0
;
...
@@ -1941,6 +1943,8 @@ int32 field::process_single_event(effect* peffect, const tevent& e, chain_list&
...
@@ -1941,6 +1943,8 @@ int32 field::process_single_event(effect* peffect, const tevent& e, chain_list&
//continuous & trigger (single)
//continuous & trigger (single)
if
(
peffect
->
type
&
EFFECT_TYPE_CONTINUOUS
)
{
if
(
peffect
->
type
&
EFFECT_TYPE_CONTINUOUS
)
{
uint8
owner_player
=
peffect
->
get_handler_player
();
uint8
owner_player
=
peffect
->
get_handler_player
();
if
(
peffect
->
is_flag
(
EFFECT_FLAG_EVENT_PLAYER
)
&&
(
e
.
event_player
==
0
||
e
.
event_player
==
1
))
owner_player
=
e
.
event_player
;
if
(
peffect
->
is_activateable
(
owner_player
,
e
))
{
if
(
peffect
->
is_activateable
(
owner_player
,
e
))
{
chain
newchain
;
chain
newchain
;
newchain
.
chain_id
=
0
;
newchain
.
chain_id
=
0
;
...
...
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