Commit 2b5bc979 authored by HidarimeYume's avatar HidarimeYume Committed by GitHub

Fix limit counter(step 1) (#403)

grammar

Update effect.cpp
parent 2e6ad0eb
......@@ -84,7 +84,7 @@ int32 effect::is_can_be_forbidden() {
// check if a single/field/equip effect is available
// check properties: range, EFFECT_FLAG_OWNER_RELATE, STATUS_BATTLE_DESTROYED, STATUS_EFFECT_ENABLED, disabled/forbidden
// check fucntions: condition
int32 effect::is_available() {
int32 effect::is_available(int32 neglect_disabled) {
if (type & EFFECT_TYPE_ACTIONS)
return FALSE;
if ((type & (EFFECT_TYPE_SINGLE | EFFECT_TYPE_XMATERIAL)) && !(type & EFFECT_TYPE_FIELD)) {
......@@ -102,9 +102,9 @@ int32 effect::is_available() {
return FALSE;
if(powner == phandler && is_can_be_forbidden() && phandler->get_status(STATUS_FORBIDDEN))
return FALSE;
if(is_flag(EFFECT_FLAG_OWNER_RELATE) && !is_flag(EFFECT_FLAG_CANNOT_DISABLE) && powner->is_status(STATUS_DISABLED))
if(is_flag(EFFECT_FLAG_OWNER_RELATE) && !(is_flag(EFFECT_FLAG_CANNOT_DISABLE) || neglect_disabled) && powner->is_status(STATUS_DISABLED))
return FALSE;
if(powner == phandler && !is_flag(EFFECT_FLAG_CANNOT_DISABLE) && phandler->get_status(STATUS_DISABLED))
if(powner == phandler && !(is_flag(EFFECT_FLAG_CANNOT_DISABLE) || neglect_disabled) && phandler->get_status(STATUS_DISABLED))
return FALSE;
}
if (type & EFFECT_TYPE_EQUIP) {
......@@ -114,9 +114,9 @@ int32 effect::is_available() {
return FALSE;
if(owner == handler && is_can_be_forbidden() && handler->get_status(STATUS_FORBIDDEN))
return FALSE;
if(is_flag(EFFECT_FLAG_OWNER_RELATE) && !is_flag(EFFECT_FLAG_CANNOT_DISABLE) && owner->is_status(STATUS_DISABLED))
if(is_flag(EFFECT_FLAG_OWNER_RELATE) && !(is_flag(EFFECT_FLAG_CANNOT_DISABLE) || neglect_disabled) && owner->is_status(STATUS_DISABLED))
return FALSE;
if(owner == handler && !is_flag(EFFECT_FLAG_CANNOT_DISABLE) && handler->get_status(STATUS_DISABLED))
if(owner == handler && !(is_flag(EFFECT_FLAG_CANNOT_DISABLE) || neglect_disabled) && handler->get_status(STATUS_DISABLED))
return FALSE;
if(!is_flag(EFFECT_FLAG_SET_AVAILABLE)) {
if(!(handler->get_status(STATUS_EFFECT_ENABLED)))
......@@ -141,9 +141,9 @@ int32 effect::is_available() {
return FALSE;
if(powner == phandler && is_can_be_forbidden() && phandler->get_status(STATUS_FORBIDDEN))
return FALSE;
if(is_flag(EFFECT_FLAG_OWNER_RELATE) && !is_flag(EFFECT_FLAG_CANNOT_DISABLE) && powner->is_status(STATUS_DISABLED))
if(is_flag(EFFECT_FLAG_OWNER_RELATE) && !(is_flag(EFFECT_FLAG_CANNOT_DISABLE) || neglect_disabled) && powner->is_status(STATUS_DISABLED))
return FALSE;
if(powner == phandler && !is_flag(EFFECT_FLAG_CANNOT_DISABLE) && phandler->get_status(STATUS_DISABLED))
if(powner == phandler && !(is_flag(EFFECT_FLAG_CANNOT_DISABLE) || neglect_disabled) && phandler->get_status(STATUS_DISABLED))
return FALSE;
if(phandler->is_status(STATUS_BATTLE_DESTROYED))
return FALSE;
......@@ -161,6 +161,10 @@ int32 effect::is_available() {
status &= ~EFFECT_STATUS_AVAILABLE;
return res;
}
// check if a count limit effect counter is available, which should be available even if the effect is disabled
int32 effect::limit_counter_is_available() {
return is_available(TRUE);
}
// check if a effect is EFFECT_TYPE_SINGLE and is ready
// check: range, enabled, condition
int32 effect::is_single_ready() {
......
......@@ -68,7 +68,8 @@ public:
int32 is_disable_related();
int32 is_self_destroy_related();
int32 is_can_be_forbidden();
int32 is_available();
int32 is_available(int32 neglect_disabled = FALSE);
int32 limit_counter_is_available();
int32 is_single_ready();
int32 check_count_limit(uint8 playerid);
int32 is_activateable(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE, int32 neglect_loc = FALSE, int32 neglect_faceup = FALSE);
......@@ -459,6 +460,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_OVERLAY_RITUAL_MATERIAL 364
#define EFFECT_CHANGE_GRAVE_ATTRIBUTE 365
#define EFFECT_CHANGE_GRAVE_RACE 366
#define EFFECT_ACTIVATION_COUNT_LIMIT 367
#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
......
......@@ -2250,7 +2250,7 @@ void field::set_spsummon_counter(uint8 playerid) {
if(core.global_flag & GLOBALFLAG_SPSUMMON_COUNT) {
for(auto& peffect : effects.spsummon_count_eff) {
card* pcard = peffect->get_handler();
if(peffect->is_available()) {
if(peffect->limit_counter_is_available()) {
if(((playerid == pcard->current.controler) && peffect->s_range) || ((playerid != pcard->current.controler) && peffect->o_range)) {
pcard->spsummon_counter[playerid]++;
}
......
......@@ -724,6 +724,7 @@ public:
#define GLOBALFLAG_SELF_TOGRAVE 0x100
#define GLOBALFLAG_SPSUMMON_ONCE 0x200
#define GLOBALFLAG_TUNE_MAGICIAN 0x400
#define GLOBALFLAG_ACTIVATION_COUNT 0x800
//
#define PROCESSOR_NONE 0
#define PROCESSOR_WAITING 0x10000
......
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