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
5351cbe6
Commit
5351cbe6
authored
Mar 06, 2016
by
DailyShana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update AddCounter
parent
c77efc27
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
11 deletions
+30
-11
card.cpp
card.cpp
+20
-7
card.h
card.h
+2
-2
libcard.cpp
libcard.cpp
+8
-2
No files found.
card.cpp
View file @
5351cbe6
...
...
@@ -1515,8 +1515,8 @@ int32 card::destination_redirect(uint8 destination, uint32 reason) {
}
return
0
;
}
int32
card
::
add_counter
(
uint8
playerid
,
uint16
countertype
,
uint16
count
)
{
if
(
!
is_can_add_counter
(
playerid
,
countertype
,
count
))
int32
card
::
add_counter
(
uint8
playerid
,
uint16
countertype
,
uint16
count
,
uint8
singly
)
{
if
(
!
is_can_add_counter
(
playerid
,
countertype
,
count
,
singly
))
return
FALSE
;
uint16
cttype
=
countertype
;
if
((
countertype
&
COUNTER_NEED_ENABLE
)
&&
!
(
countertype
&
COUNTER_NEED_PERMIT
))
...
...
@@ -1527,16 +1527,29 @@ int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count) {
cmit
->
second
[
0
]
=
0
;
cmit
->
second
[
1
]
=
0
;
}
uint16
pcount
=
count
;
if
(
singly
)
{
effect_set
eset
;
uint16
limit
=
0
;
filter_effect
(
EFFECT_COUNTER_LIMIT
+
cttype
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
limit
=
eset
[
i
]
->
get_value
();
if
(
limit
)
{
uint16
mcount
=
limit
-
get_counter
(
cttype
);
if
(
pcount
>
mcount
)
pcount
=
mcount
;
}
}
if
(
!
(
countertype
&
COUNTER_NEED_ENABLE
))
cmit
->
second
[
0
]
+=
count
;
cmit
->
second
[
0
]
+=
p
count
;
else
cmit
->
second
[
1
]
+=
count
;
cmit
->
second
[
1
]
+=
p
count
;
pduel
->
write_buffer8
(
MSG_ADD_COUNTER
);
pduel
->
write_buffer16
(
cttype
);
pduel
->
write_buffer8
(
current
.
controler
);
pduel
->
write_buffer8
(
current
.
location
);
pduel
->
write_buffer8
(
current
.
sequence
);
pduel
->
write_buffer16
(
count
);
pduel
->
write_buffer16
(
p
count
);
return
TRUE
;
}
int32
card
::
remove_counter
(
uint16
countertype
,
uint16
count
)
{
...
...
@@ -1561,7 +1574,7 @@ int32 card::remove_counter(uint16 countertype, uint16 count) {
pduel
->
write_buffer16
(
count
);
return
TRUE
;
}
int32
card
::
is_can_add_counter
(
uint8
playerid
,
uint16
countertype
,
uint16
count
)
{
int32
card
::
is_can_add_counter
(
uint8
playerid
,
uint16
countertype
,
uint16
count
,
uint8
singly
)
{
effect_set
eset
;
if
(
!
pduel
->
game_field
->
is_player_can_place_counter
(
playerid
,
this
,
countertype
,
count
))
return
FALSE
;
...
...
@@ -1582,7 +1595,7 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count)
filter_effect
(
EFFECT_COUNTER_LIMIT
+
cttype
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
limit
=
eset
[
i
]
->
get_value
();
if
(
limit
>
0
&&
(
cur
+
count
>
limit
))
if
(
limit
>
0
&&
(
cur
+
(
singly
?
1
:
count
)
>
limit
))
return
FALSE
;
return
TRUE
;
}
...
...
card.h
View file @
5351cbe6
...
...
@@ -211,9 +211,9 @@ public:
void
release_relation
(
effect
*
peffect
);
int32
leave_field_redirect
(
uint32
reason
);
int32
destination_redirect
(
uint8
destination
,
uint32
reason
);
int32
add_counter
(
uint8
playerid
,
uint16
countertype
,
uint16
count
);
int32
add_counter
(
uint8
playerid
,
uint16
countertype
,
uint16
count
,
uint8
singly
);
int32
remove_counter
(
uint16
countertype
,
uint16
count
);
int32
is_can_add_counter
(
uint8
playerid
,
uint16
countertype
,
uint16
count
);
int32
is_can_add_counter
(
uint8
playerid
,
uint16
countertype
,
uint16
count
,
uint8
singly
);
int32
get_counter
(
uint16
countertype
);
void
set_material
(
card_set
*
materials
);
void
add_card_target
(
card
*
pcard
);
...
...
libcard.cpp
View file @
5351cbe6
...
...
@@ -1840,8 +1840,11 @@ int32 scriptlib::card_add_counter(lua_State *L) {
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
countertype
=
lua_tointeger
(
L
,
2
);
uint32
count
=
lua_tointeger
(
L
,
3
);
uint8
singly
=
FALSE
;
if
(
lua_gettop
(
L
)
>
3
)
singly
=
lua_toboolean
(
L
,
4
);
if
(
pcard
->
is_affect_by_effect
(
pcard
->
pduel
->
game_field
->
core
.
reason_effect
))
lua_pushboolean
(
L
,
pcard
->
add_counter
(
pcard
->
pduel
->
game_field
->
core
.
reason_player
,
countertype
,
count
));
lua_pushboolean
(
L
,
pcard
->
add_counter
(
pcard
->
pduel
->
game_field
->
core
.
reason_player
,
countertype
,
count
,
singly
));
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
...
...
@@ -1927,7 +1930,10 @@ int32 scriptlib::card_is_can_add_counter(lua_State *L) {
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
countertype
=
lua_tointeger
(
L
,
2
);
uint32
count
=
lua_tointeger
(
L
,
3
);
lua_pushboolean
(
L
,
pcard
->
is_can_add_counter
(
pcard
->
pduel
->
game_field
->
core
.
reason_player
,
countertype
,
count
));
uint8
singly
=
FALSE
;
if
(
lua_gettop
(
L
)
>
3
)
singly
=
lua_toboolean
(
L
,
4
);
lua_pushboolean
(
L
,
pcard
->
is_can_add_counter
(
pcard
->
pduel
->
game_field
->
core
.
reason_player
,
countertype
,
count
,
singly
));
return
1
;
}
int32
scriptlib
::
card_is_can_remove_counter
(
lua_State
*
L
)
{
...
...
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