Commit 775b7666 authored by salix5's avatar salix5

EFFECT_FLAG_CANNOT_NEGATED, STATUS_FORBIDDEN

http://www.db.yugioh-card.com/yugiohdb/faq_search.action?ope=5&fid=12692&keyword=&tag=-1
http://yugioh-wiki.net/index.php?%A1%D4%A5%B5%A5%A4%A5%AD%A5%C3%A5%AF%A1%A6%A5%D6%A5%ED%A5%C3%A5%AB%A1%BC%A1%D5=
EFFECT_FLAG_CANNOT_NEGATED
effects with text 'cannot be negated':
EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATED
some auxiliary effects in the script: EFFECT_FLAG_CANNOT_DISABLE only

STATUS_FORBIDDEN
1.It preserves EFFECT_CHANGE_CODE, EFFECT_COUNTER_PERMIT, EFFECT_COUNTER_LIMIT.
2.It does not trigger RESET_DISABLE, and hence will not remove counters.
3.It does not check EFFECT_FLAG_CANNOT_DISABLE/EFFECT_CANNOT_DISEFFECT/EFFECT_CANNOT_DISABLE

COUNTER_NEED_ENABLE
It is used in c4694209
parent 0d2d78fc
...@@ -177,7 +177,7 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) { ...@@ -177,7 +177,7 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
if(query_flag & QUERY_OWNER) if(query_flag & QUERY_OWNER)
*p++ = owner; *p++ = owner;
if(query_flag & QUERY_IS_DISABLED) { if(query_flag & QUERY_IS_DISABLED) {
tdata = (status & STATUS_DISABLED) ? 1 : 0; tdata = (status & (STATUS_DISABLED | STATUS_FORBIDDEN)) ? 1 : 0;
if(!use_cache || (tdata != q_cache.is_disabled)) { if(!use_cache || (tdata != q_cache.is_disabled)) {
q_cache.is_disabled = tdata; q_cache.is_disabled = tdata;
*p++ = tdata; *p++ = tdata;
...@@ -1025,7 +1025,7 @@ void card::enable_field_effect(bool enabled) { ...@@ -1025,7 +1025,7 @@ void card::enable_field_effect(bool enabled) {
} else } else
set_status(STATUS_EFFECT_ENABLED, FALSE); set_status(STATUS_EFFECT_ENABLED, FALSE);
filter_immune_effect(); filter_immune_effect();
if (get_status(STATUS_DISABLED)) if (get_status(STATUS_DISABLED | STATUS_FORBIDDEN))
return; return;
filter_disable_related_cards(); filter_disable_related_cards();
} }
...@@ -1149,7 +1149,7 @@ void card::remove_effect(effect* peffect, effect_container::iterator it) { ...@@ -1149,7 +1149,7 @@ void card::remove_effect(effect* peffect, effect_container::iterator it) {
single_effect.erase(it); single_effect.erase(it);
else if (peffect->type & EFFECT_TYPE_FIELD) { else if (peffect->type & EFFECT_TYPE_FIELD) {
check_target = 0; check_target = 0;
if (peffect->in_range(current.location, current.sequence) && get_status(STATUS_EFFECT_ENABLED) && !get_status(STATUS_DISABLED)) { if (peffect->in_range(current.location, current.sequence) && get_status(STATUS_EFFECT_ENABLED) && !get_status(STATUS_DISABLED | STATUS_FORBIDDEN)) {
if (peffect->is_disable_related()) if (peffect->is_disable_related())
pduel->game_field->update_disable_check_list(peffect); pduel->game_field->update_disable_check_list(peffect);
} }
...@@ -1163,7 +1163,7 @@ void card::remove_effect(effect* peffect, effect_container::iterator it) { ...@@ -1163,7 +1163,7 @@ void card::remove_effect(effect* peffect, effect_container::iterator it) {
else else
check_target = 0; check_target = 0;
} }
if ((current.controler != PLAYER_NONE) && !get_status(STATUS_DISABLED) && check_target) { if ((current.controler != PLAYER_NONE) && !get_status(STATUS_DISABLED | STATUS_FORBIDDEN) && check_target) {
if (peffect->is_disable_related()) if (peffect->is_disable_related())
pduel->game_field->add_to_disable_check_list(check_target); pduel->game_field->add_to_disable_check_list(check_target);
} }
...@@ -1391,7 +1391,19 @@ void card::reset_effect_count() { ...@@ -1391,7 +1391,19 @@ void card::reset_effect_count() {
} }
} }
// refresh STATUS_DISABLED based on EFFECT_DISABLE and EFFECT_CANNOT_DISABLE // refresh STATUS_DISABLED based on EFFECT_DISABLE and EFFECT_CANNOT_DISABLE
int32 card::refresh_disable_status() { // refresh STATUS_FORBIDDEN based on EFFECT_FORBIDDEN
void card::refresh_disable_status() {
// forbidden
int32 pre_fb = is_status(STATUS_FORBIDDEN);
filter_immune_effect();
if (is_affected_by_effect(EFFECT_FORBIDDEN))
set_status(STATUS_FORBIDDEN, TRUE);
else
set_status(STATUS_FORBIDDEN, FALSE);
int32 cur_fb = is_status(STATUS_FORBIDDEN);
if(pre_fb != cur_fb)
filter_immune_effect();
// disabled
int32 pre_dis = is_status(STATUS_DISABLED); int32 pre_dis = is_status(STATUS_DISABLED);
filter_immune_effect(); filter_immune_effect();
if (!is_affected_by_effect(EFFECT_CANNOT_DISABLE) && is_affected_by_effect(EFFECT_DISABLE)) if (!is_affected_by_effect(EFFECT_CANNOT_DISABLE) && is_affected_by_effect(EFFECT_DISABLE))
...@@ -1401,7 +1413,6 @@ int32 card::refresh_disable_status() { ...@@ -1401,7 +1413,6 @@ int32 card::refresh_disable_status() {
int32 cur_dis = is_status(STATUS_DISABLED); int32 cur_dis = is_status(STATUS_DISABLED);
if(pre_dis != cur_dis) if(pre_dis != cur_dis)
filter_immune_effect(); filter_immune_effect();
return is_status(STATUS_DISABLED);
} }
uint8 card::refresh_control_status() { uint8 card::refresh_control_status() {
uint8 final = owner; uint8 final = owner;
...@@ -1519,9 +1530,7 @@ int32 card::destination_redirect(uint8 destination, uint32 reason) { ...@@ -1519,9 +1530,7 @@ int32 card::destination_redirect(uint8 destination, uint32 reason) {
int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly) { int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly) {
if(!is_can_add_counter(playerid, countertype, count, singly)) if(!is_can_add_counter(playerid, countertype, count, singly))
return FALSE; return FALSE;
uint16 cttype = countertype; uint16 cttype = countertype & ~COUNTER_NEED_ENABLE;
if((countertype & COUNTER_NEED_ENABLE) && !(countertype & COUNTER_NEED_PERMIT))
cttype &= 0xfff;
auto pr = counters.insert(std::make_pair(cttype, counter_map::mapped_type())); auto pr = counters.insert(std::make_pair(cttype, counter_map::mapped_type()));
auto cmit = pr.first; auto cmit = pr.first;
if(pr.second) { if(pr.second) {
...@@ -1541,7 +1550,7 @@ int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 ...@@ -1541,7 +1550,7 @@ int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8
pcount = mcount; pcount = mcount;
} }
} }
if(!(countertype & COUNTER_NEED_ENABLE)) if(!(countertype & COUNTER_NEED_ENABLE) && !(countertype & COUNTER_NEED_PERMIT))
cmit->second[0] += pcount; cmit->second[0] += pcount;
else else
cmit->second[1] += pcount; cmit->second[1] += pcount;
...@@ -1583,13 +1592,9 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, ...@@ -1583,13 +1592,9 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count,
return FALSE; return FALSE;
if(!(current.location & LOCATION_ONFIELD) || !is_position(POS_FACEUP)) if(!(current.location & LOCATION_ONFIELD) || !is_position(POS_FACEUP))
return FALSE; return FALSE;
if((countertype & COUNTER_NEED_ENABLE) && is_status(STATUS_DISABLED))
return FALSE;
if((countertype & COUNTER_NEED_PERMIT) && !is_affected_by_effect(EFFECT_COUNTER_PERMIT + (countertype & 0xffff))) if((countertype & COUNTER_NEED_PERMIT) && !is_affected_by_effect(EFFECT_COUNTER_PERMIT + (countertype & 0xffff)))
return FALSE; return FALSE;
uint16 cttype = countertype; uint16 cttype = countertype & ~COUNTER_NEED_ENABLE;
if((countertype & COUNTER_NEED_ENABLE) && !(countertype & COUNTER_NEED_PERMIT))
cttype &= 0xfff;
int32 limit = -1; int32 limit = -1;
int32 cur = 0; int32 cur = 0;
auto cmit = counters.find(cttype); auto cmit = counters.find(cttype);
......
...@@ -195,7 +195,7 @@ public: ...@@ -195,7 +195,7 @@ public:
int32 replace_effect(uint32 code, uint32 reset, uint32 count); int32 replace_effect(uint32 code, uint32 reset, uint32 count);
void reset(uint32 id, uint32 reset_type); void reset(uint32 id, uint32 reset_type);
void reset_effect_count(); void reset_effect_count();
int32 refresh_disable_status(); void refresh_disable_status();
uint8 refresh_control_status(); uint8 refresh_control_status();
void count_turn(uint16 ct); void count_turn(uint16 ct);
...@@ -424,7 +424,7 @@ public: ...@@ -424,7 +424,7 @@ public:
#define STATUS_ACTIVATED 0x800000 #define STATUS_ACTIVATED 0x800000
#define STATUS_JUST_POS 0x1000000 #define STATUS_JUST_POS 0x1000000
#define STATUS_CONTINUOUS_POS 0x2000000 #define STATUS_CONTINUOUS_POS 0x2000000
//#define STATUS_IS_PUBLIC 0x4000000 #define STATUS_FORBIDDEN 0x4000000
#define STATUS_ACT_FROM_HAND 0x8000000 #define STATUS_ACT_FROM_HAND 0x8000000
#define STATUS_OPPO_BATTLE 0x10000000 #define STATUS_OPPO_BATTLE 0x10000000
#define STATUS_FLIP_SUMMON_TURN 0x20000000 #define STATUS_FLIP_SUMMON_TURN 0x20000000
......
...@@ -53,12 +53,20 @@ effect::~effect() { ...@@ -53,12 +53,20 @@ effect::~effect() {
} }
int32 effect::is_disable_related() { int32 effect::is_disable_related() {
if (code == EFFECT_IMMUNE_EFFECT || code == EFFECT_DISABLE || code == EFFECT_CANNOT_DISABLE) if (code == EFFECT_IMMUNE_EFFECT || code == EFFECT_DISABLE || code == EFFECT_CANNOT_DISABLE || code == EFFECT_FORBIDDEN)
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
bool effect::is_can_be_forbidden() {
uint32 ctr = code & 0xf0000;
if (is_flag(EFFECT_FLAG_CANNOT_DISABLE) && !is_flag(EFFECT_FLAG_CANNOT_NEGATED))
return false;
if (code == EFFECT_CHANGE_CODE || ctr == EFFECT_COUNTER_PERMIT || ctr == EFFECT_COUNTER_LIMIT)
return false;
return true;
}
// check if a single/field/equip effect is available // check if a single/field/equip effect is available
// check properties: range, EFFECT_FLAG_OWNER_RELATE, STATUS_BATTLE_DESTROYED, STATUS_EFFECT_ENABLED // check properties: range, EFFECT_FLAG_OWNER_RELATE, STATUS_BATTLE_DESTROYED, STATUS_EFFECT_ENABLED, disabled/forbidden
// check fucntions: condition // check fucntions: condition
int32 effect::is_available() { int32 effect::is_available() {
if (type & EFFECT_TYPE_ACTIONS) if (type & EFFECT_TYPE_ACTIONS)
...@@ -71,6 +79,10 @@ int32 effect::is_available() { ...@@ -71,6 +79,10 @@ int32 effect::is_available() {
if(is_flag(EFFECT_FLAG_SINGLE_RANGE) && (handler->current.location & LOCATION_ONFIELD) if(is_flag(EFFECT_FLAG_SINGLE_RANGE) && (handler->current.location & LOCATION_ONFIELD)
&& (handler->is_position(POS_FACEDOWN) || (!handler->is_status(STATUS_EFFECT_ENABLED) && !is_flag(EFFECT_FLAG_IMMEDIATELY_APPLY)))) && (handler->is_position(POS_FACEDOWN) || (!handler->is_status(STATUS_EFFECT_ENABLED) && !is_flag(EFFECT_FLAG_IMMEDIATELY_APPLY))))
return FALSE; return FALSE;
if(is_flag(EFFECT_FLAG_OWNER_RELATE) && is_can_be_forbidden() && owner->is_status(STATUS_FORBIDDEN))
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) && owner->is_status(STATUS_DISABLED))
return FALSE; 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) && handler->get_status(STATUS_DISABLED))
...@@ -79,6 +91,10 @@ int32 effect::is_available() { ...@@ -79,6 +91,10 @@ int32 effect::is_available() {
if (type & EFFECT_TYPE_EQUIP) { if (type & EFFECT_TYPE_EQUIP) {
if(handler->current.controler == PLAYER_NONE) if(handler->current.controler == PLAYER_NONE)
return FALSE; return FALSE;
if(is_flag(EFFECT_FLAG_OWNER_RELATE) && is_can_be_forbidden() && owner->is_status(STATUS_FORBIDDEN))
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) && owner->is_status(STATUS_DISABLED))
return FALSE; 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) && handler->get_status(STATUS_DISABLED))
...@@ -94,6 +110,10 @@ int32 effect::is_available() { ...@@ -94,6 +110,10 @@ int32 effect::is_available() {
if (!is_flag(EFFECT_FLAG_FIELD_ONLY)) { if (!is_flag(EFFECT_FLAG_FIELD_ONLY)) {
if(handler->current.controler == PLAYER_NONE) if(handler->current.controler == PLAYER_NONE)
return FALSE; return FALSE;
if(is_flag(EFFECT_FLAG_OWNER_RELATE) && is_can_be_forbidden() && owner->is_status(STATUS_FORBIDDEN))
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) && owner->is_status(STATUS_DISABLED))
return FALSE; 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) && handler->get_status(STATUS_DISABLED))
...@@ -239,9 +259,13 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con ...@@ -239,9 +259,13 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
return FALSE; return FALSE;
if((type & EFFECT_TYPE_SINGLE) && is_flag(EFFECT_FLAG_SINGLE_RANGE) && !in_range(handler->current.location, handler->current.sequence)) if((type & EFFECT_TYPE_SINGLE) && is_flag(EFFECT_FLAG_SINGLE_RANGE) && !in_range(handler->current.location, handler->current.sequence))
return FALSE; return FALSE;
if(is_flag(EFFECT_FLAG_OWNER_RELATE) && is_can_be_forbidden() && owner->is_status(STATUS_FORBIDDEN))
return FALSE;
if(handler == owner && is_can_be_forbidden() && handler->is_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) && owner->is_status(STATUS_DISABLED))
return FALSE; return FALSE;
if((handler == owner) && !is_flag(EFFECT_FLAG_CANNOT_DISABLE) && handler->is_status(STATUS_DISABLED)) if(handler == owner && !is_flag(EFFECT_FLAG_CANNOT_DISABLE) && handler->is_status(STATUS_DISABLED))
return FALSE; return FALSE;
} }
} else { } else {
......
...@@ -63,6 +63,7 @@ public: ...@@ -63,6 +63,7 @@ public:
~effect(); ~effect();
int32 is_disable_related(); int32 is_disable_related();
bool is_can_be_forbidden();
int32 is_available(); int32 is_available();
int32 check_count_limit(uint8 playerid); 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 is_activateable(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE);
...@@ -149,7 +150,7 @@ enum effect_flag : uint32 { ...@@ -149,7 +150,7 @@ enum effect_flag : uint32 {
EFFECT_FLAG_ABSOLUTE_TARGET = 0x0040, EFFECT_FLAG_ABSOLUTE_TARGET = 0x0040,
EFFECT_FLAG_IGNORE_IMMUNE = 0x0080, EFFECT_FLAG_IGNORE_IMMUNE = 0x0080,
EFFECT_FLAG_SET_AVAILABLE = 0x0100, EFFECT_FLAG_SET_AVAILABLE = 0x0100,
EFFECT_FLAG_CONTINUOUS = 0x0200, EFFECT_FLAG_CANNOT_NEGATED = 0x0200,
EFFECT_FLAG_CANNOT_DISABLE = 0x0400, EFFECT_FLAG_CANNOT_DISABLE = 0x0400,
EFFECT_FLAG_PLAYER_TARGET = 0x0800, EFFECT_FLAG_PLAYER_TARGET = 0x0800,
EFFECT_FLAG_BOTH_SIDE = 0x1000, EFFECT_FLAG_BOTH_SIDE = 0x1000,
...@@ -161,7 +162,7 @@ enum effect_flag : uint32 { ...@@ -161,7 +162,7 @@ enum effect_flag : uint32 {
EFFECT_FLAG_UNCOPYABLE = 0x40000, EFFECT_FLAG_UNCOPYABLE = 0x40000,
EFFECT_FLAG_OATH = 0x80000, EFFECT_FLAG_OATH = 0x80000,
EFFECT_FLAG_SPSUM_PARAM = 0x100000, EFFECT_FLAG_SPSUM_PARAM = 0x100000,
EFFECT_FLAG_REPEAT = 0x200000, // EFFECT_FLAG_REPEAT = 0x200000,
EFFECT_FLAG_NO_TURN_RESET = 0x400000, EFFECT_FLAG_NO_TURN_RESET = 0x400000,
EFFECT_FLAG_EVENT_PLAYER = 0x800000, EFFECT_FLAG_EVENT_PLAYER = 0x800000,
EFFECT_FLAG_OWNER_RELATE = 0x1000000, EFFECT_FLAG_OWNER_RELATE = 0x1000000,
...@@ -355,7 +356,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2) ...@@ -355,7 +356,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_NONTUNER 244 #define EFFECT_NONTUNER 244
#define EFFECT_OVERLAY_REMOVE_REPLACE 245 #define EFFECT_OVERLAY_REMOVE_REPLACE 245
#define EFFECT_SCRAP_CHIMERA 246 #define EFFECT_SCRAP_CHIMERA 246
#define EFFECT_SPSUM_EFFECT_ACTIVATED 250 //#define EFFECT_SPSUM_EFFECT_ACTIVATED 250
#define EFFECT_MATERIAL_CHECK 251 #define EFFECT_MATERIAL_CHECK 251
#define EFFECT_DISABLE_FIELD 260 #define EFFECT_DISABLE_FIELD 260
#define EFFECT_USE_EXTRA_MZONE 261 #define EFFECT_USE_EXTRA_MZONE 261
...@@ -411,7 +412,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2) ...@@ -411,7 +412,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EVENT_CHAIN_SOLVING 1020 #define EVENT_CHAIN_SOLVING 1020
#define EVENT_CHAIN_ACTIVATING 1021 #define EVENT_CHAIN_ACTIVATING 1021
#define EVENT_CHAIN_SOLVED 1022 #define EVENT_CHAIN_SOLVED 1022
#define EVENT_CHAIN_ACTIVATED 1023 //#define EVENT_CHAIN_ACTIVATED 1023
#define EVENT_CHAIN_NEGATED 1024 #define EVENT_CHAIN_NEGATED 1024
#define EVENT_CHAIN_DISABLED 1025 #define EVENT_CHAIN_DISABLED 1025
#define EVENT_CHAIN_END 1026 #define EVENT_CHAIN_END 1026
...@@ -442,7 +443,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2) ...@@ -442,7 +443,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EVENT_PRE_DAMAGE_CALCULATE 1134 #define EVENT_PRE_DAMAGE_CALCULATE 1134
#define EVENT_DAMAGE_CALCULATING 1135 #define EVENT_DAMAGE_CALCULATING 1135
#define EVENT_PRE_BATTLE_DAMAGE 1136 #define EVENT_PRE_BATTLE_DAMAGE 1136
#define EVENT_BATTLE_END 1137 //#define EVENT_BATTLE_END 1137
#define EVENT_BATTLED 1138 #define EVENT_BATTLED 1138
#define EVENT_BATTLE_DESTROYING 1139 #define EVENT_BATTLE_DESTROYING 1139
#define EVENT_BATTLE_DESTROYED 1140 #define EVENT_BATTLE_DESTROYED 1140
......
...@@ -1416,11 +1416,11 @@ void field::adjust_disable_check_list() { ...@@ -1416,11 +1416,11 @@ void field::adjust_disable_check_list() {
effects.disable_check_list.pop_front(); effects.disable_check_list.pop_front();
effects.disable_check_set.erase(checking); effects.disable_check_set.erase(checking);
checked.insert(checking); checked.insert(checking);
if (checking->is_status(STATUS_TO_ENABLE + STATUS_TO_DISABLE)) if (checking->is_status(STATUS_TO_ENABLE | STATUS_TO_DISABLE))
continue; continue;
pre_disable = checking->is_status(STATUS_DISABLED); pre_disable = checking->is_status(STATUS_DISABLED | STATUS_FORBIDDEN);
checking->refresh_disable_status(); checking->refresh_disable_status();
new_disable = checking->is_status(STATUS_DISABLED); new_disable = checking->is_status(STATUS_DISABLED | STATUS_FORBIDDEN);
if (pre_disable != new_disable && checking->is_status(STATUS_EFFECT_ENABLED)) { if (pre_disable != new_disable && checking->is_status(STATUS_EFFECT_ENABLED)) {
checking->filter_disable_related_cards(); checking->filter_disable_related_cards();
if (pre_disable) if (pre_disable)
...@@ -1432,7 +1432,7 @@ void field::adjust_disable_check_list() { ...@@ -1432,7 +1432,7 @@ void field::adjust_disable_check_list() {
for (card_set::iterator it = checked.begin(); it != checked.end(); ++it) { for (card_set::iterator it = checked.begin(); it != checked.end(); ++it) {
if((*it)->is_status(STATUS_DISABLED) && (*it)->is_status(STATUS_TO_DISABLE) && !(*it)->is_status(STATUS_TO_ENABLE)) if((*it)->is_status(STATUS_DISABLED) && (*it)->is_status(STATUS_TO_DISABLE) && !(*it)->is_status(STATUS_TO_ENABLE))
(*it)->reset(RESET_DISABLE, RESET_EVENT); (*it)->reset(RESET_DISABLE, RESET_EVENT);
(*it)->set_status(STATUS_TO_ENABLE + STATUS_TO_DISABLE, FALSE); (*it)->set_status(STATUS_TO_ENABLE | STATUS_TO_DISABLE, FALSE);
} }
} while(effects.disable_check_list.size()); } while(effects.disable_check_list.size());
} }
...@@ -1458,7 +1458,7 @@ void field::adjust_self_destroy_set() { ...@@ -1458,7 +1458,7 @@ void field::adjust_self_destroy_set() {
effect* peffect; effect* peffect;
for(auto cit = cset.begin(); cit != cset.end(); ++cit) { for(auto cit = cset.begin(); cit != cset.end(); ++cit) {
card* pcard = *cit; card* pcard = *cit;
if((!pcard->is_status(STATUS_DISABLED) && (peffect = check_unique_onfield(pcard, pcard->current.controler, pcard->current.location))) if((!pcard->is_status(STATUS_DISABLED | STATUS_FORBIDDEN) && (peffect = check_unique_onfield(pcard, pcard->current.controler, pcard->current.location)))
|| (peffect = pcard->is_affected_by_effect(EFFECT_SELF_DESTROY))) { || (peffect = pcard->is_affected_by_effect(EFFECT_SELF_DESTROY))) {
core.self_destroy_set.insert(pcard); core.self_destroy_set.insert(pcard);
pcard->temp.reason_effect = pcard->current.reason_effect; pcard->temp.reason_effect = pcard->current.reason_effect;
...@@ -1583,7 +1583,7 @@ void field::set_spsummon_counter(uint8 playerid, bool add, bool chain) { ...@@ -1583,7 +1583,7 @@ void field::set_spsummon_counter(uint8 playerid, bool add, bool chain) {
effect* peffect = *iter; effect* peffect = *iter;
card* pcard = peffect->handler; card* pcard = peffect->handler;
if(add) { if(add) {
if(pcard->is_status(STATUS_EFFECT_ENABLED) && !pcard->is_status(STATUS_DISABLED) && pcard->is_position(POS_FACEUP)) { if(pcard->is_status(STATUS_EFFECT_ENABLED) && !pcard->is_status(STATUS_DISABLED | STATUS_FORBIDDEN) && pcard->is_position(POS_FACEUP)) {
if(((playerid == pcard->current.controler) && peffect->s_range) || ((playerid != pcard->current.controler) && peffect->o_range)) { if(((playerid == pcard->current.controler) && peffect->s_range) || ((playerid != pcard->current.controler) && peffect->o_range)) {
pcard->spsummon_counter[playerid]++; pcard->spsummon_counter[playerid]++;
if(chain) if(chain)
...@@ -1603,7 +1603,7 @@ int32 field::check_spsummon_counter(uint8 playerid, uint8 ct) { ...@@ -1603,7 +1603,7 @@ int32 field::check_spsummon_counter(uint8 playerid, uint8 ct) {
effect* peffect = *iter; effect* peffect = *iter;
card* pcard = peffect->handler; card* pcard = peffect->handler;
uint16 val = (uint16)peffect->value; uint16 val = (uint16)peffect->value;
if(pcard->is_status(STATUS_EFFECT_ENABLED) && !pcard->is_status(STATUS_DISABLED) && pcard->is_position(POS_FACEUP)) { if(pcard->is_status(STATUS_EFFECT_ENABLED) && !pcard->is_status(STATUS_DISABLED | STATUS_FORBIDDEN) && pcard->is_position(POS_FACEUP)) {
if(pcard->spsummon_counter[playerid] + ct > val) if(pcard->spsummon_counter[playerid] + ct > val)
return FALSE; return FALSE;
} }
...@@ -2324,13 +2324,15 @@ int32 field::is_chain_disablable(uint8 chaincount, uint8 naga_check) { ...@@ -2324,13 +2324,15 @@ int32 field::is_chain_disablable(uint8 chaincount, uint8 naga_check) {
peffect = core.current_chain[chaincount - 1].triggering_effect; peffect = core.current_chain[chaincount - 1].triggering_effect;
if(naga_check && peffect->is_flag(EFFECT_FLAG2_NAGA)) if(naga_check && peffect->is_flag(EFFECT_FLAG2_NAGA))
return FALSE; return FALSE;
if(peffect->is_flag(EFFECT_FLAG_CANNOT_DISABLE)) if(!peffect->handler->get_status(STATUS_FORBIDDEN)) {
return FALSE; if(peffect->is_flag(EFFECT_FLAG_CANNOT_DISABLE))
filter_field_effect(EFFECT_CANNOT_DISEFFECT, &eset);
for(int32 i = 0; i < eset.size(); ++i) {
pduel->lua->add_param(chaincount, PARAM_TYPE_INT);
if(eset[i]->check_value_condition(1))
return FALSE; return FALSE;
filter_field_effect(EFFECT_CANNOT_DISEFFECT, &eset);
for(int32 i = 0; i < eset.size(); ++i) {
pduel->lua->add_param(chaincount, PARAM_TYPE_INT);
if(eset[i]->check_value_condition(1))
return FALSE;
}
} }
return TRUE; return TRUE;
} }
......
...@@ -1820,10 +1820,7 @@ int32 scriptlib::card_is_forbidden(lua_State *L) { ...@@ -1820,10 +1820,7 @@ int32 scriptlib::card_is_forbidden(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
if(pcard->is_affected_by_effect(EFFECT_FORBIDDEN)) lua_pushboolean(L, pcard->is_status(STATUS_FORBIDDEN));
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
return 1; return 1;
} }
int32 scriptlib::card_is_able_to_change_controler(lua_State *L) { int32 scriptlib::card_is_able_to_change_controler(lua_State *L) {
......
...@@ -122,16 +122,14 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) { ...@@ -122,16 +122,14 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
uint32 countertype = lua_tointeger(L, 2); uint32 countertype = lua_tointeger(L, 2);
uint32 count = lua_tointeger(L, 3); uint32 count = lua_tointeger(L, 3);
uint16 cttype = countertype; uint16 cttype = countertype & ~COUNTER_NEED_ENABLE;
if((countertype & COUNTER_NEED_ENABLE) && !(countertype & COUNTER_NEED_PERMIT))
cttype &= 0xfff;
auto pr = pcard->counters.insert(std::make_pair(cttype, card::counter_map::mapped_type())); auto pr = pcard->counters.insert(std::make_pair(cttype, card::counter_map::mapped_type()));
auto cmit = pr.first; auto cmit = pr.first;
if(pr.second) { if(pr.second) {
cmit->second[0] = 0; cmit->second[0] = 0;
cmit->second[1] = 0; cmit->second[1] = 0;
} }
if(!(countertype & COUNTER_NEED_ENABLE)) if(!(countertype & COUNTER_NEED_ENABLE) && !(countertype & COUNTER_NEED_PERMIT))
cmit->second[0] += count; cmit->second[0] += count;
else else
cmit->second[1] += count; cmit->second[1] += count;
......
...@@ -4588,7 +4588,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2 ...@@ -4588,7 +4588,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
if(is_chain_disablable(cait->chain_count)) { if(is_chain_disablable(cait->chain_count)) {
if((cait->flag & CHAIN_DISABLE_EFFECT) || pcard->is_affected_by_effect(EFFECT_DISABLE_CHAIN) if((cait->flag & CHAIN_DISABLE_EFFECT) || pcard->is_affected_by_effect(EFFECT_DISABLE_CHAIN)
|| ((cait->triggering_location & LOCATION_ONFIELD) && pcard->is_affected_by_effect(EFFECT_DISABLE_CHAIN_FIELD)) || ((cait->triggering_location & LOCATION_ONFIELD) && pcard->is_affected_by_effect(EFFECT_DISABLE_CHAIN_FIELD))
|| (pcard->is_status(STATUS_DISABLED) && pcard->is_has_relation(*cait))) { || (pcard->is_status(STATUS_DISABLED | STATUS_FORBIDDEN) && pcard->is_has_relation(*cait))) {
if(!(cait->flag & CHAIN_DISABLE_EFFECT)) { if(!(cait->flag & CHAIN_DISABLE_EFFECT)) {
pduel->write_buffer8(MSG_CHAIN_DISABLED); pduel->write_buffer8(MSG_CHAIN_DISABLED);
pduel->write_buffer8(cait->chain_count); pduel->write_buffer8(cait->chain_count);
......
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