Commit 1956626c authored by fallenstardust's avatar fallenstardust

优化可发动效果判定

parent 4b74e797
......@@ -316,6 +316,8 @@ static const struct luaL_Reg effectlib[] = {
{ "IsActivated", scriptlib::effect_is_activated },
{ "GetActivateLocation", scriptlib::effect_get_activate_location },
{ "GetActivateSequence", scriptlib::effect_get_activate_sequence },
{ "CheckCountLimit", scriptlib::effect_check_count_limit },
{ "UseCountLimit", scriptlib::effect_use_count_limit },
{ NULL, NULL }
};
......
......@@ -504,9 +504,13 @@ int32 scriptlib::effect_is_activatable(lua_State *L) {
uint32 playerid = lua_tointeger(L, 2);
effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 neglect_loc = 0;
if(lua_gettop(L) > 2)
uint32 neglect_target = 0;
if(lua_gettop(L) > 2) {
neglect_loc = lua_toboolean(L, 3);
lua_pushboolean(L, peffect->is_activateable(playerid, peffect->pduel->game_field->nil_event, 0, 0, 0, neglect_loc));
if (lua_gettop(L) > 3)
neglect_target = lua_toboolean(L, 4);
}
lua_pushboolean(L, peffect->is_activateable(playerid, peffect->pduel->game_field->nil_event, 0, 0, neglect_target, neglect_loc));
return 1;
}
int32 scriptlib::effect_is_activated(lua_State * L) {
......@@ -530,3 +534,31 @@ int32 scriptlib::effect_get_activate_sequence(lua_State *L) {
lua_pushinteger(L, peffect->active_sequence);
return 1;
}
int32 scriptlib::effect_check_count_limit(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 p = lua_tointeger(L, 2);
lua_pushboolean(L, peffect->check_count_limit(p));
return 1;
}
int32 scriptlib::effect_use_count_limit(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 p = lua_tointeger(L, 2);
uint32 count = 1;
uint32 oath_only = 0;
uint32 code = peffect->count_code;
if(lua_gettop(L) > 2) {
count = lua_tointeger(L, 3);
if (lua_gettop(L) > 3)
oath_only = lua_toboolean(L, 4);
}
if (!oath_only || code & EFFECT_COUNT_CODE_OATH)
while(count) {
peffect->dec_count(p);
count--;
}
return 0;
}
......@@ -316,6 +316,8 @@ public:
static int32 effect_is_activated(lua_State *L);
static int32 effect_get_activate_location(lua_State *L);
static int32 effect_get_activate_sequence(lua_State *L);
static int32 effect_check_count_limit(lua_State *L);
static int32 effect_use_count_limit(lua_State *L);
//Group functions
static int32 group_new(lua_State *L);
......
......@@ -16,7 +16,16 @@
特别感谢: 菜菜,尸体,晓L,废话多,幻兽L,龙道香姐 的支持与努力.
</pre>
<ul>
<li style="color:#ffff00">3.1.9</li>
<li style="color:#ffff00">3.2.1</li>
</ul>
<pre>
更新:
1.更新ygo内核;;
2.移除版本号修改功能;
</pre>
<ul>
<li style="color:#ffffff">3.1.9</li>
</ul>
<pre>
更新:
......
......@@ -9,7 +9,7 @@ android {
applicationId "cn.garymb.ygomobile"
minSdkVersion 16
targetSdkVersion 22
versionCode 32010424
versionCode 32010425
versionName "3.2.1"
vectorDrawables.useSupportLibrary = true
ndk {
......
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