Commit f8a45057 authored by nanahira's avatar nanahira

lua53

parent a3ede6a0
...@@ -9,12 +9,12 @@ addons: ...@@ -9,12 +9,12 @@ addons:
packages: packages:
- libevent-dev - libevent-dev
- libsqlite3-dev - libsqlite3-dev
- liblua5.2-dev - liblua5.3-dev
before_install: before_install:
- git submodule update --init --recursive - git submodule update --init --recursive
- wget -O - https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-linux.tar.gz | tar zfx - - wget -O - https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-linux.tar.gz | tar zfx -
script: script:
- ./premake5 gmake - ./premake5 gmake
- cd build - cd build
- sed -i 's/-llua/-llua5.2/g' ygopro.make - sed -i 's/-llua/-llua5.3/g' ygopro.make
- make config=release - make config=release
...@@ -12,9 +12,9 @@ install: ...@@ -12,9 +12,9 @@ install:
- move libevent-2.0.22-stable event - move libevent-2.0.22-stable event
- xcopy /E event\WIN32-Code event\include - xcopy /E event\WIN32-Code event\include
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.lua.org/ftp/lua-5.2.4.tar.gz ; exit 0" - bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.lua.org/ftp/lua-5.3.4.tar.gz ; exit 0"
- tar xf lua-5.2.4.tar.gz - tar xf lua-5.3.4.tar.gz
- move lua-5.2.4\src lua - move lua-5.3.4\src lua
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/2016/sqlite-amalgamation-3150200.zip ; exit 0" - bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/2016/sqlite-amalgamation-3150200.zip ; exit 0"
- 7z x sqlite-amalgamation-3150200.zip - 7z x sqlite-amalgamation-3150200.zip
...@@ -115,7 +115,7 @@ cache: ...@@ -115,7 +115,7 @@ cache:
- libevent-2.0.22-stable.tar.gz - libevent-2.0.22-stable.tar.gz
- freetype-2.8.tar.bz2 - freetype-2.8.tar.bz2
- irrlicht-1.8.4.zip - irrlicht-1.8.4.zip
- lua-5.2.4.tar.gz - lua-5.3.4.tar.gz
- sqlite-amalgamation-3200100.zip - sqlite-amalgamation-3200100.zip
- irrKlang-32bit-1.5.0.zip - irrKlang-32bit-1.5.0.zip
- irrKlang-pro-1.5.0.zip - irrKlang-pro-1.5.0.zip
......
...@@ -104,6 +104,7 @@ public: ...@@ -104,6 +104,7 @@ public:
public: public:
void addcard(card* pcard); void addcard(card* pcard);
}; };
//millux //millux
uint32 get_ritual_type(); uint32 get_ritual_type();
//222DIY //222DIY
......
...@@ -38,6 +38,7 @@ typedef int BOOL; ...@@ -38,6 +38,7 @@ typedef int BOOL;
#ifndef NULL #ifndef NULL
#define NULL 0 #define NULL 0
#endif #endif
#define lua_tonumberint(L,i) (lua_Integer)(((lua_tonumberx(L, (i), NULL) > 0) ? 0.5 : -0.5) + lua_tonumberx(L, (i), NULL))
struct card_sort { struct card_sort {
bool operator()(void* const & c1, void* const & c2) const; bool operator()(void* const & c1, void* const & c2) const;
}; };
......
...@@ -1033,7 +1033,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg ...@@ -1033,7 +1033,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg
} }
return OPERATION_FAIL; return OPERATION_FAIL;
} }
result = lua_tointeger(current_state, -1); result = lua_tonumberint(current_state, -1);
lua_pop(current_state, 1); lua_pop(current_state, 1);
no_action--; no_action--;
call_depth--; call_depth--;
...@@ -1055,7 +1055,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count) { ...@@ -1055,7 +1055,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_tointeger(current_state, -1); result = lua_tonumberint(current_state, -1);
lua_pop(current_state, 1); lua_pop(current_state, 1);
no_action--; no_action--;
call_depth--; call_depth--;
...@@ -1089,7 +1089,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count, std::vector<i ...@@ -1089,7 +1089,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_tointeger(current_state, index); return_value = lua_tonumberint(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);
...@@ -1150,7 +1150,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va ...@@ -1150,7 +1150,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_tointeger(rthread, -1); *yield_value = lua_isboolean(rthread, -1) ? lua_toboolean(rthread, -1) : lua_tonumberint(rthread, -1);
current_state = lua_state; current_state = lua_state;
call_depth--; call_depth--;
if(call_depth == 0) { if(call_depth == 0) {
......
...@@ -18,7 +18,7 @@ int32 scriptlib::card_is_ritual_type(lua_State *L) { ...@@ -18,7 +18,7 @@ int32 scriptlib::card_is_ritual_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_tointeger(L, 2); uint32 ttype = lua_tonumberint(L, 2);
if(pcard->get_ritual_type() & ttype) if(pcard->get_ritual_type() & ttype)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -30,7 +30,7 @@ int32 scriptlib::card_set_entity_code(lua_State *L) { ...@@ -30,7 +30,7 @@ int32 scriptlib::card_set_entity_code(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_tointeger(L, 2); uint32 trace = lua_tonumberint(L, 2);
bool remove_alias = false; bool remove_alias = false;
int32 enable = lua_toboolean(L, 3); int32 enable = lua_toboolean(L, 3);
if (enable) if (enable)
...@@ -42,43 +42,43 @@ int32 scriptlib::card_set_card_data(lua_State *L) { ...@@ -42,43 +42,43 @@ int32 scriptlib::card_set_card_data(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);
int32 stype = lua_tointeger(L, 2); int32 stype = lua_tonumberint(L, 2);
switch(stype) { switch(stype) {
case ASSUME_CODE: case ASSUME_CODE:
pcard->data.code = lua_tointeger(L, 3); pcard->data.code = lua_tonumberint(L, 3);
break; break;
case ASSUME_TYPE: case ASSUME_TYPE:
pcard->data.type = lua_tointeger(L, 3); pcard->data.type = lua_tonumberint(L, 3);
break; break;
case ASSUME_LEVEL: case ASSUME_LEVEL:
pcard->data.level = lua_tointeger(L, 3); pcard->data.level = lua_tonumberint(L, 3);
break; break;
case ASSUME_RANK: case ASSUME_RANK:
pcard->data.level = lua_tointeger(L, 3); pcard->data.level = lua_tonumberint(L, 3);
break; break;
case ASSUME_ATTRIBUTE: case ASSUME_ATTRIBUTE:
pcard->data.attribute = lua_tointeger(L, 3); pcard->data.attribute = lua_tonumberint(L, 3);
break; break;
case ASSUME_RACE: case ASSUME_RACE:
pcard->data.race = lua_tointeger(L, 3); pcard->data.race = lua_tonumberint(L, 3);
break; break;
case ASSUME_ATTACK: case ASSUME_ATTACK:
pcard->data.attack = lua_tointeger(L, 3); pcard->data.attack = lua_tonumberint(L, 3);
break; break;
case ASSUME_DEFENSE: case ASSUME_DEFENSE:
pcard->data.defense = lua_tointeger(L, 3); pcard->data.defense = lua_tonumberint(L, 3);
break; break;
case 9: case 9:
pcard->data.alias = lua_tointeger(L, 3); pcard->data.alias = lua_tonumberint(L, 3);
break; break;
case 10: case 10:
pcard->data.lscale = lua_tointeger(L, 3); pcard->data.lscale = lua_tonumberint(L, 3);
break; break;
case 11: case 11:
pcard->data.rscale = lua_tointeger(L, 3); pcard->data.rscale = lua_tonumberint(L, 3);
break; break;
case 12: case 12:
pcard->data.link_marker = lua_tointeger(L, 3); pcard->data.link_marker = lua_tonumberint(L, 3);
break; break;
} }
return 0; return 0;
...@@ -170,7 +170,7 @@ int32 scriptlib::card_is_fusion_code(lua_State *L) { ...@@ -170,7 +170,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_tointeger(L, i + 2); uint32 tcode = lua_tonumberint(L, i + 2);
if(fcode.find(tcode) != fcode.end()) { if(fcode.find(tcode) != fcode.end()) {
result = TRUE; result = TRUE;
break; break;
...@@ -183,7 +183,7 @@ int32 scriptlib::card_is_set_card(lua_State *L) { ...@@ -183,7 +183,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_tointeger(L, 2); uint32 set_code = lua_tonumberint(L, 2);
lua_pushboolean(L, pcard->is_set_card(set_code)); lua_pushboolean(L, pcard->is_set_card(set_code));
return 1; return 1;
} }
...@@ -191,7 +191,7 @@ int32 scriptlib::card_is_origin_set_card(lua_State *L) { ...@@ -191,7 +191,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_tointeger(L, 2); uint32 set_code = lua_tonumberint(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;
} }
...@@ -199,7 +199,7 @@ int32 scriptlib::card_is_pre_set_card(lua_State *L) { ...@@ -199,7 +199,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_tointeger(L, 2); uint32 set_code = lua_tonumberint(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;
} }
...@@ -207,7 +207,7 @@ int32 scriptlib::card_is_fusion_set_card(lua_State *L) { ...@@ -207,7 +207,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_tointeger(L, 2); uint32 set_code = lua_tonumberint(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;
} }
...@@ -316,7 +316,7 @@ int32 scriptlib::card_is_xyz_level(lua_State *L) { ...@@ -316,7 +316,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_tointeger(L, 3); uint32 lv = lua_tonumberint(L, 3);
lua_pushboolean(L, pcard->check_xyz_level(xyzcard, lv)); lua_pushboolean(L, pcard->check_xyz_level(xyzcard, lv));
return 1; return 1;
} }
...@@ -352,7 +352,7 @@ int32 scriptlib::card_is_link_marker(lua_State *L) { ...@@ -352,7 +352,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_tointeger(L, 2); uint32 dir = lua_tonumberint(L, 2);
lua_pushboolean(L, pcard->is_link_marker(dir)); lua_pushboolean(L, pcard->is_link_marker(dir));
return 1; return 1;
} }
...@@ -382,7 +382,7 @@ int32 scriptlib::card_get_linked_zone(lua_State *L) { ...@@ -382,7 +382,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_tointeger(L, 2); cp = lua_tonumberint(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
...@@ -415,7 +415,7 @@ int32 scriptlib::card_get_mutual_linked_zone(lua_State *L) { ...@@ -415,7 +415,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_tointeger(L, 2); cp = lua_tonumberint(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
...@@ -436,9 +436,9 @@ int32 scriptlib::card_get_column_group(lua_State *L) { ...@@ -436,9 +436,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_tointeger(L, 2); left = lua_tonumberint(L, 2);
if(lua_gettop(L) >= 3) if(lua_gettop(L) >= 3)
right = lua_tointeger(L, 3); right = lua_tonumberint(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);
...@@ -452,9 +452,9 @@ int32 scriptlib::card_get_column_group_count(lua_State *L) { ...@@ -452,9 +452,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_tointeger(L, 2); left = lua_tonumberint(L, 2);
if(lua_gettop(L) >= 3) if(lua_gettop(L) >= 3)
right = lua_tointeger(L, 3); right = lua_tonumberint(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());
...@@ -464,16 +464,16 @@ int32 scriptlib::card_get_column_zone(lua_State *L) { ...@@ -464,16 +464,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_tointeger(L, 2); int32 loc = lua_tonumberint(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_tointeger(L, 3); left = lua_tonumberint(L, 3);
if(lua_gettop(L) >= 4) if(lua_gettop(L) >= 4)
right = lua_tointeger(L, 4); right = lua_tonumberint(L, 4);
if(lua_gettop(L) >= 5 && !lua_isnil(L, 5)) if(lua_gettop(L) >= 5 && !lua_isnil(L, 5))
cp = lua_tointeger(L, 5); cp = lua_tonumberint(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)));
...@@ -511,7 +511,7 @@ int32 scriptlib::card_get_fusion_attribute(lua_State *L) { ...@@ -511,7 +511,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_tointeger(L, 2); playerid = lua_tonumberint(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));
...@@ -810,7 +810,7 @@ int32 scriptlib::card_is_code(lua_State *L) { ...@@ -810,7 +810,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_tointeger(L, i + 2); uint32 tcode = lua_tonumberint(L, i + 2);
if(code1 == tcode || (code2 && code2 == tcode)) { if(code1 == tcode || (code2 && code2 == tcode)) {
result = TRUE; result = TRUE;
break; break;
...@@ -823,7 +823,7 @@ int32 scriptlib::card_is_type(lua_State *L) { ...@@ -823,7 +823,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_tointeger(L, 2); uint32 ttype = lua_tonumberint(L, 2);
if(pcard->get_type() & ttype) if(pcard->get_type() & ttype)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -834,7 +834,7 @@ int32 scriptlib::card_is_fusion_type(lua_State *L) { ...@@ -834,7 +834,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_tointeger(L, 2); uint32 ttype = lua_tonumberint(L, 2);
if(pcard->get_fusion_type() & ttype) if(pcard->get_fusion_type() & ttype)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -845,7 +845,7 @@ int32 scriptlib::card_is_synchro_type(lua_State *L) { ...@@ -845,7 +845,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_tointeger(L, 2); uint32 ttype = lua_tonumberint(L, 2);
if(pcard->get_synchro_type() & ttype) if(pcard->get_synchro_type() & ttype)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -856,7 +856,7 @@ int32 scriptlib::card_is_xyz_type(lua_State *L) { ...@@ -856,7 +856,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_tointeger(L, 2); uint32 ttype = lua_tonumberint(L, 2);
if(pcard->get_xyz_type() & ttype) if(pcard->get_xyz_type() & ttype)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -867,7 +867,7 @@ int32 scriptlib::card_is_link_type(lua_State *L) { ...@@ -867,7 +867,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_tointeger(L, 2); uint32 ttype = lua_tonumberint(L, 2);
if(pcard->get_link_type() & ttype) if(pcard->get_link_type() & ttype)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -878,7 +878,7 @@ int32 scriptlib::card_is_level(lua_State *L) { ...@@ -878,7 +878,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_tointeger(L, 2); uint32 tlevel = lua_tonumberint(L, 2);
if(pcard->get_level() == tlevel) if(pcard->get_level() == tlevel)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -889,7 +889,7 @@ int32 scriptlib::card_is_rank(lua_State *L) { ...@@ -889,7 +889,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_tointeger(L, 2); uint32 trank = lua_tonumberint(L, 2);
if(pcard->get_rank() == trank) if(pcard->get_rank() == trank)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -900,7 +900,7 @@ int32 scriptlib::card_is_link(lua_State *L) { ...@@ -900,7 +900,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_tointeger(L, 2); uint32 tlink = lua_tonumberint(L, 2);
if(pcard->get_link() == tlink) if(pcard->get_link() == tlink)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -911,7 +911,7 @@ int32 scriptlib::card_is_race(lua_State *L) { ...@@ -911,7 +911,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_tointeger(L, 2); uint32 trace = lua_tonumberint(L, 2);
if(pcard->get_race() & trace) if(pcard->get_race() & trace)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -922,7 +922,7 @@ int32 scriptlib::card_is_attribute(lua_State *L) { ...@@ -922,7 +922,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_tointeger(L, 2); uint32 tattrib = lua_tonumberint(L, 2);
if(pcard->get_attribute() & tattrib) if(pcard->get_attribute() & tattrib)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -933,10 +933,10 @@ int32 scriptlib::card_is_fusion_attribute(lua_State *L) { ...@@ -933,10 +933,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_tointeger(L, 2); uint32 tattrib = lua_tonumberint(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_tointeger(L, 3); playerid = lua_tonumberint(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)
...@@ -949,7 +949,7 @@ int32 scriptlib::card_is_reason(lua_State *L) { ...@@ -949,7 +949,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_tointeger(L, 2); uint32 treason = lua_tonumberint(L, 2);
if(pcard->current.reason & treason) if(pcard->current.reason & treason)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -960,7 +960,7 @@ int32 scriptlib::card_is_summon_type(lua_State *L) { ...@@ -960,7 +960,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_tointeger(L, 2); uint32 ttype = lua_tonumberint(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
...@@ -1030,7 +1030,7 @@ int32 scriptlib::card_set_turn_counter(lua_State *L) { ...@@ -1030,7 +1030,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_tointeger(L, 2); int32 ct = lua_tonumberint(L, 2);
pcard->count_turn(ct); pcard->count_turn(ct);
return 0; return 0;
} }
...@@ -1146,11 +1146,11 @@ int32 scriptlib::card_check_remove_overlay_card(lua_State *L) { ...@@ -1146,11 +1146,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_tointeger(L, 2); int32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 count = lua_tointeger(L, 3); int32 count = lua_tonumberint(L, 3);
int32 reason = lua_tointeger(L, 4); int32 reason = lua_tonumberint(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;
...@@ -1160,12 +1160,12 @@ int32 scriptlib::card_remove_overlay_card(lua_State *L) { ...@@ -1160,12 +1160,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_tointeger(L, 2); int32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 min = lua_tointeger(L, 3); int32 min = lua_tonumberint(L, 3);
int32 max = lua_tointeger(L, 4); int32 max = lua_tonumberint(L, 4);
int32 reason = lua_tointeger(L, 5); int32 reason = lua_tonumberint(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);
...@@ -1434,7 +1434,7 @@ int32 scriptlib::card_is_has_effect(lua_State *L) { ...@@ -1434,7 +1434,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_tointeger(L, 2); uint32 code = lua_tonumberint(L, 2);
if(!pcard) { if(!pcard) {
lua_pushnil(L); lua_pushnil(L);
return 1; return 1;
...@@ -1454,8 +1454,8 @@ int32 scriptlib::card_reset_effect(lua_State *L) { ...@@ -1454,8 +1454,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_tointeger(L, 2); uint32 code = lua_tonumberint(L, 2);
uint32 type = lua_tointeger(L, 3); uint32 type = lua_tonumberint(L, 3);
pcard->reset(code, type); pcard->reset(code, type);
return 0; return 0;
} }
...@@ -1463,7 +1463,7 @@ int32 scriptlib::card_get_effect_count(lua_State *L) { ...@@ -1463,7 +1463,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_tointeger(L, 2); uint32 code = lua_tonumberint(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());
...@@ -1473,16 +1473,16 @@ int32 scriptlib::card_register_flag_effect(lua_State *L) { ...@@ -1473,16 +1473,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_tointeger(L, 2) & 0xfffffff) | 0x10000000; int32 code = (lua_tonumberint(L, 2) & 0xfffffff) | 0x10000000;
int32 reset = lua_tointeger(L, 3); int32 reset = lua_tonumberint(L, 3);
int32 flag = lua_tointeger(L, 4); int32 flag = lua_tonumberint(L, 4);
int32 count = lua_tointeger(L, 5); int32 count = lua_tonumberint(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_tointeger(L, 6); lab = lua_tonumberint(L, 6);
if(lua_gettop(L) >= 7) if(lua_gettop(L) >= 7)
desc = lua_tointeger(L, 7); desc = lua_tonumberint(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)))
...@@ -1506,7 +1506,7 @@ int32 scriptlib::card_get_flag_effect(lua_State *L) { ...@@ -1506,7 +1506,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_tointeger(L, 2) & 0xfffffff) | 0x10000000; int32 code = (lua_tonumberint(L, 2) & 0xfffffff) | 0x10000000;
lua_pushinteger(L, pcard->single_effect.count(code)); lua_pushinteger(L, pcard->single_effect.count(code));
return 1; return 1;
} }
...@@ -1514,7 +1514,7 @@ int32 scriptlib::card_reset_flag_effect(lua_State *L) { ...@@ -1514,7 +1514,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_tointeger(L, 2) & 0xfffffff) | 0x10000000; int32 code = (lua_tonumberint(L, 2) & 0xfffffff) | 0x10000000;
pcard->reset(code, RESET_CODE); pcard->reset(code, RESET_CODE);
return 0; return 0;
} }
...@@ -1523,7 +1523,7 @@ int32 scriptlib::card_set_flag_effect_label(lua_State *L) { ...@@ -1523,7 +1523,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_tointeger(L, 3); int32 lab = lua_tonumberint(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);
...@@ -1556,7 +1556,7 @@ int32 scriptlib::card_create_relation(lua_State *L) { ...@@ -1556,7 +1556,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_tointeger(L, 3); uint32 reset = lua_tonumberint(L, 3);
pcard->create_relation(rcard, reset); pcard->create_relation(rcard, reset);
return 0; return 0;
} }
...@@ -1610,7 +1610,7 @@ int32 scriptlib::card_is_relate_to_chain(lua_State *L) { ...@@ -1610,7 +1610,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_tointeger(L, 2); uint32 chain_count = lua_tonumberint(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();
...@@ -1647,9 +1647,9 @@ int32 scriptlib::card_copy_effect(lua_State *L) { ...@@ -1647,9 +1647,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_tointeger(L, 2); uint32 code = lua_tonumberint(L, 2);
uint32 reset = lua_tointeger(L, 3); uint32 reset = lua_tonumberint(L, 3);
uint32 count = lua_tointeger(L, 4); uint32 count = lua_tonumberint(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)))
...@@ -1661,9 +1661,9 @@ int32 scriptlib::card_replace_effect(lua_State * L) { ...@@ -1661,9 +1661,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_tointeger(L, 2); uint32 code = lua_tonumberint(L, 2);
uint32 reset = lua_tointeger(L, 3); uint32 reset = lua_tonumberint(L, 3);
uint32 count = lua_tointeger(L, 4); uint32 count = lua_tonumberint(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)))
...@@ -1749,7 +1749,7 @@ int32 scriptlib::card_is_fusion_summonable_card(lua_State *L) { ...@@ -1749,7 +1749,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_tointeger(L, 2); summon_type = lua_tonumberint(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;
} }
...@@ -1766,10 +1766,10 @@ int32 scriptlib::card_is_msetable(lua_State *L) { ...@@ -1766,10 +1766,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_tointeger(L, 4); minc = lua_tonumberint(L, 4);
uint32 zone = 0x1f; uint32 zone = 0x1f;
if(lua_gettop(L) >= 5) if(lua_gettop(L) >= 5)
zone = lua_tointeger(L, 5); zone = lua_tonumberint(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;
} }
...@@ -1829,10 +1829,10 @@ int32 scriptlib::card_is_xyz_summonable(lua_State *L) { ...@@ -1829,10 +1829,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_tointeger(L, 3); minc = lua_tonumberint(L, 3);
int32 maxc = 0; int32 maxc = 0;
if(lua_gettop(L) >= 4) if(lua_gettop(L) >= 4)
maxc = lua_tointeger(L, 4); maxc = lua_tonumberint(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;
...@@ -1853,10 +1853,10 @@ int32 scriptlib::card_is_can_be_summoned(lua_State *L) { ...@@ -1853,10 +1853,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_tointeger(L, 4); minc = lua_tonumberint(L, 4);
uint32 zone = 0x1f; uint32 zone = 0x1f;
if(lua_gettop(L) >= 5) if(lua_gettop(L) >= 5)
zone = lua_tointeger(L, 5); zone = lua_tonumberint(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;
} }
...@@ -1866,19 +1866,19 @@ int32 scriptlib::card_is_can_be_special_summoned(lua_State *L) { ...@@ -1866,19 +1866,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_tointeger(L, 3); uint32 sumtype = lua_tonumberint(L, 3);
uint32 sumplayer = lua_tointeger(L, 4); uint32 sumplayer = lua_tonumberint(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_tointeger(L, 7); sumpos = lua_tonumberint(L, 7);
if(lua_gettop(L) >= 8) if(lua_gettop(L) >= 8)
toplayer = lua_tointeger(L, 8); toplayer = lua_tonumberint(L, 8);
if(lua_gettop(L) >= 9) if(lua_gettop(L) >= 9)
zone = lua_tointeger(L, 9); zone = lua_tonumberint(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
...@@ -1935,7 +1935,7 @@ int32 scriptlib::card_is_able_to_remove(lua_State *L) { ...@@ -1935,7 +1935,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_tointeger(L, 2); p = lua_tonumberint(L, 2);
if(pcard->is_removeable(p)) if(pcard->is_removeable(p))
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -2040,7 +2040,7 @@ int32 scriptlib::card_is_discardable(lua_State *L) { ...@@ -2040,7 +2040,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_tointeger(L, 2); reason = lua_tonumberint(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);
...@@ -2063,7 +2063,7 @@ int32 scriptlib::card_is_chain_attackable(lua_State *L) { ...@@ -2063,7 +2063,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_tointeger(L, 2); ac = lua_tonumberint(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;
...@@ -2116,7 +2116,7 @@ int32 scriptlib::card_is_position(lua_State *L) { ...@@ -2116,7 +2116,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_tointeger(L, 2); uint32 pos = lua_tonumberint(L, 2);
lua_pushboolean(L, pcard->is_position(pos)); lua_pushboolean(L, pcard->is_position(pos));
return 1; return 1;
} }
...@@ -2124,7 +2124,7 @@ int32 scriptlib::card_is_pre_position(lua_State *L) { ...@@ -2124,7 +2124,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_tointeger(L, 2); uint32 pos = lua_tonumberint(L, 2);
lua_pushboolean(L, pcard->previous.position & pos); lua_pushboolean(L, pcard->previous.position & pos);
return 1; return 1;
} }
...@@ -2132,7 +2132,7 @@ int32 scriptlib::card_is_controler(lua_State *L) { ...@@ -2132,7 +2132,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_tointeger(L, 2); uint32 con = lua_tonumberint(L, 2);
if(pcard->current.controler == con) if(pcard->current.controler == con)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -2154,7 +2154,7 @@ int32 scriptlib::card_is_location(lua_State *L) { ...@@ -2154,7 +2154,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_tointeger(L, 2); uint32 loc = lua_tonumberint(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);
...@@ -2173,7 +2173,7 @@ int32 scriptlib::card_is_pre_location(lua_State *L) { ...@@ -2173,7 +2173,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_tointeger(L, 2); uint32 loc = lua_tonumberint(L, 2);
lua_pushboolean(L, pcard->previous.is_location(loc)); lua_pushboolean(L, pcard->previous.is_location(loc));
return 1; return 1;
} }
...@@ -2181,7 +2181,7 @@ int32 scriptlib::card_is_level_below(lua_State *L) { ...@@ -2181,7 +2181,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_tointeger(L, 2); uint32 lvl = lua_tonumberint(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);
...@@ -2193,7 +2193,7 @@ int32 scriptlib::card_is_level_above(lua_State *L) { ...@@ -2193,7 +2193,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_tointeger(L, 2); uint32 lvl = lua_tonumberint(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);
...@@ -2205,7 +2205,7 @@ int32 scriptlib::card_is_rank_below(lua_State *L) { ...@@ -2205,7 +2205,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_tointeger(L, 2); uint32 rnk = lua_tonumberint(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);
...@@ -2217,7 +2217,7 @@ int32 scriptlib::card_is_rank_above(lua_State *L) { ...@@ -2217,7 +2217,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_tointeger(L, 2); uint32 rnk = lua_tonumberint(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);
...@@ -2229,7 +2229,7 @@ int32 scriptlib::card_is_link_below(lua_State *L) { ...@@ -2229,7 +2229,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_tointeger(L, 2); uint32 lnk = lua_tonumberint(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);
...@@ -2241,7 +2241,7 @@ int32 scriptlib::card_is_link_above(lua_State *L) { ...@@ -2241,7 +2241,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_tointeger(L, 2); uint32 lnk = lua_tonumberint(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);
...@@ -2253,7 +2253,7 @@ int32 scriptlib::card_is_attack_below(lua_State *L) { ...@@ -2253,7 +2253,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_tointeger(L, 2); int32 atk = lua_tonumberint(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 {
...@@ -2266,7 +2266,7 @@ int32 scriptlib::card_is_attack_above(lua_State *L) { ...@@ -2266,7 +2266,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_tointeger(L, 2); int32 atk = lua_tonumberint(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 {
...@@ -2279,7 +2279,7 @@ int32 scriptlib::card_is_defense_below(lua_State *L) { ...@@ -2279,7 +2279,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_tointeger(L, 2); int32 def = lua_tonumberint(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 {
...@@ -2292,7 +2292,7 @@ int32 scriptlib::card_is_defense_above(lua_State *L) { ...@@ -2292,7 +2292,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_tointeger(L, 2); int32 def = lua_tonumberint(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 {
...@@ -2337,7 +2337,7 @@ int32 scriptlib::card_is_controler_can_be_changed(lua_State *L) { ...@@ -2337,7 +2337,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_tointeger(L, 3); zone = lua_tonumberint(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
...@@ -2348,8 +2348,8 @@ int32 scriptlib::card_add_counter(lua_State *L) { ...@@ -2348,8 +2348,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_tointeger(L, 2); uint32 countertype = lua_tonumberint(L, 2);
uint32 count = lua_tointeger(L, 3); uint32 count = lua_tonumberint(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);
...@@ -2363,10 +2363,10 @@ int32 scriptlib::card_remove_counter(lua_State *L) { ...@@ -2363,10 +2363,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_tointeger(L, 2); uint32 rplayer = lua_tonumberint(L, 2);
uint32 countertype = lua_tointeger(L, 3); uint32 countertype = lua_tonumberint(L, 3);
uint32 count = lua_tointeger(L, 4); uint32 count = lua_tonumberint(L, 4);
uint32 reason = lua_tointeger(L, 5); uint32 reason = lua_tonumberint(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) {
...@@ -2388,7 +2388,7 @@ int32 scriptlib::card_get_counter(lua_State *L) { ...@@ -2388,7 +2388,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_tointeger(L, 2); uint32 countertype = lua_tonumberint(L, 2);
if(countertype == 0) if(countertype == 0)
lua_pushinteger(L, pcard->counters.size()); lua_pushinteger(L, pcard->counters.size());
else else
...@@ -2398,10 +2398,10 @@ int32 scriptlib::card_get_counter(lua_State *L) { ...@@ -2398,10 +2398,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_tointeger(L, 2); int32 countertype = lua_tonumberint(L, 2);
uint32 prange; uint32 prange;
if(lua_gettop(L) > 2) if(lua_gettop(L) > 2)
prange = lua_tointeger(L, 3); prange = lua_tonumberint(L, 3);
else if(pcard->data.type & TYPE_MONSTER) else if(pcard->data.type & TYPE_MONSTER)
prange = LOCATION_MZONE; prange = LOCATION_MZONE;
else else
...@@ -2417,8 +2417,8 @@ int32 scriptlib::card_enable_counter_permit(lua_State *L) { ...@@ -2417,8 +2417,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_tointeger(L, 2); int32 countertype = lua_tonumberint(L, 2);
int32 limit = lua_tointeger(L, 3); int32 limit = lua_tonumberint(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;
...@@ -2445,14 +2445,14 @@ int32 scriptlib::card_is_can_add_counter(lua_State *L) { ...@@ -2445,14 +2445,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_tointeger(L, 2); uint32 countertype = lua_tonumberint(L, 2);
uint32 count = lua_tointeger(L, 3); uint32 count = lua_tonumberint(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_tointeger(L, 5); loc = lua_tonumberint(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;
} }
...@@ -2460,12 +2460,12 @@ int32 scriptlib::card_is_can_remove_counter(lua_State *L) { ...@@ -2460,12 +2460,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_tointeger(L, 2); uint32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 countertype = lua_tointeger(L, 3); uint32 countertype = lua_tonumberint(L, 3);
uint32 count = lua_tointeger(L, 4); uint32 count = lua_tonumberint(L, 4);
uint32 reason = lua_tointeger(L, 5); uint32 reason = lua_tonumberint(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;
} }
...@@ -2550,7 +2550,7 @@ int32 scriptlib::card_check_fusion_material(lua_State *L) { ...@@ -2550,7 +2550,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_tointeger(L, 4); chkf = lua_tonumberint(L, 4);
lua_pushboolean(L, pcard->fusion_check(pgroup, cg, chkf)); lua_pushboolean(L, pcard->fusion_check(pgroup, cg, chkf));
return 1; return 1;
} }
...@@ -2597,12 +2597,12 @@ int32 scriptlib::card_is_can_be_battle_target(lua_State *L) { ...@@ -2597,12 +2597,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_tointeger(L, 2); int32 type = lua_tonumberint(L, 2);
int32 attribute = lua_tointeger(L, 3); int32 attribute = lua_tonumberint(L, 3);
int32 race = lua_tointeger(L, 4); int32 race = lua_tonumberint(L, 4);
int32 level = lua_tointeger(L, 5); int32 level = lua_tonumberint(L, 5);
int32 atk = lua_tointeger(L, 6); int32 atk = lua_tonumberint(L, 6);
int32 def = lua_tointeger(L, 7); int32 def = lua_tonumberint(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);
...@@ -2763,8 +2763,8 @@ int32 scriptlib::card_set_hint(lua_State *L) { ...@@ -2763,8 +2763,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_tointeger(L, 2); uint32 type = lua_tonumberint(L, 2);
uint32 value = lua_tointeger(L, 3); uint32 value = lua_tonumberint(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);
...@@ -2793,16 +2793,16 @@ int32 scriptlib::card_set_unique_onfield(lua_State *L) { ...@@ -2793,16 +2793,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_tointeger(L, 2); pcard->unique_pos[0] = lua_tonumberint(L, 2);
pcard->unique_pos[1] = lua_tointeger(L, 3); pcard->unique_pos[1] = lua_tonumberint(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_tointeger(L, 4); pcard->unique_code = lua_tonumberint(L, 4);
uint32 location = LOCATION_ONFIELD; uint32 location = LOCATION_ONFIELD;
if(lua_gettop(L) > 4) if(lua_gettop(L) > 4)
location = lua_tointeger(L, 5) & LOCATION_ONFIELD; location = lua_tonumberint(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;
...@@ -2819,10 +2819,10 @@ int32 scriptlib::card_check_unique_onfield(lua_State *L) { ...@@ -2819,10 +2819,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_tointeger(L, 2); uint32 check_player = lua_tonumberint(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_tointeger(L, 3) & LOCATION_ONFIELD; check_location = lua_tonumberint(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))
...@@ -2837,15 +2837,15 @@ int32 scriptlib::card_reset_negate_effect(lua_State *L) { ...@@ -2837,15 +2837,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_tointeger(L, i + 2), RESET_CARD); pcard->reset(lua_tonumberint(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_tointeger(L, 2); pcard->assume_type = lua_tonumberint(L, 2);
pcard->assume_value = lua_tointeger(L, 3); pcard->assume_value = lua_tonumberint(L, 3);
pcard->pduel->assumes.insert(pcard); pcard->pduel->assumes.insert(pcard);
return 0; return 0;
} }
...@@ -2855,7 +2855,7 @@ int32 scriptlib::card_set_spsummon_once(lua_State *L) { ...@@ -2855,7 +2855,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_tointeger(L, 2); pcard->spsummon_code = lua_tonumberint(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;
} }
...@@ -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_tointeger(L, 1); int32 code = lua_tonumberint(L, 1);
int32 owner = lua_tointeger(L, 2); int32 owner = lua_tonumberint(L, 2);
int32 playerid = lua_tointeger(L, 3); int32 playerid = lua_tonumberint(L, 3);
int32 location = lua_tointeger(L, 4); int32 location = lua_tonumberint(L, 4);
int32 sequence = lua_tointeger(L, 5); int32 sequence = lua_tonumberint(L, 5);
int32 position = lua_tointeger(L, 6); int32 position = lua_tonumberint(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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
uint32 lp = lua_tointeger(L, 2); uint32 lp = lua_tonumberint(L, 2);
uint32 startcount = lua_tointeger(L, 3); uint32 startcount = lua_tonumberint(L, 3);
uint32 drawcount = lua_tointeger(L, 4); uint32 drawcount = lua_tonumberint(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_tointeger(L, 2); uint32 summon_type = lua_tonumberint(L, 2);
uint8 summon_location = 0; uint8 summon_location = 0;
if(lua_gettop(L) > 2) if(lua_gettop(L) > 2)
summon_location = lua_tointeger(L, 3); summon_location = lua_tonumberint(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_tointeger(L, 2); uint32 countertype = lua_tonumberint(L, 2);
uint32 count = lua_tointeger(L, 3); uint32 count = lua_tonumberint(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_tointeger(L, 1); uint32 flag = lua_tonumberint(L, 1);
int32 rule = lua_tointeger(L, 2); int32 rule = lua_tonumberint(L, 2);
pduel->clear(); pduel->clear();
pduel->game_field->core.duel_options = flag; pduel->game_field->core.duel_options = flag;
if (rule) if (rule)
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
int32 scriptlib::duel_select_field(lua_State * L) { int32 scriptlib::duel_select_field(lua_State * L) {
check_action_permission(L); check_action_permission(L);
check_param_count(L, 4); check_param_count(L, 4);
int32 playerid = lua_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 flag1 = lua_tointeger(L, 2); uint32 flag1 = lua_tonumberint(L, 2);
uint32 flag2 = lua_tointeger(L, 3); uint32 flag2 = lua_tonumberint(L, 3);
uint32 count = lua_tointeger(L, 4); uint32 count = lua_tonumberint(L, 4);
if(count == 0) if(count == 0)
return 0; return 0;
uint32 flag = (flag1 & 0xffff) | (flag2 << 16); uint32 flag = (flag1 & 0xffff) | (flag2 << 16);
...@@ -53,14 +53,14 @@ int32 scriptlib::duel_get_master_rule(lua_State * L) { ...@@ -53,14 +53,14 @@ int32 scriptlib::duel_get_master_rule(lua_State * L) {
} }
int32 scriptlib::duel_read_card(lua_State *L) { int32 scriptlib::duel_read_card(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
int32 code = lua_tointeger(L, 1); int32 code = lua_tonumberint(L, 1);
card_data dat; card_data dat;
::read_card(code, &dat); ::read_card(code, &dat);
if(!dat.code) if(!dat.code)
return 0; return 0;
uint32 args = lua_gettop(L) - 1; uint32 args = lua_gettop(L) - 1;
for(uint32 i = 0; i < args; ++i) { for(uint32 i = 0; i < args; ++i) {
int32 flag = lua_tointeger(L, 2 + i); int32 flag = lua_tonumberint(L, 2 + i);
switch(flag) { switch(flag) {
case 1: case 1:
lua_pushinteger(L, dat.code); lua_pushinteger(L, dat.code);
...@@ -119,7 +119,7 @@ int32 scriptlib::duel_exile(lua_State *L) { ...@@ -119,7 +119,7 @@ int32 scriptlib::duel_exile(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_tointeger(L, 2); uint32 reason = lua_tonumberint(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, 0, 0, POS_FACEUP); pduel->game_field->send_to(pcard, pduel->game_field->core.reason_effect, reason, pduel->game_field->core.reason_player, PLAYER_NONE, 0, 0, POS_FACEUP);
else else
...@@ -147,7 +147,7 @@ int32 scriptlib::duel_setmetatable(lua_State *L) { ...@@ -147,7 +147,7 @@ int32 scriptlib::duel_setmetatable(lua_State *L) {
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_tointeger(L, 1); int32 flag = lua_tonumberint(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;
...@@ -155,7 +155,7 @@ int32 scriptlib::duel_enable_global_flag(lua_State *L) { ...@@ -155,7 +155,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_tointeger(L, 1); int32 p = lua_tonumberint(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);
...@@ -164,8 +164,8 @@ int32 scriptlib::duel_get_lp(lua_State *L) { ...@@ -164,8 +164,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_tointeger(L, 1); int32 p = lua_tonumberint(L, 1);
int32 lp = lua_tointeger(L, 2); int32 lp = lua_tonumberint(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;
...@@ -184,7 +184,7 @@ int32 scriptlib::duel_get_turn_player(lua_State *L) { ...@@ -184,7 +184,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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]);
...@@ -195,7 +195,7 @@ int32 scriptlib::duel_get_turn_count(lua_State *L) { ...@@ -195,7 +195,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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));
...@@ -205,7 +205,7 @@ int32 scriptlib::duel_register_effect(lua_State *L) { ...@@ -205,7 +205,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_tointeger(L, 2); uint32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
duel* pduel = peffect->pduel; duel* pduel = peffect->pduel;
...@@ -214,16 +214,16 @@ int32 scriptlib::duel_register_effect(lua_State *L) { ...@@ -214,16 +214,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 code = (lua_tointeger(L, 2) & 0xfffffff) | 0x10000000; int32 code = (lua_tonumberint(L, 2) & 0xfffffff) | 0x10000000;
int32 reset = lua_tointeger(L, 3); int32 reset = lua_tonumberint(L, 3);
int32 flag = lua_tointeger(L, 4); int32 flag = lua_tonumberint(L, 4);
int32 count = lua_tointeger(L, 5); int32 count = lua_tonumberint(L, 5);
int32 lab = 0; int32 lab = 0;
if(lua_gettop(L) >= 6) if(lua_gettop(L) >= 6)
lab = lua_tointeger(L, 6); lab = lua_tonumberint(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)))
...@@ -247,10 +247,10 @@ int32 scriptlib::duel_register_flag_effect(lua_State *L) { ...@@ -247,10 +247,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 code = (lua_tointeger(L, 2) & 0xfffffff) | 0x10000000; int32 code = (lua_tonumberint(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);
...@@ -259,10 +259,10 @@ int32 scriptlib::duel_get_flag_effect(lua_State *L) { ...@@ -259,10 +259,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 code = (lua_tointeger(L, 2) & 0xfffffff) | 0x10000000; uint32 code = (lua_tonumberint(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; ) {
...@@ -275,11 +275,11 @@ int32 scriptlib::duel_reset_flag_effect(lua_State *L) { ...@@ -275,11 +275,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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_tointeger(L, 3); int32 lab = lua_tonumberint(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);
...@@ -293,7 +293,7 @@ int32 scriptlib::duel_set_flag_effect_label(lua_State *L) { ...@@ -293,7 +293,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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;
...@@ -322,10 +322,10 @@ int32 scriptlib::duel_destroy(lua_State *L) { ...@@ -322,10 +322,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_tointeger(L, 2); uint32 reason = lua_tonumberint(L, 2);
uint32 dest = LOCATION_GRAVE; uint32 dest = LOCATION_GRAVE;
if(lua_gettop(L) >= 3) if(lua_gettop(L) >= 3)
dest = lua_tointeger(L, 3); dest = lua_tonumberint(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
...@@ -347,8 +347,8 @@ int32 scriptlib::duel_remove(lua_State *L) { ...@@ -347,8 +347,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_tointeger(L, 2); uint32 pos = lua_tonumberint(L, 2);
uint32 reason = lua_tointeger(L, 3); uint32 reason = lua_tonumberint(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
...@@ -370,7 +370,7 @@ int32 scriptlib::duel_sendto_grave(lua_State *L) { ...@@ -370,7 +370,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_tointeger(L, 2); uint32 reason = lua_tonumberint(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
...@@ -387,17 +387,17 @@ int32 scriptlib::duel_summon(lua_State *L) { ...@@ -387,17 +387,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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_tointeger(L, 5); min_tribute = lua_tonumberint(L, 5);
uint32 zone = 0x1f; uint32 zone = 0x1f;
if(lua_gettop(L) >= 6) if(lua_gettop(L) >= 6)
zone = lua_tointeger(L, 6); zone = lua_tonumberint(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);
...@@ -407,7 +407,7 @@ int32 scriptlib::duel_special_summon_rule(lua_State *L) { ...@@ -407,7 +407,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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);
...@@ -420,7 +420,7 @@ int32 scriptlib::duel_synchro_summon(lua_State *L) { ...@@ -420,7 +420,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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);
...@@ -447,7 +447,7 @@ int32 scriptlib::duel_xyz_summon(lua_State *L) { ...@@ -447,7 +447,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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);
...@@ -458,10 +458,10 @@ int32 scriptlib::duel_xyz_summon(lua_State *L) { ...@@ -458,10 +458,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_tointeger(L, 4); minc = lua_tonumberint(L, 4);
int32 maxc = 0; int32 maxc = 0;
if(lua_gettop(L) >= 5) if(lua_gettop(L) >= 5)
maxc = lua_tointeger(L, 5); maxc = lua_tonumberint(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;
...@@ -479,17 +479,17 @@ int32 scriptlib::duel_setm(lua_State *L) { ...@@ -479,17 +479,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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_tointeger(L, 5); min_tribute = lua_tonumberint(L, 5);
uint32 zone = 0x1f; uint32 zone = 0x1f;
if(lua_gettop(L) >= 6) if(lua_gettop(L) >= 6)
zone = lua_tointeger(L, 6); zone = lua_tonumberint(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);
...@@ -498,12 +498,12 @@ int32 scriptlib::duel_setm(lua_State *L) { ...@@ -498,12 +498,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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_tointeger(L, 3); toplayer = lua_tonumberint(L, 3);
if(toplayer != 0 && toplayer != 1) if(toplayer != 0 && toplayer != 1)
toplayer = playerid; toplayer = playerid;
card* pcard = 0; card* pcard = 0;
...@@ -526,8 +526,8 @@ int32 scriptlib::duel_sets(lua_State *L) { ...@@ -526,8 +526,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
int32 code = lua_tointeger(L, 2); int32 code = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) { if(playerid != 0 && playerid != 1) {
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
return 1; return 1;
...@@ -554,15 +554,15 @@ int32 scriptlib::duel_special_summon(lua_State *L) { ...@@ -554,15 +554,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_tointeger(L, 2); uint32 sumtype = lua_tonumberint(L, 2);
uint32 sumplayer = lua_tointeger(L, 3); uint32 sumplayer = lua_tonumberint(L, 3);
uint32 playerid = lua_tointeger(L, 4); uint32 playerid = lua_tonumberint(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_tointeger(L, 7); uint32 positions = lua_tonumberint(L, 7);
uint32 zone = 0xff; uint32 zone = 0xff;
if(lua_gettop(L) >= 8) if(lua_gettop(L) >= 8)
zone = lua_tointeger(L, 8); zone = lua_tonumberint(L, 8);
if(pcard) { if(pcard) {
field::card_set cset; field::card_set cset;
cset.insert(pcard); cset.insert(pcard);
...@@ -578,15 +578,15 @@ int32 scriptlib::duel_special_summon_step(lua_State *L) { ...@@ -578,15 +578,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_tointeger(L, 2); uint32 sumtype = lua_tonumberint(L, 2);
uint32 sumplayer = lua_tointeger(L, 3); uint32 sumplayer = lua_tonumberint(L, 3);
uint32 playerid = lua_tointeger(L, 4); uint32 playerid = lua_tonumberint(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_tointeger(L, 7); uint32 positions = lua_tonumberint(L, 7);
uint32 zone = 0xff; uint32 zone = 0xff;
if(lua_gettop(L) >= 8) if(lua_gettop(L) >= 8)
zone = lua_tointeger(L, 8); zone = lua_tonumberint(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);
...@@ -611,10 +611,10 @@ int32 scriptlib::duel_sendto_hand(lua_State *L) { ...@@ -611,10 +611,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_tointeger(L, 2); uint32 playerid = lua_tonumberint(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_tointeger(L, 3); uint32 reason = lua_tonumberint(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
...@@ -636,11 +636,11 @@ int32 scriptlib::duel_sendto_deck(lua_State *L) { ...@@ -636,11 +636,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_tointeger(L, 2); uint32 playerid = lua_tonumberint(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_tointeger(L, 3); uint32 sequence = lua_tonumberint(L, 3);
uint32 reason = lua_tointeger(L, 4); uint32 reason = lua_tonumberint(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
...@@ -662,10 +662,10 @@ int32 scriptlib::duel_sendto_extra(lua_State *L) { ...@@ -662,10 +662,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_tointeger(L, 2); uint32 playerid = lua_tonumberint(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_tointeger(L, 3); uint32 reason = lua_tonumberint(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
...@@ -681,9 +681,9 @@ int32 scriptlib::duel_get_operated_group(lua_State *L) { ...@@ -681,9 +681,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
int32 countertype = lua_tointeger(L, 2); int32 countertype = lua_tonumberint(L, 2);
int32 count = lua_tointeger(L, 3); int32 count = lua_tonumberint(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) {
...@@ -697,40 +697,40 @@ int32 scriptlib::duel_is_can_add_counter(lua_State *L) { ...@@ -697,40 +697,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_tointeger(L, 1); uint32 rplayer = lua_tonumberint(L, 1);
if(rplayer != 0 && rplayer != 1) if(rplayer != 0 && rplayer != 1)
return 0; return 0;
uint32 s = lua_tointeger(L, 2); uint32 s = lua_tonumberint(L, 2);
uint32 o = lua_tointeger(L, 3); uint32 o = lua_tonumberint(L, 3);
uint32 countertype = lua_tointeger(L, 4); uint32 countertype = lua_tonumberint(L, 4);
uint32 count = lua_tointeger(L, 5); uint32 count = lua_tonumberint(L, 5);
uint32 reason = lua_tointeger(L, 6); uint32 reason = lua_tonumberint(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_tointeger(L, 1); uint32 rplayer = lua_tonumberint(L, 1);
if(rplayer != 0 && rplayer != 1) if(rplayer != 0 && rplayer != 1)
return 0; return 0;
uint32 s = lua_tointeger(L, 2); uint32 s = lua_tonumberint(L, 2);
uint32 o = lua_tointeger(L, 3); uint32 o = lua_tonumberint(L, 3);
uint32 countertype = lua_tointeger(L, 4); uint32 countertype = lua_tonumberint(L, 4);
uint32 count = lua_tointeger(L, 5); uint32 count = lua_tonumberint(L, 5);
uint32 reason = lua_tointeger(L, 6); uint32 reason = lua_tonumberint(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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 s = lua_tointeger(L, 2); uint32 s = lua_tonumberint(L, 2);
uint32 o = lua_tointeger(L, 3); uint32 o = lua_tonumberint(L, 3);
uint32 countertype = lua_tointeger(L, 4); uint32 countertype = lua_tonumberint(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;
...@@ -749,12 +749,12 @@ int32 scriptlib::duel_change_form(lua_State *L) { ...@@ -749,12 +749,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_tointeger(L, 2); uint32 au = lua_tonumberint(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_tointeger(L, 3); if(top > 2) ad = lua_tonumberint(L, 3);
if(top > 3) du = lua_tointeger(L, 4); if(top > 3) du = lua_tonumberint(L, 4);
if(top > 4) dd = lua_tointeger(L, 5); if(top > 4) dd = lua_tonumberint(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) {
...@@ -780,7 +780,7 @@ int32 scriptlib::duel_release(lua_State *L) { ...@@ -780,7 +780,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_tointeger(L, 2); uint32 reason = lua_tonumberint(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
...@@ -793,12 +793,12 @@ int32 scriptlib::duel_move_to_field(lua_State *L) { ...@@ -793,12 +793,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_tointeger(L, 2); uint32 move_player = lua_tonumberint(L, 2);
uint32 playerid = lua_tointeger(L, 3); uint32 playerid = lua_tonumberint(L, 3);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 destination = lua_tointeger(L, 4); uint32 destination = lua_tonumberint(L, 4);
uint32 positions = lua_tointeger(L, 5); uint32 positions = lua_tonumberint(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);
...@@ -816,10 +816,10 @@ int32 scriptlib::duel_return_to_field(lua_State *L) { ...@@ -816,10 +816,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_tointeger(L, 2); pos = lua_tonumberint(L, 2);
uint32 zone = 0xff; uint32 zone = 0xff;
if(lua_gettop(L) >= 3) if(lua_gettop(L) >= 3)
zone = lua_tointeger(L, 3); zone = lua_tonumberint(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();
...@@ -832,7 +832,7 @@ int32 scriptlib::duel_move_sequence(lua_State *L) { ...@@ -832,7 +832,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_tointeger(L, 2); int32 seq = lua_tonumberint(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;
...@@ -890,7 +890,7 @@ int32 scriptlib::duel_set_chain_limit_p(lua_State *L) { ...@@ -890,7 +890,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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);
...@@ -904,10 +904,10 @@ int32 scriptlib::duel_get_chain_material(lua_State *L) { ...@@ -904,10 +904,10 @@ int32 scriptlib::duel_get_chain_material(lua_State *L) {
//modded //modded
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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 count = lua_tointeger(L, 2); uint32 count = lua_tonumberint(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();
...@@ -932,7 +932,7 @@ int32 scriptlib::duel_confirm_decktop(lua_State *L) { ...@@ -932,7 +932,7 @@ int32 scriptlib::duel_confirm_decktop(lua_State *L) {
field::card_set ccards; field::card_set ccards;
uint32 reason = 0; uint32 reason = 0;
if(lua_gettop(L) >= 3) if(lua_gettop(L) >= 3)
reason = lua_tointeger(L, 3); reason = lua_tonumberint(L, 3);
for(uint32 i = 0; i < count && cit != pduel->game_field->player[playerid].list_main.rend(); ++i, ++cit) { for(uint32 i = 0; i < count && cit != pduel->game_field->player[playerid].list_main.rend(); ++i, ++cit) {
pduel->write_buffer32((*cit)->data.code); pduel->write_buffer32((*cit)->data.code);
pduel->write_buffer8((*cit)->current.controler); pduel->write_buffer8((*cit)->current.controler);
...@@ -947,7 +947,7 @@ int32 scriptlib::duel_confirm_decktop(lua_State *L) { ...@@ -947,7 +947,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
card* pcard = 0; card* pcard = 0;
...@@ -986,9 +986,9 @@ int32 scriptlib::duel_confirm_cards(lua_State *L) { ...@@ -986,9 +986,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_tointeger(L, 1); uint32 sort_player = lua_tonumberint(L, 1);
uint32 target_player = lua_tointeger(L, 2); uint32 target_player = lua_tonumberint(L, 2);
uint32 count = lua_tointeger(L, 3); uint32 count = lua_tonumberint(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)
...@@ -1002,7 +1002,7 @@ int32 scriptlib::duel_sort_decktop(lua_State *L) { ...@@ -1002,7 +1002,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_tointeger(L, 1); int32 ev = lua_tonumberint(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));
...@@ -1038,16 +1038,16 @@ int32 scriptlib::duel_raise_event(lua_State *L) { ...@@ -1038,16 +1038,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_tointeger(L, 2); uint32 code = lua_tonumberint(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_tointeger(L, 4); uint32 r = lua_tonumberint(L, 4);
uint32 rp = lua_tointeger(L, 5); uint32 rp = lua_tonumberint(L, 5);
uint32 ep = lua_tointeger(L, 6); uint32 ep = lua_tonumberint(L, 6);
uint32 ev = lua_tointeger(L, 7); uint32 ev = lua_tonumberint(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
...@@ -1060,16 +1060,16 @@ int32 scriptlib::duel_raise_single_event(lua_State *L) { ...@@ -1060,16 +1060,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_tointeger(L, 2); uint32 code = lua_tonumberint(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_tointeger(L, 4); uint32 r = lua_tonumberint(L, 4);
uint32 rp = lua_tointeger(L, 5); uint32 rp = lua_tonumberint(L, 5);
uint32 ep = lua_tointeger(L, 6); uint32 ep = lua_tonumberint(L, 6);
uint32 ev = lua_tointeger(L, 7); uint32 ev = lua_tonumberint(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();
...@@ -1078,7 +1078,7 @@ int32 scriptlib::duel_raise_single_event(lua_State *L) { ...@@ -1078,7 +1078,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_tointeger(L, 1); int32 tm = lua_tonumberint(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;
} }
...@@ -1107,13 +1107,13 @@ int32 scriptlib::duel_get_environment(lua_State *L) { ...@@ -1107,13 +1107,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_tointeger(L, 1); uint32 code = lua_tonumberint(L, 1);
uint32 playerid = PLAYER_ALL; uint32 playerid = PLAYER_ALL;
if(lua_gettop(L) >= 2) if(lua_gettop(L) >= 2)
playerid = lua_tointeger(L, 2); playerid = lua_tonumberint(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_tointeger(L, 3); loc = lua_tonumberint(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);
...@@ -1178,8 +1178,8 @@ int32 scriptlib::duel_is_environment(lua_State *L) { ...@@ -1178,8 +1178,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
uint32 reason = lua_tointeger(L, 2); uint32 reason = lua_tonumberint(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);
...@@ -1192,11 +1192,11 @@ int32 scriptlib::duel_win(lua_State *L) { ...@@ -1192,11 +1192,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 count = lua_tointeger(L, 2); uint32 count = lua_tonumberint(L, 2);
uint32 reason = lua_tointeger(L, 3); uint32 reason = lua_tonumberint(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;
...@@ -1205,13 +1205,13 @@ int32 scriptlib::duel_draw(lua_State *L) { ...@@ -1205,13 +1205,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 amount = lua_tointeger(L, 2); int32 amount = lua_tonumberint(L, 2);
if(amount < 0) if(amount < 0)
amount = 0; amount = 0;
uint32 reason = lua_tointeger(L, 3); uint32 reason = lua_tonumberint(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);
...@@ -1223,13 +1223,13 @@ int32 scriptlib::duel_damage(lua_State *L) { ...@@ -1223,13 +1223,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 amount = lua_tointeger(L, 2); int32 amount = lua_tonumberint(L, 2);
if(amount < 0) if(amount < 0)
amount = 0; amount = 0;
uint32 reason = lua_tointeger(L, 3); uint32 reason = lua_tonumberint(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);
...@@ -1248,7 +1248,7 @@ int32 scriptlib::duel_equip(lua_State *L) { ...@@ -1248,7 +1248,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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);
...@@ -1299,18 +1299,18 @@ int32 scriptlib::duel_get_control(lua_State *L) { ...@@ -1299,18 +1299,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_tointeger(L, 2); uint32 playerid = lua_tonumberint(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_tointeger(L, 3) & 0x3ff; reset_phase = lua_tonumberint(L, 3) & 0x3ff;
reset_count = lua_tointeger(L, 4) & 0xff; reset_count = lua_tonumberint(L, 4) & 0xff;
} }
uint32 zone = 0xff; uint32 zone = 0xff;
if(lua_gettop(L) >= 5) if(lua_gettop(L) >= 5)
zone = lua_tointeger(L, 5); zone = lua_tonumberint(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
...@@ -1339,8 +1339,8 @@ int32 scriptlib::duel_swap_control(lua_State *L) { ...@@ -1339,8 +1339,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_tointeger(L, 3) & 0x3ff; reset_phase = lua_tonumberint(L, 3) & 0x3ff;
reset_count = lua_tointeger(L, 4) & 0xff; reset_count = lua_tonumberint(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);
...@@ -1351,10 +1351,10 @@ int32 scriptlib::duel_swap_control(lua_State *L) { ...@@ -1351,10 +1351,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 cost = lua_tointeger(L, 2); uint32 cost = lua_tonumberint(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;
...@@ -1362,10 +1362,10 @@ int32 scriptlib::duel_check_lp_cost(lua_State *L) { ...@@ -1362,10 +1362,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 cost = lua_tointeger(L, 2); uint32 cost = lua_tonumberint(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);
...@@ -1373,9 +1373,9 @@ int32 scriptlib::duel_pay_lp_cost(lua_State *L) { ...@@ -1373,9 +1373,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
uint32 count = lua_tointeger(L, 2); uint32 count = lua_tonumberint(L, 2);
uint32 reason = lua_tointeger(L, 3); uint32 reason = lua_tonumberint(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);
...@@ -1396,10 +1396,10 @@ int32 scriptlib::duel_discard_hand(lua_State *L) { ...@@ -1396,10 +1396,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
uint32 min = lua_tointeger(L, 3); uint32 min = lua_tonumberint(L, 3);
uint32 max = lua_tointeger(L, 4); uint32 max = lua_tonumberint(L, 4);
uint32 reason = lua_tointeger(L, 5); uint32 reason = lua_tonumberint(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());
...@@ -1420,7 +1420,7 @@ int32 scriptlib::duel_disable_shuffle_check(lua_State *L) { ...@@ -1420,7 +1420,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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);
...@@ -1429,7 +1429,7 @@ int32 scriptlib::duel_shuffle_deck(lua_State *L) { ...@@ -1429,7 +1429,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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);
...@@ -1565,7 +1565,7 @@ int32 scriptlib::duel_calculate_damage(lua_State *L) { ...@@ -1565,7 +1565,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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]);
...@@ -1574,8 +1574,8 @@ int32 scriptlib::duel_get_battle_damage(lua_State *L) { ...@@ -1574,8 +1574,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
int32 dam = lua_tointeger(L, 2); int32 dam = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 check = TRUE; int32 check = TRUE;
...@@ -1589,7 +1589,7 @@ int32 scriptlib::duel_change_battle_damage(lua_State *L) { ...@@ -1589,7 +1589,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_tointeger(L, 1); uint32 count = lua_tonumberint(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);
...@@ -1597,8 +1597,8 @@ int32 scriptlib::duel_change_target(lua_State *L) { ...@@ -1597,8 +1597,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_tointeger(L, 1); uint32 count = lua_tonumberint(L, 1);
uint32 playerid = lua_tointeger(L, 2); uint32 playerid = lua_tonumberint(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);
...@@ -1607,8 +1607,8 @@ int32 scriptlib::duel_change_target_player(lua_State *L) { ...@@ -1607,8 +1607,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_tointeger(L, 1); uint32 count = lua_tonumberint(L, 1);
uint32 param = lua_tointeger(L, 2); uint32 param = lua_tonumberint(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;
...@@ -1623,21 +1623,21 @@ int32 scriptlib::duel_change_effect(lua_State *L) { ...@@ -1623,21 +1623,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_tointeger(L, 1); uint32 count = lua_tonumberint(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_tointeger(L, 1); uint32 c = lua_tonumberint(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_tointeger(L, 1); uint32 c = lua_tonumberint(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;
...@@ -1646,7 +1646,7 @@ int32 scriptlib::duel_negate_related_chain(lua_State *L) { ...@@ -1646,7 +1646,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_tointeger(L, 2); uint32 reset_flag = lua_tonumberint(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;
...@@ -1722,27 +1722,27 @@ int32 scriptlib::duel_check_summon_count(lua_State *L) { ...@@ -1722,27 +1722,27 @@ 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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
uint32 location = lua_tointeger(L, 2); uint32 location = lua_tonumberint(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_tointeger(L, 3); uplayer = lua_tonumberint(L, 3);
if(lua_gettop(L) >= 4) if(lua_gettop(L) >= 4)
reason = lua_tointeger(L, 4); reason = lua_tonumberint(L, 4);
uint32 zone = 0xff; uint32 zone = 0xff;
if(lua_gettop(L) >= 5) if(lua_gettop(L) >= 5)
zone = lua_tointeger(L, 5); zone = lua_tonumberint(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;
} }
//222DIY modded by Flandre //222DIY modded by Flandre
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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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);
...@@ -1779,11 +1779,11 @@ int32 scriptlib::duel_get_mzone_count(lua_State *L) { ...@@ -1779,11 +1779,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_tointeger(L, 3); uplayer = lua_tonumberint(L, 3);
if(lua_gettop(L) >= 4) if(lua_gettop(L) >= 4)
reason = lua_tointeger(L, 4); reason = lua_tonumberint(L, 4);
if(lua_gettop(L) >= 5) if(lua_gettop(L) >= 5)
zone = lua_tointeger(L, 5); zone = lua_tonumberint(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];
...@@ -1795,13 +1795,13 @@ int32 scriptlib::duel_get_mzone_count(lua_State *L) { ...@@ -1795,13 +1795,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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_tointeger(L, 2); uplayer = lua_tonumberint(L, 2);
bool swapped = false; bool swapped = false;
card* mcard = 0; card* mcard = 0;
group* mgroup = 0; group* mgroup = 0;
...@@ -1864,13 +1864,13 @@ int32 scriptlib::duel_get_location_count_fromex(lua_State *L) { ...@@ -1864,13 +1864,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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_tointeger(L, 2); uplayer = lua_tonumberint(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;
...@@ -1888,11 +1888,11 @@ int32 scriptlib::duel_get_usable_mzone_count(lua_State *L) { ...@@ -1888,11 +1888,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_tointeger(L, 1); uint32 rplayer = lua_tonumberint(L, 1);
if(rplayer != 0 && rplayer != 1) if(rplayer != 0 && rplayer != 1)
return 0; return 0;
uint32 s = lua_tointeger(L, 2); uint32 s = lua_tonumberint(L, 2);
uint32 o = lua_tointeger(L, 3); uint32 o = lua_tonumberint(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);
...@@ -1902,11 +1902,11 @@ int32 scriptlib::duel_get_linked_group(lua_State *L) { ...@@ -1902,11 +1902,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_tointeger(L, 1); uint32 rplayer = lua_tonumberint(L, 1);
if(rplayer != 0 && rplayer != 1) if(rplayer != 0 && rplayer != 1)
return 0; return 0;
uint32 s = lua_tointeger(L, 2); uint32 s = lua_tonumberint(L, 2);
uint32 o = lua_tointeger(L, 3); uint32 o = lua_tonumberint(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);
...@@ -1915,7 +1915,7 @@ int32 scriptlib::duel_get_linked_group_count(lua_State *L) { ...@@ -1915,7 +1915,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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);
...@@ -1924,9 +1924,9 @@ int32 scriptlib::duel_get_linked_zone(lua_State *L) { ...@@ -1924,9 +1924,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
uint32 location = lua_tointeger(L, 2); uint32 location = lua_tonumberint(L, 2);
uint32 sequence = lua_tointeger(L, 3); uint32 sequence = lua_tonumberint(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);
...@@ -1938,9 +1938,9 @@ int32 scriptlib::duel_get_field_card(lua_State *L) { ...@@ -1938,9 +1938,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
uint32 location = lua_tointeger(L, 2); uint32 location = lua_tonumberint(L, 2);
uint32 sequence = lua_tointeger(L, 3); uint32 sequence = lua_tonumberint(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);
...@@ -1954,14 +1954,14 @@ int32 scriptlib::duel_get_current_chain(lua_State *L) { ...@@ -1954,14 +1954,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_tointeger(L, 1); uint32 c = lua_tonumberint(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_tointeger(L, 2 + i); uint32 flag = lua_tonumberint(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);
...@@ -2019,7 +2019,7 @@ int32 scriptlib::duel_get_chain_info(lua_State *L) { ...@@ -2019,7 +2019,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_tointeger(L, 1); uint32 count = lua_tonumberint(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)
...@@ -2048,13 +2048,13 @@ int32 scriptlib::duel_get_current_phase(lua_State *L) { ...@@ -2048,13 +2048,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 phase = lua_tointeger(L, 2); uint32 phase = lua_tonumberint(L, 2);
uint32 reset = lua_tointeger(L, 3); uint32 reset = lua_tonumberint(L, 3);
uint32 count = lua_tointeger(L, 4); uint32 count = lua_tonumberint(L, 4);
uint32 value = lua_tointeger(L, 5); uint32 value = lua_tonumberint(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);
...@@ -2146,9 +2146,9 @@ int32 scriptlib::duel_adjust_instantly(lua_State *L) { ...@@ -2146,9 +2146,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
uint32 location1 = lua_tointeger(L, 2); uint32 location1 = lua_tonumberint(L, 2);
uint32 location2 = lua_tointeger(L, 3); uint32 location2 = lua_tonumberint(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);
...@@ -2162,9 +2162,9 @@ int32 scriptlib::duel_get_field_group(lua_State *L) { ...@@ -2162,9 +2162,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
uint32 location1 = lua_tointeger(L, 2); uint32 location1 = lua_tonumberint(L, 2);
uint32 location2 = lua_tointeger(L, 3); uint32 location2 = lua_tonumberint(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);
...@@ -2177,8 +2177,8 @@ int32 scriptlib::duel_get_field_group_count(lua_State *L) { ...@@ -2177,8 +2177,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
uint32 count = lua_tointeger(L, 2); uint32 count = lua_tonumberint(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();
...@@ -2204,9 +2204,9 @@ int32 scriptlib::duel_get_matching_group(lua_State *L) { ...@@ -2204,9 +2204,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_tointeger(L, 2); uint32 self = lua_tonumberint(L, 2);
uint32 location1 = lua_tointeger(L, 3); uint32 location1 = lua_tonumberint(L, 3);
uint32 location2 = lua_tointeger(L, 4); uint32 location2 = lua_tonumberint(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);
...@@ -2229,9 +2229,9 @@ int32 scriptlib::duel_get_matching_count(lua_State *L) { ...@@ -2229,9 +2229,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_tointeger(L, 2); uint32 self = lua_tonumberint(L, 2);
uint32 location1 = lua_tointeger(L, 3); uint32 location1 = lua_tonumberint(L, 3);
uint32 location2 = lua_tointeger(L, 4); uint32 location2 = lua_tonumberint(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();
...@@ -2255,9 +2255,9 @@ int32 scriptlib::duel_get_first_matching_card(lua_State *L) { ...@@ -2255,9 +2255,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_tointeger(L, 2); uint32 self = lua_tonumberint(L, 2);
uint32 location1 = lua_tointeger(L, 3); uint32 location1 = lua_tonumberint(L, 3);
uint32 location2 = lua_tointeger(L, 4); uint32 location2 = lua_tonumberint(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)
...@@ -2282,10 +2282,10 @@ int32 scriptlib::duel_is_existing_matching_card(lua_State *L) { ...@@ -2282,10 +2282,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_tointeger(L, 2); uint32 self = lua_tonumberint(L, 2);
uint32 location1 = lua_tointeger(L, 3); uint32 location1 = lua_tonumberint(L, 3);
uint32 location2 = lua_tointeger(L, 4); uint32 location2 = lua_tonumberint(L, 4);
uint32 fcount = lua_tointeger(L, 5); uint32 fcount = lua_tonumberint(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;
} }
...@@ -2306,15 +2306,15 @@ int32 scriptlib::duel_select_matching_cards(lua_State *L) { ...@@ -2306,15 +2306,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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_tointeger(L, 3); uint32 self = lua_tonumberint(L, 3);
uint32 location1 = lua_tointeger(L, 4); uint32 location1 = lua_tonumberint(L, 4);
uint32 location2 = lua_tointeger(L, 5); uint32 location2 = lua_tonumberint(L, 5);
uint32 min = lua_tointeger(L, 6); uint32 min = lua_tonumberint(L, 6);
uint32 max = lua_tointeger(L, 7); uint32 max = lua_tonumberint(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());
...@@ -2328,7 +2328,7 @@ int32 scriptlib::duel_select_matching_cards(lua_State *L) { ...@@ -2328,7 +2328,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 hand = FALSE; uint32 hand = FALSE;
...@@ -2347,7 +2347,7 @@ int32 scriptlib::duel_get_release_group(lua_State *L) { ...@@ -2347,7 +2347,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 hand = FALSE; uint32 hand = FALSE;
...@@ -2359,7 +2359,7 @@ int32 scriptlib::duel_get_release_group_count(lua_State *L) { ...@@ -2359,7 +2359,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 use_con = FALSE; int32 use_con = FALSE;
...@@ -2375,14 +2375,14 @@ int32 scriptlib::duel_check_release_group(lua_State *L) { ...@@ -2375,14 +2375,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_tointeger(L, 3); uint32 fcount = lua_tonumberint(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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 use_con = FALSE; int32 use_con = FALSE;
...@@ -2398,8 +2398,8 @@ int32 scriptlib::duel_select_release_group(lua_State *L) { ...@@ -2398,8 +2398,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_tointeger(L, 3); uint32 min = lua_tonumberint(L, 3);
uint32 max = lua_tointeger(L, 4); uint32 max = lua_tonumberint(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);
...@@ -2408,7 +2408,7 @@ int32 scriptlib::duel_select_release_group(lua_State *L) { ...@@ -2408,7 +2408,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 use_con = FALSE; int32 use_con = FALSE;
...@@ -2424,14 +2424,14 @@ int32 scriptlib::duel_check_release_group_ex(lua_State *L) { ...@@ -2424,14 +2424,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_tointeger(L, 3); uint32 fcount = lua_tonumberint(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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 use_con = FALSE; int32 use_con = FALSE;
...@@ -2447,8 +2447,8 @@ int32 scriptlib::duel_select_release_group_ex(lua_State *L) { ...@@ -2447,8 +2447,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_tointeger(L, 3); uint32 min = lua_tonumberint(L, 3);
uint32 max = lua_tointeger(L, 4); uint32 max = lua_tonumberint(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);
...@@ -2495,10 +2495,10 @@ int32 scriptlib::duel_check_tribute(lua_State *L) { ...@@ -2495,10 +2495,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_tointeger(L, 2); uint32 min = lua_tonumberint(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_tointeger(L, 3); max = lua_tonumberint(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);
...@@ -2506,10 +2506,10 @@ int32 scriptlib::duel_check_tribute(lua_State *L) { ...@@ -2506,10 +2506,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_tointeger(L, 5); toplayer = lua_tonumberint(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_tointeger(L, 6); zone = lua_tonumberint(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;
...@@ -2518,12 +2518,12 @@ int32 scriptlib::duel_select_tribute(lua_State *L) { ...@@ -2518,12 +2518,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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_tointeger(L, 3); uint32 min = lua_tonumberint(L, 3);
uint32 max = lua_tointeger(L, 4); uint32 max = lua_tonumberint(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);
...@@ -2531,7 +2531,7 @@ int32 scriptlib::duel_select_tribute(lua_State *L) { ...@@ -2531,7 +2531,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_tointeger(L, 6); toplayer = lua_tonumberint(L, 6);
if(toplayer != 0 && toplayer != 1) if(toplayer != 0 && toplayer != 1)
return 0; return 0;
uint32 ex = FALSE; uint32 ex = FALSE;
...@@ -2563,9 +2563,9 @@ int32 scriptlib::duel_get_target_count(lua_State *L) { ...@@ -2563,9 +2563,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_tointeger(L, 2); uint32 self = lua_tonumberint(L, 2);
uint32 location1 = lua_tointeger(L, 3); uint32 location1 = lua_tonumberint(L, 3);
uint32 location2 = lua_tointeger(L, 4); uint32 location2 = lua_tonumberint(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);
...@@ -2590,10 +2590,10 @@ int32 scriptlib::duel_is_existing_target(lua_State *L) { ...@@ -2590,10 +2590,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_tointeger(L, 2); uint32 self = lua_tonumberint(L, 2);
uint32 location1 = lua_tointeger(L, 3); uint32 location1 = lua_tonumberint(L, 3);
uint32 location2 = lua_tointeger(L, 4); uint32 location2 = lua_tonumberint(L, 4);
uint32 count = lua_tointeger(L, 5); uint32 count = lua_tonumberint(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;
} }
...@@ -2614,15 +2614,15 @@ int32 scriptlib::duel_select_target(lua_State *L) { ...@@ -2614,15 +2614,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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_tointeger(L, 3); uint32 self = lua_tonumberint(L, 3);
uint32 location1 = lua_tointeger(L, 4); uint32 location1 = lua_tonumberint(L, 4);
uint32 location2 = lua_tointeger(L, 5); uint32 location2 = lua_tonumberint(L, 5);
uint32 min = lua_tointeger(L, 6); uint32 min = lua_tonumberint(L, 6);
uint32 max = lua_tointeger(L, 7); uint32 max = lua_tonumberint(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();
...@@ -2634,7 +2634,7 @@ int32 scriptlib::duel_select_target(lua_State *L) { ...@@ -2634,7 +2634,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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);
...@@ -2646,7 +2646,7 @@ int32 scriptlib::duel_select_fusion_material(lua_State *L) { ...@@ -2646,7 +2646,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_tointeger(L, 5); chkf = lua_tonumberint(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);
...@@ -2671,7 +2671,7 @@ int32 scriptlib::duel_set_synchro_material(lua_State *L) { ...@@ -2671,7 +2671,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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);
...@@ -2680,8 +2680,8 @@ int32 scriptlib::duel_select_synchro_material(lua_State *L) { ...@@ -2680,8 +2680,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_tointeger(L, 5); int32 min = lua_tonumberint(L, 5);
int32 max = lua_tointeger(L, 6); int32 max = lua_tonumberint(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)) {
...@@ -2709,8 +2709,8 @@ int32 scriptlib::duel_check_synchro_material(lua_State *L) { ...@@ -2709,8 +2709,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_tointeger(L, 4); int32 min = lua_tonumberint(L, 4);
int32 max = lua_tointeger(L, 5); int32 max = lua_tonumberint(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)) {
...@@ -2728,7 +2728,7 @@ int32 scriptlib::duel_select_tuner_material(lua_State *L) { ...@@ -2728,7 +2728,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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);
...@@ -2738,8 +2738,8 @@ int32 scriptlib::duel_select_tuner_material(lua_State *L) { ...@@ -2738,8 +2738,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_tointeger(L, 6); int32 min = lua_tonumberint(L, 6);
int32 max = lua_tointeger(L, 7); int32 max = lua_tonumberint(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);
...@@ -2774,8 +2774,8 @@ int32 scriptlib::duel_check_tuner_material(lua_State *L) { ...@@ -2774,8 +2774,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_tointeger(L, 5); int32 min = lua_tonumberint(L, 5);
int32 max = lua_tointeger(L, 6); int32 max = lua_tonumberint(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);
...@@ -2786,7 +2786,7 @@ int32 scriptlib::duel_check_tuner_material(lua_State *L) { ...@@ -2786,7 +2786,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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);
...@@ -2805,7 +2805,7 @@ int32 scriptlib::duel_release_ritual_material(lua_State *L) { ...@@ -2805,7 +2805,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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);
...@@ -2896,7 +2896,7 @@ int32 scriptlib::duel_clear_target_card(lua_State *L) { ...@@ -2896,7 +2896,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(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)
...@@ -2906,7 +2906,7 @@ int32 scriptlib::duel_set_target_player(lua_State *L) { ...@@ -2906,7 +2906,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_tointeger(L, 1); uint32 param = lua_tonumberint(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)
...@@ -2924,11 +2924,11 @@ int32 scriptlib::duel_set_operation_info(lua_State *L) { ...@@ -2924,11 +2924,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_tointeger(L, 1); uint32 ct = lua_tonumberint(L, 1);
uint32 cate = lua_tointeger(L, 2); uint32 cate = lua_tonumberint(L, 2);
uint32 count = lua_tointeger(L, 4); uint32 count = lua_tonumberint(L, 4);
uint32 playerid = lua_tointeger(L, 5); uint32 playerid = lua_tonumberint(L, 5);
uint32 param = lua_tointeger(L, 6); uint32 param = lua_tonumberint(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);
...@@ -2962,8 +2962,8 @@ int32 scriptlib::duel_set_operation_info(lua_State *L) { ...@@ -2962,8 +2962,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_tointeger(L, 1); uint32 ct = lua_tonumberint(L, 1);
uint32 cate = lua_tointeger(L, 2); uint32 cate = lua_tonumberint(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)
...@@ -2987,7 +2987,7 @@ int32 scriptlib::duel_get_operation_info(lua_State *L) { ...@@ -2987,7 +2987,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_tointeger(L, 1); uint32 ct = lua_tonumberint(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)
...@@ -3004,9 +3004,9 @@ int32 scriptlib::duel_check_xyz_material(lua_State *L) { ...@@ -3004,9 +3004,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_tointeger(L, 3); uint32 lv = lua_tonumberint(L, 3);
uint32 minc = lua_tointeger(L, 4); uint32 minc = lua_tonumberint(L, 4);
uint32 maxc = lua_tointeger(L, 5); uint32 maxc = lua_tonumberint(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);
...@@ -3025,10 +3025,10 @@ int32 scriptlib::duel_select_xyz_material(lua_State *L) { ...@@ -3025,10 +3025,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_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
uint32 lv = lua_tointeger(L, 4); uint32 lv = lua_tonumberint(L, 4);
uint32 minc = lua_tointeger(L, 5); uint32 minc = lua_tonumberint(L, 5);
uint32 maxc = lua_tointeger(L, 6); uint32 maxc = lua_tonumberint(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);
...@@ -3066,11 +3066,11 @@ int32 scriptlib::duel_overlay(lua_State *L) { ...@@ -3066,11 +3066,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_tointeger(L, 1); uint32 rplayer = lua_tonumberint(L, 1);
if(rplayer != 0 && rplayer != 1) if(rplayer != 0 && rplayer != 1)
return 0; return 0;
uint32 s = lua_tointeger(L, 2); uint32 s = lua_tonumberint(L, 2);
uint32 o = lua_tointeger(L, 3); uint32 o = lua_tonumberint(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);
...@@ -3079,24 +3079,24 @@ int32 scriptlib::duel_get_overlay_group(lua_State *L) { ...@@ -3079,24 +3079,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_tointeger(L, 1); uint32 rplayer = lua_tonumberint(L, 1);
if(rplayer != 0 && rplayer != 1) if(rplayer != 0 && rplayer != 1)
return 0; return 0;
uint32 s = lua_tointeger(L, 2); uint32 s = lua_tonumberint(L, 2);
uint32 o = lua_tointeger(L, 3); uint32 o = lua_tonumberint(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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 s = lua_tointeger(L, 2); uint32 s = lua_tonumberint(L, 2);
uint32 o = lua_tointeger(L, 3); uint32 o = lua_tonumberint(L, 3);
int32 count = lua_tointeger(L, 4); int32 count = lua_tonumberint(L, 4);
int32 reason = lua_tointeger(L, 5); int32 reason = lua_tonumberint(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;
...@@ -3104,25 +3104,25 @@ int32 scriptlib::duel_check_remove_overlay_card(lua_State *L) { ...@@ -3104,25 +3104,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 s = lua_tointeger(L, 2); uint32 s = lua_tonumberint(L, 2);
uint32 o = lua_tointeger(L, 3); uint32 o = lua_tonumberint(L, 3);
int32 min = lua_tointeger(L, 4); int32 min = lua_tonumberint(L, 4);
int32 max = lua_tointeger(L, 5); int32 max = lua_tonumberint(L, 5);
int32 reason = lua_tointeger(L, 6); int32 reason = lua_tonumberint(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_tointeger(L, 1); int32 htype = lua_tonumberint(L, 1);
int32 playerid = lua_tointeger(L, 2); int32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 desc = lua_tointeger(L, 3); int32 desc = lua_tonumberint(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);
...@@ -3149,13 +3149,13 @@ int32 scriptlib::duel_select_effect_yesno(lua_State * L) { ...@@ -3149,13 +3149,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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_tointeger(L, 3); desc = lua_tonumberint(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);
...@@ -3163,10 +3163,10 @@ int32 scriptlib::duel_select_effect_yesno(lua_State * L) { ...@@ -3163,10 +3163,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 desc = lua_tointeger(L, 2); int32 desc = lua_tonumberint(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);
...@@ -3175,13 +3175,13 @@ int32 scriptlib::duel_select_option(lua_State * L) { ...@@ -3175,13 +3175,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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_tointeger(L, i + 2)); pduel->game_field->core.select_options.push_back(lua_tonumberint(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);
} }
...@@ -3193,9 +3193,9 @@ int32 scriptlib::duel_select_position(lua_State * L) { ...@@ -3193,9 +3193,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
card* pcard = *(card**) lua_touserdata(L, 2); card* pcard = *(card**) lua_touserdata(L, 2);
uint32 positions = lua_tointeger(L, 3); uint32 positions = lua_tonumberint(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);
...@@ -3203,13 +3203,13 @@ int32 scriptlib::duel_select_position(lua_State * L) { ...@@ -3203,13 +3203,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 count = lua_tointeger(L, 2); uint32 count = lua_tonumberint(L, 2);
uint32 location1 = lua_tointeger(L, 3); uint32 location1 = lua_tonumberint(L, 3);
uint32 location2 = lua_tointeger(L, 4); uint32 location2 = lua_tonumberint(L, 4);
uint32 filter = lua_tointeger(L, 5); uint32 filter = lua_tonumberint(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) {
...@@ -3239,9 +3239,9 @@ int32 scriptlib::duel_select_disable_field(lua_State * L) { ...@@ -3239,9 +3239,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
int32 count = lua_tointeger(L, 2); int32 count = lua_tonumberint(L, 2);
int32 available = lua_tointeger(L, 3); int32 available = lua_tonumberint(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);
...@@ -3249,9 +3249,9 @@ int32 scriptlib::duel_announce_race(lua_State * L) { ...@@ -3249,9 +3249,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
int32 count = lua_tointeger(L, 2); int32 count = lua_tonumberint(L, 2);
int32 available = lua_tointeger(L, 3); int32 available = lua_tonumberint(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);
...@@ -3259,13 +3259,13 @@ int32 scriptlib::duel_announce_attribute(lua_State * L) { ...@@ -3259,13 +3259,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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_tointeger(L, 2); min = lua_tonumberint(L, 2);
if(lua_gettop(L) >= 3 && !lua_isnil(L, 3)) if(lua_gettop(L) >= 3 && !lua_isnil(L, 3))
max = lua_tointeger(L, 3); max = lua_tonumberint(L, 3);
if(min > max) { if(min > max) {
int32 aux = max; int32 aux = max;
max = min; max = min;
...@@ -3278,7 +3278,7 @@ int32 scriptlib::duel_announce_level(lua_State * L) { ...@@ -3278,7 +3278,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_tointeger(L, j)) { if (!lua_isnil(L, j) && i == lua_tonumberint(L, j)) {
chk = 0; chk = 0;
break; break;
} }
...@@ -3302,23 +3302,23 @@ int32 scriptlib::duel_announce_level(lua_State * L) { ...@@ -3302,23 +3302,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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_tointeger(L, 2); ttype = lua_tonumberint(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_tointeger(L, 1); int32 playerid = lua_tonumberint(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_tointeger(L, i)); pduel->game_field->core.select_options.push_back(lua_tonumberint(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);
} }
...@@ -3326,7 +3326,7 @@ int32 scriptlib::duel_announce_type(lua_State * L) { ...@@ -3326,7 +3326,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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);
...@@ -3337,11 +3337,11 @@ int32 scriptlib::duel_announce_type(lua_State * L) { ...@@ -3337,11 +3337,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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_tointeger(L, i)); pduel->game_field->core.select_options.push_back(lua_tonumberint(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);
} }
...@@ -3349,7 +3349,7 @@ int32 scriptlib::duel_announce_coin(lua_State * L) { ...@@ -3349,7 +3349,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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);
...@@ -3360,8 +3360,8 @@ int32 scriptlib::duel_toss_coin(lua_State * L) { ...@@ -3360,8 +3360,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
int32 count = lua_tointeger(L, 2); int32 count = lua_tonumberint(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)
...@@ -3373,11 +3373,11 @@ int32 scriptlib::duel_toss_dice(lua_State * L) { ...@@ -3373,11 +3373,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
int32 count1 = lua_tointeger(L, 2); int32 count1 = lua_tonumberint(L, 2);
int32 count2 = 0; int32 count2 = 0;
if(lua_gettop(L) > 2) if(lua_gettop(L) > 2)
count2 = lua_tointeger(L, 3); count2 = lua_tonumberint(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)
...@@ -3411,7 +3411,7 @@ int32 scriptlib::duel_set_coin_result(lua_State * L) { ...@@ -3411,7 +3411,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_tointeger(L, i + 1); res = lua_tonumberint(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;
...@@ -3422,7 +3422,7 @@ int32 scriptlib::duel_set_dice_result(lua_State * L) { ...@@ -3422,7 +3422,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_tointeger(L, i + 1); res = lua_tonumberint(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;
...@@ -3432,12 +3432,12 @@ int32 scriptlib::duel_set_dice_result(lua_State * L) { ...@@ -3432,12 +3432,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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_tointeger(L, 2); int32 code = lua_tonumberint(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();
...@@ -3451,14 +3451,14 @@ int32 scriptlib::duel_is_player_affected_by_effect(lua_State *L) { ...@@ -3451,14 +3451,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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_tointeger(L, 2); count = lua_tonumberint(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));
...@@ -3469,8 +3469,8 @@ int32 scriptlib::duel_is_player_can_draw(lua_State * L) { ...@@ -3469,8 +3469,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
int32 count = lua_tointeger(L, 2); int32 count = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) { if(playerid != 0 && playerid != 1) {
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
return 1; return 1;
...@@ -3481,8 +3481,8 @@ int32 scriptlib::duel_is_player_can_discard_deck(lua_State * L) { ...@@ -3481,8 +3481,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
int32 count = lua_tointeger(L, 2); int32 count = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) { if(playerid != 0 && playerid != 1) {
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
return 1; return 1;
...@@ -3493,7 +3493,7 @@ int32 scriptlib::duel_is_player_can_discard_deck_as_cost(lua_State * L) { ...@@ -3493,7 +3493,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) { if(playerid != 0 && playerid != 1) {
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
return 1; return 1;
...@@ -3504,7 +3504,7 @@ int32 scriptlib::duel_is_player_can_summon(lua_State * L) { ...@@ -3504,7 +3504,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_tointeger(L, 2); int32 sumtype = lua_tonumberint(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));
} }
...@@ -3512,7 +3512,7 @@ int32 scriptlib::duel_is_player_can_summon(lua_State * L) { ...@@ -3512,7 +3512,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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1) { if(playerid != 0 && playerid != 1) {
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
return 1; return 1;
...@@ -3523,9 +3523,9 @@ int32 scriptlib::duel_is_player_can_spsummon(lua_State * L) { ...@@ -3523,9 +3523,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_tointeger(L, 2); int32 sumtype = lua_tonumberint(L, 2);
int32 sumpos = lua_tointeger(L, 3); int32 sumpos = lua_tonumberint(L, 3);
int32 toplayer = lua_tointeger(L, 4); int32 toplayer = lua_tonumberint(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));
} }
...@@ -3533,7 +3533,7 @@ int32 scriptlib::duel_is_player_can_spsummon(lua_State * L) { ...@@ -3533,7 +3533,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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) {
...@@ -3546,47 +3546,47 @@ int32 scriptlib::duel_is_player_can_flipsummon(lua_State * L) { ...@@ -3546,47 +3546,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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_tointeger(L, 2); int32 code = lua_tonumberint(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_tointeger(L, 3); dat.setcode = lua_tonumberint(L, 3);
if(!lua_isnil(L, 4)) if(!lua_isnil(L, 4))
dat.type = lua_tointeger(L, 4); dat.type = lua_tonumberint(L, 4);
if(!lua_isnil(L, 5)) if(!lua_isnil(L, 5))
dat.attack = lua_tointeger(L, 5); dat.attack = lua_tonumberint(L, 5);
if(!lua_isnil(L, 6)) if(!lua_isnil(L, 6))
dat.defense = lua_tointeger(L, 6); dat.defense = lua_tonumberint(L, 6);
if(!lua_isnil(L, 7)) if(!lua_isnil(L, 7))
dat.level = lua_tointeger(L, 7); dat.level = lua_tonumberint(L, 7);
if(!lua_isnil(L, 8)) if(!lua_isnil(L, 8))
dat.race = lua_tointeger(L, 8); dat.race = lua_tonumberint(L, 8);
if(!lua_isnil(L, 9)) if(!lua_isnil(L, 9))
dat.attribute = lua_tointeger(L, 9); dat.attribute = lua_tonumberint(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_tointeger(L, 10); pos = lua_tonumberint(L, 10);
if(lua_gettop(L) >= 11) if(lua_gettop(L) >= 11)
toplayer = lua_tointeger(L, 11); toplayer = lua_tonumberint(L, 11);
if(lua_gettop(L) >= 12) if(lua_gettop(L) >= 12)
sumtype = lua_tointeger(L, 12); sumtype = lua_tonumberint(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_tointeger(L, 1); int32 playerid = lua_tonumberint(L, 1);
int32 count = lua_tointeger(L, 2); int32 count = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) { if(playerid != 0 && playerid != 1) {
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
return 1; return 1;
...@@ -3597,7 +3597,7 @@ int32 scriptlib::duel_is_player_can_spsummon_count(lua_State * L) { ...@@ -3597,7 +3597,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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) {
...@@ -3610,7 +3610,7 @@ int32 scriptlib::duel_is_player_can_release(lua_State * L) { ...@@ -3610,7 +3610,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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) {
...@@ -3623,7 +3623,7 @@ int32 scriptlib::duel_is_player_can_remove(lua_State * L) { ...@@ -3623,7 +3623,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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) {
...@@ -3636,7 +3636,7 @@ int32 scriptlib::duel_is_player_can_send_to_hand(lua_State * L) { ...@@ -3636,7 +3636,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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) {
...@@ -3649,7 +3649,7 @@ int32 scriptlib::duel_is_player_can_send_to_grave(lua_State * L) { ...@@ -3649,7 +3649,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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) {
...@@ -3662,7 +3662,7 @@ int32 scriptlib::duel_is_player_can_send_to_deck(lua_State * L) { ...@@ -3662,7 +3662,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_tointeger(L, 1); int32 chaincount = lua_tonumberint(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())
...@@ -3683,7 +3683,7 @@ int32 scriptlib::duel_is_chain_negatable(lua_State * L) { ...@@ -3683,7 +3683,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_tointeger(L, 1); int32 chaincount = lua_tonumberint(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())
...@@ -3707,7 +3707,7 @@ int32 scriptlib::duel_is_chain_disablable(lua_State * L) { ...@@ -3707,7 +3707,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_tointeger(L, 1); int32 chaincount = lua_tonumberint(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;
...@@ -3729,13 +3729,13 @@ int32 scriptlib::duel_check_chain_uniqueness(lua_State *L) { ...@@ -3729,13 +3729,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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_tointeger(L, 2 + i); int32 activity_type = lua_tonumberint(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]);
...@@ -3770,8 +3770,8 @@ int32 scriptlib::duel_check_phase_activity(lua_State *L) { ...@@ -3770,8 +3770,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_tointeger(L, 1); int32 counter_id = lua_tonumberint(L, 1);
int32 activity_type = lua_tointeger(L, 2); int32 activity_type = lua_tonumberint(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) {
...@@ -3825,9 +3825,9 @@ int32 scriptlib::duel_add_custom_activity_counter(lua_State *L) { ...@@ -3825,9 +3825,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_tointeger(L, 1); int32 counter_id = lua_tonumberint(L, 1);
int32 playerid = lua_tointeger(L, 2); int32 playerid = lua_tonumberint(L, 2);
int32 activity_type = lua_tointeger(L, 3); int32 activity_type = lua_tonumberint(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) {
...@@ -3881,7 +3881,7 @@ int32 scriptlib::duel_get_custom_activity_count(lua_State *L) { ...@@ -3881,7 +3881,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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);
...@@ -3949,7 +3949,7 @@ int32 scriptlib::duel_venom_swamp_check(lua_State *L) { ...@@ -3949,7 +3949,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_tointeger(L, 1); int32 playerid = lua_tonumberint(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);
......
...@@ -291,7 +291,7 @@ int32 scriptlib::effect_set_value(lua_State *L) { ...@@ -291,7 +291,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_tointeger(L, 2); peffect->value = lua_tonumberint(L, 2);
} }
return 0; return 0;
} }
...@@ -485,7 +485,7 @@ int32 scriptlib::effect_is_active_type(lua_State *L) { ...@@ -485,7 +485,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_tointeger(L, 2); uint32 tpe = lua_tonumberint(L, 2);
uint32 atype; uint32 atype;
if(peffect->type & 0x7f0) { if(peffect->type & 0x7f0) {
if(peffect->active_type) if(peffect->active_type)
...@@ -515,7 +515,7 @@ int32 scriptlib::effect_is_has_category(lua_State *L) { ...@@ -515,7 +515,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_tointeger(L, 2); uint32 tcate = lua_tonumberint(L, 2);
if (peffect && (peffect->category & tcate)) if (peffect && (peffect->category & tcate))
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -526,7 +526,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) { ...@@ -526,7 +526,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_tointeger(L, 2); uint32 ttype = lua_tonumberint(L, 2);
if (peffect && (peffect->type & ttype)) if (peffect && (peffect->type & ttype))
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -536,7 +536,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) { ...@@ -536,7 +536,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_tointeger(L, 2); uint32 playerid = lua_tonumberint(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)
......
...@@ -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_tointeger(L, 2); uint32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 min = lua_tointeger(L, 4); uint32 min = lua_tonumberint(L, 4);
uint32 max = lua_tointeger(L, 5); uint32 max = lua_tonumberint(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_tointeger(L, 2); uint32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 min = lua_tointeger(L, 3); uint32 min = lua_tonumberint(L, 3);
uint32 max = lua_tointeger(L, 4); uint32 max = lua_tonumberint(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);
...@@ -255,7 +255,7 @@ int32 scriptlib::group_select_unselect(lua_State *L) { ...@@ -255,7 +255,7 @@ int32 scriptlib::group_select_unselect(lua_State *L) {
group* pgroup1 = *(group**) lua_touserdata(L, 1); group* pgroup1 = *(group**) lua_touserdata(L, 1);
group* pgroup2 = *(group**) lua_touserdata(L, 2); group* pgroup2 = *(group**) lua_touserdata(L, 2);
duel* pduel = pgroup1->pduel; duel* pduel = pgroup1->pduel;
uint32 playerid = lua_tointeger(L, 3); uint32 playerid = lua_tonumberint(L, 3);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
for (auto it = pgroup2->container.begin(); it != pgroup2->container.end(); ++it) { for (auto it = pgroup2->container.begin(); it != pgroup2->container.end(); ++it) {
...@@ -276,11 +276,11 @@ int32 scriptlib::group_select_unselect(lua_State *L) { ...@@ -276,11 +276,11 @@ int32 scriptlib::group_select_unselect(lua_State *L) {
} }
uint32 min = 1; uint32 min = 1;
if (lua_gettop(L) > 5) { if (lua_gettop(L) > 5) {
min = lua_tointeger(L, 6); min = lua_tonumberint(L, 6);
} }
uint32 max = 1; uint32 max = 1;
if (lua_gettop(L) > 6) { if (lua_gettop(L) > 6) {
max = lua_tointeger(L, 7); max = lua_tonumberint(L, 7);
} }
if (min > max) if (min > max)
min = max; min = max;
...@@ -299,8 +299,8 @@ int32 scriptlib::group_random_select(lua_State *L) { ...@@ -299,8 +299,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_tointeger(L, 2); int32 playerid = lua_tonumberint(L, 2);
int32 count = lua_tointeger(L, 3); int32 count = lua_tonumberint(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);
} }
...@@ -319,7 +319,7 @@ int32 scriptlib::group_is_exists(lua_State *L) { ...@@ -319,7 +319,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_tointeger(L, 3); uint32 count = lua_tonumberint(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;
...@@ -341,9 +341,9 @@ int32 scriptlib::group_check_with_sum_equal(lua_State *L) { ...@@ -341,9 +341,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_tointeger(L, 3); int32 acc = lua_tonumberint(L, 3);
int32 min = lua_tointeger(L, 4); int32 min = lua_tonumberint(L, 4);
int32 max = lua_tointeger(L, 5); int32 max = lua_tonumberint(L, 5);
if(min < 0) if(min < 0)
min = 0; min = 0;
if(max < min) if(max < min)
...@@ -369,12 +369,12 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) { ...@@ -369,12 +369,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_tointeger(L, 2); int32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 acc = lua_tointeger(L, 4); int32 acc = lua_tonumberint(L, 4);
int32 min = lua_tointeger(L, 5); int32 min = lua_tonumberint(L, 5);
int32 max = lua_tointeger(L, 6); int32 max = lua_tonumberint(L, 6);
if(min < 0) if(min < 0)
min = 0; min = 0;
if(max < min) if(max < min)
...@@ -405,7 +405,7 @@ int32 scriptlib::group_check_with_sum_greater(lua_State *L) { ...@@ -405,7 +405,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_tointeger(L, 3); int32 acc = lua_tonumberint(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();
...@@ -427,10 +427,10 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) { ...@@ -427,10 +427,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_tointeger(L, 2); int32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 acc = lua_tointeger(L, 4); int32 acc = lua_tonumberint(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) {
......
...@@ -7,4 +7,4 @@ project "ocgcore" ...@@ -7,4 +7,4 @@ project "ocgcore"
configuration "not vs*" configuration "not vs*"
buildoptions { "-std=gnu++0x" } buildoptions { "-std=gnu++0x" }
configuration "not windows" configuration "not windows"
includedirs { "/usr/include/lua", "/usr/include/lua5.2", "/usr/include/lua/5.2" } includedirs { "/usr/include/lua", "/usr/include/lua5.3", "/usr/include/lua/5.3" }
...@@ -2,8 +2,10 @@ solution "ygo" ...@@ -2,8 +2,10 @@ solution "ygo"
location "build" location "build"
language "C++" language "C++"
objdir "obj" objdir "obj"
startproject "ygopro"
configurations { "Debug", "Release" } configurations { "Debug", "Release" }
defines { "LUA_COMPAT_5_2" }
configuration "windows" configuration "windows"
defines { "WIN32", "_WIN32" } defines { "WIN32", "_WIN32" }
......
...@@ -2,8 +2,10 @@ solution "ygo" ...@@ -2,8 +2,10 @@ solution "ygo"
location "build" location "build"
language "C++" language "C++"
objdir "obj" objdir "obj"
startproject "ygopro"
configurations { "Debug", "Release" } configurations { "Debug", "Release" }
defines { "LUA_COMPAT_5_2" }
configuration "windows" configuration "windows"
defines { "WIN32", "_WIN32" } defines { "WIN32", "_WIN32" }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment