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
da0db24f
Commit
da0db24f
authored
Apr 12, 2017
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
504ff1fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
46 deletions
+75
-46
field.cpp
field.cpp
+70
-46
field.h
field.h
+5
-0
No files found.
field.cpp
View file @
da0db24f
...
@@ -551,50 +551,48 @@ int32 field::get_useable_count(card* pcard, uint8 playerid, uint8 location, uint
...
@@ -551,50 +551,48 @@ int32 field::get_useable_count(card* pcard, uint8 playerid, uint8 location, uint
else
else
return
get_useable_count
(
playerid
,
location
,
uplayer
,
reason
,
zone
,
list
);
return
get_useable_count
(
playerid
,
location
,
uplayer
,
reason
,
zone
,
list
);
}
}
int32
field
::
get_spsummonable_count
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
,
uint32
*
list
)
{
if
(
core
.
duel_rule
>=
4
&&
pcard
->
current
.
location
==
LOCATION_EXTRA
)
return
get_spsummonable_count_fromex
(
pcard
,
playerid
,
uplayer
,
zone
,
list
);
else
return
get_tofield_count
(
playerid
,
LOCATION_MZONE
,
uplayer
,
zone
,
list
);
}
int32
field
::
get_useable_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
,
uint32
*
list
)
{
int32
field
::
get_useable_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
,
uint32
*
list
)
{
int32
count
=
get_tofield_count
(
playerid
,
location
,
uplayer
,
zone
,
list
);
int32
limit
;
if
(
location
==
LOCATION_MZONE
)
limit
=
get_mzone_limit
(
playerid
,
uplayer
,
LOCATION_REASON_TOFIELD
);
else
limit
=
get_szone_limit
(
playerid
,
uplayer
,
LOCATION_REASON_TOFIELD
);
if
(
count
>
limit
)
count
=
limit
;
return
count
;
}
int32
field
::
get_tofield_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
zone
,
uint32
*
list
)
{
if
(
location
!=
LOCATION_MZONE
&&
location
!=
LOCATION_SZONE
)
if
(
location
!=
LOCATION_MZONE
&&
location
!=
LOCATION_SZONE
)
return
0
;
return
0
;
uint32
flag
=
player
[
playerid
].
disabled_location
|
player
[
playerid
].
used_location
;
uint32
flag
=
player
[
playerid
].
disabled_location
|
player
[
playerid
].
used_location
;
uint32
used_flag
=
player
[
playerid
].
used_location
;
if
(
location
==
LOCATION_MZONE
)
effect_set
eset
;
if
(
location
==
LOCATION_MZONE
)
{
flag
=
(
flag
|
~
zone
)
&
0x1f
;
flag
=
(
flag
|
~
zone
)
&
0x1f
;
used_flag
=
used_flag
&
0x1f
;
else
if
(
uplayer
<
2
)
filter_player_effect
(
playerid
,
EFFECT_MAX_MZONE
,
&
eset
);
}
else
{
flag
=
(
flag
>>
8
)
&
0x1f
;
flag
=
(
flag
>>
8
)
&
0x1f
;
used_flag
=
(
used_flag
>>
8
)
&
0x1f
;
if
(
uplayer
<
2
)
filter_player_effect
(
playerid
,
EFFECT_MAX_SZONE
,
&
eset
);
}
if
(
list
)
if
(
list
)
*
list
=
flag
;
*
list
=
flag
;
int32
count
=
5
-
field_used_count
[
flag
];
int32
count
=
5
-
field_used_count
[
flag
];
if
(
eset
.
size
())
{
return
count
;
int32
max
=
5
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
uplayer
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason
,
PARAM_TYPE_INT
);
int32
v
=
eset
[
i
]
->
get_value
(
3
);
if
(
max
>
v
)
max
=
v
;
}
int32
limit
=
max
-
field_used_count
[
used_flag
];
return
count
<
limit
?
count
:
limit
;
}
else
{
return
count
;
}
}
}
int32
field
::
get_useable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
,
uint32
*
list
)
{
int32
field
::
get_useable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
,
uint32
*
list
)
{
int32
count
=
get_spsummonable_count_fromex
(
pcard
,
playerid
,
uplayer
,
zone
,
list
);
int32
limit
=
get_mzone_limit
(
playerid
,
uplayer
,
LOCATION_REASON_TOFIELD
);
if
(
count
>
limit
)
count
=
limit
;
return
count
;
}
int32
field
::
get_spsummonable_count_fromex
(
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
;
uint32
used_flag
=
player
[
playerid
].
used_location
;
uint32
linked_zone
=
get_linked_zone
(
playerid
);
uint32
linked_zone
=
get_linked_zone
(
playerid
);
flag
=
(
flag
|
~
zone
|
~
linked_zone
)
&
0x1f
;
flag
=
(
flag
|
~
zone
|
~
linked_zone
)
&
0x1f
;
used_flag
=
used_flag
&
0x1f
;
int32
count
=
6
-
field_used_count
[
flag
];
int32
used_count
=
field_used_count
[
flag
];
int32
maxcount
=
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
)
&&
(
zone
&
(
1u
<<
6
))
&&
pcard
&&
check_extra_link
(
playerid
,
pcard
,
6
))
{
&&
(
zone
&
(
1u
<<
6
))
&&
pcard
&&
check_extra_link
(
playerid
,
pcard
,
6
))
{
flag
|=
1u
<<
5
;
flag
|=
1u
<<
5
;
...
@@ -603,32 +601,58 @@ int32 field::get_useable_count_fromex(card* pcard, uint8 playerid, uint8 uplayer
...
@@ -603,32 +601,58 @@ int32 field::get_useable_count_fromex(card* pcard, uint8 playerid, uint8 uplayer
flag
|=
1u
<<
6
;
flag
|=
1u
<<
6
;
}
else
if
(
player
[
playerid
].
list_mzone
[
5
]
||
player
[
playerid
].
list_mzone
[
6
]
||
!
(
zone
&
((
1u
<<
5
)
|
(
1u
<<
6
))))
{
}
else
if
(
player
[
playerid
].
list_mzone
[
5
]
||
player
[
playerid
].
list_mzone
[
6
]
||
!
(
zone
&
((
1u
<<
5
)
|
(
1u
<<
6
))))
{
flag
|=
(
1u
<<
5
)
|
(
1u
<<
6
);
flag
|=
(
1u
<<
5
)
|
(
1u
<<
6
);
maxcount
=
5
;
count
--
;
}
else
if
(
player
[
1
-
playerid
].
list_mzone
[
5
]
||
!
is_location_useable
(
playerid
,
LOCATION_MZONE
,
6
)
||
!
(
zone
&
(
1u
<<
6
)))
}
else
if
(
player
[
1
-
playerid
].
list_mzone
[
5
]
||
!
is_location_useable
(
playerid
,
LOCATION_MZONE
,
6
)
||
!
(
zone
&
(
1u
<<
6
)))
flag
|=
1u
<<
6
;
flag
|=
1u
<<
6
;
else
if
(
player
[
1
-
playerid
].
list_mzone
[
6
]
||
!
is_location_useable
(
playerid
,
LOCATION_MZONE
,
5
)
||
!
(
zone
&
(
1u
<<
5
)))
else
if
(
player
[
1
-
playerid
].
list_mzone
[
6
]
||
!
is_location_useable
(
playerid
,
LOCATION_MZONE
,
5
)
||
!
(
zone
&
(
1u
<<
5
)))
flag
|=
1u
<<
5
;
flag
|=
1u
<<
5
;
if
(
list
)
if
(
list
)
*
list
=
flag
;
*
list
=
flag
;
int32
count
=
maxcount
-
used_count
;
return
count
;
}
int32
field
::
get_mzone_limit
(
uint8
playerid
,
uint8
uplayer
,
uint32
reason
)
{
uint32
used_flag
=
player
[
playerid
].
used_location
;
used_flag
=
used_flag
&
0x1f
;
int32
max
=
5
;
int32
used_count
=
field_used_count
[
used_flag
];
if
(
core
.
duel_rule
>=
4
)
{
max
=
7
;
if
(
player
[
playerid
].
list_mzone
[
5
])
used_count
++
;
if
(
player
[
playerid
].
list_mzone
[
6
])
used_count
++
;
}
effect_set
eset
;
effect_set
eset
;
if
(
uplayer
<
2
)
if
(
uplayer
<
2
)
filter_player_effect
(
playerid
,
EFFECT_MAX_MZONE
,
&
eset
);
filter_player_effect
(
playerid
,
EFFECT_MAX_MZONE
,
&
eset
);
if
(
eset
.
size
())
{
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
int32
max
=
maxcount
;
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
uplayer
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
uplayer
,
PARAM_TYPE_INT
);
int32
v
=
eset
[
i
]
->
get_value
(
3
);
pduel
->
lua
->
add_param
(
LOCATION_REASON_TOFIELD
,
PARAM_TYPE_INT
);
if
(
max
>
v
)
int32
v
=
eset
[
i
]
->
get_value
(
3
);
max
=
v
;
if
(
max
>
v
)
max
=
v
;
}
int32
limit
=
max
-
field_used_count
[
used_flag
];
if
(
count
>
limit
)
count
=
limit
;
}
}
return
count
;
int32
limit
=
max
-
used_count
;
return
limit
;
}
int32
field
::
get_szone_limit
(
uint8
playerid
,
uint8
uplayer
,
uint32
reason
)
{
uint32
used_flag
=
player
[
playerid
].
used_location
;
used_flag
=
(
used_flag
>>
8
)
&
0x1f
;
effect_set
eset
;
if
(
uplayer
<
2
)
filter_player_effect
(
playerid
,
EFFECT_MAX_SZONE
,
&
eset
);
int32
max
=
5
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
uplayer
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason
,
PARAM_TYPE_INT
);
int32
v
=
eset
[
i
]
->
get_value
(
3
);
if
(
max
>
v
)
max
=
v
;
}
int32
limit
=
max
-
field_used_count
[
used_flag
];
return
limit
;
}
}
uint32
field
::
get_linked_zone
(
int32
playerid
)
{
uint32
field
::
get_linked_zone
(
int32
playerid
)
{
uint32
zones
=
0
;
uint32
zones
=
0
;
...
...
field.h
View file @
da0db24f
...
@@ -343,8 +343,13 @@ public:
...
@@ -343,8 +343,13 @@ public:
card
*
get_field_card
(
uint32
playerid
,
uint32
location
,
uint32
sequence
);
card
*
get_field_card
(
uint32
playerid
,
uint32
location
,
uint32
sequence
);
int32
is_location_useable
(
uint32
playerid
,
uint32
location
,
uint32
sequence
);
int32
is_location_useable
(
uint32
playerid
,
uint32
location
,
uint32
sequence
);
int32
get_useable_count
(
card
*
pcard
,
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_useable_count
(
card
*
pcard
,
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_spsummonable_count
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_useable_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_useable_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
reason
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_tofield_count
(
uint8
playerid
,
uint8
location
,
uint8
uplayer
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_useable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_useable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_spsummonable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
=
0xff
,
uint32
*
list
=
0
);
int32
get_mzone_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
);
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
);
...
...
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