Commit d755f16c authored by VanillaSalt's avatar VanillaSalt

add Duel.IsAbleToEnterBP

parent 63fc6b5e
...@@ -2148,3 +2148,8 @@ int32 field::check_chain_target(uint8 chaincount, card * pcard) { ...@@ -2148,3 +2148,8 @@ int32 field::check_chain_target(uint8 chaincount, card * pcard) {
pduel->lua->add_param(pcard, PARAM_TYPE_CARD); pduel->lua->add_param(pcard, PARAM_TYPE_CARD);
return pduel->lua->check_condition(peffect->target, 10); return pduel->lua->check_condition(peffect->target, 10);
} }
int32 field::is_able_to_enter_bp() {
return ((core.duel_options & DUEL_ATTACK_FIRST_TURN) || infos.turn_id != 1)
&& infos.phase < PHASE_BATTLE
&& !is_player_affected_by_effect(infos.turn_player, EFFECT_CANNOT_BP);
}
...@@ -406,6 +406,7 @@ public: ...@@ -406,6 +406,7 @@ public:
int32 is_chain_negatable(uint8 chaincount, uint8 naga_check = FALSE); int32 is_chain_negatable(uint8 chaincount, uint8 naga_check = FALSE);
int32 is_chain_disablable(uint8 chaincount, uint8 naga_check = FALSE); int32 is_chain_disablable(uint8 chaincount, uint8 naga_check = FALSE);
int32 check_chain_target(uint8 chaincount, card* pcard); int32 check_chain_target(uint8 chaincount, card* pcard);
int32 is_able_to_enter_bp();
void add_process(uint16 type, uint16 step, effect* peffect, group* target, ptr arg1, ptr arg2); void add_process(uint16 type, uint16 step, effect* peffect, group* target, ptr arg1, ptr arg2);
int32 process(); int32 process();
......
...@@ -481,6 +481,7 @@ static const struct luaL_Reg duellib[] = { ...@@ -481,6 +481,7 @@ static const struct luaL_Reg duellib[] = {
{ "CheckPhaseActivity", scriptlib::duel_check_phase_activity }, { "CheckPhaseActivity", scriptlib::duel_check_phase_activity },
{ "AddCustomActivityCounter", scriptlib::duel_add_custom_activity_counter }, { "AddCustomActivityCounter", scriptlib::duel_add_custom_activity_counter },
{ "GetCustomActivityCount", scriptlib::duel_get_custom_activity_count }, { "GetCustomActivityCount", scriptlib::duel_get_custom_activity_count },
{ "IsAbleToEnterBP", scriptlib::duel_is_able_to_enter_bp },
{ "VenomSwampCheck", scriptlib::duel_venom_swamp_check }, { "VenomSwampCheck", scriptlib::duel_venom_swamp_check },
{ "SwapDeckAndGrave", scriptlib::duel_swap_deck_and_grave }, { "SwapDeckAndGrave", scriptlib::duel_swap_deck_and_grave },
{ "MajesticCopy", scriptlib::duel_majestic_copy }, { "MajesticCopy", scriptlib::duel_majestic_copy },
......
...@@ -3175,6 +3175,11 @@ int32 scriptlib::duel_get_custom_activity_count(lua_State *L) { ...@@ -3175,6 +3175,11 @@ int32 scriptlib::duel_get_custom_activity_count(lua_State *L) {
lua_pushinteger(L, (val >> 16) & 0xffff); lua_pushinteger(L, (val >> 16) & 0xffff);
return 1; return 1;
} }
int32 scriptlib::duel_is_able_to_enter_bp(lua_State *L) {
duel* pduel = interpreter::get_duel_info(L);
lua_pushboolean(L, pduel->game_field->is_able_to_enter_bp());
return 1;
}
int32 scriptlib::duel_venom_swamp_check(lua_State *L) { int32 scriptlib::duel_venom_swamp_check(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);
......
...@@ -481,6 +481,7 @@ public: ...@@ -481,6 +481,7 @@ public:
static int32 duel_check_phase_activity(lua_State *L); static int32 duel_check_phase_activity(lua_State *L);
static int32 duel_add_custom_activity_counter(lua_State *L); static int32 duel_add_custom_activity_counter(lua_State *L);
static int32 duel_get_custom_activity_count(lua_State *L); static int32 duel_get_custom_activity_count(lua_State *L);
static int32 duel_is_able_to_enter_bp(lua_State *L);
//specific card functions //specific card functions
static int32 duel_venom_swamp_check(lua_State *L); static int32 duel_venom_swamp_check(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