Commit ad36ec4f authored by nanahira's avatar nanahira

add Duel.DisableActionCheck

parent 00bfdd04
......@@ -1378,10 +1378,13 @@ uint32 card::get_column_zone(int32 loc1, int32 left, int32 right) {
zones |= (1u << 1) | (1u << (16 + 3));
if(s == 6)
zones |= (1u << 3) | (1u << (16 + 1));
for (int32 i = 1; i <= left; ++i) {
for(int32 i = 1; i <= left; ++i) {
int32 seq = s - i;
if(seq >= 0) {
if(seq <= 4) {
if(s == 5)
seq = 1 - i;
if(s == 6)
seq = 3 - i;
if(seq >= 0 && seq <= 4) {
zones |= 1u << seq | 1u << (16 + (4 - seq));
if(loc1 & LOCATION_MZONE) {
if(seq == 1)
......@@ -1390,16 +1393,14 @@ uint32 card::get_column_zone(int32 loc1, int32 left, int32 right) {
zones |= (1u << 6) | (1u << (16 + 5));
}
}
if(seq == 5)
zones |= (1u << 1) | (1u << (16 + 3));
if(seq == 6)
zones |= (1u << 3) | (1u << (16 + 1));
}
}
for (int32 i = 1; i <= right; ++i) {
for(int32 i = 1; i <= right; ++i) {
int32 seq = s + i;
if(seq <= 6) {
if(seq <= 4) {
if(s == 5)
seq = 1 + i;
if(s == 6)
seq = 3 + i;
if(seq >= 0 && seq <= 4) {
zones |= 1u << seq | 1u << (16 + (4 - seq));
if(loc1 & LOCATION_MZONE) {
if(seq == 1)
......@@ -1408,11 +1409,6 @@ uint32 card::get_column_zone(int32 loc1, int32 left, int32 right) {
zones |= (1u << 6) | (1u << (16 + 5));
}
}
if(seq == 5)
zones |= (1u << 1) | (1u << (16 + 3));
if(seq == 6)
zones |= (1u << 3) | (1u << (16 + 1));
}
}
return zones;
}
......
......@@ -355,6 +355,7 @@ static const struct luaL_Reg duellib[] = {
{ "FilterPlayerEffect", scriptlib::duel_filter_player_effect },
{ "ReadCard", scriptlib::duel_read_card },
{ "Exile", scriptlib::duel_exile },
{ "DisableActionCheck", scriptlib::duel_disable_action_check },
{ "EnableGlobalFlag", scriptlib::duel_enable_global_flag },
{ "GetLP", scriptlib::duel_get_lp },
......@@ -579,6 +580,9 @@ interpreter::interpreter(duel* pd): coroutines(256) {
pduel = pd;
no_action = 0;
call_depth = 0;
//222DIY
disable_action_check = 0;
set_duel_info(lua_state, pd);
//Initial
luaL_openlibs(lua_state);
......
......@@ -43,6 +43,8 @@ public:
coroutine_map coroutines;
int32 no_action;
int32 call_depth;
//222DIY
int32 disable_action_check;
explicit interpreter(duel* pd);
~interpreter();
......
......@@ -147,6 +147,13 @@ int32 scriptlib::duel_exile(lua_State *L) {
pduel->game_field->core.subunits.back().type = PROCESSOR_SENDTO_S;
return lua_yield(L, 0);
}
int32 scriptlib::duel_exile(lua_State *L) {
check_param_count(L, 1);
int32 dis = lua_toboolean(L, 1);
duel* pduel = interpreter::get_duel_info(L);
pduel->lua->disable_action_check = dis;
return 0;
}
int32 scriptlib::duel_enable_global_flag(lua_State *L) {
check_param_count(L, 1);
......
......@@ -63,9 +63,10 @@ int32 scriptlib::check_param_count(lua_State* L, int32 count) {
luaL_error(L, "%d Parameters are needed.", count);
return TRUE;
}
//222DIY
int32 scriptlib::check_action_permission(lua_State* L) {
duel* pduel = interpreter::get_duel_info(L);
if(pduel->lua->no_action)
if(pduel->lua->no_action && !pduel->lua->disable_action_check)
luaL_error(L, "Action is not allowed here.");
return TRUE;
}
......@@ -26,6 +26,7 @@ public:
static int32 duel_filter_player_effect(lua_State *L);
static int32 duel_read_card(lua_State *L);
static int32 duel_exile(lua_State *L);
static int32 duel_disable_action_check(lua_State *L);
//card lib
static int32 card_get_code(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