Commit 8f6ed154 authored by DailyShana's avatar DailyShana

add Duel.IsCanAddCounter

parent fae7551d
......@@ -340,6 +340,7 @@ static const struct luaL_Reg duellib[] = {
{ "SpecialSummon", scriptlib::duel_special_summon },
{ "SpecialSummonStep", scriptlib::duel_special_summon_step },
{ "SpecialSummonComplete", scriptlib::duel_special_summon_complete },
{ "IsCanAddCounter", scriptlib::duel_is_can_add_counter },
{ "RemoveCounter", scriptlib::duel_remove_counter },
{ "IsCanRemoveCounter", scriptlib::duel_is_can_remove_counter },
{ "GetCounter", scriptlib::duel_get_counter },
......
......@@ -490,6 +490,21 @@ int32 scriptlib::duel_get_operated_group(lua_State *L) {
interpreter::group2value(L, pgroup);
return 1;
}
int32 scriptlib::duel_is_can_add_counter(lua_State *L) {
check_param_count(L, 4);
int32 playerid = lua_tointeger(L, 1);
int32 countertype = lua_tointeger(L, 2);
int32 count = lua_tointeger(L, 3);
check_param(L, PARAM_TYPE_CARD, 4);
card* pcard = *(card**)lua_touserdata(L, 4);
if(playerid != 0 && playerid != 1) {
lua_pushboolean(L, 0);
return 1;
}
duel* pduel = interpreter::get_duel_info(L);
lua_pushboolean(L, pduel->game_field->is_player_can_place_counter(playerid, pcard, countertype, count));
return 1;
}
int32 scriptlib::duel_remove_counter(lua_State *L) {
check_action_permission(L);
check_param_count(L, 6);
......
......@@ -336,6 +336,7 @@ public:
static int32 duel_sendto_deck(lua_State *L);
static int32 duel_sendto_extra(lua_State *L);
static int32 duel_get_operated_group(lua_State *L);
static int32 duel_is_can_add_counter(lua_State *L);
static int32 duel_remove_counter(lua_State *L);
static int32 duel_is_can_remove_counter(lua_State *L);
static int32 duel_get_counter(lua_State *L);
......
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