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
7f4e9653
Commit
7f4e9653
authored
Sep 29, 2016
by
salix5
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove_counter(), select_counter()
Now a player can remove 2^16-1=65535 counters in both ways.
parent
93c62a6e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
42 deletions
+41
-42
field.h
field.h
+1
-1
libcard.cpp
libcard.cpp
+1
-1
operations.cpp
operations.cpp
+4
-26
playerop.cpp
playerop.cpp
+33
-12
processor.cpp
processor.cpp
+2
-2
No files found.
field.h
View file @
7f4e9653
...
...
@@ -536,7 +536,7 @@ public:
int32
select_place
(
uint16
step
,
uint8
playerid
,
uint32
flag
,
uint8
count
);
int32
select_position
(
uint16
step
,
uint8
playerid
,
uint32
code
,
uint8
positions
);
int32
select_tribute
(
uint16
step
,
uint8
playerid
,
uint8
cancelable
,
uint8
min
,
uint8
max
);
int32
select_counter
(
uint16
step
,
uint8
playerid
,
uint16
countertype
,
uint16
count
);
int32
select_counter
(
uint16
step
,
uint8
playerid
,
uint16
countertype
,
uint16
count
,
uint8
s
,
uint8
o
);
int32
select_with_sum_limit
(
int16
step
,
uint8
playerid
,
int32
acc
,
int32
min
,
int
max
);
int32
sort_card
(
int16
step
,
uint8
playerid
,
uint8
is_chain
);
int32
announce_race
(
int16
step
,
uint8
playerid
,
int32
count
,
int32
available
);
...
...
libcard.cpp
View file @
7f4e9653
...
...
@@ -1875,7 +1875,7 @@ int32 scriptlib::card_remove_counter(lua_State *L) {
uint32
count
=
lua_tointeger
(
L
,
4
);
uint32
reason
=
lua_tointeger
(
L
,
5
);
if
(
countertype
==
0
)
{
// c38834303
// c38834303
: remove all counters
for
(
auto
cmit
=
pcard
->
counters
.
begin
();
cmit
!=
pcard
->
counters
.
end
();
++
cmit
)
{
pcard
->
pduel
->
write_buffer8
(
MSG_REMOVE_COUNTER
);
pcard
->
pduel
->
write_buffer16
(
cmit
->
first
);
...
...
operations.cpp
View file @
7f4e9653
...
...
@@ -100,7 +100,7 @@ void field::change_target_param(uint8 chaincount, int32 param) {
core
.
current_chain
[
chaincount
-
1
].
target_param
=
param
;
}
void
field
::
remove_counter
(
uint32
reason
,
card
*
pcard
,
uint32
rplayer
,
uint32
s
,
uint32
o
,
uint32
countertype
,
uint32
count
)
{
add_process
(
PROCESSOR_REMOVE_COUNTER
,
0
,
NULL
,
(
group
*
)
pcard
,
(
rplayer
<<
16
)
+
(
s
<<
8
)
+
o
,
countertype
+
(
count
<<
16
)
,
reason
);
add_process
(
PROCESSOR_REMOVE_COUNTER
,
0
,
NULL
,
(
group
*
)
pcard
,
(
rplayer
<<
16
)
+
(
s
<<
8
)
+
o
,
countertype
,
count
,
reason
);
}
void
field
::
remove_overlay_card
(
uint32
reason
,
card
*
pcard
,
uint32
rplayer
,
uint32
s
,
uint32
o
,
uint16
min
,
uint16
max
)
{
add_process
(
PROCESSOR_REMOVEOL_S
,
0
,
NULL
,
(
group
*
)
pcard
,
(
rplayer
<<
16
)
+
(
s
<<
8
)
+
o
,
(
max
<<
16
)
+
min
,
reason
);
...
...
@@ -636,6 +636,8 @@ int32 field::pay_lp_cost(uint32 step, uint8 playerid, uint32 cost) {
}
// rplayer rmoves counter from pcard or the field
// s,o: binary value indicating the available side
// from pcard: Card.RemoveCounter() -> here -> card::remove_counter() -> the script should raise EVENT_REMOVE_COUNTER if necessary
// from the field: Duel.RemoveCounter() -> here -> field::select_counter() -> the system raises EVENT_REMOVE_COUNTER automatically
int32
field
::
remove_counter
(
uint16
step
,
uint32
reason
,
card
*
pcard
,
uint8
rplayer
,
uint8
s
,
uint8
o
,
uint16
countertype
,
uint16
count
)
{
switch
(
step
)
{
case
0
:
{
...
...
@@ -692,31 +694,7 @@ int32 field::remove_counter(uint16 step, uint32 reason, card* pcard, uint8 rplay
core
.
units
.
begin
()
->
step
=
3
;
return
FALSE
;
}
card
*
pcard
;
core
.
select_cards
.
clear
();
uint8
fc
=
s
;
uint8
fp
=
rplayer
;
for
(
int
p
=
0
;
p
<
2
;
++
p
)
{
if
(
fc
)
{
for
(
uint32
j
=
0
;
j
<
5
;
++
j
)
{
pcard
=
player
[
fp
].
list_mzone
[
j
];
if
(
pcard
&&
pcard
->
get_counter
(
countertype
))
{
core
.
select_cards
.
push_back
(
pcard
);
pcard
->
operation_param
=
pcard
->
get_counter
(
countertype
);
}
}
for
(
uint32
j
=
0
;
j
<
8
;
++
j
)
{
pcard
=
player
[
fp
].
list_szone
[
j
];
if
(
pcard
&&
pcard
->
get_counter
(
countertype
))
{
core
.
select_cards
.
push_back
(
pcard
);
pcard
->
operation_param
=
pcard
->
get_counter
(
countertype
);
}
}
}
fp
=
1
-
fp
;
fc
=
o
;
}
add_process
(
PROCESSOR_SELECT_COUNTER
,
0
,
0
,
0
,
rplayer
,
countertype
+
(((
uint32
)
count
)
<<
16
));
add_process
(
PROCESSOR_SELECT_COUNTER
,
0
,
NULL
,
NULL
,
rplayer
,
countertype
,
count
,
(
s
<<
8
)
+
o
);
return
FALSE
;
}
case
2
:
{
...
...
playerop.cpp
View file @
7f4e9653
...
...
@@ -494,23 +494,44 @@ int32 field::select_tribute(uint16 step, uint8 playerid, uint8 cancelable, uint8
return
TRUE
;
}
}
int32
field
::
select_counter
(
uint16
step
,
uint8
playerid
,
uint16
countertype
,
uint16
count
)
{
int32
field
::
select_counter
(
uint16
step
,
uint8
playerid
,
uint16
countertype
,
uint16
count
,
uint8
s
,
uint8
o
)
{
if
(
step
==
0
)
{
if
(
co
re
.
select_cards
.
empty
()
||
co
unt
==
0
)
if
(
count
==
0
)
return
TRUE
;
uint8
tm
=
0
;
for
(
uint32
i
=
0
;
i
<
core
.
select_cards
.
size
();
++
i
)
tm
+=
core
.
select_cards
[
i
]
->
operation_param
;
if
(
count
>
tm
)
{
count
=
tm
;
core
.
units
.
begin
()
->
arg2
=
countertype
+
(((
uint32
)
count
)
<<
16
);
card
*
pcard
;
uint8
avail
=
s
;
uint8
fp
=
playerid
;
uint32
total
=
0
;
core
.
select_cards
.
clear
();
for
(
int
p
=
0
;
p
<
2
;
++
p
)
{
if
(
avail
)
{
for
(
int
j
=
0
;
j
<
5
;
++
j
)
{
pcard
=
player
[
fp
].
list_mzone
[
j
];
if
(
pcard
&&
pcard
->
get_counter
(
countertype
))
{
core
.
select_cards
.
push_back
(
pcard
);
total
+=
pcard
->
get_counter
(
countertype
);
}
}
for
(
int
j
=
0
;
j
<
8
;
++
j
)
{
pcard
=
player
[
fp
].
list_szone
[
j
];
if
(
pcard
&&
pcard
->
get_counter
(
countertype
))
{
core
.
select_cards
.
push_back
(
pcard
);
total
+=
pcard
->
get_counter
(
countertype
);
}
}
}
fp
=
1
-
fp
;
avail
=
o
;
}
if
(
count
>
total
)
{
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
}
pduel
->
write_buffer8
(
MSG_SELECT_COUNTER
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer16
(
countertype
);
pduel
->
write_buffer
8
((
uint8
)
count
);
pduel
->
write_buffer
16
(
count
);
pduel
->
write_buffer8
(
core
.
select_cards
.
size
());
card
*
pcard
;
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
for
(
uint32
i
=
0
;
i
<
core
.
select_cards
.
size
();
++
i
)
{
pcard
=
core
.
select_cards
[
i
];
...
...
@@ -518,13 +539,13 @@ int32 field::select_counter(uint16 step, uint8 playerid, uint16 countertype, uin
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
sequence
);
pduel
->
write_buffer
8
(
pcard
->
operation_param
);
pduel
->
write_buffer
16
(
pcard
->
get_counter
(
countertype
)
);
}
return
FALSE
;
}
else
{
uint16
ct
=
0
;
for
(
uint32
i
=
0
;
i
<
core
.
select_cards
.
size
();
++
i
)
{
if
(
core
.
select_cards
[
i
]
->
operation_param
<
(
uint32
)
returns
.
bvalue
[
i
])
{
if
(
core
.
select_cards
[
i
]
->
get_counter
(
countertype
)
<
(
uint32
)
returns
.
bvalue
[
i
])
{
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
}
...
...
processor.cpp
View file @
7f4e9653
...
...
@@ -161,7 +161,7 @@ int32 field::process() {
return
pduel
->
bufferlen
;
}
case
PROCESSOR_SELECT_COUNTER
:
{
if
(
select_counter
(
it
->
step
,
it
->
arg1
,
(
it
->
arg2
)
&
0xffff
,
(
it
->
arg2
>>
16
)
&
0xff
ff
))
{
if
(
select_counter
(
it
->
step
,
it
->
arg1
,
it
->
arg2
,
it
->
arg3
,
it
->
arg4
>>
8
,
it
->
arg4
&
0x
ff
))
{
core
.
units
.
pop_front
();
return
pduel
->
bufferlen
;
}
else
{
...
...
@@ -487,7 +487,7 @@ int32 field::process() {
return
pduel
->
bufferlen
;
}
case
PROCESSOR_REMOVE_COUNTER
:
{
if
(
remove_counter
(
it
->
step
,
it
->
arg
3
,
(
card
*
)
it
->
ptarget
,
(
it
->
arg1
>>
16
)
&
0xff
,
(
it
->
arg1
>>
8
)
&
0xff
,
it
->
arg1
&
0xff
,
it
->
arg2
&
0xffff
,
it
->
arg2
>>
16
))
{
if
(
remove_counter
(
it
->
step
,
it
->
arg
4
,
(
card
*
)
it
->
ptarget
,
(
it
->
arg1
>>
16
)
&
0xff
,
(
it
->
arg1
>>
8
)
&
0xff
,
it
->
arg1
&
0xff
,
it
->
arg2
,
it
->
arg3
))
{
pduel
->
lua
->
add_param
(
returns
.
ivalue
[
0
],
PARAM_TYPE_BOOLEAN
);
core
.
units
.
pop_front
();
}
else
...
...
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