Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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-2pick
Commits
411112ba
Commit
411112ba
authored
Nov 30, 2017
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua53
parent
f6fe0d0e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
558 additions
and
557 deletions
+558
-557
ocgcore/common.h
ocgcore/common.h
+2
-1
ocgcore/interpreter.cpp
ocgcore/interpreter.cpp
+4
-4
ocgcore/libcard.cpp
ocgcore/libcard.cpp
+130
-130
ocgcore/libdebug.cpp
ocgcore/libdebug.cpp
+16
-16
ocgcore/libduel.cpp
ocgcore/libduel.cpp
+382
-382
ocgcore/libeffect.cpp
ocgcore/libeffect.cpp
+5
-5
ocgcore/libgroup.cpp
ocgcore/libgroup.cpp
+19
-19
No files found.
ocgcore/common.h
View file @
411112ba
...
@@ -42,4 +42,5 @@ struct card_sort {
...
@@ -42,4 +42,5 @@ struct card_sort {
bool
operator
()(
void
*
const
&
c1
,
void
*
const
&
c2
)
const
;
bool
operator
()(
void
*
const
&
c1
,
void
*
const
&
c2
)
const
;
};
};
#endif
/* COMMON_H_ */
#endif
/* COMMON_H_ */
#define lua_tonumberint(L,i) (lua_Integer)(((lua_tonumberx(L, (i), NULL) > 0) ? 0.5 : -0.5) + lua_tonumberx(L, (i), NULL))
ocgcore/interpreter.cpp
View file @
411112ba
...
@@ -1010,7 +1010,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg
...
@@ -1010,7 +1010,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg
}
}
return
OPERATION_FAIL
;
return
OPERATION_FAIL
;
}
}
result
=
lua_to
integer
(
current_state
,
-
1
);
result
=
lua_to
numberint
(
current_state
,
-
1
);
lua_pop
(
current_state
,
1
);
lua_pop
(
current_state
,
1
);
no_action
--
;
no_action
--
;
call_depth
--
;
call_depth
--
;
...
@@ -1032,7 +1032,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count) {
...
@@ -1032,7 +1032,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count) {
if
(
lua_isboolean
(
current_state
,
-
1
))
if
(
lua_isboolean
(
current_state
,
-
1
))
result
=
lua_toboolean
(
current_state
,
-
1
);
result
=
lua_toboolean
(
current_state
,
-
1
);
else
else
result
=
lua_to
integer
(
current_state
,
-
1
);
result
=
lua_to
numberint
(
current_state
,
-
1
);
lua_pop
(
current_state
,
1
);
lua_pop
(
current_state
,
1
);
no_action
--
;
no_action
--
;
call_depth
--
;
call_depth
--
;
...
@@ -1066,7 +1066,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count, std::vector<i
...
@@ -1066,7 +1066,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count, std::vector<i
if
(
lua_isboolean
(
current_state
,
index
))
if
(
lua_isboolean
(
current_state
,
index
))
return_value
=
lua_toboolean
(
current_state
,
index
);
return_value
=
lua_toboolean
(
current_state
,
index
);
else
else
return_value
=
lua_to
integer
(
current_state
,
index
);
return_value
=
lua_to
numberint
(
current_state
,
index
);
result
->
push_back
(
return_value
);
result
->
push_back
(
return_value
);
}
}
lua_settop
(
current_state
,
stack_top
);
lua_settop
(
current_state
,
stack_top
);
...
@@ -1127,7 +1127,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
...
@@ -1127,7 +1127,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
if
(
result
==
0
)
{
if
(
result
==
0
)
{
coroutines
.
erase
(
f
);
coroutines
.
erase
(
f
);
if
(
yield_value
)
if
(
yield_value
)
*
yield_value
=
lua_isboolean
(
rthread
,
-
1
)
?
lua_toboolean
(
rthread
,
-
1
)
:
lua_to
integer
(
rthread
,
-
1
);
*
yield_value
=
lua_isboolean
(
rthread
,
-
1
)
?
lua_toboolean
(
rthread
,
-
1
)
:
lua_to
numberint
(
rthread
,
-
1
);
current_state
=
lua_state
;
current_state
=
lua_state
;
call_depth
--
;
call_depth
--
;
if
(
call_depth
==
0
)
{
if
(
call_depth
==
0
)
{
...
...
ocgcore/libcard.cpp
View file @
411112ba
...
@@ -99,7 +99,7 @@ int32 scriptlib::card_is_fusion_code(lua_State *L) {
...
@@ -99,7 +99,7 @@ int32 scriptlib::card_is_fusion_code(lua_State *L) {
for
(
uint32
i
=
0
;
i
<
count
;
++
i
)
{
for
(
uint32
i
=
0
;
i
<
count
;
++
i
)
{
if
(
lua_isnil
(
L
,
i
+
2
))
if
(
lua_isnil
(
L
,
i
+
2
))
continue
;
continue
;
uint32
tcode
=
lua_to
integer
(
L
,
i
+
2
);
uint32
tcode
=
lua_to
numberint
(
L
,
i
+
2
);
if
(
fcode
.
find
(
tcode
)
!=
fcode
.
end
())
{
if
(
fcode
.
find
(
tcode
)
!=
fcode
.
end
())
{
result
=
TRUE
;
result
=
TRUE
;
break
;
break
;
...
@@ -112,7 +112,7 @@ int32 scriptlib::card_is_set_card(lua_State *L) {
...
@@ -112,7 +112,7 @@ int32 scriptlib::card_is_set_card(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
set_code
=
lua_to
integer
(
L
,
2
);
uint32
set_code
=
lua_to
numberint
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
is_set_card
(
set_code
));
lua_pushboolean
(
L
,
pcard
->
is_set_card
(
set_code
));
return
1
;
return
1
;
}
}
...
@@ -120,7 +120,7 @@ int32 scriptlib::card_is_origin_set_card(lua_State *L) {
...
@@ -120,7 +120,7 @@ int32 scriptlib::card_is_origin_set_card(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
set_code
=
lua_to
integer
(
L
,
2
);
uint32
set_code
=
lua_to
numberint
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
is_origin_set_card
(
set_code
));
lua_pushboolean
(
L
,
pcard
->
is_origin_set_card
(
set_code
));
return
1
;
return
1
;
}
}
...
@@ -128,7 +128,7 @@ int32 scriptlib::card_is_pre_set_card(lua_State *L) {
...
@@ -128,7 +128,7 @@ int32 scriptlib::card_is_pre_set_card(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
set_code
=
lua_to
integer
(
L
,
2
);
uint32
set_code
=
lua_to
numberint
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
is_pre_set_card
(
set_code
));
lua_pushboolean
(
L
,
pcard
->
is_pre_set_card
(
set_code
));
return
1
;
return
1
;
}
}
...
@@ -136,7 +136,7 @@ int32 scriptlib::card_is_fusion_set_card(lua_State *L) {
...
@@ -136,7 +136,7 @@ int32 scriptlib::card_is_fusion_set_card(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
set_code
=
lua_to
integer
(
L
,
2
);
uint32
set_code
=
lua_to
numberint
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
is_fusion_set_card
(
set_code
));
lua_pushboolean
(
L
,
pcard
->
is_fusion_set_card
(
set_code
));
return
1
;
return
1
;
}
}
...
@@ -245,7 +245,7 @@ int32 scriptlib::card_is_xyz_level(lua_State *L) {
...
@@ -245,7 +245,7 @@ int32 scriptlib::card_is_xyz_level(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
xyzcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
xyzcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
uint32
lv
=
lua_to
integer
(
L
,
3
);
uint32
lv
=
lua_to
numberint
(
L
,
3
);
lua_pushboolean
(
L
,
pcard
->
check_xyz_level
(
xyzcard
,
lv
));
lua_pushboolean
(
L
,
pcard
->
check_xyz_level
(
xyzcard
,
lv
));
return
1
;
return
1
;
}
}
...
@@ -281,7 +281,7 @@ int32 scriptlib::card_is_link_marker(lua_State *L) {
...
@@ -281,7 +281,7 @@ int32 scriptlib::card_is_link_marker(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
dir
=
lua_to
integer
(
L
,
2
);
uint32
dir
=
lua_to
numberint
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
is_link_marker
(
dir
));
lua_pushboolean
(
L
,
pcard
->
is_link_marker
(
dir
));
return
1
;
return
1
;
}
}
...
@@ -311,7 +311,7 @@ int32 scriptlib::card_get_linked_zone(lua_State *L) {
...
@@ -311,7 +311,7 @@ int32 scriptlib::card_get_linked_zone(lua_State *L) {
uint32
zone
=
pcard
->
get_linked_zone
();
uint32
zone
=
pcard
->
get_linked_zone
();
int32
cp
=
pcard
->
current
.
controler
;
int32
cp
=
pcard
->
current
.
controler
;
if
(
lua_gettop
(
L
)
>=
2
&&
!
lua_isnil
(
L
,
2
))
if
(
lua_gettop
(
L
)
>=
2
&&
!
lua_isnil
(
L
,
2
))
cp
=
lua_to
integer
(
L
,
2
);
cp
=
lua_to
numberint
(
L
,
2
);
if
(
cp
==
1
-
pcard
->
current
.
controler
)
if
(
cp
==
1
-
pcard
->
current
.
controler
)
lua_pushinteger
(
L
,
(((
zone
&
0xffff
)
<<
16
)
|
(
zone
>>
16
)));
lua_pushinteger
(
L
,
(((
zone
&
0xffff
)
<<
16
)
|
(
zone
>>
16
)));
else
else
...
@@ -344,7 +344,7 @@ int32 scriptlib::card_get_mutual_linked_zone(lua_State *L) {
...
@@ -344,7 +344,7 @@ int32 scriptlib::card_get_mutual_linked_zone(lua_State *L) {
uint32
zone
=
pcard
->
get_mutual_linked_zone
();
uint32
zone
=
pcard
->
get_mutual_linked_zone
();
int32
cp
=
pcard
->
current
.
controler
;
int32
cp
=
pcard
->
current
.
controler
;
if
(
lua_gettop
(
L
)
>=
2
&&
!
lua_isnil
(
L
,
2
))
if
(
lua_gettop
(
L
)
>=
2
&&
!
lua_isnil
(
L
,
2
))
cp
=
lua_to
integer
(
L
,
2
);
cp
=
lua_to
numberint
(
L
,
2
);
if
(
cp
==
1
-
pcard
->
current
.
controler
)
if
(
cp
==
1
-
pcard
->
current
.
controler
)
lua_pushinteger
(
L
,
(((
zone
&
0xffff
)
<<
16
)
|
(
zone
>>
16
)));
lua_pushinteger
(
L
,
(((
zone
&
0xffff
)
<<
16
)
|
(
zone
>>
16
)));
else
else
...
@@ -365,9 +365,9 @@ int32 scriptlib::card_get_column_group(lua_State *L) {
...
@@ -365,9 +365,9 @@ int32 scriptlib::card_get_column_group(lua_State *L) {
int32
left
=
0
;
int32
left
=
0
;
int32
right
=
0
;
int32
right
=
0
;
if
(
lua_gettop
(
L
)
>=
2
)
if
(
lua_gettop
(
L
)
>=
2
)
left
=
lua_to
integer
(
L
,
2
);
left
=
lua_to
numberint
(
L
,
2
);
if
(
lua_gettop
(
L
)
>=
3
)
if
(
lua_gettop
(
L
)
>=
3
)
right
=
lua_to
integer
(
L
,
3
);
right
=
lua_to
numberint
(
L
,
3
);
card
::
card_set
cset
;
card
::
card_set
cset
;
pcard
->
get_column_cards
(
&
cset
,
left
,
right
);
pcard
->
get_column_cards
(
&
cset
,
left
,
right
);
group
*
pgroup
=
pcard
->
pduel
->
new_group
(
cset
);
group
*
pgroup
=
pcard
->
pduel
->
new_group
(
cset
);
...
@@ -381,9 +381,9 @@ int32 scriptlib::card_get_column_group_count(lua_State *L) {
...
@@ -381,9 +381,9 @@ int32 scriptlib::card_get_column_group_count(lua_State *L) {
int32
left
=
0
;
int32
left
=
0
;
int32
right
=
0
;
int32
right
=
0
;
if
(
lua_gettop
(
L
)
>=
2
)
if
(
lua_gettop
(
L
)
>=
2
)
left
=
lua_to
integer
(
L
,
2
);
left
=
lua_to
numberint
(
L
,
2
);
if
(
lua_gettop
(
L
)
>=
3
)
if
(
lua_gettop
(
L
)
>=
3
)
right
=
lua_to
integer
(
L
,
3
);
right
=
lua_to
numberint
(
L
,
3
);
card
::
card_set
cset
;
card
::
card_set
cset
;
pcard
->
get_column_cards
(
&
cset
,
left
,
right
);
pcard
->
get_column_cards
(
&
cset
,
left
,
right
);
lua_pushinteger
(
L
,
cset
.
size
());
lua_pushinteger
(
L
,
cset
.
size
());
...
@@ -393,16 +393,16 @@ int32 scriptlib::card_get_column_zone(lua_State *L) {
...
@@ -393,16 +393,16 @@ int32 scriptlib::card_get_column_zone(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
loc
=
lua_to
integer
(
L
,
2
);
int32
loc
=
lua_to
numberint
(
L
,
2
);
int32
left
=
0
;
int32
left
=
0
;
int32
right
=
0
;
int32
right
=
0
;
int32
cp
=
pcard
->
current
.
controler
;
int32
cp
=
pcard
->
current
.
controler
;
if
(
lua_gettop
(
L
)
>=
3
)
if
(
lua_gettop
(
L
)
>=
3
)
left
=
lua_to
integer
(
L
,
3
);
left
=
lua_to
numberint
(
L
,
3
);
if
(
lua_gettop
(
L
)
>=
4
)
if
(
lua_gettop
(
L
)
>=
4
)
right
=
lua_to
integer
(
L
,
4
);
right
=
lua_to
numberint
(
L
,
4
);
if
(
lua_gettop
(
L
)
>=
5
&&
!
lua_isnil
(
L
,
5
))
if
(
lua_gettop
(
L
)
>=
5
&&
!
lua_isnil
(
L
,
5
))
cp
=
lua_to
integer
(
L
,
5
);
cp
=
lua_to
numberint
(
L
,
5
);
uint32
zone
=
pcard
->
get_column_zone
(
loc
,
left
,
right
);
uint32
zone
=
pcard
->
get_column_zone
(
loc
,
left
,
right
);
if
(
cp
==
1
-
pcard
->
current
.
controler
)
if
(
cp
==
1
-
pcard
->
current
.
controler
)
lua_pushinteger
(
L
,
(((
zone
&
0xffff
)
<<
16
)
|
(
zone
>>
16
)));
lua_pushinteger
(
L
,
(((
zone
&
0xffff
)
<<
16
)
|
(
zone
>>
16
)));
...
@@ -440,7 +440,7 @@ int32 scriptlib::card_get_fusion_attribute(lua_State *L) {
...
@@ -440,7 +440,7 @@ int32 scriptlib::card_get_fusion_attribute(lua_State *L) {
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
playerid
=
PLAYER_NONE
;
int32
playerid
=
PLAYER_NONE
;
if
(
lua_gettop
(
L
)
>
1
&&
!
lua_isnil
(
L
,
2
))
if
(
lua_gettop
(
L
)
>
1
&&
!
lua_isnil
(
L
,
2
))
playerid
=
lua_to
integer
(
L
,
2
);
playerid
=
lua_to
numberint
(
L
,
2
);
else
else
playerid
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
playerid
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
lua_pushinteger
(
L
,
pcard
->
get_fusion_attribute
(
playerid
));
lua_pushinteger
(
L
,
pcard
->
get_fusion_attribute
(
playerid
));
...
@@ -739,7 +739,7 @@ int32 scriptlib::card_is_code(lua_State *L) {
...
@@ -739,7 +739,7 @@ int32 scriptlib::card_is_code(lua_State *L) {
for
(
uint32
i
=
0
;
i
<
count
;
++
i
)
{
for
(
uint32
i
=
0
;
i
<
count
;
++
i
)
{
if
(
lua_isnil
(
L
,
i
+
2
))
if
(
lua_isnil
(
L
,
i
+
2
))
continue
;
continue
;
uint32
tcode
=
lua_to
integer
(
L
,
i
+
2
);
uint32
tcode
=
lua_to
numberint
(
L
,
i
+
2
);
if
(
code1
==
tcode
||
(
code2
&&
code2
==
tcode
))
{
if
(
code1
==
tcode
||
(
code2
&&
code2
==
tcode
))
{
result
=
TRUE
;
result
=
TRUE
;
break
;
break
;
...
@@ -752,7 +752,7 @@ int32 scriptlib::card_is_type(lua_State *L) {
...
@@ -752,7 +752,7 @@ int32 scriptlib::card_is_type(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
ttype
=
lua_to
integer
(
L
,
2
);
uint32
ttype
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
get_type
()
&
ttype
)
if
(
pcard
->
get_type
()
&
ttype
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -763,7 +763,7 @@ int32 scriptlib::card_is_fusion_type(lua_State *L) {
...
@@ -763,7 +763,7 @@ int32 scriptlib::card_is_fusion_type(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
ttype
=
lua_to
integer
(
L
,
2
);
uint32
ttype
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
get_fusion_type
()
&
ttype
)
if
(
pcard
->
get_fusion_type
()
&
ttype
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -774,7 +774,7 @@ int32 scriptlib::card_is_synchro_type(lua_State *L) {
...
@@ -774,7 +774,7 @@ int32 scriptlib::card_is_synchro_type(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
ttype
=
lua_to
integer
(
L
,
2
);
uint32
ttype
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
get_synchro_type
()
&
ttype
)
if
(
pcard
->
get_synchro_type
()
&
ttype
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -785,7 +785,7 @@ int32 scriptlib::card_is_xyz_type(lua_State *L) {
...
@@ -785,7 +785,7 @@ int32 scriptlib::card_is_xyz_type(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
ttype
=
lua_to
integer
(
L
,
2
);
uint32
ttype
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
get_xyz_type
()
&
ttype
)
if
(
pcard
->
get_xyz_type
()
&
ttype
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -796,7 +796,7 @@ int32 scriptlib::card_is_link_type(lua_State *L) {
...
@@ -796,7 +796,7 @@ int32 scriptlib::card_is_link_type(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
ttype
=
lua_to
integer
(
L
,
2
);
uint32
ttype
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
get_link_type
()
&
ttype
)
if
(
pcard
->
get_link_type
()
&
ttype
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -807,7 +807,7 @@ int32 scriptlib::card_is_level(lua_State *L) {
...
@@ -807,7 +807,7 @@ int32 scriptlib::card_is_level(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
tlevel
=
lua_to
integer
(
L
,
2
);
uint32
tlevel
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
get_level
()
==
tlevel
)
if
(
pcard
->
get_level
()
==
tlevel
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -818,7 +818,7 @@ int32 scriptlib::card_is_rank(lua_State *L) {
...
@@ -818,7 +818,7 @@ int32 scriptlib::card_is_rank(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
trank
=
lua_to
integer
(
L
,
2
);
uint32
trank
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
get_rank
()
==
trank
)
if
(
pcard
->
get_rank
()
==
trank
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -829,7 +829,7 @@ int32 scriptlib::card_is_link(lua_State *L) {
...
@@ -829,7 +829,7 @@ int32 scriptlib::card_is_link(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
tlink
=
lua_to
integer
(
L
,
2
);
uint32
tlink
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
get_link
()
==
tlink
)
if
(
pcard
->
get_link
()
==
tlink
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -840,7 +840,7 @@ int32 scriptlib::card_is_race(lua_State *L) {
...
@@ -840,7 +840,7 @@ int32 scriptlib::card_is_race(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
trace
=
lua_to
integer
(
L
,
2
);
uint32
trace
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
get_race
()
&
trace
)
if
(
pcard
->
get_race
()
&
trace
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -851,7 +851,7 @@ int32 scriptlib::card_is_attribute(lua_State *L) {
...
@@ -851,7 +851,7 @@ int32 scriptlib::card_is_attribute(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
tattrib
=
lua_to
integer
(
L
,
2
);
uint32
tattrib
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
get_attribute
()
&
tattrib
)
if
(
pcard
->
get_attribute
()
&
tattrib
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -862,10 +862,10 @@ int32 scriptlib::card_is_fusion_attribute(lua_State *L) {
...
@@ -862,10 +862,10 @@ int32 scriptlib::card_is_fusion_attribute(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
tattrib
=
lua_to
integer
(
L
,
2
);
uint32
tattrib
=
lua_to
numberint
(
L
,
2
);
int32
playerid
=
PLAYER_NONE
;
int32
playerid
=
PLAYER_NONE
;
if
(
lua_gettop
(
L
)
>
2
&&
!
lua_isnil
(
L
,
3
))
if
(
lua_gettop
(
L
)
>
2
&&
!
lua_isnil
(
L
,
3
))
playerid
=
lua_to
integer
(
L
,
3
);
playerid
=
lua_to
numberint
(
L
,
3
);
else
else
playerid
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
playerid
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
if
(
pcard
->
get_fusion_attribute
(
playerid
)
&
tattrib
)
if
(
pcard
->
get_fusion_attribute
(
playerid
)
&
tattrib
)
...
@@ -878,7 +878,7 @@ int32 scriptlib::card_is_reason(lua_State *L) {
...
@@ -878,7 +878,7 @@ int32 scriptlib::card_is_reason(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
treason
=
lua_to
integer
(
L
,
2
);
uint32
treason
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
current
.
reason
&
treason
)
if
(
pcard
->
current
.
reason
&
treason
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -889,7 +889,7 @@ int32 scriptlib::card_is_summon_type(lua_State *L) {
...
@@ -889,7 +889,7 @@ int32 scriptlib::card_is_summon_type(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
ttype
=
lua_to
integer
(
L
,
2
);
uint32
ttype
=
lua_to
numberint
(
L
,
2
);
if
(((
pcard
->
summon_info
&
0xff00ffff
)
&
ttype
)
==
ttype
)
if
(((
pcard
->
summon_info
&
0xff00ffff
)
&
ttype
)
==
ttype
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -959,7 +959,7 @@ int32 scriptlib::card_set_turn_counter(lua_State *L) {
...
@@ -959,7 +959,7 @@ int32 scriptlib::card_set_turn_counter(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
ct
=
lua_to
integer
(
L
,
2
);
int32
ct
=
lua_to
numberint
(
L
,
2
);
pcard
->
count_turn
(
ct
);
pcard
->
count_turn
(
ct
);
return
0
;
return
0
;
}
}
...
@@ -1075,11 +1075,11 @@ int32 scriptlib::card_check_remove_overlay_card(lua_State *L) {
...
@@ -1075,11 +1075,11 @@ int32 scriptlib::card_check_remove_overlay_card(lua_State *L) {
check_param_count
(
L
,
4
);
check_param_count
(
L
,
4
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
2
);
int32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
count
=
lua_to
integer
(
L
,
3
);
int32
count
=
lua_to
numberint
(
L
,
3
);
int32
reason
=
lua_to
integer
(
L
,
4
);
int32
reason
=
lua_to
numberint
(
L
,
4
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_remove_overlay_card
(
playerid
,
pcard
,
0
,
0
,
count
,
reason
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_remove_overlay_card
(
playerid
,
pcard
,
0
,
0
,
count
,
reason
));
return
1
;
return
1
;
...
@@ -1089,12 +1089,12 @@ int32 scriptlib::card_remove_overlay_card(lua_State *L) {
...
@@ -1089,12 +1089,12 @@ int32 scriptlib::card_remove_overlay_card(lua_State *L) {
check_param_count
(
L
,
5
);
check_param_count
(
L
,
5
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
2
);
int32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
min
=
lua_to
integer
(
L
,
3
);
int32
min
=
lua_to
numberint
(
L
,
3
);
int32
max
=
lua_to
integer
(
L
,
4
);
int32
max
=
lua_to
numberint
(
L
,
4
);
int32
reason
=
lua_to
integer
(
L
,
5
);
int32
reason
=
lua_to
numberint
(
L
,
5
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
pduel
->
game_field
->
remove_overlay_card
(
reason
,
pcard
,
playerid
,
0
,
0
,
min
,
max
);
pduel
->
game_field
->
remove_overlay_card
(
reason
,
pcard
,
playerid
,
0
,
0
,
min
,
max
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
...
@@ -1363,7 +1363,7 @@ int32 scriptlib::card_is_has_effect(lua_State *L) {
...
@@ -1363,7 +1363,7 @@ int32 scriptlib::card_is_has_effect(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
lua_to
integer
(
L
,
2
);
uint32
code
=
lua_to
numberint
(
L
,
2
);
if
(
!
pcard
)
{
if
(
!
pcard
)
{
lua_pushnil
(
L
);
lua_pushnil
(
L
);
return
1
;
return
1
;
...
@@ -1383,8 +1383,8 @@ int32 scriptlib::card_reset_effect(lua_State *L) {
...
@@ -1383,8 +1383,8 @@ int32 scriptlib::card_reset_effect(lua_State *L) {
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
lua_to
integer
(
L
,
2
);
uint32
code
=
lua_to
numberint
(
L
,
2
);
uint32
type
=
lua_to
integer
(
L
,
3
);
uint32
type
=
lua_to
numberint
(
L
,
3
);
pcard
->
reset
(
code
,
type
);
pcard
->
reset
(
code
,
type
);
return
0
;
return
0
;
}
}
...
@@ -1392,7 +1392,7 @@ int32 scriptlib::card_get_effect_count(lua_State *L) {
...
@@ -1392,7 +1392,7 @@ int32 scriptlib::card_get_effect_count(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
lua_to
integer
(
L
,
2
);
uint32
code
=
lua_to
numberint
(
L
,
2
);
effect_set
eset
;
effect_set
eset
;
pcard
->
filter_effect
(
code
,
&
eset
);
pcard
->
filter_effect
(
code
,
&
eset
);
lua_pushinteger
(
L
,
eset
.
size
());
lua_pushinteger
(
L
,
eset
.
size
());
...
@@ -1402,16 +1402,16 @@ int32 scriptlib::card_register_flag_effect(lua_State *L) {
...
@@ -1402,16 +1402,16 @@ int32 scriptlib::card_register_flag_effect(lua_State *L) {
check_param_count
(
L
,
5
);
check_param_count
(
L
,
5
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
code
=
(
lua_to
integer
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
code
=
(
lua_to
numberint
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
reset
=
lua_to
integer
(
L
,
3
);
int32
reset
=
lua_to
numberint
(
L
,
3
);
int32
flag
=
lua_to
integer
(
L
,
4
);
int32
flag
=
lua_to
numberint
(
L
,
4
);
int32
count
=
lua_to
integer
(
L
,
5
);
int32
count
=
lua_to
numberint
(
L
,
5
);
int32
lab
=
0
;
int32
lab
=
0
;
int32
desc
=
0
;
int32
desc
=
0
;
if
(
lua_gettop
(
L
)
>=
6
)
if
(
lua_gettop
(
L
)
>=
6
)
lab
=
lua_to
integer
(
L
,
6
);
lab
=
lua_to
numberint
(
L
,
6
);
if
(
lua_gettop
(
L
)
>=
7
)
if
(
lua_gettop
(
L
)
>=
7
)
desc
=
lua_to
integer
(
L
,
7
);
desc
=
lua_to
numberint
(
L
,
7
);
if
(
count
==
0
)
if
(
count
==
0
)
count
=
1
;
count
=
1
;
if
(
reset
&
(
RESET_PHASE
)
&&
!
(
reset
&
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
)))
if
(
reset
&
(
RESET_PHASE
)
&&
!
(
reset
&
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
)))
...
@@ -1435,7 +1435,7 @@ int32 scriptlib::card_get_flag_effect(lua_State *L) {
...
@@ -1435,7 +1435,7 @@ int32 scriptlib::card_get_flag_effect(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
code
=
(
lua_to
integer
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
code
=
(
lua_to
numberint
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
lua_pushinteger
(
L
,
pcard
->
single_effect
.
count
(
code
));
lua_pushinteger
(
L
,
pcard
->
single_effect
.
count
(
code
));
return
1
;
return
1
;
}
}
...
@@ -1443,7 +1443,7 @@ int32 scriptlib::card_reset_flag_effect(lua_State *L) {
...
@@ -1443,7 +1443,7 @@ int32 scriptlib::card_reset_flag_effect(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
code
=
(
lua_to
integer
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
code
=
(
lua_to
numberint
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
pcard
->
reset
(
code
,
RESET_CODE
);
pcard
->
reset
(
code
,
RESET_CODE
);
return
0
;
return
0
;
}
}
...
@@ -1452,7 +1452,7 @@ int32 scriptlib::card_set_flag_effect_label(lua_State *L) {
...
@@ -1452,7 +1452,7 @@ int32 scriptlib::card_set_flag_effect_label(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
(
lua_tounsigned
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_tounsigned
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
lab
=
lua_to
integer
(
L
,
3
);
int32
lab
=
lua_to
numberint
(
L
,
3
);
auto
eit
=
pcard
->
single_effect
.
find
(
code
);
auto
eit
=
pcard
->
single_effect
.
find
(
code
);
if
(
eit
==
pcard
->
single_effect
.
end
())
if
(
eit
==
pcard
->
single_effect
.
end
())
lua_pushboolean
(
L
,
FALSE
);
lua_pushboolean
(
L
,
FALSE
);
...
@@ -1485,7 +1485,7 @@ int32 scriptlib::card_create_relation(lua_State *L) {
...
@@ -1485,7 +1485,7 @@ int32 scriptlib::card_create_relation(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
rcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
rcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
uint32
reset
=
lua_to
integer
(
L
,
3
);
uint32
reset
=
lua_to
numberint
(
L
,
3
);
pcard
->
create_relation
(
rcard
,
reset
);
pcard
->
create_relation
(
rcard
,
reset
);
return
0
;
return
0
;
}
}
...
@@ -1539,7 +1539,7 @@ int32 scriptlib::card_is_relate_to_chain(lua_State *L) {
...
@@ -1539,7 +1539,7 @@ int32 scriptlib::card_is_relate_to_chain(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
chain_count
=
lua_to
integer
(
L
,
2
);
uint32
chain_count
=
lua_to
numberint
(
L
,
2
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
if
(
chain_count
>
pduel
->
game_field
->
core
.
current_chain
.
size
()
||
chain_count
<
1
)
if
(
chain_count
>
pduel
->
game_field
->
core
.
current_chain
.
size
()
||
chain_count
<
1
)
chain_count
=
pduel
->
game_field
->
core
.
current_chain
.
size
();
chain_count
=
pduel
->
game_field
->
core
.
current_chain
.
size
();
...
@@ -1576,9 +1576,9 @@ int32 scriptlib::card_copy_effect(lua_State *L) {
...
@@ -1576,9 +1576,9 @@ int32 scriptlib::card_copy_effect(lua_State *L) {
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
lua_to
integer
(
L
,
2
);
uint32
code
=
lua_to
numberint
(
L
,
2
);
uint32
reset
=
lua_to
integer
(
L
,
3
);
uint32
reset
=
lua_to
numberint
(
L
,
3
);
uint32
count
=
lua_to
integer
(
L
,
4
);
uint32
count
=
lua_to
numberint
(
L
,
4
);
if
(
count
==
0
)
if
(
count
==
0
)
count
=
1
;
count
=
1
;
if
(
reset
&
RESET_PHASE
&&
!
(
reset
&
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
)))
if
(
reset
&
RESET_PHASE
&&
!
(
reset
&
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
)))
...
@@ -1590,9 +1590,9 @@ int32 scriptlib::card_replace_effect(lua_State * L) {
...
@@ -1590,9 +1590,9 @@ int32 scriptlib::card_replace_effect(lua_State * L) {
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
lua_to
integer
(
L
,
2
);
uint32
code
=
lua_to
numberint
(
L
,
2
);
uint32
reset
=
lua_to
integer
(
L
,
3
);
uint32
reset
=
lua_to
numberint
(
L
,
3
);
uint32
count
=
lua_to
integer
(
L
,
4
);
uint32
count
=
lua_to
numberint
(
L
,
4
);
if
(
count
==
0
)
if
(
count
==
0
)
count
=
1
;
count
=
1
;
if
(
reset
&
RESET_PHASE
&&
!
(
reset
&
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
)))
if
(
reset
&
RESET_PHASE
&&
!
(
reset
&
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
)))
...
@@ -1678,7 +1678,7 @@ int32 scriptlib::card_is_fusion_summonable_card(lua_State *L) {
...
@@ -1678,7 +1678,7 @@ int32 scriptlib::card_is_fusion_summonable_card(lua_State *L) {
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
summon_type
=
0
;
uint32
summon_type
=
0
;
if
(
lua_gettop
(
L
)
>
1
)
if
(
lua_gettop
(
L
)
>
1
)
summon_type
=
lua_to
integer
(
L
,
2
);
summon_type
=
lua_to
numberint
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
is_fusion_summonable_card
(
summon_type
));
lua_pushboolean
(
L
,
pcard
->
is_fusion_summonable_card
(
summon_type
));
return
1
;
return
1
;
}
}
...
@@ -1695,10 +1695,10 @@ int32 scriptlib::card_is_msetable(lua_State *L) {
...
@@ -1695,10 +1695,10 @@ int32 scriptlib::card_is_msetable(lua_State *L) {
}
}
uint32
minc
=
0
;
uint32
minc
=
0
;
if
(
lua_gettop
(
L
)
>=
4
)
if
(
lua_gettop
(
L
)
>=
4
)
minc
=
lua_to
integer
(
L
,
4
);
minc
=
lua_to
numberint
(
L
,
4
);
uint32
zone
=
0x1f
;
uint32
zone
=
0x1f
;
if
(
lua_gettop
(
L
)
>=
5
)
if
(
lua_gettop
(
L
)
>=
5
)
zone
=
lua_to
integer
(
L
,
5
);
zone
=
lua_to
numberint
(
L
,
5
);
lua_pushboolean
(
L
,
pcard
->
is_setable_mzone
(
p
,
ign
,
peffect
,
minc
,
zone
));
lua_pushboolean
(
L
,
pcard
->
is_setable_mzone
(
p
,
ign
,
peffect
,
minc
,
zone
));
return
1
;
return
1
;
}
}
...
@@ -1758,10 +1758,10 @@ int32 scriptlib::card_is_xyz_summonable(lua_State *L) {
...
@@ -1758,10 +1758,10 @@ int32 scriptlib::card_is_xyz_summonable(lua_State *L) {
}
}
int32
minc
=
0
;
int32
minc
=
0
;
if
(
lua_gettop
(
L
)
>=
3
)
if
(
lua_gettop
(
L
)
>=
3
)
minc
=
lua_to
integer
(
L
,
3
);
minc
=
lua_to
numberint
(
L
,
3
);
int32
maxc
=
0
;
int32
maxc
=
0
;
if
(
lua_gettop
(
L
)
>=
4
)
if
(
lua_gettop
(
L
)
>=
4
)
maxc
=
lua_to
integer
(
L
,
4
);
maxc
=
lua_to
numberint
(
L
,
4
);
uint32
p
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
uint32
p
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
pcard
->
pduel
->
game_field
->
core
.
limit_xyz
=
materials
;
pcard
->
pduel
->
game_field
->
core
.
limit_xyz
=
materials
;
pcard
->
pduel
->
game_field
->
core
.
limit_xyz_minc
=
minc
;
pcard
->
pduel
->
game_field
->
core
.
limit_xyz_minc
=
minc
;
...
@@ -1782,10 +1782,10 @@ int32 scriptlib::card_is_can_be_summoned(lua_State *L) {
...
@@ -1782,10 +1782,10 @@ int32 scriptlib::card_is_can_be_summoned(lua_State *L) {
}
}
uint32
minc
=
0
;
uint32
minc
=
0
;
if
(
lua_gettop
(
L
)
>=
4
)
if
(
lua_gettop
(
L
)
>=
4
)
minc
=
lua_to
integer
(
L
,
4
);
minc
=
lua_to
numberint
(
L
,
4
);
uint32
zone
=
0x1f
;
uint32
zone
=
0x1f
;
if
(
lua_gettop
(
L
)
>=
5
)
if
(
lua_gettop
(
L
)
>=
5
)
zone
=
lua_to
integer
(
L
,
5
);
zone
=
lua_to
numberint
(
L
,
5
);
lua_pushboolean
(
L
,
pcard
->
is_can_be_summoned
(
p
,
ign
,
peffect
,
minc
,
zone
));
lua_pushboolean
(
L
,
pcard
->
is_can_be_summoned
(
p
,
ign
,
peffect
,
minc
,
zone
));
return
1
;
return
1
;
}
}
...
@@ -1795,19 +1795,19 @@ int32 scriptlib::card_is_can_be_special_summoned(lua_State *L) {
...
@@ -1795,19 +1795,19 @@ int32 scriptlib::card_is_can_be_special_summoned(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_EFFECT
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
2
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
2
);
uint32
sumtype
=
lua_to
integer
(
L
,
3
);
uint32
sumtype
=
lua_to
numberint
(
L
,
3
);
uint32
sumplayer
=
lua_to
integer
(
L
,
4
);
uint32
sumplayer
=
lua_to
numberint
(
L
,
4
);
uint32
nocheck
=
lua_toboolean
(
L
,
5
);
uint32
nocheck
=
lua_toboolean
(
L
,
5
);
uint32
nolimit
=
lua_toboolean
(
L
,
6
);
uint32
nolimit
=
lua_toboolean
(
L
,
6
);
uint32
sumpos
=
POS_FACEUP
;
uint32
sumpos
=
POS_FACEUP
;
uint32
toplayer
=
sumplayer
;
uint32
toplayer
=
sumplayer
;
uint32
zone
=
0xff
;
uint32
zone
=
0xff
;
if
(
lua_gettop
(
L
)
>=
7
)
if
(
lua_gettop
(
L
)
>=
7
)
sumpos
=
lua_to
integer
(
L
,
7
);
sumpos
=
lua_to
numberint
(
L
,
7
);
if
(
lua_gettop
(
L
)
>=
8
)
if
(
lua_gettop
(
L
)
>=
8
)
toplayer
=
lua_to
integer
(
L
,
8
);
toplayer
=
lua_to
numberint
(
L
,
8
);
if
(
lua_gettop
(
L
)
>=
9
)
if
(
lua_gettop
(
L
)
>=
9
)
zone
=
lua_to
integer
(
L
,
9
);
zone
=
lua_to
numberint
(
L
,
9
);
if
(
pcard
->
is_can_be_special_summoned
(
peffect
,
sumtype
,
sumpos
,
sumplayer
,
toplayer
,
nocheck
,
nolimit
,
zone
))
if
(
pcard
->
is_can_be_special_summoned
(
peffect
,
sumtype
,
sumpos
,
sumplayer
,
toplayer
,
nocheck
,
nolimit
,
zone
))
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -1864,7 +1864,7 @@ int32 scriptlib::card_is_able_to_remove(lua_State *L) {
...
@@ -1864,7 +1864,7 @@ int32 scriptlib::card_is_able_to_remove(lua_State *L) {
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
p
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
uint32
p
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
if
(
lua_gettop
(
L
)
>=
2
)
if
(
lua_gettop
(
L
)
>=
2
)
p
=
lua_to
integer
(
L
,
2
);
p
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
is_removeable
(
p
))
if
(
pcard
->
is_removeable
(
p
))
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -1969,7 +1969,7 @@ int32 scriptlib::card_is_discardable(lua_State *L) {
...
@@ -1969,7 +1969,7 @@ int32 scriptlib::card_is_discardable(lua_State *L) {
effect
*
pe
=
pcard
->
pduel
->
game_field
->
core
.
reason_effect
;
effect
*
pe
=
pcard
->
pduel
->
game_field
->
core
.
reason_effect
;
uint32
reason
=
REASON_COST
;
uint32
reason
=
REASON_COST
;
if
(
lua_gettop
(
L
)
>
1
)
if
(
lua_gettop
(
L
)
>
1
)
reason
=
lua_to
integer
(
L
,
2
);
reason
=
lua_to
numberint
(
L
,
2
);
if
((
reason
!=
REASON_COST
||
!
pcard
->
is_affected_by_effect
(
EFFECT_CANNOT_USE_AS_COST
))
if
((
reason
!=
REASON_COST
||
!
pcard
->
is_affected_by_effect
(
EFFECT_CANNOT_USE_AS_COST
))
&&
pcard
->
pduel
->
game_field
->
is_player_can_discard_hand
(
p
,
pcard
,
pe
,
reason
))
&&
pcard
->
pduel
->
game_field
->
is_player_can_discard_hand
(
p
,
pcard
,
pe
,
reason
))
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
...
@@ -1992,7 +1992,7 @@ int32 scriptlib::card_is_chain_attackable(lua_State *L) {
...
@@ -1992,7 +1992,7 @@ int32 scriptlib::card_is_chain_attackable(lua_State *L) {
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
int32
ac
=
2
;
int32
ac
=
2
;
if
(
lua_gettop
(
L
)
>
1
)
if
(
lua_gettop
(
L
)
>
1
)
ac
=
lua_to
integer
(
L
,
2
);
ac
=
lua_to
numberint
(
L
,
2
);
if
(
lua_gettop
(
L
)
>
2
)
if
(
lua_gettop
(
L
)
>
2
)
monsteronly
=
lua_toboolean
(
L
,
3
);
monsteronly
=
lua_toboolean
(
L
,
3
);
card
*
attacker
=
pduel
->
game_field
->
core
.
attacker
;
card
*
attacker
=
pduel
->
game_field
->
core
.
attacker
;
...
@@ -2045,7 +2045,7 @@ int32 scriptlib::card_is_position(lua_State *L) {
...
@@ -2045,7 +2045,7 @@ int32 scriptlib::card_is_position(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
pos
=
lua_to
integer
(
L
,
2
);
uint32
pos
=
lua_to
numberint
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
is_position
(
pos
));
lua_pushboolean
(
L
,
pcard
->
is_position
(
pos
));
return
1
;
return
1
;
}
}
...
@@ -2053,7 +2053,7 @@ int32 scriptlib::card_is_pre_position(lua_State *L) {
...
@@ -2053,7 +2053,7 @@ int32 scriptlib::card_is_pre_position(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
pos
=
lua_to
integer
(
L
,
2
);
uint32
pos
=
lua_to
numberint
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
previous
.
position
&
pos
);
lua_pushboolean
(
L
,
pcard
->
previous
.
position
&
pos
);
return
1
;
return
1
;
}
}
...
@@ -2061,7 +2061,7 @@ int32 scriptlib::card_is_controler(lua_State *L) {
...
@@ -2061,7 +2061,7 @@ int32 scriptlib::card_is_controler(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
con
=
lua_to
integer
(
L
,
2
);
uint32
con
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
current
.
controler
==
con
)
if
(
pcard
->
current
.
controler
==
con
)
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -2083,7 +2083,7 @@ int32 scriptlib::card_is_location(lua_State *L) {
...
@@ -2083,7 +2083,7 @@ int32 scriptlib::card_is_location(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
loc
=
lua_to
integer
(
L
,
2
);
uint32
loc
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
->
current
.
location
==
LOCATION_MZONE
)
{
if
(
pcard
->
current
.
location
==
LOCATION_MZONE
)
{
if
((
loc
&
LOCATION_MZONE
)
&&
!
pcard
->
get_status
(
STATUS_SUMMONING
|
STATUS_SUMMON_DISABLED
|
STATUS_SPSUMMON_STEP
))
if
((
loc
&
LOCATION_MZONE
)
&&
!
pcard
->
get_status
(
STATUS_SUMMONING
|
STATUS_SUMMON_DISABLED
|
STATUS_SPSUMMON_STEP
))
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
...
@@ -2102,7 +2102,7 @@ int32 scriptlib::card_is_pre_location(lua_State *L) {
...
@@ -2102,7 +2102,7 @@ int32 scriptlib::card_is_pre_location(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
loc
=
lua_to
integer
(
L
,
2
);
uint32
loc
=
lua_to
numberint
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
previous
.
is_location
(
loc
));
lua_pushboolean
(
L
,
pcard
->
previous
.
is_location
(
loc
));
return
1
;
return
1
;
}
}
...
@@ -2110,7 +2110,7 @@ int32 scriptlib::card_is_level_below(lua_State *L) {
...
@@ -2110,7 +2110,7 @@ int32 scriptlib::card_is_level_below(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
lvl
=
lua_to
integer
(
L
,
2
);
uint32
lvl
=
lua_to
numberint
(
L
,
2
);
if
((
pcard
->
data
.
type
&
(
TYPE_XYZ
|
TYPE_LINK
))
||
(
pcard
->
status
&
STATUS_NO_LEVEL
)
if
((
pcard
->
data
.
type
&
(
TYPE_XYZ
|
TYPE_LINK
))
||
(
pcard
->
status
&
STATUS_NO_LEVEL
)
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
get_type
()
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
get_type
()
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
...
@@ -2122,7 +2122,7 @@ int32 scriptlib::card_is_level_above(lua_State *L) {
...
@@ -2122,7 +2122,7 @@ int32 scriptlib::card_is_level_above(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
lvl
=
lua_to
integer
(
L
,
2
);
uint32
lvl
=
lua_to
numberint
(
L
,
2
);
if
((
pcard
->
data
.
type
&
(
TYPE_XYZ
|
TYPE_LINK
))
||
(
pcard
->
status
&
STATUS_NO_LEVEL
)
if
((
pcard
->
data
.
type
&
(
TYPE_XYZ
|
TYPE_LINK
))
||
(
pcard
->
status
&
STATUS_NO_LEVEL
)
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
get_type
()
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
get_type
()
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
...
@@ -2134,7 +2134,7 @@ int32 scriptlib::card_is_rank_below(lua_State *L) {
...
@@ -2134,7 +2134,7 @@ int32 scriptlib::card_is_rank_below(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
rnk
=
lua_to
integer
(
L
,
2
);
uint32
rnk
=
lua_to
numberint
(
L
,
2
);
if
(
!
(
pcard
->
data
.
type
&
TYPE_XYZ
)
||
(
pcard
->
status
&
STATUS_NO_LEVEL
)
if
(
!
(
pcard
->
data
.
type
&
TYPE_XYZ
)
||
(
pcard
->
status
&
STATUS_NO_LEVEL
)
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
...
@@ -2146,7 +2146,7 @@ int32 scriptlib::card_is_rank_above(lua_State *L) {
...
@@ -2146,7 +2146,7 @@ int32 scriptlib::card_is_rank_above(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
rnk
=
lua_to
integer
(
L
,
2
);
uint32
rnk
=
lua_to
numberint
(
L
,
2
);
if
(
!
(
pcard
->
data
.
type
&
TYPE_XYZ
)
||
(
pcard
->
status
&
STATUS_NO_LEVEL
)
if
(
!
(
pcard
->
data
.
type
&
TYPE_XYZ
)
||
(
pcard
->
status
&
STATUS_NO_LEVEL
)
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
...
@@ -2158,7 +2158,7 @@ int32 scriptlib::card_is_link_below(lua_State *L) {
...
@@ -2158,7 +2158,7 @@ int32 scriptlib::card_is_link_below(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
lnk
=
lua_to
integer
(
L
,
2
);
uint32
lnk
=
lua_to
numberint
(
L
,
2
);
if
(
!
(
pcard
->
data
.
type
&
TYPE_LINK
)
||
(
pcard
->
status
&
STATUS_NO_LEVEL
)
if
(
!
(
pcard
->
data
.
type
&
TYPE_LINK
)
||
(
pcard
->
status
&
STATUS_NO_LEVEL
)
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
...
@@ -2170,7 +2170,7 @@ int32 scriptlib::card_is_link_above(lua_State *L) {
...
@@ -2170,7 +2170,7 @@ int32 scriptlib::card_is_link_above(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
lnk
=
lua_to
integer
(
L
,
2
);
uint32
lnk
=
lua_to
numberint
(
L
,
2
);
if
(
!
(
pcard
->
data
.
type
&
TYPE_LINK
)
||
(
pcard
->
status
&
STATUS_NO_LEVEL
)
if
(
!
(
pcard
->
data
.
type
&
TYPE_LINK
)
||
(
pcard
->
status
&
STATUS_NO_LEVEL
)
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
...
@@ -2182,7 +2182,7 @@ int32 scriptlib::card_is_attack_below(lua_State *L) {
...
@@ -2182,7 +2182,7 @@ int32 scriptlib::card_is_attack_below(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
atk
=
lua_to
integer
(
L
,
2
);
int32
atk
=
lua_to
numberint
(
L
,
2
);
if
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
get_type
()
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
))
if
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
get_type
()
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
))
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
else
{
else
{
...
@@ -2195,7 +2195,7 @@ int32 scriptlib::card_is_attack_above(lua_State *L) {
...
@@ -2195,7 +2195,7 @@ int32 scriptlib::card_is_attack_above(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
atk
=
lua_to
integer
(
L
,
2
);
int32
atk
=
lua_to
numberint
(
L
,
2
);
if
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
get_type
()
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
))
if
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
get_type
()
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
))
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
else
{
else
{
...
@@ -2208,7 +2208,7 @@ int32 scriptlib::card_is_defense_below(lua_State *L) {
...
@@ -2208,7 +2208,7 @@ int32 scriptlib::card_is_defense_below(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
def
=
lua_to
integer
(
L
,
2
);
int32
def
=
lua_to
numberint
(
L
,
2
);
if
((
pcard
->
data
.
type
&
TYPE_LINK
)
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
get_type
()
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
if
((
pcard
->
data
.
type
&
TYPE_LINK
)
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
get_type
()
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
else
{
else
{
...
@@ -2221,7 +2221,7 @@ int32 scriptlib::card_is_defense_above(lua_State *L) {
...
@@ -2221,7 +2221,7 @@ int32 scriptlib::card_is_defense_above(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
def
=
lua_to
integer
(
L
,
2
);
int32
def
=
lua_to
numberint
(
L
,
2
);
if
((
pcard
->
data
.
type
&
TYPE_LINK
)
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
get_type
()
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
if
((
pcard
->
data
.
type
&
TYPE_LINK
)
||
(
!
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
!
(
pcard
->
get_type
()
&
TYPE_MONSTER
)
&&
!
(
pcard
->
current
.
location
&
LOCATION_MZONE
)))
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
else
{
else
{
...
@@ -2266,7 +2266,7 @@ int32 scriptlib::card_is_controler_can_be_changed(lua_State *L) {
...
@@ -2266,7 +2266,7 @@ int32 scriptlib::card_is_controler_can_be_changed(lua_State *L) {
ign
=
lua_toboolean
(
L
,
2
);
ign
=
lua_toboolean
(
L
,
2
);
uint32
zone
=
0xff
;
uint32
zone
=
0xff
;
if
(
lua_gettop
(
L
)
>=
3
)
if
(
lua_gettop
(
L
)
>=
3
)
zone
=
lua_to
integer
(
L
,
3
);
zone
=
lua_to
numberint
(
L
,
3
);
if
(
pcard
->
is_control_can_be_changed
(
ign
,
zone
))
if
(
pcard
->
is_control_can_be_changed
(
ign
,
zone
))
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -2277,8 +2277,8 @@ int32 scriptlib::card_add_counter(lua_State *L) {
...
@@ -2277,8 +2277,8 @@ int32 scriptlib::card_add_counter(lua_State *L) {
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
countertype
=
lua_to
integer
(
L
,
2
);
uint32
countertype
=
lua_to
numberint
(
L
,
2
);
uint32
count
=
lua_to
integer
(
L
,
3
);
uint32
count
=
lua_to
numberint
(
L
,
3
);
uint8
singly
=
FALSE
;
uint8
singly
=
FALSE
;
if
(
lua_gettop
(
L
)
>
3
)
if
(
lua_gettop
(
L
)
>
3
)
singly
=
lua_toboolean
(
L
,
4
);
singly
=
lua_toboolean
(
L
,
4
);
...
@@ -2292,10 +2292,10 @@ int32 scriptlib::card_remove_counter(lua_State *L) {
...
@@ -2292,10 +2292,10 @@ int32 scriptlib::card_remove_counter(lua_State *L) {
check_param_count
(
L
,
5
);
check_param_count
(
L
,
5
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
rplayer
=
lua_to
integer
(
L
,
2
);
uint32
rplayer
=
lua_to
numberint
(
L
,
2
);
uint32
countertype
=
lua_to
integer
(
L
,
3
);
uint32
countertype
=
lua_to
numberint
(
L
,
3
);
uint32
count
=
lua_to
integer
(
L
,
4
);
uint32
count
=
lua_to
numberint
(
L
,
4
);
uint32
reason
=
lua_to
integer
(
L
,
5
);
uint32
reason
=
lua_to
numberint
(
L
,
5
);
if
(
countertype
==
0
)
{
if
(
countertype
==
0
)
{
// c38834303: remove all counters
// c38834303: remove all counters
for
(
auto
cmit
=
pcard
->
counters
.
begin
();
cmit
!=
pcard
->
counters
.
end
();
++
cmit
)
{
for
(
auto
cmit
=
pcard
->
counters
.
begin
();
cmit
!=
pcard
->
counters
.
end
();
++
cmit
)
{
...
@@ -2317,7 +2317,7 @@ int32 scriptlib::card_get_counter(lua_State *L) {
...
@@ -2317,7 +2317,7 @@ int32 scriptlib::card_get_counter(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
countertype
=
lua_to
integer
(
L
,
2
);
uint32
countertype
=
lua_to
numberint
(
L
,
2
);
if
(
countertype
==
0
)
if
(
countertype
==
0
)
lua_pushinteger
(
L
,
pcard
->
counters
.
size
());
lua_pushinteger
(
L
,
pcard
->
counters
.
size
());
else
else
...
@@ -2327,10 +2327,10 @@ int32 scriptlib::card_get_counter(lua_State *L) {
...
@@ -2327,10 +2327,10 @@ int32 scriptlib::card_get_counter(lua_State *L) {
int32
scriptlib
::
card_enable_counter_permit
(
lua_State
*
L
)
{
int32
scriptlib
::
card_enable_counter_permit
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
countertype
=
lua_to
integer
(
L
,
2
);
int32
countertype
=
lua_to
numberint
(
L
,
2
);
uint32
prange
;
uint32
prange
;
if
(
lua_gettop
(
L
)
>
2
)
if
(
lua_gettop
(
L
)
>
2
)
prange
=
lua_to
integer
(
L
,
3
);
prange
=
lua_to
numberint
(
L
,
3
);
else
if
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
else
if
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
prange
=
LOCATION_MZONE
;
prange
=
LOCATION_MZONE
;
else
else
...
@@ -2346,8 +2346,8 @@ int32 scriptlib::card_enable_counter_permit(lua_State *L) {
...
@@ -2346,8 +2346,8 @@ int32 scriptlib::card_enable_counter_permit(lua_State *L) {
int32
scriptlib
::
card_set_counter_limit
(
lua_State
*
L
)
{
int32
scriptlib
::
card_set_counter_limit
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
countertype
=
lua_to
integer
(
L
,
2
);
int32
countertype
=
lua_to
numberint
(
L
,
2
);
int32
limit
=
lua_to
integer
(
L
,
3
);
int32
limit
=
lua_to
numberint
(
L
,
3
);
effect
*
peffect
=
pcard
->
pduel
->
new_effect
();
effect
*
peffect
=
pcard
->
pduel
->
new_effect
();
peffect
->
owner
=
pcard
;
peffect
->
owner
=
pcard
;
peffect
->
type
=
EFFECT_TYPE_SINGLE
;
peffect
->
type
=
EFFECT_TYPE_SINGLE
;
...
@@ -2374,14 +2374,14 @@ int32 scriptlib::card_is_can_add_counter(lua_State *L) {
...
@@ -2374,14 +2374,14 @@ int32 scriptlib::card_is_can_add_counter(lua_State *L) {
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
countertype
=
lua_to
integer
(
L
,
2
);
uint32
countertype
=
lua_to
numberint
(
L
,
2
);
uint32
count
=
lua_to
integer
(
L
,
3
);
uint32
count
=
lua_to
numberint
(
L
,
3
);
uint8
singly
=
FALSE
;
uint8
singly
=
FALSE
;
if
(
lua_gettop
(
L
)
>
3
)
if
(
lua_gettop
(
L
)
>
3
)
singly
=
lua_toboolean
(
L
,
4
);
singly
=
lua_toboolean
(
L
,
4
);
uint32
loc
=
0
;
uint32
loc
=
0
;
if
(
lua_gettop
(
L
)
>
4
)
if
(
lua_gettop
(
L
)
>
4
)
loc
=
lua_to
integer
(
L
,
5
);
loc
=
lua_to
numberint
(
L
,
5
);
lua_pushboolean
(
L
,
pcard
->
is_can_add_counter
(
pcard
->
pduel
->
game_field
->
core
.
reason_player
,
countertype
,
count
,
singly
,
loc
));
lua_pushboolean
(
L
,
pcard
->
is_can_add_counter
(
pcard
->
pduel
->
game_field
->
core
.
reason_player
,
countertype
,
count
,
singly
,
loc
));
return
1
;
return
1
;
}
}
...
@@ -2389,12 +2389,12 @@ int32 scriptlib::card_is_can_remove_counter(lua_State *L) {
...
@@ -2389,12 +2389,12 @@ int32 scriptlib::card_is_can_remove_counter(lua_State *L) {
check_param_count
(
L
,
5
);
check_param_count
(
L
,
5
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
2
);
uint32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
countertype
=
lua_to
integer
(
L
,
3
);
uint32
countertype
=
lua_to
numberint
(
L
,
3
);
uint32
count
=
lua_to
integer
(
L
,
4
);
uint32
count
=
lua_to
numberint
(
L
,
4
);
uint32
reason
=
lua_to
integer
(
L
,
5
);
uint32
reason
=
lua_to
numberint
(
L
,
5
);
lua_pushboolean
(
L
,
pcard
->
pduel
->
game_field
->
is_player_can_remove_counter
(
playerid
,
pcard
,
0
,
0
,
countertype
,
count
,
reason
));
lua_pushboolean
(
L
,
pcard
->
pduel
->
game_field
->
is_player_can_remove_counter
(
playerid
,
pcard
,
0
,
0
,
countertype
,
count
,
reason
));
return
1
;
return
1
;
}
}
...
@@ -2479,7 +2479,7 @@ int32 scriptlib::card_check_fusion_material(lua_State *L) {
...
@@ -2479,7 +2479,7 @@ int32 scriptlib::card_check_fusion_material(lua_State *L) {
cg
=
*
(
card
**
)
lua_touserdata
(
L
,
3
);
cg
=
*
(
card
**
)
lua_touserdata
(
L
,
3
);
}
}
if
(
lua_gettop
(
L
)
>
3
)
if
(
lua_gettop
(
L
)
>
3
)
chkf
=
lua_to
integer
(
L
,
4
);
chkf
=
lua_to
numberint
(
L
,
4
);
lua_pushboolean
(
L
,
pcard
->
fusion_check
(
pgroup
,
cg
,
chkf
));
lua_pushboolean
(
L
,
pcard
->
fusion_check
(
pgroup
,
cg
,
chkf
));
return
1
;
return
1
;
}
}
...
@@ -2526,12 +2526,12 @@ int32 scriptlib::card_is_can_be_battle_target(lua_State *L) {
...
@@ -2526,12 +2526,12 @@ int32 scriptlib::card_is_can_be_battle_target(lua_State *L) {
int32
scriptlib
::
card_add_monster_attribute
(
lua_State
*
L
)
{
int32
scriptlib
::
card_add_monster_attribute
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
int32
type
=
lua_to
integer
(
L
,
2
);
int32
type
=
lua_to
numberint
(
L
,
2
);
int32
attribute
=
lua_to
integer
(
L
,
3
);
int32
attribute
=
lua_to
numberint
(
L
,
3
);
int32
race
=
lua_to
integer
(
L
,
4
);
int32
race
=
lua_to
numberint
(
L
,
4
);
int32
level
=
lua_to
integer
(
L
,
5
);
int32
level
=
lua_to
numberint
(
L
,
5
);
int32
atk
=
lua_to
integer
(
L
,
6
);
int32
atk
=
lua_to
numberint
(
L
,
6
);
int32
def
=
lua_to
integer
(
L
,
7
);
int32
def
=
lua_to
numberint
(
L
,
7
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
pcard
->
set_status
(
STATUS_NO_LEVEL
,
FALSE
);
pcard
->
set_status
(
STATUS_NO_LEVEL
,
FALSE
);
...
@@ -2692,8 +2692,8 @@ int32 scriptlib::card_set_hint(lua_State *L) {
...
@@ -2692,8 +2692,8 @@ int32 scriptlib::card_set_hint(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
uint32
type
=
lua_to
integer
(
L
,
2
);
uint32
type
=
lua_to
numberint
(
L
,
2
);
uint32
value
=
lua_to
integer
(
L
,
3
);
uint32
value
=
lua_to
numberint
(
L
,
3
);
if
(
type
>=
CHINT_DESC_ADD
)
if
(
type
>=
CHINT_DESC_ADD
)
return
0
;
return
0
;
pduel
->
write_buffer8
(
MSG_CARD_HINT
);
pduel
->
write_buffer8
(
MSG_CARD_HINT
);
...
@@ -2722,16 +2722,16 @@ int32 scriptlib::card_set_unique_onfield(lua_State *L) {
...
@@ -2722,16 +2722,16 @@ int32 scriptlib::card_set_unique_onfield(lua_State *L) {
check_param_count
(
L
,
4
);
check_param_count
(
L
,
4
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
pcard
->
unique_pos
[
0
]
=
lua_to
integer
(
L
,
2
);
pcard
->
unique_pos
[
0
]
=
lua_to
numberint
(
L
,
2
);
pcard
->
unique_pos
[
1
]
=
lua_to
integer
(
L
,
3
);
pcard
->
unique_pos
[
1
]
=
lua_to
numberint
(
L
,
3
);
if
(
lua_isfunction
(
L
,
4
))
{
if
(
lua_isfunction
(
L
,
4
))
{
pcard
->
unique_code
=
1
;
pcard
->
unique_code
=
1
;
pcard
->
unique_function
=
interpreter
::
get_function_handle
(
L
,
4
);
pcard
->
unique_function
=
interpreter
::
get_function_handle
(
L
,
4
);
}
else
}
else
pcard
->
unique_code
=
lua_to
integer
(
L
,
4
);
pcard
->
unique_code
=
lua_to
numberint
(
L
,
4
);
uint32
location
=
LOCATION_ONFIELD
;
uint32
location
=
LOCATION_ONFIELD
;
if
(
lua_gettop
(
L
)
>
4
)
if
(
lua_gettop
(
L
)
>
4
)
location
=
lua_to
integer
(
L
,
5
)
&
LOCATION_ONFIELD
;
location
=
lua_to
numberint
(
L
,
5
)
&
LOCATION_ONFIELD
;
pcard
->
unique_location
=
location
;
pcard
->
unique_location
=
location
;
effect
*
peffect
=
pcard
->
pduel
->
new_effect
();
effect
*
peffect
=
pcard
->
pduel
->
new_effect
();
peffect
->
owner
=
pcard
;
peffect
->
owner
=
pcard
;
...
@@ -2748,10 +2748,10 @@ int32 scriptlib::card_check_unique_onfield(lua_State *L) {
...
@@ -2748,10 +2748,10 @@ int32 scriptlib::card_check_unique_onfield(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
check_player
=
lua_to
integer
(
L
,
2
);
uint32
check_player
=
lua_to
numberint
(
L
,
2
);
uint32
check_location
=
LOCATION_ONFIELD
;
uint32
check_location
=
LOCATION_ONFIELD
;
if
(
lua_gettop
(
L
)
>
2
)
if
(
lua_gettop
(
L
)
>
2
)
check_location
=
lua_to
integer
(
L
,
3
)
&
LOCATION_ONFIELD
;
check_location
=
lua_to
numberint
(
L
,
3
)
&
LOCATION_ONFIELD
;
card
*
icard
=
0
;
card
*
icard
=
0
;
if
(
lua_gettop
(
L
)
>
3
)
{
if
(
lua_gettop
(
L
)
>
3
)
{
if
(
check_param
(
L
,
PARAM_TYPE_CARD
,
4
,
TRUE
))
if
(
check_param
(
L
,
PARAM_TYPE_CARD
,
4
,
TRUE
))
...
@@ -2766,15 +2766,15 @@ int32 scriptlib::card_reset_negate_effect(lua_State *L) {
...
@@ -2766,15 +2766,15 @@ int32 scriptlib::card_reset_negate_effect(lua_State *L) {
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
count
=
lua_gettop
(
L
)
-
1
;
int32
count
=
lua_gettop
(
L
)
-
1
;
for
(
int32
i
=
0
;
i
<
count
;
++
i
)
for
(
int32
i
=
0
;
i
<
count
;
++
i
)
pcard
->
reset
(
lua_to
integer
(
L
,
i
+
2
),
RESET_CARD
);
pcard
->
reset
(
lua_to
numberint
(
L
,
i
+
2
),
RESET_CARD
);
return
0
;
return
0
;
}
}
int32
scriptlib
::
card_assume_prop
(
lua_State
*
L
)
{
int32
scriptlib
::
card_assume_prop
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
pcard
->
assume_type
=
lua_to
integer
(
L
,
2
);
pcard
->
assume_type
=
lua_to
numberint
(
L
,
2
);
pcard
->
assume_value
=
lua_to
integer
(
L
,
3
);
pcard
->
assume_value
=
lua_to
numberint
(
L
,
3
);
pcard
->
pduel
->
assumes
.
insert
(
pcard
);
pcard
->
pduel
->
assumes
.
insert
(
pcard
);
return
0
;
return
0
;
}
}
...
@@ -2784,7 +2784,7 @@ int32 scriptlib::card_set_spsummon_once(lua_State *L) {
...
@@ -2784,7 +2784,7 @@ int32 scriptlib::card_set_spsummon_once(lua_State *L) {
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
if
(
pcard
->
status
&
STATUS_COPYING_EFFECT
)
if
(
pcard
->
status
&
STATUS_COPYING_EFFECT
)
return
0
;
return
0
;
pcard
->
spsummon_code
=
lua_to
integer
(
L
,
2
);
pcard
->
spsummon_code
=
lua_to
numberint
(
L
,
2
);
pcard
->
pduel
->
game_field
->
core
.
global_flag
|=
GLOBALFLAG_SPSUMMON_ONCE
;
pcard
->
pduel
->
game_field
->
core
.
global_flag
|=
GLOBALFLAG_SPSUMMON_ONCE
;
return
0
;
return
0
;
}
}
ocgcore/libdebug.cpp
View file @
411112ba
...
@@ -25,12 +25,12 @@ int32 scriptlib::debug_message(lua_State *L) {
...
@@ -25,12 +25,12 @@ int32 scriptlib::debug_message(lua_State *L) {
int32
scriptlib
::
debug_add_card
(
lua_State
*
L
)
{
int32
scriptlib
::
debug_add_card
(
lua_State
*
L
)
{
check_param_count
(
L
,
6
);
check_param_count
(
L
,
6
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
code
=
lua_to
integer
(
L
,
1
);
int32
code
=
lua_to
numberint
(
L
,
1
);
int32
owner
=
lua_to
integer
(
L
,
2
);
int32
owner
=
lua_to
numberint
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
3
);
int32
playerid
=
lua_to
numberint
(
L
,
3
);
int32
location
=
lua_to
integer
(
L
,
4
);
int32
location
=
lua_to
numberint
(
L
,
4
);
int32
sequence
=
lua_to
integer
(
L
,
5
);
int32
sequence
=
lua_to
numberint
(
L
,
5
);
int32
position
=
lua_to
integer
(
L
,
6
);
int32
position
=
lua_to
numberint
(
L
,
6
);
int32
proc
=
lua_toboolean
(
L
,
7
);
int32
proc
=
lua_toboolean
(
L
,
7
);
if
(
owner
!=
0
&&
owner
!=
1
)
if
(
owner
!=
0
&&
owner
!=
1
)
return
0
;
return
0
;
...
@@ -77,10 +77,10 @@ int32 scriptlib::debug_add_card(lua_State *L) {
...
@@ -77,10 +77,10 @@ int32 scriptlib::debug_add_card(lua_State *L) {
int32
scriptlib
::
debug_set_player_info
(
lua_State
*
L
)
{
int32
scriptlib
::
debug_set_player_info
(
lua_State
*
L
)
{
check_param_count
(
L
,
4
);
check_param_count
(
L
,
4
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
uint32
lp
=
lua_to
integer
(
L
,
2
);
uint32
lp
=
lua_to
numberint
(
L
,
2
);
uint32
startcount
=
lua_to
integer
(
L
,
3
);
uint32
startcount
=
lua_to
numberint
(
L
,
3
);
uint32
drawcount
=
lua_to
integer
(
L
,
4
);
uint32
drawcount
=
lua_to
numberint
(
L
,
4
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
pduel
->
game_field
->
player
[
playerid
].
lp
=
lp
;
pduel
->
game_field
->
player
[
playerid
].
lp
=
lp
;
...
@@ -92,10 +92,10 @@ int32 scriptlib::debug_pre_summon(lua_State *L) {
...
@@ -92,10 +92,10 @@ int32 scriptlib::debug_pre_summon(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
summon_type
=
lua_to
integer
(
L
,
2
);
uint32
summon_type
=
lua_to
numberint
(
L
,
2
);
uint8
summon_location
=
0
;
uint8
summon_location
=
0
;
if
(
lua_gettop
(
L
)
>
2
)
if
(
lua_gettop
(
L
)
>
2
)
summon_location
=
lua_to
integer
(
L
,
3
);
summon_location
=
lua_to
numberint
(
L
,
3
);
pcard
->
summon_info
=
summon_type
|
(
summon_location
<<
16
);
pcard
->
summon_info
=
summon_type
|
(
summon_location
<<
16
);
return
0
;
return
0
;
}
}
...
@@ -130,8 +130,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
...
@@ -130,8 +130,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
countertype
=
lua_to
integer
(
L
,
2
);
uint32
countertype
=
lua_to
numberint
(
L
,
2
);
uint32
count
=
lua_to
integer
(
L
,
3
);
uint32
count
=
lua_to
numberint
(
L
,
3
);
uint16
cttype
=
countertype
&
~
COUNTER_NEED_ENABLE
;
uint16
cttype
=
countertype
&
~
COUNTER_NEED_ENABLE
;
auto
pr
=
pcard
->
counters
.
insert
(
std
::
make_pair
(
cttype
,
card
::
counter_map
::
mapped_type
()));
auto
pr
=
pcard
->
counters
.
insert
(
std
::
make_pair
(
cttype
,
card
::
counter_map
::
mapped_type
()));
auto
cmit
=
pr
.
first
;
auto
cmit
=
pr
.
first
;
...
@@ -148,8 +148,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
...
@@ -148,8 +148,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
int32
scriptlib
::
debug_reload_field_begin
(
lua_State
*
L
)
{
int32
scriptlib
::
debug_reload_field_begin
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
flag
=
lua_to
integer
(
L
,
1
);
uint32
flag
=
lua_to
numberint
(
L
,
1
);
int32
rule
=
lua_to
integer
(
L
,
2
);
int32
rule
=
lua_to
numberint
(
L
,
2
);
pduel
->
clear
();
pduel
->
clear
();
pduel
->
game_field
->
core
.
duel_options
=
flag
;
pduel
->
game_field
->
core
.
duel_options
=
flag
;
if
(
rule
)
if
(
rule
)
...
...
ocgcore/libduel.cpp
View file @
411112ba
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
int32
scriptlib
::
duel_enable_global_flag
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_enable_global_flag
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
flag
=
lua_to
integer
(
L
,
1
);
int32
flag
=
lua_to
numberint
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
core
.
global_flag
|=
flag
;
pduel
->
game_field
->
core
.
global_flag
|=
flag
;
return
0
;
return
0
;
...
@@ -23,7 +23,7 @@ int32 scriptlib::duel_enable_global_flag(lua_State *L) {
...
@@ -23,7 +23,7 @@ int32 scriptlib::duel_enable_global_flag(lua_State *L) {
int32
scriptlib
::
duel_get_lp
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_lp
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
p
=
lua_to
integer
(
L
,
1
);
int32
p
=
lua_to
numberint
(
L
,
1
);
if
(
p
!=
0
&&
p
!=
1
)
if
(
p
!=
0
&&
p
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -32,8 +32,8 @@ int32 scriptlib::duel_get_lp(lua_State *L) {
...
@@ -32,8 +32,8 @@ int32 scriptlib::duel_get_lp(lua_State *L) {
}
}
int32
scriptlib
::
duel_set_lp
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_set_lp
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
p
=
lua_to
integer
(
L
,
1
);
int32
p
=
lua_to
numberint
(
L
,
1
);
int32
lp
=
lua_to
integer
(
L
,
2
);
int32
lp
=
lua_to
numberint
(
L
,
2
);
if
(
lp
<
0
)
lp
=
0
;
if
(
lp
<
0
)
lp
=
0
;
if
(
p
!=
0
&&
p
!=
1
)
if
(
p
!=
0
&&
p
!=
1
)
return
0
;
return
0
;
...
@@ -52,7 +52,7 @@ int32 scriptlib::duel_get_turn_player(lua_State *L) {
...
@@ -52,7 +52,7 @@ int32 scriptlib::duel_get_turn_player(lua_State *L) {
int32
scriptlib
::
duel_get_turn_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_turn_count
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
lua_gettop
(
L
)
>
0
)
{
if
(
lua_gettop
(
L
)
>
0
)
{
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
lua_pushinteger
(
L
,
pduel
->
game_field
->
infos
.
turn_id_by_player
[
playerid
]);
lua_pushinteger
(
L
,
pduel
->
game_field
->
infos
.
turn_id_by_player
[
playerid
]);
...
@@ -63,7 +63,7 @@ int32 scriptlib::duel_get_turn_count(lua_State *L) {
...
@@ -63,7 +63,7 @@ int32 scriptlib::duel_get_turn_count(lua_State *L) {
int32
scriptlib
::
duel_get_draw_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_draw_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_draw_count
(
playerid
));
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_draw_count
(
playerid
));
...
@@ -73,7 +73,7 @@ int32 scriptlib::duel_register_effect(lua_State *L) {
...
@@ -73,7 +73,7 @@ int32 scriptlib::duel_register_effect(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
2
);
uint32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
peffect
->
pduel
;
duel
*
pduel
=
peffect
->
pduel
;
...
@@ -82,16 +82,16 @@ int32 scriptlib::duel_register_effect(lua_State *L) {
...
@@ -82,16 +82,16 @@ int32 scriptlib::duel_register_effect(lua_State *L) {
}
}
int32
scriptlib
::
duel_register_flag_effect
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_register_flag_effect
(
lua_State
*
L
)
{
check_param_count
(
L
,
5
);
check_param_count
(
L
,
5
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
code
=
(
lua_to
integer
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
code
=
(
lua_to
numberint
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
reset
=
lua_to
integer
(
L
,
3
);
int32
reset
=
lua_to
numberint
(
L
,
3
);
int32
flag
=
lua_to
integer
(
L
,
4
);
int32
flag
=
lua_to
numberint
(
L
,
4
);
int32
count
=
lua_to
integer
(
L
,
5
);
int32
count
=
lua_to
numberint
(
L
,
5
);
int32
lab
=
0
;
int32
lab
=
0
;
if
(
lua_gettop
(
L
)
>=
6
)
if
(
lua_gettop
(
L
)
>=
6
)
lab
=
lua_to
integer
(
L
,
6
);
lab
=
lua_to
numberint
(
L
,
6
);
if
(
count
==
0
)
if
(
count
==
0
)
count
=
1
;
count
=
1
;
if
(
reset
&
(
RESET_PHASE
)
&&
!
(
reset
&
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
)))
if
(
reset
&
(
RESET_PHASE
)
&&
!
(
reset
&
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
)))
...
@@ -115,10 +115,10 @@ int32 scriptlib::duel_register_flag_effect(lua_State *L) {
...
@@ -115,10 +115,10 @@ int32 scriptlib::duel_register_flag_effect(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_flag_effect
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_flag_effect
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
code
=
(
lua_to
integer
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
code
=
(
lua_to
numberint
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
effect_set
eset
;
effect_set
eset
;
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
...
@@ -127,10 +127,10 @@ int32 scriptlib::duel_get_flag_effect(lua_State *L) {
...
@@ -127,10 +127,10 @@ int32 scriptlib::duel_get_flag_effect(lua_State *L) {
}
}
int32
scriptlib
::
duel_reset_flag_effect
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_reset_flag_effect
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
code
=
(
lua_to
integer
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_to
numberint
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
auto
pr
=
pduel
->
game_field
->
effects
.
aura_effect
.
equal_range
(
code
);
auto
pr
=
pduel
->
game_field
->
effects
.
aura_effect
.
equal_range
(
code
);
for
(;
pr
.
first
!=
pr
.
second
;
)
{
for
(;
pr
.
first
!=
pr
.
second
;
)
{
...
@@ -143,11 +143,11 @@ int32 scriptlib::duel_reset_flag_effect(lua_State *L) {
...
@@ -143,11 +143,11 @@ int32 scriptlib::duel_reset_flag_effect(lua_State *L) {
}
}
int32
scriptlib
::
duel_set_flag_effect_label
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_set_flag_effect_label
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
code
=
(
lua_tounsigned
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_tounsigned
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
lab
=
lua_to
integer
(
L
,
3
);
int32
lab
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
effect_set
eset
;
effect_set
eset
;
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
...
@@ -161,7 +161,7 @@ int32 scriptlib::duel_set_flag_effect_label(lua_State *L) {
...
@@ -161,7 +161,7 @@ int32 scriptlib::duel_set_flag_effect_label(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_flag_effect_label
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_flag_effect_label
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
code
=
(
lua_tounsigned
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_tounsigned
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
...
@@ -190,10 +190,10 @@ int32 scriptlib::duel_destroy(lua_State *L) {
...
@@ -190,10 +190,10 @@ int32 scriptlib::duel_destroy(lua_State *L) {
pduel
=
pgroup
->
pduel
;
pduel
=
pgroup
->
pduel
;
}
else
}
else
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
uint32
reason
=
lua_to
integer
(
L
,
2
);
uint32
reason
=
lua_to
numberint
(
L
,
2
);
uint32
dest
=
LOCATION_GRAVE
;
uint32
dest
=
LOCATION_GRAVE
;
if
(
lua_gettop
(
L
)
>=
3
)
if
(
lua_gettop
(
L
)
>=
3
)
dest
=
lua_to
integer
(
L
,
3
);
dest
=
lua_to
numberint
(
L
,
3
);
if
(
pcard
)
if
(
pcard
)
pduel
->
game_field
->
destroy
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
PLAYER_NONE
,
dest
,
0
);
pduel
->
game_field
->
destroy
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
PLAYER_NONE
,
dest
,
0
);
else
else
...
@@ -215,8 +215,8 @@ int32 scriptlib::duel_remove(lua_State *L) {
...
@@ -215,8 +215,8 @@ int32 scriptlib::duel_remove(lua_State *L) {
pduel
=
pgroup
->
pduel
;
pduel
=
pgroup
->
pduel
;
}
else
}
else
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
uint32
pos
=
lua_to
integer
(
L
,
2
);
uint32
pos
=
lua_to
numberint
(
L
,
2
);
uint32
reason
=
lua_to
integer
(
L
,
3
);
uint32
reason
=
lua_to
numberint
(
L
,
3
);
if
(
pcard
)
if
(
pcard
)
pduel
->
game_field
->
send_to
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_REMOVED
,
0
,
pos
);
pduel
->
game_field
->
send_to
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_REMOVED
,
0
,
pos
);
else
else
...
@@ -238,7 +238,7 @@ int32 scriptlib::duel_sendto_grave(lua_State *L) {
...
@@ -238,7 +238,7 @@ int32 scriptlib::duel_sendto_grave(lua_State *L) {
pduel
=
pgroup
->
pduel
;
pduel
=
pgroup
->
pduel
;
}
else
}
else
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
uint32
reason
=
lua_to
integer
(
L
,
2
);
uint32
reason
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
)
if
(
pcard
)
pduel
->
game_field
->
send_to
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
POS_FACEUP
);
pduel
->
game_field
->
send_to
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
POS_FACEUP
);
else
else
...
@@ -255,17 +255,17 @@ int32 scriptlib::duel_summon(lua_State *L) {
...
@@ -255,17 +255,17 @@ int32 scriptlib::duel_summon(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_EFFECT
,
4
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
4
);
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
4
);
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
4
);
}
}
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
uint32
ignore_count
=
lua_toboolean
(
L
,
3
);
uint32
ignore_count
=
lua_toboolean
(
L
,
3
);
uint32
min_tribute
=
0
;
uint32
min_tribute
=
0
;
if
(
lua_gettop
(
L
)
>=
5
)
if
(
lua_gettop
(
L
)
>=
5
)
min_tribute
=
lua_to
integer
(
L
,
5
);
min_tribute
=
lua_to
numberint
(
L
,
5
);
uint32
zone
=
0x1f
;
uint32
zone
=
0x1f
;
if
(
lua_gettop
(
L
)
>=
6
)
if
(
lua_gettop
(
L
)
>=
6
)
zone
=
lua_to
integer
(
L
,
6
);
zone
=
lua_to
numberint
(
L
,
6
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
pduel
->
game_field
->
core
.
summon_cancelable
=
FALSE
;
pduel
->
game_field
->
core
.
summon_cancelable
=
FALSE
;
pduel
->
game_field
->
summon
(
playerid
,
pcard
,
peffect
,
ignore_count
,
min_tribute
,
zone
);
pduel
->
game_field
->
summon
(
playerid
,
pcard
,
peffect
,
ignore_count
,
min_tribute
,
zone
);
...
@@ -275,7 +275,7 @@ int32 scriptlib::duel_special_summon_rule(lua_State *L) {
...
@@ -275,7 +275,7 @@ int32 scriptlib::duel_special_summon_rule(lua_State *L) {
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
...
@@ -288,7 +288,7 @@ int32 scriptlib::duel_synchro_summon(lua_State *L) {
...
@@ -288,7 +288,7 @@ int32 scriptlib::duel_synchro_summon(lua_State *L) {
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
...
@@ -315,7 +315,7 @@ int32 scriptlib::duel_xyz_summon(lua_State *L) {
...
@@ -315,7 +315,7 @@ int32 scriptlib::duel_xyz_summon(lua_State *L) {
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
...
@@ -326,10 +326,10 @@ int32 scriptlib::duel_xyz_summon(lua_State *L) {
...
@@ -326,10 +326,10 @@ int32 scriptlib::duel_xyz_summon(lua_State *L) {
}
}
int32
minc
=
0
;
int32
minc
=
0
;
if
(
lua_gettop
(
L
)
>=
4
)
if
(
lua_gettop
(
L
)
>=
4
)
minc
=
lua_to
integer
(
L
,
4
);
minc
=
lua_to
numberint
(
L
,
4
);
int32
maxc
=
0
;
int32
maxc
=
0
;
if
(
lua_gettop
(
L
)
>=
5
)
if
(
lua_gettop
(
L
)
>=
5
)
maxc
=
lua_to
integer
(
L
,
5
);
maxc
=
lua_to
numberint
(
L
,
5
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
pduel
->
game_field
->
core
.
limit_xyz
=
materials
;
pduel
->
game_field
->
core
.
limit_xyz
=
materials
;
pduel
->
game_field
->
core
.
limit_xyz_minc
=
minc
;
pduel
->
game_field
->
core
.
limit_xyz_minc
=
minc
;
...
@@ -347,17 +347,17 @@ int32 scriptlib::duel_setm(lua_State *L) {
...
@@ -347,17 +347,17 @@ int32 scriptlib::duel_setm(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_EFFECT
,
4
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
4
);
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
4
);
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
4
);
}
}
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
uint32
ignore_count
=
lua_toboolean
(
L
,
3
);
uint32
ignore_count
=
lua_toboolean
(
L
,
3
);
uint32
min_tribute
=
0
;
uint32
min_tribute
=
0
;
if
(
lua_gettop
(
L
)
>=
5
)
if
(
lua_gettop
(
L
)
>=
5
)
min_tribute
=
lua_to
integer
(
L
,
5
);
min_tribute
=
lua_to
numberint
(
L
,
5
);
uint32
zone
=
0x1f
;
uint32
zone
=
0x1f
;
if
(
lua_gettop
(
L
)
>=
6
)
if
(
lua_gettop
(
L
)
>=
6
)
zone
=
lua_to
integer
(
L
,
6
);
zone
=
lua_to
numberint
(
L
,
6
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
pduel
->
game_field
->
core
.
summon_cancelable
=
FALSE
;
pduel
->
game_field
->
core
.
summon_cancelable
=
FALSE
;
pduel
->
game_field
->
mset
(
playerid
,
pcard
,
peffect
,
ignore_count
,
min_tribute
,
zone
);
pduel
->
game_field
->
mset
(
playerid
,
pcard
,
peffect
,
ignore_count
,
min_tribute
,
zone
);
...
@@ -366,12 +366,12 @@ int32 scriptlib::duel_setm(lua_State *L) {
...
@@ -366,12 +366,12 @@ int32 scriptlib::duel_setm(lua_State *L) {
int32
scriptlib
::
duel_sets
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_sets
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
toplayer
=
playerid
;
uint32
toplayer
=
playerid
;
if
(
lua_gettop
(
L
)
>
2
)
if
(
lua_gettop
(
L
)
>
2
)
toplayer
=
lua_to
integer
(
L
,
3
);
toplayer
=
lua_to
numberint
(
L
,
3
);
if
(
toplayer
!=
0
&&
toplayer
!=
1
)
if
(
toplayer
!=
0
&&
toplayer
!=
1
)
toplayer
=
playerid
;
toplayer
=
playerid
;
card
*
pcard
=
0
;
card
*
pcard
=
0
;
...
@@ -394,8 +394,8 @@ int32 scriptlib::duel_sets(lua_State *L) {
...
@@ -394,8 +394,8 @@ int32 scriptlib::duel_sets(lua_State *L) {
int32
scriptlib
::
duel_create_token
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_create_token
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
int32
code
=
lua_to
integer
(
L
,
2
);
int32
code
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
return
1
;
return
1
;
...
@@ -422,15 +422,15 @@ int32 scriptlib::duel_special_summon(lua_State *L) {
...
@@ -422,15 +422,15 @@ int32 scriptlib::duel_special_summon(lua_State *L) {
pduel
=
pgroup
->
pduel
;
pduel
=
pgroup
->
pduel
;
}
else
}
else
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
uint32
sumtype
=
lua_to
integer
(
L
,
2
);
uint32
sumtype
=
lua_to
numberint
(
L
,
2
);
uint32
sumplayer
=
lua_to
integer
(
L
,
3
);
uint32
sumplayer
=
lua_to
numberint
(
L
,
3
);
uint32
playerid
=
lua_to
integer
(
L
,
4
);
uint32
playerid
=
lua_to
numberint
(
L
,
4
);
uint32
nocheck
=
lua_toboolean
(
L
,
5
);
uint32
nocheck
=
lua_toboolean
(
L
,
5
);
uint32
nolimit
=
lua_toboolean
(
L
,
6
);
uint32
nolimit
=
lua_toboolean
(
L
,
6
);
uint32
positions
=
lua_to
integer
(
L
,
7
);
uint32
positions
=
lua_to
numberint
(
L
,
7
);
uint32
zone
=
0xff
;
uint32
zone
=
0xff
;
if
(
lua_gettop
(
L
)
>=
8
)
if
(
lua_gettop
(
L
)
>=
8
)
zone
=
lua_to
integer
(
L
,
8
);
zone
=
lua_to
numberint
(
L
,
8
);
if
(
pcard
)
{
if
(
pcard
)
{
field
::
card_set
cset
;
field
::
card_set
cset
;
cset
.
insert
(
pcard
);
cset
.
insert
(
pcard
);
...
@@ -446,15 +446,15 @@ int32 scriptlib::duel_special_summon_step(lua_State *L) {
...
@@ -446,15 +446,15 @@ int32 scriptlib::duel_special_summon_step(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
uint32
sumtype
=
lua_to
integer
(
L
,
2
);
uint32
sumtype
=
lua_to
numberint
(
L
,
2
);
uint32
sumplayer
=
lua_to
integer
(
L
,
3
);
uint32
sumplayer
=
lua_to
numberint
(
L
,
3
);
uint32
playerid
=
lua_to
integer
(
L
,
4
);
uint32
playerid
=
lua_to
numberint
(
L
,
4
);
uint32
nocheck
=
lua_toboolean
(
L
,
5
);
uint32
nocheck
=
lua_toboolean
(
L
,
5
);
uint32
nolimit
=
lua_toboolean
(
L
,
6
);
uint32
nolimit
=
lua_toboolean
(
L
,
6
);
uint32
positions
=
lua_to
integer
(
L
,
7
);
uint32
positions
=
lua_to
numberint
(
L
,
7
);
uint32
zone
=
0xff
;
uint32
zone
=
0xff
;
if
(
lua_gettop
(
L
)
>=
8
)
if
(
lua_gettop
(
L
)
>=
8
)
zone
=
lua_to
integer
(
L
,
8
);
zone
=
lua_to
numberint
(
L
,
8
);
pduel
->
game_field
->
special_summon_step
(
pcard
,
sumtype
,
sumplayer
,
playerid
,
nocheck
,
nolimit
,
positions
,
zone
);
pduel
->
game_field
->
special_summon_step
(
pcard
,
sumtype
,
sumplayer
,
playerid
,
nocheck
,
nolimit
,
positions
,
zone
);
pduel
->
game_field
->
core
.
subunits
.
back
().
type
=
PROCESSOR_SPSUMMON_STEP_S
;
pduel
->
game_field
->
core
.
subunits
.
back
().
type
=
PROCESSOR_SPSUMMON_STEP_S
;
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
...
@@ -479,10 +479,10 @@ int32 scriptlib::duel_sendto_hand(lua_State *L) {
...
@@ -479,10 +479,10 @@ int32 scriptlib::duel_sendto_hand(lua_State *L) {
pduel
=
pgroup
->
pduel
;
pduel
=
pgroup
->
pduel
;
}
else
}
else
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
2
);
uint32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
lua_isnil
(
L
,
2
)
||
(
playerid
!=
0
&&
playerid
!=
1
))
if
(
lua_isnil
(
L
,
2
)
||
(
playerid
!=
0
&&
playerid
!=
1
))
playerid
=
PLAYER_NONE
;
playerid
=
PLAYER_NONE
;
uint32
reason
=
lua_to
integer
(
L
,
3
);
uint32
reason
=
lua_to
numberint
(
L
,
3
);
if
(
pcard
)
if
(
pcard
)
pduel
->
game_field
->
send_to
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
playerid
,
LOCATION_HAND
,
0
,
POS_FACEUP
);
pduel
->
game_field
->
send_to
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
playerid
,
LOCATION_HAND
,
0
,
POS_FACEUP
);
else
else
...
@@ -504,11 +504,11 @@ int32 scriptlib::duel_sendto_deck(lua_State *L) {
...
@@ -504,11 +504,11 @@ int32 scriptlib::duel_sendto_deck(lua_State *L) {
pduel
=
pgroup
->
pduel
;
pduel
=
pgroup
->
pduel
;
}
else
}
else
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
2
);
uint32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
lua_isnil
(
L
,
2
)
||
(
playerid
!=
0
&&
playerid
!=
1
))
if
(
lua_isnil
(
L
,
2
)
||
(
playerid
!=
0
&&
playerid
!=
1
))
playerid
=
PLAYER_NONE
;
playerid
=
PLAYER_NONE
;
uint32
sequence
=
lua_to
integer
(
L
,
3
);
uint32
sequence
=
lua_to
numberint
(
L
,
3
);
uint32
reason
=
lua_to
integer
(
L
,
4
);
uint32
reason
=
lua_to
numberint
(
L
,
4
);
if
(
pcard
)
if
(
pcard
)
pduel
->
game_field
->
send_to
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
playerid
,
LOCATION_DECK
,
sequence
,
POS_FACEUP
);
pduel
->
game_field
->
send_to
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
playerid
,
LOCATION_DECK
,
sequence
,
POS_FACEUP
);
else
else
...
@@ -530,10 +530,10 @@ int32 scriptlib::duel_sendto_extra(lua_State *L) {
...
@@ -530,10 +530,10 @@ int32 scriptlib::duel_sendto_extra(lua_State *L) {
pduel
=
pgroup
->
pduel
;
pduel
=
pgroup
->
pduel
;
}
else
}
else
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
2
);
uint32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
lua_isnil
(
L
,
2
)
||
(
playerid
!=
0
&&
playerid
!=
1
))
if
(
lua_isnil
(
L
,
2
)
||
(
playerid
!=
0
&&
playerid
!=
1
))
playerid
=
PLAYER_NONE
;
playerid
=
PLAYER_NONE
;
uint32
reason
=
lua_to
integer
(
L
,
3
);
uint32
reason
=
lua_to
numberint
(
L
,
3
);
if
(
pcard
)
if
(
pcard
)
pduel
->
game_field
->
send_to
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
playerid
,
LOCATION_EXTRA
,
0
,
POS_FACEUP
);
pduel
->
game_field
->
send_to
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
playerid
,
LOCATION_EXTRA
,
0
,
POS_FACEUP
);
else
else
...
@@ -549,9 +549,9 @@ int32 scriptlib::duel_get_operated_group(lua_State *L) {
...
@@ -549,9 +549,9 @@ int32 scriptlib::duel_get_operated_group(lua_State *L) {
}
}
int32
scriptlib
::
duel_is_can_add_counter
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_can_add_counter
(
lua_State
*
L
)
{
check_param_count
(
L
,
4
);
check_param_count
(
L
,
4
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
int32
countertype
=
lua_to
integer
(
L
,
2
);
int32
countertype
=
lua_to
numberint
(
L
,
2
);
int32
count
=
lua_to
integer
(
L
,
3
);
int32
count
=
lua_to
numberint
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
4
);
check_param
(
L
,
PARAM_TYPE_CARD
,
4
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
4
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
4
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
...
@@ -565,40 +565,40 @@ int32 scriptlib::duel_is_can_add_counter(lua_State *L) {
...
@@ -565,40 +565,40 @@ int32 scriptlib::duel_is_can_add_counter(lua_State *L) {
int32
scriptlib
::
duel_remove_counter
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_remove_counter
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
6
);
check_param_count
(
L
,
6
);
uint32
rplayer
=
lua_to
integer
(
L
,
1
);
uint32
rplayer
=
lua_to
numberint
(
L
,
1
);
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
return
0
;
return
0
;
uint32
s
=
lua_to
integer
(
L
,
2
);
uint32
s
=
lua_to
numberint
(
L
,
2
);
uint32
o
=
lua_to
integer
(
L
,
3
);
uint32
o
=
lua_to
numberint
(
L
,
3
);
uint32
countertype
=
lua_to
integer
(
L
,
4
);
uint32
countertype
=
lua_to
numberint
(
L
,
4
);
uint32
count
=
lua_to
integer
(
L
,
5
);
uint32
count
=
lua_to
numberint
(
L
,
5
);
uint32
reason
=
lua_to
integer
(
L
,
6
);
uint32
reason
=
lua_to
numberint
(
L
,
6
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
remove_counter
(
reason
,
0
,
rplayer
,
s
,
o
,
countertype
,
count
);
pduel
->
game_field
->
remove_counter
(
reason
,
0
,
rplayer
,
s
,
o
,
countertype
,
count
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
}
}
int32
scriptlib
::
duel_is_can_remove_counter
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_can_remove_counter
(
lua_State
*
L
)
{
check_param_count
(
L
,
6
);
check_param_count
(
L
,
6
);
uint32
rplayer
=
lua_to
integer
(
L
,
1
);
uint32
rplayer
=
lua_to
numberint
(
L
,
1
);
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
return
0
;
return
0
;
uint32
s
=
lua_to
integer
(
L
,
2
);
uint32
s
=
lua_to
numberint
(
L
,
2
);
uint32
o
=
lua_to
integer
(
L
,
3
);
uint32
o
=
lua_to
numberint
(
L
,
3
);
uint32
countertype
=
lua_to
integer
(
L
,
4
);
uint32
countertype
=
lua_to
numberint
(
L
,
4
);
uint32
count
=
lua_to
integer
(
L
,
5
);
uint32
count
=
lua_to
numberint
(
L
,
5
);
uint32
reason
=
lua_to
integer
(
L
,
6
);
uint32
reason
=
lua_to
numberint
(
L
,
6
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_remove_counter
(
rplayer
,
0
,
s
,
o
,
countertype
,
count
,
reason
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_remove_counter
(
rplayer
,
0
,
s
,
o
,
countertype
,
count
,
reason
));
return
1
;
return
1
;
}
}
int32
scriptlib
::
duel_get_counter
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_counter
(
lua_State
*
L
)
{
check_param_count
(
L
,
4
);
check_param_count
(
L
,
4
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
s
=
lua_to
integer
(
L
,
2
);
uint32
s
=
lua_to
numberint
(
L
,
2
);
uint32
o
=
lua_to
integer
(
L
,
3
);
uint32
o
=
lua_to
numberint
(
L
,
3
);
uint32
countertype
=
lua_to
integer
(
L
,
4
);
uint32
countertype
=
lua_to
numberint
(
L
,
4
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_field_counter
(
playerid
,
s
,
o
,
countertype
));
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_field_counter
(
playerid
,
s
,
o
,
countertype
));
return
1
;
return
1
;
...
@@ -617,12 +617,12 @@ int32 scriptlib::duel_change_form(lua_State *L) {
...
@@ -617,12 +617,12 @@ int32 scriptlib::duel_change_form(lua_State *L) {
pduel
=
pgroup
->
pduel
;
pduel
=
pgroup
->
pduel
;
}
else
}
else
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
uint32
au
=
lua_to
integer
(
L
,
2
);
uint32
au
=
lua_to
numberint
(
L
,
2
);
uint32
ad
=
au
,
du
=
au
,
dd
=
au
,
flag
=
0
;
uint32
ad
=
au
,
du
=
au
,
dd
=
au
,
flag
=
0
;
uint32
top
=
lua_gettop
(
L
);
uint32
top
=
lua_gettop
(
L
);
if
(
top
>
2
)
ad
=
lua_to
integer
(
L
,
3
);
if
(
top
>
2
)
ad
=
lua_to
numberint
(
L
,
3
);
if
(
top
>
3
)
du
=
lua_to
integer
(
L
,
4
);
if
(
top
>
3
)
du
=
lua_to
numberint
(
L
,
4
);
if
(
top
>
4
)
dd
=
lua_to
integer
(
L
,
5
);
if
(
top
>
4
)
dd
=
lua_to
numberint
(
L
,
5
);
if
(
top
>
5
&&
lua_toboolean
(
L
,
6
))
flag
|=
NO_FLIP_EFFECT
;
if
(
top
>
5
&&
lua_toboolean
(
L
,
6
))
flag
|=
NO_FLIP_EFFECT
;
if
(
top
>
6
&&
lua_toboolean
(
L
,
7
))
flag
|=
FLIP_SET_AVAILABLE
;
if
(
top
>
6
&&
lua_toboolean
(
L
,
7
))
flag
|=
FLIP_SET_AVAILABLE
;
if
(
pcard
)
{
if
(
pcard
)
{
...
@@ -648,7 +648,7 @@ int32 scriptlib::duel_release(lua_State *L) {
...
@@ -648,7 +648,7 @@ int32 scriptlib::duel_release(lua_State *L) {
pduel
=
pgroup
->
pduel
;
pduel
=
pgroup
->
pduel
;
}
else
}
else
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
uint32
reason
=
lua_to
integer
(
L
,
2
);
uint32
reason
=
lua_to
numberint
(
L
,
2
);
if
(
pcard
)
if
(
pcard
)
pduel
->
game_field
->
release
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
);
pduel
->
game_field
->
release
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
);
else
else
...
@@ -661,12 +661,12 @@ int32 scriptlib::duel_move_to_field(lua_State *L) {
...
@@ -661,12 +661,12 @@ int32 scriptlib::duel_move_to_field(lua_State *L) {
check_param_count
(
L
,
6
);
check_param_count
(
L
,
6
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
move_player
=
lua_to
integer
(
L
,
2
);
uint32
move_player
=
lua_to
numberint
(
L
,
2
);
uint32
playerid
=
lua_to
integer
(
L
,
3
);
uint32
playerid
=
lua_to
numberint
(
L
,
3
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
destination
=
lua_to
integer
(
L
,
4
);
uint32
destination
=
lua_to
numberint
(
L
,
4
);
uint32
positions
=
lua_to
integer
(
L
,
5
);
uint32
positions
=
lua_to
numberint
(
L
,
5
);
uint32
enable
=
lua_toboolean
(
L
,
6
);
uint32
enable
=
lua_toboolean
(
L
,
6
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
pcard
->
enable_field_effect
(
false
);
pcard
->
enable_field_effect
(
false
);
...
@@ -684,10 +684,10 @@ int32 scriptlib::duel_return_to_field(lua_State *L) {
...
@@ -684,10 +684,10 @@ int32 scriptlib::duel_return_to_field(lua_State *L) {
return
0
;
return
0
;
int32
pos
=
pcard
->
previous
.
position
;
int32
pos
=
pcard
->
previous
.
position
;
if
(
lua_gettop
(
L
)
>=
2
)
if
(
lua_gettop
(
L
)
>=
2
)
pos
=
lua_to
integer
(
L
,
2
);
pos
=
lua_to
numberint
(
L
,
2
);
uint32
zone
=
0xff
;
uint32
zone
=
0xff
;
if
(
lua_gettop
(
L
)
>=
3
)
if
(
lua_gettop
(
L
)
>=
3
)
zone
=
lua_to
integer
(
L
,
3
);
zone
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
pcard
->
enable_field_effect
(
false
);
pcard
->
enable_field_effect
(
false
);
pduel
->
game_field
->
adjust_instant
();
pduel
->
game_field
->
adjust_instant
();
...
@@ -700,7 +700,7 @@ int32 scriptlib::duel_move_sequence(lua_State *L) {
...
@@ -700,7 +700,7 @@ int32 scriptlib::duel_move_sequence(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
seq
=
lua_to
integer
(
L
,
2
);
int32
seq
=
lua_to
numberint
(
L
,
2
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
pduel
->
game_field
->
move_card
(
pcard
->
current
.
controler
,
pcard
,
pcard
->
current
.
location
,
seq
);
pduel
->
game_field
->
move_card
(
pcard
->
current
.
controler
,
pcard
,
pcard
->
current
.
location
,
seq
);
return
0
;
return
0
;
...
@@ -758,7 +758,7 @@ int32 scriptlib::duel_set_chain_limit_p(lua_State *L) {
...
@@ -758,7 +758,7 @@ int32 scriptlib::duel_set_chain_limit_p(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_chain_material
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_chain_material
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -771,10 +771,10 @@ int32 scriptlib::duel_get_chain_material(lua_State *L) {
...
@@ -771,10 +771,10 @@ int32 scriptlib::duel_get_chain_material(lua_State *L) {
}
}
int32
scriptlib
::
duel_confirm_decktop
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_confirm_decktop
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
count
=
lua_to
integer
(
L
,
2
);
uint32
count
=
lua_to
numberint
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
count
>=
pduel
->
game_field
->
player
[
playerid
].
list_main
.
size
())
if
(
count
>=
pduel
->
game_field
->
player
[
playerid
].
list_main
.
size
())
count
=
pduel
->
game_field
->
player
[
playerid
].
list_main
.
size
();
count
=
pduel
->
game_field
->
player
[
playerid
].
list_main
.
size
();
...
@@ -807,7 +807,7 @@ int32 scriptlib::duel_confirm_decktop(lua_State *L) {
...
@@ -807,7 +807,7 @@ int32 scriptlib::duel_confirm_decktop(lua_State *L) {
}
}
int32
scriptlib
::
duel_confirm_cards
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_confirm_cards
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
card
*
pcard
=
0
;
card
*
pcard
=
0
;
...
@@ -846,9 +846,9 @@ int32 scriptlib::duel_confirm_cards(lua_State *L) {
...
@@ -846,9 +846,9 @@ int32 scriptlib::duel_confirm_cards(lua_State *L) {
int32
scriptlib
::
duel_sort_decktop
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_sort_decktop
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
sort_player
=
lua_to
integer
(
L
,
1
);
uint32
sort_player
=
lua_to
numberint
(
L
,
1
);
uint32
target_player
=
lua_to
integer
(
L
,
2
);
uint32
target_player
=
lua_to
numberint
(
L
,
2
);
uint32
count
=
lua_to
integer
(
L
,
3
);
uint32
count
=
lua_to
numberint
(
L
,
3
);
if
(
sort_player
!=
0
&&
sort_player
!=
1
)
if
(
sort_player
!=
0
&&
sort_player
!=
1
)
return
0
;
return
0
;
if
(
target_player
!=
0
&&
target_player
!=
1
)
if
(
target_player
!=
0
&&
target_player
!=
1
)
...
@@ -862,7 +862,7 @@ int32 scriptlib::duel_sort_decktop(lua_State *L) {
...
@@ -862,7 +862,7 @@ int32 scriptlib::duel_sort_decktop(lua_State *L) {
int32
scriptlib
::
duel_check_event
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_check_event
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
ev
=
lua_to
integer
(
L
,
1
);
int32
ev
=
lua_to
numberint
(
L
,
1
);
int32
get_info
=
lua_toboolean
(
L
,
2
);
int32
get_info
=
lua_toboolean
(
L
,
2
);
if
(
!
get_info
)
{
if
(
!
get_info
)
{
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_event
(
ev
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_event
(
ev
));
...
@@ -898,16 +898,16 @@ int32 scriptlib::duel_raise_event(lua_State *L) {
...
@@ -898,16 +898,16 @@ int32 scriptlib::duel_raise_event(lua_State *L) {
pduel
=
pgroup
->
pduel
;
pduel
=
pgroup
->
pduel
;
}
else
}
else
return
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
return
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
uint32
code
=
lua_to
integer
(
L
,
2
);
uint32
code
=
lua_to
numberint
(
L
,
2
);
effect
*
peffect
=
0
;
effect
*
peffect
=
0
;
if
(
!
lua_isnil
(
L
,
3
))
{
if
(
!
lua_isnil
(
L
,
3
))
{
check_param
(
L
,
PARAM_TYPE_EFFECT
,
3
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
3
);
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
3
);
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
3
);
}
}
uint32
r
=
lua_to
integer
(
L
,
4
);
uint32
r
=
lua_to
numberint
(
L
,
4
);
uint32
rp
=
lua_to
integer
(
L
,
5
);
uint32
rp
=
lua_to
numberint
(
L
,
5
);
uint32
ep
=
lua_to
integer
(
L
,
6
);
uint32
ep
=
lua_to
numberint
(
L
,
6
);
uint32
ev
=
lua_to
integer
(
L
,
7
);
uint32
ev
=
lua_to
numberint
(
L
,
7
);
if
(
pcard
)
if
(
pcard
)
pduel
->
game_field
->
raise_event
(
pcard
,
code
,
peffect
,
r
,
rp
,
ep
,
ev
);
pduel
->
game_field
->
raise_event
(
pcard
,
code
,
peffect
,
r
,
rp
,
ep
,
ev
);
else
else
...
@@ -920,16 +920,16 @@ int32 scriptlib::duel_raise_single_event(lua_State *L) {
...
@@ -920,16 +920,16 @@ int32 scriptlib::duel_raise_single_event(lua_State *L) {
check_param_count
(
L
,
7
);
check_param_count
(
L
,
7
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
lua_to
integer
(
L
,
2
);
uint32
code
=
lua_to
numberint
(
L
,
2
);
effect
*
peffect
=
0
;
effect
*
peffect
=
0
;
if
(
!
lua_isnil
(
L
,
3
))
{
if
(
!
lua_isnil
(
L
,
3
))
{
check_param
(
L
,
PARAM_TYPE_EFFECT
,
3
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
3
);
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
3
);
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
3
);
}
}
uint32
r
=
lua_to
integer
(
L
,
4
);
uint32
r
=
lua_to
numberint
(
L
,
4
);
uint32
rp
=
lua_to
integer
(
L
,
5
);
uint32
rp
=
lua_to
numberint
(
L
,
5
);
uint32
ep
=
lua_to
integer
(
L
,
6
);
uint32
ep
=
lua_to
numberint
(
L
,
6
);
uint32
ev
=
lua_to
integer
(
L
,
7
);
uint32
ev
=
lua_to
numberint
(
L
,
7
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
pduel
->
game_field
->
raise_single_event
(
pcard
,
0
,
code
,
peffect
,
r
,
rp
,
ep
,
ev
);
pduel
->
game_field
->
raise_single_event
(
pcard
,
0
,
code
,
peffect
,
r
,
rp
,
ep
,
ev
);
pduel
->
game_field
->
process_single_event
();
pduel
->
game_field
->
process_single_event
();
...
@@ -938,7 +938,7 @@ int32 scriptlib::duel_raise_single_event(lua_State *L) {
...
@@ -938,7 +938,7 @@ int32 scriptlib::duel_raise_single_event(lua_State *L) {
int32
scriptlib
::
duel_check_timing
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_check_timing
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
tm
=
lua_to
integer
(
L
,
1
);
int32
tm
=
lua_to
numberint
(
L
,
1
);
lua_pushboolean
(
L
,
(
pduel
->
game_field
->
core
.
hint_timing
[
0
]
&
tm
)
||
(
pduel
->
game_field
->
core
.
hint_timing
[
1
]
&
tm
));
lua_pushboolean
(
L
,
(
pduel
->
game_field
->
core
.
hint_timing
[
0
]
&
tm
)
||
(
pduel
->
game_field
->
core
.
hint_timing
[
1
]
&
tm
));
return
1
;
return
1
;
}
}
...
@@ -967,13 +967,13 @@ int32 scriptlib::duel_get_environment(lua_State *L) {
...
@@ -967,13 +967,13 @@ int32 scriptlib::duel_get_environment(lua_State *L) {
}
}
int32
scriptlib
::
duel_is_environment
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_environment
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
code
=
lua_to
integer
(
L
,
1
);
uint32
code
=
lua_to
numberint
(
L
,
1
);
uint32
playerid
=
PLAYER_ALL
;
uint32
playerid
=
PLAYER_ALL
;
if
(
lua_gettop
(
L
)
>=
2
)
if
(
lua_gettop
(
L
)
>=
2
)
playerid
=
lua_to
integer
(
L
,
2
);
playerid
=
lua_to
numberint
(
L
,
2
);
uint32
loc
=
LOCATION_FZONE
+
LOCATION_ONFIELD
;
uint32
loc
=
LOCATION_FZONE
+
LOCATION_ONFIELD
;
if
(
lua_gettop
(
L
)
>=
3
)
if
(
lua_gettop
(
L
)
>=
3
)
loc
=
lua_to
integer
(
L
,
3
);
loc
=
lua_to
numberint
(
L
,
3
);
if
(
playerid
!=
0
&&
playerid
!=
1
&&
playerid
!=
PLAYER_ALL
)
if
(
playerid
!=
0
&&
playerid
!=
1
&&
playerid
!=
PLAYER_ALL
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -1038,8 +1038,8 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
...
@@ -1038,8 +1038,8 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
}
}
int32
scriptlib
::
duel_win
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_win
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
uint32
reason
=
lua_to
integer
(
L
,
2
);
uint32
reason
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
&&
playerid
!=
2
)
if
(
playerid
!=
0
&&
playerid
!=
1
&&
playerid
!=
2
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -1052,11 +1052,11 @@ int32 scriptlib::duel_win(lua_State *L) {
...
@@ -1052,11 +1052,11 @@ int32 scriptlib::duel_win(lua_State *L) {
int32
scriptlib
::
duel_draw
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_draw
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
count
=
lua_to
integer
(
L
,
2
);
uint32
count
=
lua_to
numberint
(
L
,
2
);
uint32
reason
=
lua_to
integer
(
L
,
3
);
uint32
reason
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
draw
(
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
playerid
,
count
);
pduel
->
game_field
->
draw
(
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
playerid
,
count
);
pduel
->
game_field
->
core
.
subunits
.
back
().
type
=
PROCESSOR_DRAW_S
;
pduel
->
game_field
->
core
.
subunits
.
back
().
type
=
PROCESSOR_DRAW_S
;
...
@@ -1065,13 +1065,13 @@ int32 scriptlib::duel_draw(lua_State *L) {
...
@@ -1065,13 +1065,13 @@ int32 scriptlib::duel_draw(lua_State *L) {
int32
scriptlib
::
duel_damage
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_damage
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
amount
=
lua_to
integer
(
L
,
2
);
int32
amount
=
lua_to
numberint
(
L
,
2
);
if
(
amount
<
0
)
if
(
amount
<
0
)
amount
=
0
;
amount
=
0
;
uint32
reason
=
lua_to
integer
(
L
,
3
);
uint32
reason
=
lua_to
numberint
(
L
,
3
);
uint32
is_step
=
FALSE
;
uint32
is_step
=
FALSE
;
if
(
lua_gettop
(
L
)
>=
4
)
if
(
lua_gettop
(
L
)
>=
4
)
is_step
=
lua_toboolean
(
L
,
4
);
is_step
=
lua_toboolean
(
L
,
4
);
...
@@ -1083,13 +1083,13 @@ int32 scriptlib::duel_damage(lua_State *L) {
...
@@ -1083,13 +1083,13 @@ int32 scriptlib::duel_damage(lua_State *L) {
int32
scriptlib
::
duel_recover
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_recover
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
amount
=
lua_to
integer
(
L
,
2
);
int32
amount
=
lua_to
numberint
(
L
,
2
);
if
(
amount
<
0
)
if
(
amount
<
0
)
amount
=
0
;
amount
=
0
;
uint32
reason
=
lua_to
integer
(
L
,
3
);
uint32
reason
=
lua_to
numberint
(
L
,
3
);
uint32
is_step
=
FALSE
;
uint32
is_step
=
FALSE
;
if
(
lua_gettop
(
L
)
>=
4
)
if
(
lua_gettop
(
L
)
>=
4
)
is_step
=
lua_toboolean
(
L
,
4
);
is_step
=
lua_toboolean
(
L
,
4
);
...
@@ -1108,7 +1108,7 @@ int32 scriptlib::duel_equip(lua_State *L) {
...
@@ -1108,7 +1108,7 @@ int32 scriptlib::duel_equip(lua_State *L) {
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
3
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
card
*
equip_card
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
equip_card
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
...
@@ -1159,18 +1159,18 @@ int32 scriptlib::duel_get_control(lua_State *L) {
...
@@ -1159,18 +1159,18 @@ int32 scriptlib::duel_get_control(lua_State *L) {
pduel
=
pgroup
->
pduel
;
pduel
=
pgroup
->
pduel
;
}
else
}
else
return
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
return
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
2
);
uint32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
reset_phase
=
0
;
uint32
reset_phase
=
0
;
uint32
reset_count
=
0
;
uint32
reset_count
=
0
;
if
(
lua_gettop
(
L
)
>=
3
)
{
if
(
lua_gettop
(
L
)
>=
3
)
{
reset_phase
=
lua_to
integer
(
L
,
3
)
&
0x3ff
;
reset_phase
=
lua_to
numberint
(
L
,
3
)
&
0x3ff
;
reset_count
=
lua_to
integer
(
L
,
4
)
&
0xff
;
reset_count
=
lua_to
numberint
(
L
,
4
)
&
0xff
;
}
}
uint32
zone
=
0xff
;
uint32
zone
=
0xff
;
if
(
lua_gettop
(
L
)
>=
5
)
if
(
lua_gettop
(
L
)
>=
5
)
zone
=
lua_to
integer
(
L
,
5
);
zone
=
lua_to
numberint
(
L
,
5
);
if
(
pcard
)
if
(
pcard
)
pduel
->
game_field
->
get_control
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
pduel
->
game_field
->
core
.
reason_player
,
playerid
,
reset_phase
,
reset_count
,
zone
);
pduel
->
game_field
->
get_control
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
pduel
->
game_field
->
core
.
reason_player
,
playerid
,
reset_phase
,
reset_count
,
zone
);
else
else
...
@@ -1199,8 +1199,8 @@ int32 scriptlib::duel_swap_control(lua_State *L) {
...
@@ -1199,8 +1199,8 @@ int32 scriptlib::duel_swap_control(lua_State *L) {
uint32
reset_phase
=
0
;
uint32
reset_phase
=
0
;
uint32
reset_count
=
0
;
uint32
reset_count
=
0
;
if
(
lua_gettop
(
L
)
>
2
)
{
if
(
lua_gettop
(
L
)
>
2
)
{
reset_phase
=
lua_to
integer
(
L
,
3
)
&
0x3ff
;
reset_phase
=
lua_to
numberint
(
L
,
3
)
&
0x3ff
;
reset_count
=
lua_to
integer
(
L
,
4
)
&
0xff
;
reset_count
=
lua_to
numberint
(
L
,
4
)
&
0xff
;
}
}
if
(
pcard1
)
if
(
pcard1
)
pduel
->
game_field
->
swap_control
(
pduel
->
game_field
->
core
.
reason_effect
,
pduel
->
game_field
->
core
.
reason_player
,
pcard1
,
pcard2
,
reset_phase
,
reset_count
);
pduel
->
game_field
->
swap_control
(
pduel
->
game_field
->
core
.
reason_effect
,
pduel
->
game_field
->
core
.
reason_player
,
pcard1
,
pcard2
,
reset_phase
,
reset_count
);
...
@@ -1211,10 +1211,10 @@ int32 scriptlib::duel_swap_control(lua_State *L) {
...
@@ -1211,10 +1211,10 @@ int32 scriptlib::duel_swap_control(lua_State *L) {
}
}
int32
scriptlib
::
duel_check_lp_cost
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_check_lp_cost
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
cost
=
lua_to
integer
(
L
,
2
);
uint32
cost
=
lua_to
numberint
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_lp_cost
(
playerid
,
cost
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_lp_cost
(
playerid
,
cost
));
return
1
;
return
1
;
...
@@ -1222,10 +1222,10 @@ int32 scriptlib::duel_check_lp_cost(lua_State *L) {
...
@@ -1222,10 +1222,10 @@ int32 scriptlib::duel_check_lp_cost(lua_State *L) {
int32
scriptlib
::
duel_pay_lp_cost
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_pay_lp_cost
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
cost
=
lua_to
integer
(
L
,
2
);
uint32
cost
=
lua_to
numberint
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
add_process
(
PROCESSOR_PAY_LPCOST
,
0
,
0
,
0
,
playerid
,
cost
);
pduel
->
game_field
->
add_process
(
PROCESSOR_PAY_LPCOST
,
0
,
0
,
0
,
playerid
,
cost
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
...
@@ -1233,9 +1233,9 @@ int32 scriptlib::duel_pay_lp_cost(lua_State *L) {
...
@@ -1233,9 +1233,9 @@ int32 scriptlib::duel_pay_lp_cost(lua_State *L) {
int32
scriptlib
::
duel_discard_deck
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_discard_deck
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
uint32
count
=
lua_to
integer
(
L
,
2
);
uint32
count
=
lua_to
numberint
(
L
,
2
);
uint32
reason
=
lua_to
integer
(
L
,
3
);
uint32
reason
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
add_process
(
PROCESSOR_DISCARD_DECK_S
,
0
,
0
,
0
,
playerid
+
(
count
<<
16
),
reason
);
pduel
->
game_field
->
add_process
(
PROCESSOR_DISCARD_DECK_S
,
0
,
0
,
0
,
playerid
+
(
count
<<
16
),
reason
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
...
@@ -1256,10 +1256,10 @@ int32 scriptlib::duel_discard_hand(lua_State *L) {
...
@@ -1256,10 +1256,10 @@ int32 scriptlib::duel_discard_hand(lua_State *L) {
extraargs
=
lua_gettop
(
L
)
-
6
;
extraargs
=
lua_gettop
(
L
)
-
6
;
}
}
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
uint32
min
=
lua_to
integer
(
L
,
3
);
uint32
min
=
lua_to
numberint
(
L
,
3
);
uint32
max
=
lua_to
integer
(
L
,
4
);
uint32
max
=
lua_to
numberint
(
L
,
4
);
uint32
reason
=
lua_to
integer
(
L
,
5
);
uint32
reason
=
lua_to
numberint
(
L
,
5
);
group
*
pgroup
=
pduel
->
new_group
();
group
*
pgroup
=
pduel
->
new_group
();
pduel
->
game_field
->
filter_matching_card
(
2
,
playerid
,
LOCATION_HAND
,
0
,
pgroup
,
pexception
,
pexgroup
,
extraargs
);
pduel
->
game_field
->
filter_matching_card
(
2
,
playerid
,
LOCATION_HAND
,
0
,
pgroup
,
pexception
,
pexgroup
,
extraargs
);
pduel
->
game_field
->
core
.
select_cards
.
assign
(
pgroup
->
container
.
begin
(),
pgroup
->
container
.
end
());
pduel
->
game_field
->
core
.
select_cards
.
assign
(
pgroup
->
container
.
begin
(),
pgroup
->
container
.
end
());
...
@@ -1280,7 +1280,7 @@ int32 scriptlib::duel_disable_shuffle_check(lua_State *L) {
...
@@ -1280,7 +1280,7 @@ int32 scriptlib::duel_disable_shuffle_check(lua_State *L) {
}
}
int32
scriptlib
::
duel_shuffle_deck
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_shuffle_deck
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -1289,7 +1289,7 @@ int32 scriptlib::duel_shuffle_deck(lua_State *L) {
...
@@ -1289,7 +1289,7 @@ int32 scriptlib::duel_shuffle_deck(lua_State *L) {
}
}
int32
scriptlib
::
duel_shuffle_hand
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_shuffle_hand
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -1425,7 +1425,7 @@ int32 scriptlib::duel_calculate_damage(lua_State *L) {
...
@@ -1425,7 +1425,7 @@ int32 scriptlib::duel_calculate_damage(lua_State *L) {
int32
scriptlib
::
duel_get_battle_damage
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_battle_damage
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
battle_damage
[
playerid
]);
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
battle_damage
[
playerid
]);
...
@@ -1434,8 +1434,8 @@ int32 scriptlib::duel_get_battle_damage(lua_State *L) {
...
@@ -1434,8 +1434,8 @@ int32 scriptlib::duel_get_battle_damage(lua_State *L) {
int32
scriptlib
::
duel_change_battle_damage
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_change_battle_damage
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
int32
dam
=
lua_to
integer
(
L
,
2
);
int32
dam
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
check
=
TRUE
;
int32
check
=
TRUE
;
...
@@ -1449,7 +1449,7 @@ int32 scriptlib::duel_change_battle_damage(lua_State *L) {
...
@@ -1449,7 +1449,7 @@ int32 scriptlib::duel_change_battle_damage(lua_State *L) {
int32
scriptlib
::
duel_change_target
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_change_target
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
2
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
2
);
uint32
count
=
lua_to
integer
(
L
,
1
);
uint32
count
=
lua_to
numberint
(
L
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
2
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
change_target
(
count
,
pgroup
);
pduel
->
game_field
->
change_target
(
count
,
pgroup
);
...
@@ -1457,8 +1457,8 @@ int32 scriptlib::duel_change_target(lua_State *L) {
...
@@ -1457,8 +1457,8 @@ int32 scriptlib::duel_change_target(lua_State *L) {
}
}
int32
scriptlib
::
duel_change_target_player
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_change_target_player
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
uint32
count
=
lua_to
integer
(
L
,
1
);
uint32
count
=
lua_to
numberint
(
L
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
2
);
uint32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -1467,8 +1467,8 @@ int32 scriptlib::duel_change_target_player(lua_State *L) {
...
@@ -1467,8 +1467,8 @@ int32 scriptlib::duel_change_target_player(lua_State *L) {
}
}
int32
scriptlib
::
duel_change_target_param
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_change_target_param
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
uint32
count
=
lua_to
integer
(
L
,
1
);
uint32
count
=
lua_to
numberint
(
L
,
1
);
uint32
param
=
lua_to
integer
(
L
,
2
);
uint32
param
=
lua_to
numberint
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
change_target_param
(
count
,
param
);
pduel
->
game_field
->
change_target_param
(
count
,
param
);
return
0
;
return
0
;
...
@@ -1483,21 +1483,21 @@ int32 scriptlib::duel_change_effect(lua_State *L) {
...
@@ -1483,21 +1483,21 @@ int32 scriptlib::duel_change_effect(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
2
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
count
=
lua_to
integer
(
L
,
1
);
uint32
count
=
lua_to
numberint
(
L
,
1
);
int32
pf
=
interpreter
::
get_function_handle
(
L
,
2
);
int32
pf
=
interpreter
::
get_function_handle
(
L
,
2
);
pduel
->
game_field
->
change_chain_effect
(
count
,
pf
);
pduel
->
game_field
->
change_chain_effect
(
count
,
pf
);
return
0
;
return
0
;
}
}
int32
scriptlib
::
duel_negate_activate
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_negate_activate
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
c
=
lua_to
integer
(
L
,
1
);
uint32
c
=
lua_to
numberint
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
negate_chain
(
c
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
negate_chain
(
c
));
return
1
;
return
1
;
}
}
int32
scriptlib
::
duel_negate_effect
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_negate_effect
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
c
=
lua_to
integer
(
L
,
1
);
uint32
c
=
lua_to
numberint
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
disable_chain
(
c
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
disable_chain
(
c
));
return
1
;
return
1
;
...
@@ -1506,7 +1506,7 @@ int32 scriptlib::duel_negate_related_chain(lua_State *L) {
...
@@ -1506,7 +1506,7 @@ int32 scriptlib::duel_negate_related_chain(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
reset_flag
=
lua_to
integer
(
L
,
2
);
uint32
reset_flag
=
lua_to
numberint
(
L
,
2
);
duel
*
pduel
=
pcard
->
pduel
;
duel
*
pduel
=
pcard
->
pduel
;
if
(
pduel
->
game_field
->
core
.
current_chain
.
size
()
<
2
)
if
(
pduel
->
game_field
->
core
.
current_chain
.
size
()
<
2
)
return
0
;
return
0
;
...
@@ -1582,26 +1582,26 @@ int32 scriptlib::duel_check_summon_count(lua_State *L) {
...
@@ -1582,26 +1582,26 @@ int32 scriptlib::duel_check_summon_count(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_location_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_location_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
uint32
location
=
lua_to
integer
(
L
,
2
);
uint32
location
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
uplayer
=
pduel
->
game_field
->
core
.
reason_player
;
uint32
uplayer
=
pduel
->
game_field
->
core
.
reason_player
;
uint32
reason
=
LOCATION_REASON_TOFIELD
;
uint32
reason
=
LOCATION_REASON_TOFIELD
;
if
(
lua_gettop
(
L
)
>=
3
&&
!
lua_isnil
(
L
,
3
))
if
(
lua_gettop
(
L
)
>=
3
&&
!
lua_isnil
(
L
,
3
))
uplayer
=
lua_to
integer
(
L
,
3
);
uplayer
=
lua_to
numberint
(
L
,
3
);
if
(
lua_gettop
(
L
)
>=
4
)
if
(
lua_gettop
(
L
)
>=
4
)
reason
=
lua_to
integer
(
L
,
4
);
reason
=
lua_to
numberint
(
L
,
4
);
uint32
zone
=
0xff
;
uint32
zone
=
0xff
;
if
(
lua_gettop
(
L
)
>=
5
)
if
(
lua_gettop
(
L
)
>=
5
)
zone
=
lua_to
integer
(
L
,
5
);
zone
=
lua_to
numberint
(
L
,
5
);
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_useable_count
(
playerid
,
location
,
uplayer
,
reason
,
zone
));
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_useable_count
(
playerid
,
location
,
uplayer
,
reason
,
zone
));
return
1
;
return
1
;
}
}
int32
scriptlib
::
duel_get_mzone_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_mzone_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -1638,11 +1638,11 @@ int32 scriptlib::duel_get_mzone_count(lua_State *L) {
...
@@ -1638,11 +1638,11 @@ int32 scriptlib::duel_get_mzone_count(lua_State *L) {
uint32
reason
=
LOCATION_REASON_TOFIELD
;
uint32
reason
=
LOCATION_REASON_TOFIELD
;
uint32
zone
=
0xff
;
uint32
zone
=
0xff
;
if
(
lua_gettop
(
L
)
>=
3
)
if
(
lua_gettop
(
L
)
>=
3
)
uplayer
=
lua_to
integer
(
L
,
3
);
uplayer
=
lua_to
numberint
(
L
,
3
);
if
(
lua_gettop
(
L
)
>=
4
)
if
(
lua_gettop
(
L
)
>=
4
)
reason
=
lua_to
integer
(
L
,
4
);
reason
=
lua_to
numberint
(
L
,
4
);
if
(
lua_gettop
(
L
)
>=
5
)
if
(
lua_gettop
(
L
)
>=
5
)
zone
=
lua_to
integer
(
L
,
5
);
zone
=
lua_to
numberint
(
L
,
5
);
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_useable_count
(
playerid
,
LOCATION_MZONE
,
uplayer
,
reason
,
zone
));
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_useable_count
(
playerid
,
LOCATION_MZONE
,
uplayer
,
reason
,
zone
));
if
(
swapped
)
{
if
(
swapped
)
{
pduel
->
game_field
->
player
[
0
].
used_location
=
used_location
[
0
];
pduel
->
game_field
->
player
[
0
].
used_location
=
used_location
[
0
];
...
@@ -1654,13 +1654,13 @@ int32 scriptlib::duel_get_mzone_count(lua_State *L) {
...
@@ -1654,13 +1654,13 @@ int32 scriptlib::duel_get_mzone_count(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_location_count_fromex
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_location_count_fromex
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
uplayer
=
pduel
->
game_field
->
core
.
reason_player
;
uint32
uplayer
=
pduel
->
game_field
->
core
.
reason_player
;
if
(
lua_gettop
(
L
)
>=
2
)
if
(
lua_gettop
(
L
)
>=
2
)
uplayer
=
lua_to
integer
(
L
,
2
);
uplayer
=
lua_to
numberint
(
L
,
2
);
bool
swapped
=
false
;
bool
swapped
=
false
;
card
*
mcard
=
0
;
card
*
mcard
=
0
;
group
*
mgroup
=
0
;
group
*
mgroup
=
0
;
...
@@ -1710,13 +1710,13 @@ int32 scriptlib::duel_get_location_count_fromex(lua_State *L) {
...
@@ -1710,13 +1710,13 @@ int32 scriptlib::duel_get_location_count_fromex(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_usable_mzone_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_usable_mzone_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
uplayer
=
pduel
->
game_field
->
core
.
reason_player
;
uint32
uplayer
=
pduel
->
game_field
->
core
.
reason_player
;
if
(
lua_gettop
(
L
)
>=
2
)
if
(
lua_gettop
(
L
)
>=
2
)
uplayer
=
lua_to
integer
(
L
,
2
);
uplayer
=
lua_to
numberint
(
L
,
2
);
uint32
zone
=
0xff
;
uint32
zone
=
0xff
;
if
(
pduel
->
game_field
->
core
.
duel_rule
>=
4
)
{
if
(
pduel
->
game_field
->
core
.
duel_rule
>=
4
)
{
uint32
flag1
,
flag2
;
uint32
flag1
,
flag2
;
...
@@ -1734,11 +1734,11 @@ int32 scriptlib::duel_get_usable_mzone_count(lua_State *L) {
...
@@ -1734,11 +1734,11 @@ int32 scriptlib::duel_get_usable_mzone_count(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_linked_group
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_linked_group
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
rplayer
=
lua_to
integer
(
L
,
1
);
uint32
rplayer
=
lua_to
numberint
(
L
,
1
);
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
return
0
;
return
0
;
uint32
s
=
lua_to
integer
(
L
,
2
);
uint32
s
=
lua_to
numberint
(
L
,
2
);
uint32
o
=
lua_to
integer
(
L
,
3
);
uint32
o
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
field
::
card_set
cset
;
field
::
card_set
cset
;
pduel
->
game_field
->
get_linked_cards
(
rplayer
,
s
,
o
,
&
cset
);
pduel
->
game_field
->
get_linked_cards
(
rplayer
,
s
,
o
,
&
cset
);
...
@@ -1748,11 +1748,11 @@ int32 scriptlib::duel_get_linked_group(lua_State *L) {
...
@@ -1748,11 +1748,11 @@ int32 scriptlib::duel_get_linked_group(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_linked_group_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_linked_group_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
rplayer
=
lua_to
integer
(
L
,
1
);
uint32
rplayer
=
lua_to
numberint
(
L
,
1
);
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
return
0
;
return
0
;
uint32
s
=
lua_to
integer
(
L
,
2
);
uint32
s
=
lua_to
numberint
(
L
,
2
);
uint32
o
=
lua_to
integer
(
L
,
3
);
uint32
o
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
field
::
card_set
cset
;
field
::
card_set
cset
;
pduel
->
game_field
->
get_linked_cards
(
rplayer
,
s
,
o
,
&
cset
);
pduel
->
game_field
->
get_linked_cards
(
rplayer
,
s
,
o
,
&
cset
);
...
@@ -1761,7 +1761,7 @@ int32 scriptlib::duel_get_linked_group_count(lua_State *L) {
...
@@ -1761,7 +1761,7 @@ int32 scriptlib::duel_get_linked_group_count(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_linked_zone
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_linked_zone
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -1770,9 +1770,9 @@ int32 scriptlib::duel_get_linked_zone(lua_State *L) {
...
@@ -1770,9 +1770,9 @@ int32 scriptlib::duel_get_linked_zone(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_field_card
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_field_card
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
uint32
location
=
lua_to
integer
(
L
,
2
);
uint32
location
=
lua_to
numberint
(
L
,
2
);
uint32
sequence
=
lua_to
integer
(
L
,
3
);
uint32
sequence
=
lua_to
numberint
(
L
,
3
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -1784,9 +1784,9 @@ int32 scriptlib::duel_get_field_card(lua_State *L) {
...
@@ -1784,9 +1784,9 @@ int32 scriptlib::duel_get_field_card(lua_State *L) {
}
}
int32
scriptlib
::
duel_check_location
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_check_location
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
uint32
location
=
lua_to
integer
(
L
,
2
);
uint32
location
=
lua_to
numberint
(
L
,
2
);
uint32
sequence
=
lua_to
integer
(
L
,
3
);
uint32
sequence
=
lua_to
numberint
(
L
,
3
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -1800,14 +1800,14 @@ int32 scriptlib::duel_get_current_chain(lua_State *L) {
...
@@ -1800,14 +1800,14 @@ int32 scriptlib::duel_get_current_chain(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_chain_info
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_chain_info
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
c
=
lua_to
integer
(
L
,
1
);
uint32
c
=
lua_to
numberint
(
L
,
1
);
uint32
args
=
lua_gettop
(
L
)
-
1
;
uint32
args
=
lua_gettop
(
L
)
-
1
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
c
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
c
);
if
(
!
ch
)
if
(
!
ch
)
return
0
;
return
0
;
for
(
uint32
i
=
0
;
i
<
args
;
++
i
)
{
for
(
uint32
i
=
0
;
i
<
args
;
++
i
)
{
uint32
flag
=
lua_to
integer
(
L
,
2
+
i
);
uint32
flag
=
lua_to
numberint
(
L
,
2
+
i
);
switch
(
flag
)
{
switch
(
flag
)
{
case
CHAININFO_CHAIN_COUNT
:
case
CHAININFO_CHAIN_COUNT
:
lua_pushinteger
(
L
,
ch
->
chain_count
);
lua_pushinteger
(
L
,
ch
->
chain_count
);
...
@@ -1865,7 +1865,7 @@ int32 scriptlib::duel_get_chain_info(lua_State *L) {
...
@@ -1865,7 +1865,7 @@ int32 scriptlib::duel_get_chain_info(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_chain_event
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_chain_event
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
count
=
lua_to
integer
(
L
,
1
);
uint32
count
=
lua_to
numberint
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
count
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
count
);
if
(
!
ch
)
if
(
!
ch
)
...
@@ -1894,13 +1894,13 @@ int32 scriptlib::duel_get_current_phase(lua_State *L) {
...
@@ -1894,13 +1894,13 @@ int32 scriptlib::duel_get_current_phase(lua_State *L) {
}
}
int32
scriptlib
::
duel_skip_phase
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_skip_phase
(
lua_State
*
L
)
{
check_param_count
(
L
,
4
);
check_param_count
(
L
,
4
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
phase
=
lua_to
integer
(
L
,
2
);
uint32
phase
=
lua_to
numberint
(
L
,
2
);
uint32
reset
=
lua_to
integer
(
L
,
3
);
uint32
reset
=
lua_to
numberint
(
L
,
3
);
uint32
count
=
lua_to
integer
(
L
,
4
);
uint32
count
=
lua_to
numberint
(
L
,
4
);
uint32
value
=
lua_to
integer
(
L
,
5
);
uint32
value
=
lua_to
numberint
(
L
,
5
);
if
(
count
<=
0
)
if
(
count
<=
0
)
count
=
1
;
count
=
1
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -1992,9 +1992,9 @@ int32 scriptlib::duel_adjust_instantly(lua_State *L) {
...
@@ -1992,9 +1992,9 @@ int32 scriptlib::duel_adjust_instantly(lua_State *L) {
*/
*/
int32
scriptlib
::
duel_get_field_group
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_field_group
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
uint32
location1
=
lua_to
integer
(
L
,
2
);
uint32
location1
=
lua_to
numberint
(
L
,
2
);
uint32
location2
=
lua_to
integer
(
L
,
3
);
uint32
location2
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
pgroup
=
pduel
->
new_group
();
group
*
pgroup
=
pduel
->
new_group
();
pduel
->
game_field
->
filter_field_card
(
playerid
,
location1
,
location2
,
pgroup
);
pduel
->
game_field
->
filter_field_card
(
playerid
,
location1
,
location2
,
pgroup
);
...
@@ -2008,9 +2008,9 @@ int32 scriptlib::duel_get_field_group(lua_State *L) {
...
@@ -2008,9 +2008,9 @@ int32 scriptlib::duel_get_field_group(lua_State *L) {
*/
*/
int32
scriptlib
::
duel_get_field_group_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_field_group_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
uint32
location1
=
lua_to
integer
(
L
,
2
);
uint32
location1
=
lua_to
numberint
(
L
,
2
);
uint32
location2
=
lua_to
integer
(
L
,
3
);
uint32
location2
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
count
=
pduel
->
game_field
->
filter_field_card
(
playerid
,
location1
,
location2
,
0
);
uint32
count
=
pduel
->
game_field
->
filter_field_card
(
playerid
,
location1
,
location2
,
0
);
lua_pushinteger
(
L
,
count
);
lua_pushinteger
(
L
,
count
);
...
@@ -2023,8 +2023,8 @@ int32 scriptlib::duel_get_field_group_count(lua_State *L) {
...
@@ -2023,8 +2023,8 @@ int32 scriptlib::duel_get_field_group_count(lua_State *L) {
*/
*/
int32
scriptlib
::
duel_get_decktop_group
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_decktop_group
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
uint32
count
=
lua_to
integer
(
L
,
2
);
uint32
count
=
lua_to
numberint
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
pgroup
=
pduel
->
new_group
();
group
*
pgroup
=
pduel
->
new_group
();
auto
cit
=
pduel
->
game_field
->
player
[
playerid
].
list_main
.
rbegin
();
auto
cit
=
pduel
->
game_field
->
player
[
playerid
].
list_main
.
rbegin
();
...
@@ -2050,9 +2050,9 @@ int32 scriptlib::duel_get_matching_group(lua_State *L) {
...
@@ -2050,9 +2050,9 @@ int32 scriptlib::duel_get_matching_group(lua_State *L) {
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
uint32
extraargs
=
lua_gettop
(
L
)
-
5
;
uint32
extraargs
=
lua_gettop
(
L
)
-
5
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
self
=
lua_to
integer
(
L
,
2
);
uint32
self
=
lua_to
numberint
(
L
,
2
);
uint32
location1
=
lua_to
integer
(
L
,
3
);
uint32
location1
=
lua_to
numberint
(
L
,
3
);
uint32
location2
=
lua_to
integer
(
L
,
4
);
uint32
location2
=
lua_to
numberint
(
L
,
4
);
group
*
pgroup
=
pduel
->
new_group
();
group
*
pgroup
=
pduel
->
new_group
();
pduel
->
game_field
->
filter_matching_card
(
1
,
(
uint8
)
self
,
location1
,
location2
,
pgroup
,
pexception
,
pexgroup
,
extraargs
);
pduel
->
game_field
->
filter_matching_card
(
1
,
(
uint8
)
self
,
location1
,
location2
,
pgroup
,
pexception
,
pexgroup
,
extraargs
);
interpreter
::
group2value
(
L
,
pgroup
);
interpreter
::
group2value
(
L
,
pgroup
);
...
@@ -2075,9 +2075,9 @@ int32 scriptlib::duel_get_matching_count(lua_State *L) {
...
@@ -2075,9 +2075,9 @@ int32 scriptlib::duel_get_matching_count(lua_State *L) {
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
uint32
extraargs
=
lua_gettop
(
L
)
-
5
;
uint32
extraargs
=
lua_gettop
(
L
)
-
5
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
self
=
lua_to
integer
(
L
,
2
);
uint32
self
=
lua_to
numberint
(
L
,
2
);
uint32
location1
=
lua_to
integer
(
L
,
3
);
uint32
location1
=
lua_to
numberint
(
L
,
3
);
uint32
location2
=
lua_to
integer
(
L
,
4
);
uint32
location2
=
lua_to
numberint
(
L
,
4
);
group
*
pgroup
=
pduel
->
new_group
();
group
*
pgroup
=
pduel
->
new_group
();
pduel
->
game_field
->
filter_matching_card
(
1
,
(
uint8
)
self
,
location1
,
location2
,
pgroup
,
pexception
,
pexgroup
,
extraargs
);
pduel
->
game_field
->
filter_matching_card
(
1
,
(
uint8
)
self
,
location1
,
location2
,
pgroup
,
pexception
,
pexgroup
,
extraargs
);
uint32
count
=
pgroup
->
container
.
size
();
uint32
count
=
pgroup
->
container
.
size
();
...
@@ -2101,9 +2101,9 @@ int32 scriptlib::duel_get_first_matching_card(lua_State *L) {
...
@@ -2101,9 +2101,9 @@ int32 scriptlib::duel_get_first_matching_card(lua_State *L) {
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
uint32
extraargs
=
lua_gettop
(
L
)
-
5
;
uint32
extraargs
=
lua_gettop
(
L
)
-
5
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
self
=
lua_to
integer
(
L
,
2
);
uint32
self
=
lua_to
numberint
(
L
,
2
);
uint32
location1
=
lua_to
integer
(
L
,
3
);
uint32
location1
=
lua_to
numberint
(
L
,
3
);
uint32
location2
=
lua_to
integer
(
L
,
4
);
uint32
location2
=
lua_to
numberint
(
L
,
4
);
card
*
pret
=
0
;
card
*
pret
=
0
;
pduel
->
game_field
->
filter_matching_card
(
1
,
(
uint8
)
self
,
location1
,
location2
,
0
,
pexception
,
pexgroup
,
extraargs
,
&
pret
);
pduel
->
game_field
->
filter_matching_card
(
1
,
(
uint8
)
self
,
location1
,
location2
,
0
,
pexception
,
pexgroup
,
extraargs
,
&
pret
);
if
(
pret
)
if
(
pret
)
...
@@ -2128,10 +2128,10 @@ int32 scriptlib::duel_is_existing_matching_card(lua_State *L) {
...
@@ -2128,10 +2128,10 @@ int32 scriptlib::duel_is_existing_matching_card(lua_State *L) {
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
6
);
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
6
);
uint32
extraargs
=
lua_gettop
(
L
)
-
6
;
uint32
extraargs
=
lua_gettop
(
L
)
-
6
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
self
=
lua_to
integer
(
L
,
2
);
uint32
self
=
lua_to
numberint
(
L
,
2
);
uint32
location1
=
lua_to
integer
(
L
,
3
);
uint32
location1
=
lua_to
numberint
(
L
,
3
);
uint32
location2
=
lua_to
integer
(
L
,
4
);
uint32
location2
=
lua_to
numberint
(
L
,
4
);
uint32
fcount
=
lua_to
integer
(
L
,
5
);
uint32
fcount
=
lua_to
numberint
(
L
,
5
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
filter_matching_card
(
1
,
(
uint8
)
self
,
location1
,
location2
,
0
,
pexception
,
pexgroup
,
extraargs
,
0
,
fcount
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
filter_matching_card
(
1
,
(
uint8
)
self
,
location1
,
location2
,
0
,
pexception
,
pexgroup
,
extraargs
,
0
,
fcount
));
return
1
;
return
1
;
}
}
...
@@ -2152,15 +2152,15 @@ int32 scriptlib::duel_select_matching_cards(lua_State *L) {
...
@@ -2152,15 +2152,15 @@ int32 scriptlib::duel_select_matching_cards(lua_State *L) {
else
if
(
check_param
(
L
,
PARAM_TYPE_GROUP
,
8
,
TRUE
))
else
if
(
check_param
(
L
,
PARAM_TYPE_GROUP
,
8
,
TRUE
))
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
8
);
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
8
);
uint32
extraargs
=
lua_gettop
(
L
)
-
8
;
uint32
extraargs
=
lua_gettop
(
L
)
-
8
;
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
self
=
lua_to
integer
(
L
,
3
);
uint32
self
=
lua_to
numberint
(
L
,
3
);
uint32
location1
=
lua_to
integer
(
L
,
4
);
uint32
location1
=
lua_to
numberint
(
L
,
4
);
uint32
location2
=
lua_to
integer
(
L
,
5
);
uint32
location2
=
lua_to
numberint
(
L
,
5
);
uint32
min
=
lua_to
integer
(
L
,
6
);
uint32
min
=
lua_to
numberint
(
L
,
6
);
uint32
max
=
lua_to
integer
(
L
,
7
);
uint32
max
=
lua_to
numberint
(
L
,
7
);
group
*
pgroup
=
pduel
->
new_group
();
group
*
pgroup
=
pduel
->
new_group
();
pduel
->
game_field
->
filter_matching_card
(
2
,
(
uint8
)
self
,
location1
,
location2
,
pgroup
,
pexception
,
pexgroup
,
extraargs
);
pduel
->
game_field
->
filter_matching_card
(
2
,
(
uint8
)
self
,
location1
,
location2
,
pgroup
,
pexception
,
pexgroup
,
extraargs
);
pduel
->
game_field
->
core
.
select_cards
.
assign
(
pgroup
->
container
.
begin
(),
pgroup
->
container
.
end
());
pduel
->
game_field
->
core
.
select_cards
.
assign
(
pgroup
->
container
.
begin
(),
pgroup
->
container
.
end
());
...
@@ -2174,7 +2174,7 @@ int32 scriptlib::duel_select_matching_cards(lua_State *L) {
...
@@ -2174,7 +2174,7 @@ int32 scriptlib::duel_select_matching_cards(lua_State *L) {
*/
*/
int32
scriptlib
::
duel_get_release_group
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_release_group
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
hand
=
FALSE
;
uint32
hand
=
FALSE
;
...
@@ -2193,7 +2193,7 @@ int32 scriptlib::duel_get_release_group(lua_State *L) {
...
@@ -2193,7 +2193,7 @@ int32 scriptlib::duel_get_release_group(lua_State *L) {
*/
*/
int32
scriptlib
::
duel_get_release_group_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_release_group_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
hand
=
FALSE
;
uint32
hand
=
FALSE
;
...
@@ -2205,7 +2205,7 @@ int32 scriptlib::duel_get_release_group_count(lua_State *L) {
...
@@ -2205,7 +2205,7 @@ int32 scriptlib::duel_get_release_group_count(lua_State *L) {
}
}
int32
scriptlib
::
duel_check_release_group
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_check_release_group
(
lua_State
*
L
)
{
check_param_count
(
L
,
4
);
check_param_count
(
L
,
4
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
use_con
=
FALSE
;
int32
use_con
=
FALSE
;
...
@@ -2221,14 +2221,14 @@ int32 scriptlib::duel_check_release_group(lua_State *L) {
...
@@ -2221,14 +2221,14 @@ int32 scriptlib::duel_check_release_group(lua_State *L) {
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
4
);
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
4
);
uint32
extraargs
=
lua_gettop
(
L
)
-
4
;
uint32
extraargs
=
lua_gettop
(
L
)
-
4
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
fcount
=
lua_to
integer
(
L
,
3
);
uint32
fcount
=
lua_to
numberint
(
L
,
3
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_release_list
(
playerid
,
fcount
,
use_con
,
FALSE
,
2
,
extraargs
,
pexception
,
pexgroup
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_release_list
(
playerid
,
fcount
,
use_con
,
FALSE
,
2
,
extraargs
,
pexception
,
pexgroup
));
return
1
;
return
1
;
}
}
int32
scriptlib
::
duel_select_release_group
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_select_release_group
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
5
);
check_param_count
(
L
,
5
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
use_con
=
FALSE
;
int32
use_con
=
FALSE
;
...
@@ -2244,8 +2244,8 @@ int32 scriptlib::duel_select_release_group(lua_State *L) {
...
@@ -2244,8 +2244,8 @@ int32 scriptlib::duel_select_release_group(lua_State *L) {
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
uint32
extraargs
=
lua_gettop
(
L
)
-
5
;
uint32
extraargs
=
lua_gettop
(
L
)
-
5
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
min
=
lua_to
integer
(
L
,
3
);
uint32
min
=
lua_to
numberint
(
L
,
3
);
uint32
max
=
lua_to
integer
(
L
,
4
);
uint32
max
=
lua_to
numberint
(
L
,
4
);
pduel
->
game_field
->
core
.
release_cards
.
clear
();
pduel
->
game_field
->
core
.
release_cards
.
clear
();
pduel
->
game_field
->
core
.
release_cards_ex
.
clear
();
pduel
->
game_field
->
core
.
release_cards_ex
.
clear
();
pduel
->
game_field
->
get_release_list
(
playerid
,
&
pduel
->
game_field
->
core
.
release_cards
,
&
pduel
->
game_field
->
core
.
release_cards_ex
,
use_con
,
FALSE
,
2
,
extraargs
,
pexception
,
pexgroup
);
pduel
->
game_field
->
get_release_list
(
playerid
,
&
pduel
->
game_field
->
core
.
release_cards
,
&
pduel
->
game_field
->
core
.
release_cards_ex
,
use_con
,
FALSE
,
2
,
extraargs
,
pexception
,
pexgroup
);
...
@@ -2254,7 +2254,7 @@ int32 scriptlib::duel_select_release_group(lua_State *L) {
...
@@ -2254,7 +2254,7 @@ int32 scriptlib::duel_select_release_group(lua_State *L) {
}
}
int32
scriptlib
::
duel_check_release_group_ex
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_check_release_group_ex
(
lua_State
*
L
)
{
check_param_count
(
L
,
4
);
check_param_count
(
L
,
4
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
use_con
=
FALSE
;
int32
use_con
=
FALSE
;
...
@@ -2270,14 +2270,14 @@ int32 scriptlib::duel_check_release_group_ex(lua_State *L) {
...
@@ -2270,14 +2270,14 @@ int32 scriptlib::duel_check_release_group_ex(lua_State *L) {
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
4
);
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
4
);
uint32
extraargs
=
lua_gettop
(
L
)
-
4
;
uint32
extraargs
=
lua_gettop
(
L
)
-
4
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
fcount
=
lua_to
integer
(
L
,
3
);
uint32
fcount
=
lua_to
numberint
(
L
,
3
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_release_list
(
playerid
,
fcount
,
use_con
,
TRUE
,
2
,
extraargs
,
pexception
,
pexgroup
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_release_list
(
playerid
,
fcount
,
use_con
,
TRUE
,
2
,
extraargs
,
pexception
,
pexgroup
));
return
1
;
return
1
;
}
}
int32
scriptlib
::
duel_select_release_group_ex
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_select_release_group_ex
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
5
);
check_param_count
(
L
,
5
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
use_con
=
FALSE
;
int32
use_con
=
FALSE
;
...
@@ -2293,8 +2293,8 @@ int32 scriptlib::duel_select_release_group_ex(lua_State *L) {
...
@@ -2293,8 +2293,8 @@ int32 scriptlib::duel_select_release_group_ex(lua_State *L) {
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
uint32
extraargs
=
lua_gettop
(
L
)
-
5
;
uint32
extraargs
=
lua_gettop
(
L
)
-
5
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
min
=
lua_to
integer
(
L
,
3
);
uint32
min
=
lua_to
numberint
(
L
,
3
);
uint32
max
=
lua_to
integer
(
L
,
4
);
uint32
max
=
lua_to
numberint
(
L
,
4
);
pduel
->
game_field
->
core
.
release_cards
.
clear
();
pduel
->
game_field
->
core
.
release_cards
.
clear
();
pduel
->
game_field
->
core
.
release_cards_ex
.
clear
();
pduel
->
game_field
->
core
.
release_cards_ex
.
clear
();
pduel
->
game_field
->
get_release_list
(
playerid
,
&
pduel
->
game_field
->
core
.
release_cards
,
&
pduel
->
game_field
->
core
.
release_cards_ex
,
use_con
,
TRUE
,
2
,
extraargs
,
pexception
,
pexgroup
);
pduel
->
game_field
->
get_release_list
(
playerid
,
&
pduel
->
game_field
->
core
.
release_cards
,
&
pduel
->
game_field
->
core
.
release_cards_ex
,
use_con
,
TRUE
,
2
,
extraargs
,
pexception
,
pexgroup
);
...
@@ -2341,10 +2341,10 @@ int32 scriptlib::duel_check_tribute(lua_State *L) {
...
@@ -2341,10 +2341,10 @@ int32 scriptlib::duel_check_tribute(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
target
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
target
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
min
=
lua_to
integer
(
L
,
2
);
uint32
min
=
lua_to
numberint
(
L
,
2
);
uint32
max
=
min
;
uint32
max
=
min
;
if
(
lua_gettop
(
L
)
>=
3
&&
!
lua_isnil
(
L
,
3
))
if
(
lua_gettop
(
L
)
>=
3
&&
!
lua_isnil
(
L
,
3
))
max
=
lua_to
integer
(
L
,
3
);
max
=
lua_to
numberint
(
L
,
3
);
group
*
mg
=
0
;
group
*
mg
=
0
;
if
(
lua_gettop
(
L
)
>=
4
&&
!
lua_isnil
(
L
,
4
))
{
if
(
lua_gettop
(
L
)
>=
4
&&
!
lua_isnil
(
L
,
4
))
{
check_param
(
L
,
PARAM_TYPE_GROUP
,
4
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
4
);
...
@@ -2352,10 +2352,10 @@ int32 scriptlib::duel_check_tribute(lua_State *L) {
...
@@ -2352,10 +2352,10 @@ int32 scriptlib::duel_check_tribute(lua_State *L) {
}
}
uint8
toplayer
=
target
->
current
.
controler
;
uint8
toplayer
=
target
->
current
.
controler
;
if
(
lua_gettop
(
L
)
>=
5
&&
!
lua_isnil
(
L
,
5
))
if
(
lua_gettop
(
L
)
>=
5
&&
!
lua_isnil
(
L
,
5
))
toplayer
=
lua_to
integer
(
L
,
5
);
toplayer
=
lua_to
numberint
(
L
,
5
);
uint32
zone
=
0x1f
;
uint32
zone
=
0x1f
;
if
(
lua_gettop
(
L
)
>=
6
&&
!
lua_isnil
(
L
,
6
))
if
(
lua_gettop
(
L
)
>=
6
&&
!
lua_isnil
(
L
,
6
))
zone
=
lua_to
integer
(
L
,
6
);
zone
=
lua_to
numberint
(
L
,
6
);
duel
*
pduel
=
target
->
pduel
;
duel
*
pduel
=
target
->
pduel
;
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_tribute
(
target
,
min
,
max
,
mg
,
toplayer
,
zone
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
check_tribute
(
target
,
min
,
max
,
mg
,
toplayer
,
zone
));
return
1
;
return
1
;
...
@@ -2364,12 +2364,12 @@ int32 scriptlib::duel_select_tribute(lua_State *L) {
...
@@ -2364,12 +2364,12 @@ int32 scriptlib::duel_select_tribute(lua_State *L) {
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
4
);
check_param_count
(
L
,
4
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
card
*
target
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
target
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
uint32
min
=
lua_to
integer
(
L
,
3
);
uint32
min
=
lua_to
numberint
(
L
,
3
);
uint32
max
=
lua_to
integer
(
L
,
4
);
uint32
max
=
lua_to
numberint
(
L
,
4
);
group
*
mg
=
0
;
group
*
mg
=
0
;
if
(
lua_gettop
(
L
)
>=
5
&&
!
lua_isnil
(
L
,
5
))
{
if
(
lua_gettop
(
L
)
>=
5
&&
!
lua_isnil
(
L
,
5
))
{
check_param
(
L
,
PARAM_TYPE_GROUP
,
5
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
5
);
...
@@ -2377,7 +2377,7 @@ int32 scriptlib::duel_select_tribute(lua_State *L) {
...
@@ -2377,7 +2377,7 @@ int32 scriptlib::duel_select_tribute(lua_State *L) {
}
}
uint8
toplayer
=
playerid
;
uint8
toplayer
=
playerid
;
if
(
lua_gettop
(
L
)
>=
6
)
if
(
lua_gettop
(
L
)
>=
6
)
toplayer
=
lua_to
integer
(
L
,
6
);
toplayer
=
lua_to
numberint
(
L
,
6
);
if
(
toplayer
!=
0
&&
toplayer
!=
1
)
if
(
toplayer
!=
0
&&
toplayer
!=
1
)
return
0
;
return
0
;
uint32
ex
=
FALSE
;
uint32
ex
=
FALSE
;
...
@@ -2409,9 +2409,9 @@ int32 scriptlib::duel_get_target_count(lua_State *L) {
...
@@ -2409,9 +2409,9 @@ int32 scriptlib::duel_get_target_count(lua_State *L) {
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
uint32
extraargs
=
lua_gettop
(
L
)
-
5
;
uint32
extraargs
=
lua_gettop
(
L
)
-
5
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
self
=
lua_to
integer
(
L
,
2
);
uint32
self
=
lua_to
numberint
(
L
,
2
);
uint32
location1
=
lua_to
integer
(
L
,
3
);
uint32
location1
=
lua_to
numberint
(
L
,
3
);
uint32
location2
=
lua_to
integer
(
L
,
4
);
uint32
location2
=
lua_to
numberint
(
L
,
4
);
group
*
pgroup
=
pduel
->
new_group
();
group
*
pgroup
=
pduel
->
new_group
();
uint32
count
=
0
;
uint32
count
=
0
;
pduel
->
game_field
->
filter_matching_card
(
1
,
(
uint8
)
self
,
location1
,
location2
,
pgroup
,
pexception
,
pexgroup
,
extraargs
,
0
,
0
,
TRUE
);
pduel
->
game_field
->
filter_matching_card
(
1
,
(
uint8
)
self
,
location1
,
location2
,
pgroup
,
pexception
,
pexgroup
,
extraargs
,
0
,
0
,
TRUE
);
...
@@ -2436,10 +2436,10 @@ int32 scriptlib::duel_is_existing_target(lua_State *L) {
...
@@ -2436,10 +2436,10 @@ int32 scriptlib::duel_is_existing_target(lua_State *L) {
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
6
);
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
6
);
uint32
extraargs
=
lua_gettop
(
L
)
-
6
;
uint32
extraargs
=
lua_gettop
(
L
)
-
6
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
self
=
lua_to
integer
(
L
,
2
);
uint32
self
=
lua_to
numberint
(
L
,
2
);
uint32
location1
=
lua_to
integer
(
L
,
3
);
uint32
location1
=
lua_to
numberint
(
L
,
3
);
uint32
location2
=
lua_to
integer
(
L
,
4
);
uint32
location2
=
lua_to
numberint
(
L
,
4
);
uint32
count
=
lua_to
integer
(
L
,
5
);
uint32
count
=
lua_to
numberint
(
L
,
5
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
filter_matching_card
(
1
,
(
uint8
)
self
,
location1
,
location2
,
0
,
pexception
,
pexgroup
,
extraargs
,
0
,
count
,
TRUE
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
filter_matching_card
(
1
,
(
uint8
)
self
,
location1
,
location2
,
0
,
pexception
,
pexgroup
,
extraargs
,
0
,
count
,
TRUE
));
return
1
;
return
1
;
}
}
...
@@ -2460,15 +2460,15 @@ int32 scriptlib::duel_select_target(lua_State *L) {
...
@@ -2460,15 +2460,15 @@ int32 scriptlib::duel_select_target(lua_State *L) {
else
if
(
check_param
(
L
,
PARAM_TYPE_GROUP
,
8
,
TRUE
))
else
if
(
check_param
(
L
,
PARAM_TYPE_GROUP
,
8
,
TRUE
))
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
8
);
pexgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
8
);
uint32
extraargs
=
lua_gettop
(
L
)
-
8
;
uint32
extraargs
=
lua_gettop
(
L
)
-
8
;
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
self
=
lua_to
integer
(
L
,
3
);
uint32
self
=
lua_to
numberint
(
L
,
3
);
uint32
location1
=
lua_to
integer
(
L
,
4
);
uint32
location1
=
lua_to
numberint
(
L
,
4
);
uint32
location2
=
lua_to
integer
(
L
,
5
);
uint32
location2
=
lua_to
numberint
(
L
,
5
);
uint32
min
=
lua_to
integer
(
L
,
6
);
uint32
min
=
lua_to
numberint
(
L
,
6
);
uint32
max
=
lua_to
integer
(
L
,
7
);
uint32
max
=
lua_to
numberint
(
L
,
7
);
if
(
pduel
->
game_field
->
core
.
current_chain
.
size
()
==
0
)
if
(
pduel
->
game_field
->
core
.
current_chain
.
size
()
==
0
)
return
0
;
return
0
;
group
*
pgroup
=
pduel
->
new_group
();
group
*
pgroup
=
pduel
->
new_group
();
...
@@ -2480,7 +2480,7 @@ int32 scriptlib::duel_select_target(lua_State *L) {
...
@@ -2480,7 +2480,7 @@ int32 scriptlib::duel_select_target(lua_State *L) {
int32
scriptlib
::
duel_select_fusion_material
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_select_fusion_material
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
...
@@ -2492,7 +2492,7 @@ int32 scriptlib::duel_select_fusion_material(lua_State *L) {
...
@@ -2492,7 +2492,7 @@ int32 scriptlib::duel_select_fusion_material(lua_State *L) {
cg
=
*
(
card
**
)
lua_touserdata
(
L
,
4
);
cg
=
*
(
card
**
)
lua_touserdata
(
L
,
4
);
}
}
if
(
lua_gettop
(
L
)
>
4
)
if
(
lua_gettop
(
L
)
>
4
)
chkf
=
lua_to
integer
(
L
,
5
);
chkf
=
lua_to
numberint
(
L
,
5
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
3
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
3
);
pcard
->
fusion_select
(
playerid
,
pgroup
,
cg
,
chkf
);
pcard
->
fusion_select
(
playerid
,
pgroup
,
cg
,
chkf
);
...
@@ -2517,7 +2517,7 @@ int32 scriptlib::duel_set_synchro_material(lua_State *L) {
...
@@ -2517,7 +2517,7 @@ int32 scriptlib::duel_set_synchro_material(lua_State *L) {
int32
scriptlib
::
duel_select_synchro_material
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_select_synchro_material
(
lua_State
*
L
)
{
check_param_count
(
L
,
6
);
check_param_count
(
L
,
6
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
...
@@ -2526,8 +2526,8 @@ int32 scriptlib::duel_select_synchro_material(lua_State *L) {
...
@@ -2526,8 +2526,8 @@ int32 scriptlib::duel_select_synchro_material(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
if
(
!
lua_isnil
(
L
,
4
))
if
(
!
lua_isnil
(
L
,
4
))
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
4
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
4
);
int32
min
=
lua_to
integer
(
L
,
5
);
int32
min
=
lua_to
numberint
(
L
,
5
);
int32
max
=
lua_to
integer
(
L
,
6
);
int32
max
=
lua_to
numberint
(
L
,
6
);
card
*
smat
=
0
;
card
*
smat
=
0
;
group
*
mg
=
0
;
group
*
mg
=
0
;
if
(
lua_gettop
(
L
)
>=
7
&&
!
lua_isnil
(
L
,
7
))
{
if
(
lua_gettop
(
L
)
>=
7
&&
!
lua_isnil
(
L
,
7
))
{
...
@@ -2555,8 +2555,8 @@ int32 scriptlib::duel_check_synchro_material(lua_State *L) {
...
@@ -2555,8 +2555,8 @@ int32 scriptlib::duel_check_synchro_material(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
2
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
2
);
if
(
!
lua_isnil
(
L
,
3
))
if
(
!
lua_isnil
(
L
,
3
))
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
int32
min
=
lua_to
integer
(
L
,
4
);
int32
min
=
lua_to
numberint
(
L
,
4
);
int32
max
=
lua_to
integer
(
L
,
5
);
int32
max
=
lua_to
numberint
(
L
,
5
);
card
*
smat
=
0
;
card
*
smat
=
0
;
group
*
mg
=
0
;
group
*
mg
=
0
;
if
(
lua_gettop
(
L
)
>=
6
&&
!
lua_isnil
(
L
,
6
))
{
if
(
lua_gettop
(
L
)
>=
6
&&
!
lua_isnil
(
L
,
6
))
{
...
@@ -2574,7 +2574,7 @@ int32 scriptlib::duel_select_tuner_material(lua_State *L) {
...
@@ -2574,7 +2574,7 @@ int32 scriptlib::duel_select_tuner_material(lua_State *L) {
check_param_count
(
L
,
7
);
check_param_count
(
L
,
7
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
3
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
...
@@ -2584,8 +2584,8 @@ int32 scriptlib::duel_select_tuner_material(lua_State *L) {
...
@@ -2584,8 +2584,8 @@ int32 scriptlib::duel_select_tuner_material(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
4
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
4
);
if
(
!
lua_isnil
(
L
,
5
))
if
(
!
lua_isnil
(
L
,
5
))
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
5
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
5
);
int32
min
=
lua_to
integer
(
L
,
6
);
int32
min
=
lua_to
numberint
(
L
,
6
);
int32
max
=
lua_to
integer
(
L
,
7
);
int32
max
=
lua_to
numberint
(
L
,
7
);
group
*
mg
=
0
;
group
*
mg
=
0
;
if
(
lua_gettop
(
L
)
>=
8
&&
!
lua_isnil
(
L
,
8
))
{
if
(
lua_gettop
(
L
)
>=
8
&&
!
lua_isnil
(
L
,
8
))
{
check_param
(
L
,
PARAM_TYPE_GROUP
,
8
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
8
);
...
@@ -2620,8 +2620,8 @@ int32 scriptlib::duel_check_tuner_material(lua_State *L) {
...
@@ -2620,8 +2620,8 @@ int32 scriptlib::duel_check_tuner_material(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
if
(
!
lua_isnil
(
L
,
4
))
if
(
!
lua_isnil
(
L
,
4
))
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
4
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
4
);
int32
min
=
lua_to
integer
(
L
,
5
);
int32
min
=
lua_to
numberint
(
L
,
5
);
int32
max
=
lua_to
integer
(
L
,
6
);
int32
max
=
lua_to
numberint
(
L
,
6
);
group
*
mg
=
0
;
group
*
mg
=
0
;
if
(
lua_gettop
(
L
)
>=
7
&&
!
lua_isnil
(
L
,
7
))
{
if
(
lua_gettop
(
L
)
>=
7
&&
!
lua_isnil
(
L
,
7
))
{
check_param
(
L
,
PARAM_TYPE_GROUP
,
7
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
7
);
...
@@ -2632,7 +2632,7 @@ int32 scriptlib::duel_check_tuner_material(lua_State *L) {
...
@@ -2632,7 +2632,7 @@ int32 scriptlib::duel_check_tuner_material(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_ritual_material
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_ritual_material
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -2651,7 +2651,7 @@ int32 scriptlib::duel_release_ritual_material(lua_State *L) {
...
@@ -2651,7 +2651,7 @@ int32 scriptlib::duel_release_ritual_material(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_fusion_material
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_fusion_material
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -2742,7 +2742,7 @@ int32 scriptlib::duel_clear_target_card(lua_State *L) {
...
@@ -2742,7 +2742,7 @@ int32 scriptlib::duel_clear_target_card(lua_State *L) {
int32
scriptlib
::
duel_set_target_player
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_set_target_player
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
0
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
0
);
if
(
ch
)
if
(
ch
)
...
@@ -2752,7 +2752,7 @@ int32 scriptlib::duel_set_target_player(lua_State *L) {
...
@@ -2752,7 +2752,7 @@ int32 scriptlib::duel_set_target_player(lua_State *L) {
int32
scriptlib
::
duel_set_target_param
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_set_target_param
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
param
=
lua_to
integer
(
L
,
1
);
uint32
param
=
lua_to
numberint
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
0
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
0
);
if
(
ch
)
if
(
ch
)
...
@@ -2770,11 +2770,11 @@ int32 scriptlib::duel_set_operation_info(lua_State *L) {
...
@@ -2770,11 +2770,11 @@ int32 scriptlib::duel_set_operation_info(lua_State *L) {
group
*
pgroup
=
0
;
group
*
pgroup
=
0
;
card
*
pcard
=
0
;
card
*
pcard
=
0
;
group
*
pg
=
0
;
group
*
pg
=
0
;
uint32
ct
=
lua_to
integer
(
L
,
1
);
uint32
ct
=
lua_to
numberint
(
L
,
1
);
uint32
cate
=
lua_to
integer
(
L
,
2
);
uint32
cate
=
lua_to
numberint
(
L
,
2
);
uint32
count
=
lua_to
integer
(
L
,
4
);
uint32
count
=
lua_to
numberint
(
L
,
4
);
uint32
playerid
=
lua_to
integer
(
L
,
5
);
uint32
playerid
=
lua_to
numberint
(
L
,
5
);
uint32
param
=
lua_to
integer
(
L
,
6
);
uint32
param
=
lua_to
numberint
(
L
,
6
);
duel
*
pduel
;
duel
*
pduel
;
if
(
check_param
(
L
,
PARAM_TYPE_CARD
,
3
,
TRUE
))
{
if
(
check_param
(
L
,
PARAM_TYPE_CARD
,
3
,
TRUE
))
{
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
3
);
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
3
);
...
@@ -2808,8 +2808,8 @@ int32 scriptlib::duel_set_operation_info(lua_State *L) {
...
@@ -2808,8 +2808,8 @@ int32 scriptlib::duel_set_operation_info(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_operation_info
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_operation_info
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
uint32
ct
=
lua_to
integer
(
L
,
1
);
uint32
ct
=
lua_to
numberint
(
L
,
1
);
uint32
cate
=
lua_to
integer
(
L
,
2
);
uint32
cate
=
lua_to
numberint
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
ct
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
ct
);
if
(
!
ch
)
if
(
!
ch
)
...
@@ -2833,7 +2833,7 @@ int32 scriptlib::duel_get_operation_info(lua_State *L) {
...
@@ -2833,7 +2833,7 @@ int32 scriptlib::duel_get_operation_info(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_operation_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_operation_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
ct
=
lua_to
integer
(
L
,
1
);
uint32
ct
=
lua_to
numberint
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
ct
);
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
ct
);
if
(
!
ch
)
if
(
!
ch
)
...
@@ -2850,9 +2850,9 @@ int32 scriptlib::duel_check_xyz_material(lua_State *L) {
...
@@ -2850,9 +2850,9 @@ int32 scriptlib::duel_check_xyz_material(lua_State *L) {
findex
=
2
;
findex
=
2
;
}
}
card
*
scard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
scard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
lv
=
lua_to
integer
(
L
,
3
);
uint32
lv
=
lua_to
numberint
(
L
,
3
);
uint32
minc
=
lua_to
integer
(
L
,
4
);
uint32
minc
=
lua_to
numberint
(
L
,
4
);
uint32
maxc
=
lua_to
integer
(
L
,
5
);
uint32
maxc
=
lua_to
numberint
(
L
,
5
);
group
*
mg
=
nullptr
;
group
*
mg
=
nullptr
;
if
(
!
lua_isnil
(
L
,
6
))
{
if
(
!
lua_isnil
(
L
,
6
))
{
check_param
(
L
,
PARAM_TYPE_GROUP
,
6
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
6
);
...
@@ -2871,10 +2871,10 @@ int32 scriptlib::duel_select_xyz_material(lua_State *L) {
...
@@ -2871,10 +2871,10 @@ int32 scriptlib::duel_select_xyz_material(lua_State *L) {
findex
=
3
;
findex
=
3
;
}
}
card
*
scard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
scard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
uint32
playerid
=
lua_to
integer
(
L
,
1
);
uint32
playerid
=
lua_to
numberint
(
L
,
1
);
uint32
lv
=
lua_to
integer
(
L
,
4
);
uint32
lv
=
lua_to
numberint
(
L
,
4
);
uint32
minc
=
lua_to
integer
(
L
,
5
);
uint32
minc
=
lua_to
numberint
(
L
,
5
);
uint32
maxc
=
lua_to
integer
(
L
,
6
);
uint32
maxc
=
lua_to
numberint
(
L
,
6
);
group
*
mg
=
0
;
group
*
mg
=
0
;
if
(
lua_gettop
(
L
)
>=
7
&&
!
lua_isnil
(
L
,
7
))
{
if
(
lua_gettop
(
L
)
>=
7
&&
!
lua_isnil
(
L
,
7
))
{
check_param
(
L
,
PARAM_TYPE_GROUP
,
7
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
7
);
...
@@ -2912,11 +2912,11 @@ int32 scriptlib::duel_overlay(lua_State *L) {
...
@@ -2912,11 +2912,11 @@ int32 scriptlib::duel_overlay(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_overlay_group
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_overlay_group
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
rplayer
=
lua_to
integer
(
L
,
1
);
uint32
rplayer
=
lua_to
numberint
(
L
,
1
);
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
return
0
;
return
0
;
uint32
s
=
lua_to
integer
(
L
,
2
);
uint32
s
=
lua_to
numberint
(
L
,
2
);
uint32
o
=
lua_to
integer
(
L
,
3
);
uint32
o
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
pgroup
=
pduel
->
new_group
();
group
*
pgroup
=
pduel
->
new_group
();
pduel
->
game_field
->
get_overlay_group
(
rplayer
,
s
,
o
,
&
pgroup
->
container
);
pduel
->
game_field
->
get_overlay_group
(
rplayer
,
s
,
o
,
&
pgroup
->
container
);
...
@@ -2925,24 +2925,24 @@ int32 scriptlib::duel_get_overlay_group(lua_State *L) {
...
@@ -2925,24 +2925,24 @@ int32 scriptlib::duel_get_overlay_group(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_overlay_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_overlay_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
uint32
rplayer
=
lua_to
integer
(
L
,
1
);
uint32
rplayer
=
lua_to
numberint
(
L
,
1
);
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
if
(
rplayer
!=
0
&&
rplayer
!=
1
)
return
0
;
return
0
;
uint32
s
=
lua_to
integer
(
L
,
2
);
uint32
s
=
lua_to
numberint
(
L
,
2
);
uint32
o
=
lua_to
integer
(
L
,
3
);
uint32
o
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_overlay_count
(
rplayer
,
s
,
o
));
lua_pushinteger
(
L
,
pduel
->
game_field
->
get_overlay_count
(
rplayer
,
s
,
o
));
return
1
;
return
1
;
}
}
int32
scriptlib
::
duel_check_remove_overlay_card
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_check_remove_overlay_card
(
lua_State
*
L
)
{
check_param_count
(
L
,
5
);
check_param_count
(
L
,
5
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
s
=
lua_to
integer
(
L
,
2
);
uint32
s
=
lua_to
numberint
(
L
,
2
);
uint32
o
=
lua_to
integer
(
L
,
3
);
uint32
o
=
lua_to
numberint
(
L
,
3
);
int32
count
=
lua_to
integer
(
L
,
4
);
int32
count
=
lua_to
numberint
(
L
,
4
);
int32
reason
=
lua_to
integer
(
L
,
5
);
int32
reason
=
lua_to
numberint
(
L
,
5
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_remove_overlay_card
(
playerid
,
0
,
s
,
o
,
count
,
reason
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_remove_overlay_card
(
playerid
,
0
,
s
,
o
,
count
,
reason
));
return
1
;
return
1
;
...
@@ -2950,25 +2950,25 @@ int32 scriptlib::duel_check_remove_overlay_card(lua_State *L) {
...
@@ -2950,25 +2950,25 @@ int32 scriptlib::duel_check_remove_overlay_card(lua_State *L) {
int32
scriptlib
::
duel_remove_overlay_card
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_remove_overlay_card
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
6
);
check_param_count
(
L
,
6
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
s
=
lua_to
integer
(
L
,
2
);
uint32
s
=
lua_to
numberint
(
L
,
2
);
uint32
o
=
lua_to
integer
(
L
,
3
);
uint32
o
=
lua_to
numberint
(
L
,
3
);
int32
min
=
lua_to
integer
(
L
,
4
);
int32
min
=
lua_to
numberint
(
L
,
4
);
int32
max
=
lua_to
integer
(
L
,
5
);
int32
max
=
lua_to
numberint
(
L
,
5
);
int32
reason
=
lua_to
integer
(
L
,
6
);
int32
reason
=
lua_to
numberint
(
L
,
6
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
remove_overlay_card
(
reason
,
0
,
playerid
,
s
,
o
,
min
,
max
);
pduel
->
game_field
->
remove_overlay_card
(
reason
,
0
,
playerid
,
s
,
o
,
min
,
max
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
}
}
int32
scriptlib
::
duel_hint
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_hint
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
int32
htype
=
lua_to
integer
(
L
,
1
);
int32
htype
=
lua_to
numberint
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
2
);
int32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
desc
=
lua_to
integer
(
L
,
3
);
int32
desc
=
lua_to
numberint
(
L
,
3
);
if
(
htype
==
HINT_OPSELECTED
)
if
(
htype
==
HINT_OPSELECTED
)
playerid
=
1
-
playerid
;
playerid
=
1
-
playerid
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -2995,13 +2995,13 @@ int32 scriptlib::duel_select_effect_yesno(lua_State * L) {
...
@@ -2995,13 +2995,13 @@ int32 scriptlib::duel_select_effect_yesno(lua_State * L) {
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
int32
desc
=
95
;
int32
desc
=
95
;
if
(
lua_gettop
(
L
)
>=
3
)
if
(
lua_gettop
(
L
)
>=
3
)
desc
=
lua_to
integer
(
L
,
3
);
desc
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_EFFECTYN_S
,
0
,
0
,
(
group
*
)
pcard
,
playerid
,
desc
);
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_EFFECTYN_S
,
0
,
0
,
(
group
*
)
pcard
,
playerid
,
desc
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
...
@@ -3009,10 +3009,10 @@ int32 scriptlib::duel_select_effect_yesno(lua_State * L) {
...
@@ -3009,10 +3009,10 @@ int32 scriptlib::duel_select_effect_yesno(lua_State * L) {
int32
scriptlib
::
duel_select_yesno
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_select_yesno
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
desc
=
lua_to
integer
(
L
,
2
);
int32
desc
=
lua_to
numberint
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_YESNO_S
,
0
,
0
,
0
,
playerid
,
desc
);
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_YESNO_S
,
0
,
0
,
0
,
playerid
,
desc
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
...
@@ -3021,13 +3021,13 @@ int32 scriptlib::duel_select_option(lua_State * L) {
...
@@ -3021,13 +3021,13 @@ int32 scriptlib::duel_select_option(lua_State * L) {
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
count
=
lua_gettop
(
L
)
-
1
;
uint32
count
=
lua_gettop
(
L
)
-
1
;
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
core
.
select_options
.
clear
();
pduel
->
game_field
->
core
.
select_options
.
clear
();
for
(
uint32
i
=
0
;
i
<
count
;
++
i
)
for
(
uint32
i
=
0
;
i
<
count
;
++
i
)
pduel
->
game_field
->
core
.
select_options
.
push_back
(
lua_to
integer
(
L
,
i
+
2
));
pduel
->
game_field
->
core
.
select_options
.
push_back
(
lua_to
numberint
(
L
,
i
+
2
));
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_OPTION_S
,
0
,
0
,
0
,
playerid
,
0
);
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_OPTION_S
,
0
,
0
,
0
,
playerid
,
0
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
}
}
...
@@ -3039,9 +3039,9 @@ int32 scriptlib::duel_select_position(lua_State * L) {
...
@@ -3039,9 +3039,9 @@ int32 scriptlib::duel_select_position(lua_State * L) {
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
uint32
positions
=
lua_to
integer
(
L
,
3
);
uint32
positions
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_POSITION_S
,
0
,
0
,
0
,
playerid
+
(
positions
<<
16
),
pcard
->
data
.
code
);
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_POSITION_S
,
0
,
0
,
0
,
playerid
+
(
positions
<<
16
),
pcard
->
data
.
code
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
...
@@ -3049,13 +3049,13 @@ int32 scriptlib::duel_select_position(lua_State * L) {
...
@@ -3049,13 +3049,13 @@ int32 scriptlib::duel_select_position(lua_State * L) {
int32
scriptlib
::
duel_select_disable_field
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_select_disable_field
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
5
);
check_param_count
(
L
,
5
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
count
=
lua_to
integer
(
L
,
2
);
uint32
count
=
lua_to
numberint
(
L
,
2
);
uint32
location1
=
lua_to
integer
(
L
,
3
);
uint32
location1
=
lua_to
numberint
(
L
,
3
);
uint32
location2
=
lua_to
integer
(
L
,
4
);
uint32
location2
=
lua_to
numberint
(
L
,
4
);
uint32
filter
=
lua_to
integer
(
L
,
5
);
uint32
filter
=
lua_to
numberint
(
L
,
5
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
ct1
=
0
,
ct2
=
0
,
ct3
=
0
,
ct4
=
0
,
plist
=
0
,
flag
=
0xffffffff
;
uint32
ct1
=
0
,
ct2
=
0
,
ct3
=
0
,
ct4
=
0
,
plist
=
0
,
flag
=
0xffffffff
;
if
(
location1
&
LOCATION_MZONE
)
{
if
(
location1
&
LOCATION_MZONE
)
{
...
@@ -3085,9 +3085,9 @@ int32 scriptlib::duel_select_disable_field(lua_State * L) {
...
@@ -3085,9 +3085,9 @@ int32 scriptlib::duel_select_disable_field(lua_State * L) {
int32
scriptlib
::
duel_announce_race
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_announce_race
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
int32
count
=
lua_to
integer
(
L
,
2
);
int32
count
=
lua_to
numberint
(
L
,
2
);
int32
available
=
lua_to
integer
(
L
,
3
);
int32
available
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
add_process
(
PROCESSOR_ANNOUNCE_RACE
,
0
,
0
,
0
,
playerid
+
(
count
<<
16
),
available
);
pduel
->
game_field
->
add_process
(
PROCESSOR_ANNOUNCE_RACE
,
0
,
0
,
0
,
playerid
+
(
count
<<
16
),
available
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
...
@@ -3095,9 +3095,9 @@ int32 scriptlib::duel_announce_race(lua_State * L) {
...
@@ -3095,9 +3095,9 @@ int32 scriptlib::duel_announce_race(lua_State * L) {
int32
scriptlib
::
duel_announce_attribute
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_announce_attribute
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
int32
count
=
lua_to
integer
(
L
,
2
);
int32
count
=
lua_to
numberint
(
L
,
2
);
int32
available
=
lua_to
integer
(
L
,
3
);
int32
available
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
add_process
(
PROCESSOR_ANNOUNCE_ATTRIB
,
0
,
0
,
0
,
playerid
+
(
count
<<
16
),
available
);
pduel
->
game_field
->
add_process
(
PROCESSOR_ANNOUNCE_ATTRIB
,
0
,
0
,
0
,
playerid
+
(
count
<<
16
),
available
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
...
@@ -3105,13 +3105,13 @@ int32 scriptlib::duel_announce_attribute(lua_State * L) {
...
@@ -3105,13 +3105,13 @@ int32 scriptlib::duel_announce_attribute(lua_State * L) {
int32
scriptlib
::
duel_announce_level
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_announce_level
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
int32
min
=
1
;
int32
min
=
1
;
int32
max
=
12
;
int32
max
=
12
;
if
(
lua_gettop
(
L
)
>=
2
&&
!
lua_isnil
(
L
,
2
))
if
(
lua_gettop
(
L
)
>=
2
&&
!
lua_isnil
(
L
,
2
))
min
=
lua_to
integer
(
L
,
2
);
min
=
lua_to
numberint
(
L
,
2
);
if
(
lua_gettop
(
L
)
>=
3
&&
!
lua_isnil
(
L
,
3
))
if
(
lua_gettop
(
L
)
>=
3
&&
!
lua_isnil
(
L
,
3
))
max
=
lua_to
integer
(
L
,
3
);
max
=
lua_to
numberint
(
L
,
3
);
if
(
min
>
max
)
{
if
(
min
>
max
)
{
int32
aux
=
max
;
int32
aux
=
max
;
max
=
min
;
max
=
min
;
...
@@ -3124,7 +3124,7 @@ int32 scriptlib::duel_announce_level(lua_State * L) {
...
@@ -3124,7 +3124,7 @@ int32 scriptlib::duel_announce_level(lua_State * L) {
for
(
int32
i
=
min
;
i
<=
max
;
++
i
)
{
for
(
int32
i
=
min
;
i
<=
max
;
++
i
)
{
int32
chk
=
1
;
int32
chk
=
1
;
for
(
int32
j
=
4
;
j
<=
lua_gettop
(
L
);
++
j
)
{
for
(
int32
j
=
4
;
j
<=
lua_gettop
(
L
);
++
j
)
{
if
(
!
lua_isnil
(
L
,
j
)
&&
i
==
lua_to
integer
(
L
,
j
))
{
if
(
!
lua_isnil
(
L
,
j
)
&&
i
==
lua_to
numberint
(
L
,
j
))
{
chk
=
0
;
chk
=
0
;
break
;
break
;
}
}
...
@@ -3148,23 +3148,23 @@ int32 scriptlib::duel_announce_level(lua_State * L) {
...
@@ -3148,23 +3148,23 @@ int32 scriptlib::duel_announce_level(lua_State * L) {
int32
scriptlib
::
duel_announce_card
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_announce_card
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
core
.
select_options
.
clear
();
pduel
->
game_field
->
core
.
select_options
.
clear
();
uint32
ttype
=
TYPE_MONSTER
|
TYPE_SPELL
|
TYPE_TRAP
;
uint32
ttype
=
TYPE_MONSTER
|
TYPE_SPELL
|
TYPE_TRAP
;
if
(
lua_gettop
(
L
)
>=
2
)
if
(
lua_gettop
(
L
)
>=
2
)
ttype
=
lua_to
integer
(
L
,
2
);
ttype
=
lua_to
numberint
(
L
,
2
);
pduel
->
game_field
->
add_process
(
PROCESSOR_ANNOUNCE_CARD
,
0
,
0
,
0
,
playerid
,
ttype
);
pduel
->
game_field
->
add_process
(
PROCESSOR_ANNOUNCE_CARD
,
0
,
0
,
0
,
playerid
,
ttype
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
}
}
int32
scriptlib
::
duel_announce_card_filter
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_announce_card_filter
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
core
.
select_options
.
clear
();
pduel
->
game_field
->
core
.
select_options
.
clear
();
for
(
int32
i
=
2
;
i
<=
lua_gettop
(
L
);
++
i
)
for
(
int32
i
=
2
;
i
<=
lua_gettop
(
L
);
++
i
)
pduel
->
game_field
->
core
.
select_options
.
push_back
(
lua_to
integer
(
L
,
i
));
pduel
->
game_field
->
core
.
select_options
.
push_back
(
lua_to
numberint
(
L
,
i
));
pduel
->
game_field
->
add_process
(
PROCESSOR_ANNOUNCE_CARD
,
0
,
0
,
0
,
playerid
,
0
);
pduel
->
game_field
->
add_process
(
PROCESSOR_ANNOUNCE_CARD
,
0
,
0
,
0
,
playerid
,
0
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
}
}
...
@@ -3172,7 +3172,7 @@ int32 scriptlib::duel_announce_type(lua_State * L) {
...
@@ -3172,7 +3172,7 @@ int32 scriptlib::duel_announce_type(lua_State * L) {
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
pduel
->
game_field
->
core
.
select_options
.
clear
();
pduel
->
game_field
->
core
.
select_options
.
clear
();
pduel
->
game_field
->
core
.
select_options
.
push_back
(
70
);
pduel
->
game_field
->
core
.
select_options
.
push_back
(
70
);
pduel
->
game_field
->
core
.
select_options
.
push_back
(
71
);
pduel
->
game_field
->
core
.
select_options
.
push_back
(
71
);
...
@@ -3183,11 +3183,11 @@ int32 scriptlib::duel_announce_type(lua_State * L) {
...
@@ -3183,11 +3183,11 @@ int32 scriptlib::duel_announce_type(lua_State * L) {
int32
scriptlib
::
duel_announce_number
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_announce_number
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
core
.
select_options
.
clear
();
pduel
->
game_field
->
core
.
select_options
.
clear
();
for
(
int32
i
=
2
;
i
<=
lua_gettop
(
L
);
++
i
)
for
(
int32
i
=
2
;
i
<=
lua_gettop
(
L
);
++
i
)
pduel
->
game_field
->
core
.
select_options
.
push_back
(
lua_to
integer
(
L
,
i
));
pduel
->
game_field
->
core
.
select_options
.
push_back
(
lua_to
numberint
(
L
,
i
));
pduel
->
game_field
->
add_process
(
PROCESSOR_ANNOUNCE_NUMBER
,
0
,
0
,
0
,
playerid
,
0
);
pduel
->
game_field
->
add_process
(
PROCESSOR_ANNOUNCE_NUMBER
,
0
,
0
,
0
,
playerid
,
0
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
}
}
...
@@ -3195,7 +3195,7 @@ int32 scriptlib::duel_announce_coin(lua_State * L) {
...
@@ -3195,7 +3195,7 @@ int32 scriptlib::duel_announce_coin(lua_State * L) {
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
pduel
->
game_field
->
core
.
select_options
.
clear
();
pduel
->
game_field
->
core
.
select_options
.
clear
();
pduel
->
game_field
->
core
.
select_options
.
push_back
(
60
);
pduel
->
game_field
->
core
.
select_options
.
push_back
(
60
);
pduel
->
game_field
->
core
.
select_options
.
push_back
(
61
);
pduel
->
game_field
->
core
.
select_options
.
push_back
(
61
);
...
@@ -3206,8 +3206,8 @@ int32 scriptlib::duel_toss_coin(lua_State * L) {
...
@@ -3206,8 +3206,8 @@ int32 scriptlib::duel_toss_coin(lua_State * L) {
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
int32
count
=
lua_to
integer
(
L
,
2
);
int32
count
=
lua_to
numberint
(
L
,
2
);
if
((
playerid
!=
0
&&
playerid
!=
1
)
||
count
<=
0
)
if
((
playerid
!=
0
&&
playerid
!=
1
)
||
count
<=
0
)
return
0
;
return
0
;
if
(
count
>
5
)
if
(
count
>
5
)
...
@@ -3219,11 +3219,11 @@ int32 scriptlib::duel_toss_dice(lua_State * L) {
...
@@ -3219,11 +3219,11 @@ int32 scriptlib::duel_toss_dice(lua_State * L) {
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
int32
count1
=
lua_to
integer
(
L
,
2
);
int32
count1
=
lua_to
numberint
(
L
,
2
);
int32
count2
=
0
;
int32
count2
=
0
;
if
(
lua_gettop
(
L
)
>
2
)
if
(
lua_gettop
(
L
)
>
2
)
count2
=
lua_to
integer
(
L
,
3
);
count2
=
lua_to
numberint
(
L
,
3
);
if
((
playerid
!=
0
&&
playerid
!=
1
)
||
count1
<=
0
||
count2
<
0
)
if
((
playerid
!=
0
&&
playerid
!=
1
)
||
count1
<=
0
||
count2
<
0
)
return
0
;
return
0
;
if
(
count1
>
5
)
if
(
count1
>
5
)
...
@@ -3257,7 +3257,7 @@ int32 scriptlib::duel_set_coin_result(lua_State * L) {
...
@@ -3257,7 +3257,7 @@ int32 scriptlib::duel_set_coin_result(lua_State * L) {
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
res
;
int32
res
;
for
(
int32
i
=
0
;
i
<
5
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
5
;
++
i
)
{
res
=
lua_to
integer
(
L
,
i
+
1
);
res
=
lua_to
numberint
(
L
,
i
+
1
);
if
(
res
!=
0
&&
res
!=
1
)
if
(
res
!=
0
&&
res
!=
1
)
res
=
0
;
res
=
0
;
pduel
->
game_field
->
core
.
coin_result
[
i
]
=
res
;
pduel
->
game_field
->
core
.
coin_result
[
i
]
=
res
;
...
@@ -3268,7 +3268,7 @@ int32 scriptlib::duel_set_dice_result(lua_State * L) {
...
@@ -3268,7 +3268,7 @@ int32 scriptlib::duel_set_dice_result(lua_State * L) {
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
res
;
int32
res
;
for
(
int32
i
=
0
;
i
<
5
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
5
;
++
i
)
{
res
=
lua_to
integer
(
L
,
i
+
1
);
res
=
lua_to
numberint
(
L
,
i
+
1
);
if
(
res
<
1
||
res
>
6
)
if
(
res
<
1
||
res
>
6
)
res
=
1
;
res
=
1
;
pduel
->
game_field
->
core
.
dice_result
[
i
]
=
res
;
pduel
->
game_field
->
core
.
dice_result
[
i
]
=
res
;
...
@@ -3278,12 +3278,12 @@ int32 scriptlib::duel_set_dice_result(lua_State * L) {
...
@@ -3278,12 +3278,12 @@ int32 scriptlib::duel_set_dice_result(lua_State * L) {
int32
scriptlib
::
duel_is_player_affected_by_effect
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_affected_by_effect
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
lua_pushnil
(
L
);
lua_pushnil
(
L
);
return
1
;
return
1
;
}
}
int32
code
=
lua_to
integer
(
L
,
2
);
int32
code
=
lua_to
numberint
(
L
,
2
);
effect_set
eset
;
effect_set
eset
;
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
int32
size
=
eset
.
size
();
int32
size
=
eset
.
size
();
...
@@ -3297,14 +3297,14 @@ int32 scriptlib::duel_is_player_affected_by_effect(lua_State *L) {
...
@@ -3297,14 +3297,14 @@ int32 scriptlib::duel_is_player_affected_by_effect(lua_State *L) {
}
}
int32
scriptlib
::
duel_is_player_can_draw
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_draw
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
return
1
;
return
1
;
}
}
uint32
count
=
0
;
uint32
count
=
0
;
if
(
lua_gettop
(
L
)
>
1
)
if
(
lua_gettop
(
L
)
>
1
)
count
=
lua_to
integer
(
L
,
2
);
count
=
lua_to
numberint
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
count
==
0
)
if
(
count
==
0
)
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_draw
(
playerid
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_draw
(
playerid
));
...
@@ -3315,8 +3315,8 @@ int32 scriptlib::duel_is_player_can_draw(lua_State * L) {
...
@@ -3315,8 +3315,8 @@ int32 scriptlib::duel_is_player_can_draw(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_player_can_discard_deck
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_discard_deck
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
int32
count
=
lua_to
integer
(
L
,
2
);
int32
count
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
return
1
;
return
1
;
...
@@ -3327,8 +3327,8 @@ int32 scriptlib::duel_is_player_can_discard_deck(lua_State * L) {
...
@@ -3327,8 +3327,8 @@ int32 scriptlib::duel_is_player_can_discard_deck(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_player_can_discard_deck_as_cost
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_discard_deck_as_cost
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
int32
count
=
lua_to
integer
(
L
,
2
);
int32
count
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
return
1
;
return
1
;
...
@@ -3339,7 +3339,7 @@ int32 scriptlib::duel_is_player_can_discard_deck_as_cost(lua_State * L) {
...
@@ -3339,7 +3339,7 @@ int32 scriptlib::duel_is_player_can_discard_deck_as_cost(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_player_can_summon
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_summon
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
return
1
;
return
1
;
...
@@ -3350,7 +3350,7 @@ int32 scriptlib::duel_is_player_can_summon(lua_State * L) {
...
@@ -3350,7 +3350,7 @@ int32 scriptlib::duel_is_player_can_summon(lua_State * L) {
else
{
else
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
3
);
int32
sumtype
=
lua_to
integer
(
L
,
2
);
int32
sumtype
=
lua_to
numberint
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
3
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
3
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_summon
(
sumtype
,
playerid
,
pcard
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_summon
(
sumtype
,
playerid
,
pcard
));
}
}
...
@@ -3358,7 +3358,7 @@ int32 scriptlib::duel_is_player_can_summon(lua_State * L) {
...
@@ -3358,7 +3358,7 @@ int32 scriptlib::duel_is_player_can_summon(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_player_can_spsummon
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_spsummon
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
return
1
;
return
1
;
...
@@ -3369,9 +3369,9 @@ int32 scriptlib::duel_is_player_can_spsummon(lua_State * L) {
...
@@ -3369,9 +3369,9 @@ int32 scriptlib::duel_is_player_can_spsummon(lua_State * L) {
else
{
else
{
check_param_count
(
L
,
5
);
check_param_count
(
L
,
5
);
check_param
(
L
,
PARAM_TYPE_CARD
,
5
);
check_param
(
L
,
PARAM_TYPE_CARD
,
5
);
int32
sumtype
=
lua_to
integer
(
L
,
2
);
int32
sumtype
=
lua_to
numberint
(
L
,
2
);
int32
sumpos
=
lua_to
integer
(
L
,
3
);
int32
sumpos
=
lua_to
numberint
(
L
,
3
);
int32
toplayer
=
lua_to
integer
(
L
,
4
);
int32
toplayer
=
lua_to
numberint
(
L
,
4
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
5
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
5
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_spsummon
(
pduel
->
game_field
->
core
.
reason_effect
,
sumtype
,
sumpos
,
playerid
,
toplayer
,
pcard
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_spsummon
(
pduel
->
game_field
->
core
.
reason_effect
,
sumtype
,
sumpos
,
playerid
,
toplayer
,
pcard
));
}
}
...
@@ -3379,7 +3379,7 @@ int32 scriptlib::duel_is_player_can_spsummon(lua_State * L) {
...
@@ -3379,7 +3379,7 @@ int32 scriptlib::duel_is_player_can_spsummon(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_player_can_flipsummon
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_flipsummon
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
...
@@ -3392,47 +3392,47 @@ int32 scriptlib::duel_is_player_can_flipsummon(lua_State * L) {
...
@@ -3392,47 +3392,47 @@ int32 scriptlib::duel_is_player_can_flipsummon(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_player_can_spsummon_monster
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_spsummon_monster
(
lua_State
*
L
)
{
check_param_count
(
L
,
9
);
check_param_count
(
L
,
9
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
return
1
;
return
1
;
}
}
int32
code
=
lua_to
integer
(
L
,
2
);
int32
code
=
lua_to
numberint
(
L
,
2
);
card_data
dat
;
card_data
dat
;
::
read_card
(
code
,
&
dat
);
::
read_card
(
code
,
&
dat
);
dat
.
code
=
code
;
dat
.
code
=
code
;
dat
.
alias
=
0
;
dat
.
alias
=
0
;
if
(
!
lua_isnil
(
L
,
3
))
if
(
!
lua_isnil
(
L
,
3
))
dat
.
setcode
=
lua_to
integer
(
L
,
3
);
dat
.
setcode
=
lua_to
numberint
(
L
,
3
);
if
(
!
lua_isnil
(
L
,
4
))
if
(
!
lua_isnil
(
L
,
4
))
dat
.
type
=
lua_to
integer
(
L
,
4
);
dat
.
type
=
lua_to
numberint
(
L
,
4
);
if
(
!
lua_isnil
(
L
,
5
))
if
(
!
lua_isnil
(
L
,
5
))
dat
.
attack
=
lua_to
integer
(
L
,
5
);
dat
.
attack
=
lua_to
numberint
(
L
,
5
);
if
(
!
lua_isnil
(
L
,
6
))
if
(
!
lua_isnil
(
L
,
6
))
dat
.
defense
=
lua_to
integer
(
L
,
6
);
dat
.
defense
=
lua_to
numberint
(
L
,
6
);
if
(
!
lua_isnil
(
L
,
7
))
if
(
!
lua_isnil
(
L
,
7
))
dat
.
level
=
lua_to
integer
(
L
,
7
);
dat
.
level
=
lua_to
numberint
(
L
,
7
);
if
(
!
lua_isnil
(
L
,
8
))
if
(
!
lua_isnil
(
L
,
8
))
dat
.
race
=
lua_to
integer
(
L
,
8
);
dat
.
race
=
lua_to
numberint
(
L
,
8
);
if
(
!
lua_isnil
(
L
,
9
))
if
(
!
lua_isnil
(
L
,
9
))
dat
.
attribute
=
lua_to
integer
(
L
,
9
);
dat
.
attribute
=
lua_to
numberint
(
L
,
9
);
int32
pos
=
POS_FACEUP
;
int32
pos
=
POS_FACEUP
;
int32
toplayer
=
playerid
;
int32
toplayer
=
playerid
;
uint32
sumtype
=
0
;
uint32
sumtype
=
0
;
if
(
lua_gettop
(
L
)
>=
10
)
if
(
lua_gettop
(
L
)
>=
10
)
pos
=
lua_to
integer
(
L
,
10
);
pos
=
lua_to
numberint
(
L
,
10
);
if
(
lua_gettop
(
L
)
>=
11
)
if
(
lua_gettop
(
L
)
>=
11
)
toplayer
=
lua_to
integer
(
L
,
11
);
toplayer
=
lua_to
numberint
(
L
,
11
);
if
(
lua_gettop
(
L
)
>=
12
)
if
(
lua_gettop
(
L
)
>=
12
)
sumtype
=
lua_to
integer
(
L
,
12
);
sumtype
=
lua_to
numberint
(
L
,
12
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_spsummon_monster
(
playerid
,
toplayer
,
pos
,
sumtype
,
&
dat
));
lua_pushboolean
(
L
,
pduel
->
game_field
->
is_player_can_spsummon_monster
(
playerid
,
toplayer
,
pos
,
sumtype
,
&
dat
));
return
1
;
return
1
;
}
}
int32
scriptlib
::
duel_is_player_can_spsummon_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_spsummon_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
int32
count
=
lua_to
integer
(
L
,
2
);
int32
count
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
return
1
;
return
1
;
...
@@ -3443,7 +3443,7 @@ int32 scriptlib::duel_is_player_can_spsummon_count(lua_State * L) {
...
@@ -3443,7 +3443,7 @@ int32 scriptlib::duel_is_player_can_spsummon_count(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_player_can_release
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_release
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
...
@@ -3456,7 +3456,7 @@ int32 scriptlib::duel_is_player_can_release(lua_State * L) {
...
@@ -3456,7 +3456,7 @@ int32 scriptlib::duel_is_player_can_release(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_player_can_remove
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_remove
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
...
@@ -3469,7 +3469,7 @@ int32 scriptlib::duel_is_player_can_remove(lua_State * L) {
...
@@ -3469,7 +3469,7 @@ int32 scriptlib::duel_is_player_can_remove(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_player_can_send_to_hand
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_send_to_hand
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
...
@@ -3482,7 +3482,7 @@ int32 scriptlib::duel_is_player_can_send_to_hand(lua_State * L) {
...
@@ -3482,7 +3482,7 @@ int32 scriptlib::duel_is_player_can_send_to_hand(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_player_can_send_to_grave
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_send_to_grave
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
...
@@ -3495,7 +3495,7 @@ int32 scriptlib::duel_is_player_can_send_to_grave(lua_State * L) {
...
@@ -3495,7 +3495,7 @@ int32 scriptlib::duel_is_player_can_send_to_grave(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_player_can_send_to_deck
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_player_can_send_to_deck
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
{
...
@@ -3508,7 +3508,7 @@ int32 scriptlib::duel_is_player_can_send_to_deck(lua_State * L) {
...
@@ -3508,7 +3508,7 @@ int32 scriptlib::duel_is_player_can_send_to_deck(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_chain_negatable
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_chain_negatable
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
chaincount
=
lua_to
integer
(
L
,
1
);
int32
chaincount
=
lua_to
numberint
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
res
=
0
;
int32
res
=
0
;
if
(
chaincount
<
0
||
chaincount
>
(
int32
)
pduel
->
game_field
->
core
.
current_chain
.
size
())
if
(
chaincount
<
0
||
chaincount
>
(
int32
)
pduel
->
game_field
->
core
.
current_chain
.
size
())
...
@@ -3529,7 +3529,7 @@ int32 scriptlib::duel_is_chain_negatable(lua_State * L) {
...
@@ -3529,7 +3529,7 @@ int32 scriptlib::duel_is_chain_negatable(lua_State * L) {
}
}
int32
scriptlib
::
duel_is_chain_disablable
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_is_chain_disablable
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
chaincount
=
lua_to
integer
(
L
,
1
);
int32
chaincount
=
lua_to
numberint
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
res
=
0
;
int32
res
=
0
;
if
(
chaincount
<
0
||
chaincount
>
(
int32
)
pduel
->
game_field
->
core
.
current_chain
.
size
())
if
(
chaincount
<
0
||
chaincount
>
(
int32
)
pduel
->
game_field
->
core
.
current_chain
.
size
())
...
@@ -3553,7 +3553,7 @@ int32 scriptlib::duel_is_chain_disablable(lua_State * L) {
...
@@ -3553,7 +3553,7 @@ int32 scriptlib::duel_is_chain_disablable(lua_State * L) {
int32
scriptlib
::
duel_check_chain_target
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_check_chain_target
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
int32
chaincount
=
lua_to
integer
(
L
,
1
);
int32
chaincount
=
lua_to
numberint
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
pduel
->
game_field
->
check_chain_target
(
chaincount
,
pcard
));
lua_pushboolean
(
L
,
pcard
->
pduel
->
game_field
->
check_chain_target
(
chaincount
,
pcard
));
return
1
;
return
1
;
...
@@ -3575,13 +3575,13 @@ int32 scriptlib::duel_check_chain_uniqueness(lua_State *L) {
...
@@ -3575,13 +3575,13 @@ int32 scriptlib::duel_check_chain_uniqueness(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_activity_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_activity_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
retct
=
lua_gettop
(
L
)
-
1
;
int32
retct
=
lua_gettop
(
L
)
-
1
;
for
(
int32
i
=
0
;
i
<
retct
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
retct
;
++
i
)
{
int32
activity_type
=
lua_to
integer
(
L
,
2
+
i
);
int32
activity_type
=
lua_to
numberint
(
L
,
2
+
i
);
switch
(
activity_type
)
{
switch
(
activity_type
)
{
case
1
:
case
1
:
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
summon_state_count
[
playerid
]);
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
summon_state_count
[
playerid
]);
...
@@ -3616,8 +3616,8 @@ int32 scriptlib::duel_check_phase_activity(lua_State *L) {
...
@@ -3616,8 +3616,8 @@ int32 scriptlib::duel_check_phase_activity(lua_State *L) {
int32
scriptlib
::
duel_add_custom_activity_counter
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_add_custom_activity_counter
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
int32
counter_id
=
lua_to
integer
(
L
,
1
);
int32
counter_id
=
lua_to
numberint
(
L
,
1
);
int32
activity_type
=
lua_to
integer
(
L
,
2
);
int32
activity_type
=
lua_to
numberint
(
L
,
2
);
int32
counter_filter
=
interpreter
::
get_function_handle
(
L
,
3
);
int32
counter_filter
=
interpreter
::
get_function_handle
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
switch
(
activity_type
)
{
switch
(
activity_type
)
{
...
@@ -3671,9 +3671,9 @@ int32 scriptlib::duel_add_custom_activity_counter(lua_State *L) {
...
@@ -3671,9 +3671,9 @@ int32 scriptlib::duel_add_custom_activity_counter(lua_State *L) {
}
}
int32
scriptlib
::
duel_get_custom_activity_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_custom_activity_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
int32
counter_id
=
lua_to
integer
(
L
,
1
);
int32
counter_id
=
lua_to
numberint
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
2
);
int32
playerid
=
lua_to
numberint
(
L
,
2
);
int32
activity_type
=
lua_to
integer
(
L
,
3
);
int32
activity_type
=
lua_to
numberint
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
int32
val
=
0
;
int32
val
=
0
;
switch
(
activity_type
)
{
switch
(
activity_type
)
{
...
@@ -3727,7 +3727,7 @@ int32 scriptlib::duel_get_custom_activity_count(lua_State *L) {
...
@@ -3727,7 +3727,7 @@ int32 scriptlib::duel_get_custom_activity_count(lua_State *L) {
int32
scriptlib
::
duel_get_battled_count
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_get_battled_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
@@ -3795,7 +3795,7 @@ int32 scriptlib::duel_venom_swamp_check(lua_State *L) {
...
@@ -3795,7 +3795,7 @@ int32 scriptlib::duel_venom_swamp_check(lua_State *L) {
int32
scriptlib
::
duel_swap_deck_and_grave
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_swap_deck_and_grave
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
1
);
int32
playerid
=
lua_to
numberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
...
...
ocgcore/libeffect.cpp
View file @
411112ba
...
@@ -256,7 +256,7 @@ int32 scriptlib::effect_set_value(lua_State *L) {
...
@@ -256,7 +256,7 @@ int32 scriptlib::effect_set_value(lua_State *L) {
if
(
lua_isboolean
(
L
,
2
))
if
(
lua_isboolean
(
L
,
2
))
peffect
->
value
=
lua_toboolean
(
L
,
2
);
peffect
->
value
=
lua_toboolean
(
L
,
2
);
else
else
peffect
->
value
=
lua_to
integer
(
L
,
2
);
peffect
->
value
=
lua_to
numberint
(
L
,
2
);
}
}
return
0
;
return
0
;
}
}
...
@@ -450,7 +450,7 @@ int32 scriptlib::effect_is_active_type(lua_State *L) {
...
@@ -450,7 +450,7 @@ int32 scriptlib::effect_is_active_type(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
tpe
=
lua_to
integer
(
L
,
2
);
uint32
tpe
=
lua_to
numberint
(
L
,
2
);
uint32
atype
;
uint32
atype
;
if
(
peffect
->
type
&
0x7f0
)
{
if
(
peffect
->
type
&
0x7f0
)
{
if
(
peffect
->
active_type
)
if
(
peffect
->
active_type
)
...
@@ -480,7 +480,7 @@ int32 scriptlib::effect_is_has_category(lua_State *L) {
...
@@ -480,7 +480,7 @@ int32 scriptlib::effect_is_has_category(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
tcate
=
lua_to
integer
(
L
,
2
);
uint32
tcate
=
lua_to
numberint
(
L
,
2
);
if
(
peffect
&&
(
peffect
->
category
&
tcate
))
if
(
peffect
&&
(
peffect
->
category
&
tcate
))
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -491,7 +491,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) {
...
@@ -491,7 +491,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) {
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
ttype
=
lua_to
integer
(
L
,
2
);
uint32
ttype
=
lua_to
numberint
(
L
,
2
);
if
(
peffect
&&
(
peffect
->
type
&
ttype
))
if
(
peffect
&&
(
peffect
->
type
&
ttype
))
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
else
else
...
@@ -501,7 +501,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) {
...
@@ -501,7 +501,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) {
int32
scriptlib
::
effect_is_activatable
(
lua_State
*
L
)
{
int32
scriptlib
::
effect_is_activatable
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
uint32
playerid
=
lua_to
integer
(
L
,
2
);
uint32
playerid
=
lua_to
numberint
(
L
,
2
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
neglect_loc
=
0
;
uint32
neglect_loc
=
0
;
if
(
lua_gettop
(
L
)
>
2
)
if
(
lua_gettop
(
L
)
>
2
)
...
...
ocgcore/libgroup.cpp
View file @
411112ba
...
@@ -206,11 +206,11 @@ int32 scriptlib::group_filter_select(lua_State *L) {
...
@@ -206,11 +206,11 @@ int32 scriptlib::group_filter_select(lua_State *L) {
cset
.
erase
(
*
cit
);
cset
.
erase
(
*
cit
);
}
}
duel
*
pduel
=
pgroup
->
pduel
;
duel
*
pduel
=
pgroup
->
pduel
;
uint32
playerid
=
lua_to
integer
(
L
,
2
);
uint32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
min
=
lua_to
integer
(
L
,
4
);
uint32
min
=
lua_to
numberint
(
L
,
4
);
uint32
max
=
lua_to
integer
(
L
,
5
);
uint32
max
=
lua_to
numberint
(
L
,
5
);
uint32
extraargs
=
lua_gettop
(
L
)
-
6
;
uint32
extraargs
=
lua_gettop
(
L
)
-
6
;
pduel
->
game_field
->
core
.
select_cards
.
clear
();
pduel
->
game_field
->
core
.
select_cards
.
clear
();
for
(
auto
it
=
cset
.
begin
();
it
!=
cset
.
end
();
++
it
)
{
for
(
auto
it
=
cset
.
begin
();
it
!=
cset
.
end
();
++
it
)
{
...
@@ -235,11 +235,11 @@ int32 scriptlib::group_select(lua_State *L) {
...
@@ -235,11 +235,11 @@ int32 scriptlib::group_select(lua_State *L) {
cset
.
erase
(
*
cit
);
cset
.
erase
(
*
cit
);
}
}
duel
*
pduel
=
pgroup
->
pduel
;
duel
*
pduel
=
pgroup
->
pduel
;
uint32
playerid
=
lua_to
integer
(
L
,
2
);
uint32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
uint32
min
=
lua_to
integer
(
L
,
3
);
uint32
min
=
lua_to
numberint
(
L
,
3
);
uint32
max
=
lua_to
integer
(
L
,
4
);
uint32
max
=
lua_to
numberint
(
L
,
4
);
pduel
->
game_field
->
core
.
select_cards
.
clear
();
pduel
->
game_field
->
core
.
select_cards
.
clear
();
for
(
auto
it
=
cset
.
begin
();
it
!=
cset
.
end
();
++
it
)
{
for
(
auto
it
=
cset
.
begin
();
it
!=
cset
.
end
();
++
it
)
{
pduel
->
game_field
->
core
.
select_cards
.
push_back
(
*
it
);
pduel
->
game_field
->
core
.
select_cards
.
push_back
(
*
it
);
...
@@ -251,8 +251,8 @@ int32 scriptlib::group_random_select(lua_State *L) {
...
@@ -251,8 +251,8 @@ int32 scriptlib::group_random_select(lua_State *L) {
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
int32
playerid
=
lua_to
integer
(
L
,
2
);
int32
playerid
=
lua_to
numberint
(
L
,
2
);
int32
count
=
lua_to
integer
(
L
,
3
);
int32
count
=
lua_to
numberint
(
L
,
3
);
pgroup
->
pduel
->
game_field
->
add_process
(
PROCESSOR_RANDOM_SELECT_S
,
0
,
0
,
pgroup
,
playerid
,
count
);
pgroup
->
pduel
->
game_field
->
add_process
(
PROCESSOR_RANDOM_SELECT_S
,
0
,
0
,
pgroup
,
playerid
,
count
);
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
}
}
...
@@ -271,7 +271,7 @@ int32 scriptlib::group_is_exists(lua_State *L) {
...
@@ -271,7 +271,7 @@ int32 scriptlib::group_is_exists(lua_State *L) {
cset
.
erase
(
*
cit
);
cset
.
erase
(
*
cit
);
}
}
duel
*
pduel
=
pgroup
->
pduel
;
duel
*
pduel
=
pgroup
->
pduel
;
uint32
count
=
lua_to
integer
(
L
,
3
);
uint32
count
=
lua_to
numberint
(
L
,
3
);
uint32
extraargs
=
lua_gettop
(
L
)
-
4
;
uint32
extraargs
=
lua_gettop
(
L
)
-
4
;
uint32
fcount
=
0
;
uint32
fcount
=
0
;
uint32
result
=
FALSE
;
uint32
result
=
FALSE
;
...
@@ -293,9 +293,9 @@ int32 scriptlib::group_check_with_sum_equal(lua_State *L) {
...
@@ -293,9 +293,9 @@ int32 scriptlib::group_check_with_sum_equal(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
2
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
2
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pgroup
->
pduel
;
duel
*
pduel
=
pgroup
->
pduel
;
int32
acc
=
lua_to
integer
(
L
,
3
);
int32
acc
=
lua_to
numberint
(
L
,
3
);
int32
min
=
lua_to
integer
(
L
,
4
);
int32
min
=
lua_to
numberint
(
L
,
4
);
int32
max
=
lua_to
integer
(
L
,
5
);
int32
max
=
lua_to
numberint
(
L
,
5
);
if
(
min
<
0
)
if
(
min
<
0
)
min
=
0
;
min
=
0
;
if
(
max
<
min
)
if
(
max
<
min
)
...
@@ -321,12 +321,12 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) {
...
@@ -321,12 +321,12 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pgroup
->
pduel
;
duel
*
pduel
=
pgroup
->
pduel
;
int32
playerid
=
lua_to
integer
(
L
,
2
);
int32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
acc
=
lua_to
integer
(
L
,
4
);
int32
acc
=
lua_to
numberint
(
L
,
4
);
int32
min
=
lua_to
integer
(
L
,
5
);
int32
min
=
lua_to
numberint
(
L
,
5
);
int32
max
=
lua_to
integer
(
L
,
6
);
int32
max
=
lua_to
numberint
(
L
,
6
);
if
(
min
<
0
)
if
(
min
<
0
)
min
=
0
;
min
=
0
;
if
(
max
<
min
)
if
(
max
<
min
)
...
@@ -357,7 +357,7 @@ int32 scriptlib::group_check_with_sum_greater(lua_State *L) {
...
@@ -357,7 +357,7 @@ int32 scriptlib::group_check_with_sum_greater(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
2
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
2
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pgroup
->
pduel
;
duel
*
pduel
=
pgroup
->
pduel
;
int32
acc
=
lua_to
integer
(
L
,
3
);
int32
acc
=
lua_to
numberint
(
L
,
3
);
int32
extraargs
=
lua_gettop
(
L
)
-
3
;
int32
extraargs
=
lua_gettop
(
L
)
-
3
;
field
::
card_vector
cv
(
pduel
->
game_field
->
core
.
must_select_cards
);
field
::
card_vector
cv
(
pduel
->
game_field
->
core
.
must_select_cards
);
int32
mcount
=
cv
.
size
();
int32
mcount
=
cv
.
size
();
...
@@ -379,10 +379,10 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) {
...
@@ -379,10 +379,10 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
pgroup
->
pduel
;
duel
*
pduel
=
pgroup
->
pduel
;
int32
playerid
=
lua_to
integer
(
L
,
2
);
int32
playerid
=
lua_to
numberint
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
0
;
int32
acc
=
lua_to
integer
(
L
,
4
);
int32
acc
=
lua_to
numberint
(
L
,
4
);
int32
extraargs
=
lua_gettop
(
L
)
-
4
;
int32
extraargs
=
lua_gettop
(
L
)
-
4
;
pduel
->
game_field
->
core
.
select_cards
.
assign
(
pgroup
->
container
.
begin
(),
pgroup
->
container
.
end
());
pduel
->
game_field
->
core
.
select_cards
.
assign
(
pgroup
->
container
.
begin
(),
pgroup
->
container
.
end
());
for
(
auto
cit
=
pduel
->
game_field
->
core
.
must_select_cards
.
begin
();
cit
!=
pduel
->
game_field
->
core
.
must_select_cards
.
end
();
++
cit
)
{
for
(
auto
cit
=
pduel
->
game_field
->
core
.
must_select_cards
.
begin
();
cit
!=
pduel
->
game_field
->
core
.
must_select_cards
.
end
();
++
cit
)
{
...
...
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