Commit a9b84ac6 authored by salix5's avatar salix5 Committed by GitHub

add Card.IsCanBeDisabledByEffect() (#469)

parent 00cf6b81
......@@ -3394,6 +3394,15 @@ int32 card::is_affect_by_effect(effect* reason_effect) {
return FALSE;
return TRUE;
}
int32 card::is_can_be_disabled_by_effect(effect* reason_effect) {
if (is_status(STATUS_DISABLED))
return FALSE;
if (is_affected_by_effect(EFFECT_CANNOT_DISABLE))
return FALSE;
if (!is_affect_by_effect(reason_effect))
return FALSE;
return TRUE;
}
int32 card::is_destructable() {
if(overlay_target)
return FALSE;
......
......@@ -351,6 +351,7 @@ public:
int32 is_setable_mzone(uint8 playerid, uint8 ignore_count, effect* peffect, uint8 min_tribute, uint32 zone = 0x1f);
int32 is_setable_szone(uint8 playerid, uint8 ignore_fd = 0);
int32 is_affect_by_effect(effect* reason_effect);
int32 is_can_be_disabled_by_effect(effect* reason_effect);
int32 is_destructable();
int32 is_destructable_by_battle(card* pcard);
effect* check_indestructable_by_effect(effect* reason_effect, uint8 playerid);
......
......@@ -2971,6 +2971,15 @@ int32 scriptlib::card_is_immune_to_effect(lua_State *L) {
lua_pushboolean(L, !pcard->is_affect_by_effect(peffect));
return 1;
}
int32 scriptlib::card_is_can_be_disabled_by_effect(lua_State* L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
check_param(L, PARAM_TYPE_EFFECT, 2);
card* pcard = *(card**)lua_touserdata(L, 1);
effect* peffect = *(effect**)lua_touserdata(L, 2);
lua_pushboolean(L, pcard->is_can_be_disabled_by_effect(peffect));
return 1;
}
int32 scriptlib::card_is_can_be_effect_target(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
......@@ -3474,6 +3483,7 @@ static const struct luaL_Reg cardlib[] = {
{ "CheckFusionMaterial", scriptlib::card_check_fusion_material },
{ "CheckFusionSubstitute", scriptlib::card_check_fusion_substitute },
{ "IsImmuneToEffect", scriptlib::card_is_immune_to_effect },
{ "IsCanBeDisabledByEffect", scriptlib::card_is_can_be_disabled_by_effect },
{ "IsCanBeEffectTarget", scriptlib::card_is_can_be_effect_target },
{ "IsCanBeBattleTarget", scriptlib::card_is_can_be_battle_target },
{ "AddMonsterAttribute", scriptlib::card_add_monster_attribute },
......
......@@ -266,6 +266,7 @@ public:
static int32 card_check_fusion_material(lua_State *L);
static int32 card_check_fusion_substitute(lua_State *L);
static int32 card_is_immune_to_effect(lua_State *L);
static int32 card_is_can_be_disabled_by_effect(lua_State* L);
static int32 card_is_can_be_effect_target(lua_State *L);
static int32 card_is_can_be_battle_target(lua_State *L);
static int32 card_add_monster_attribute(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