Commit 3fee0191 authored by salix5's avatar salix5

COUNTER_WITHOUT_PERMIT

COUNTER_WITHOUT_PERMIT: counters that can beplaced on non-specific cards
COUNTER_NEED_ENABLE: COUNTER_WITHOUT_PERMIT counters placed on itself
parent 3d1a3700
......@@ -1537,6 +1537,8 @@ int32 card::destination_redirect(uint8 destination, uint32 reason) {
}
return 0;
}
// cmit->second[0]: permanent
// cmit->second[1]: reset while negated
int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly) {
if(!is_can_add_counter(playerid, countertype, count, singly))
return FALSE;
......@@ -1560,7 +1562,7 @@ int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8
pcount = mcount;
}
}
if(!(countertype & COUNTER_NEED_ENABLE) && !(countertype & COUNTER_NEED_PERMIT))
if((countertype & COUNTER_WITHOUT_PERMIT) && !(countertype & COUNTER_NEED_ENABLE))
cmit->second[0] += pcount;
else
cmit->second[1] += pcount;
......@@ -1602,7 +1604,9 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count,
return FALSE;
if(!(current.location & LOCATION_ONFIELD) || !is_position(POS_FACEUP))
return FALSE;
if((countertype & COUNTER_NEED_PERMIT) && !is_affected_by_effect(EFFECT_COUNTER_PERMIT + (countertype & 0xffff)))
if((countertype & COUNTER_NEED_ENABLE) && is_status(STATUS_DISABLED))
return FALSE;
if(!(countertype & COUNTER_WITHOUT_PERMIT) && !is_affected_by_effect(EFFECT_COUNTER_PERMIT + (countertype & 0xffff)))
return FALSE;
uint16 cttype = countertype & ~COUNTER_NEED_ENABLE;
int32 limit = -1;
......
......@@ -430,7 +430,7 @@ public:
#define STATUS_FLIP_SUMMON_TURN 0x20000000
#define STATUS_SPSUMMON_TURN 0x40000000
//Counter
#define COUNTER_NEED_PERMIT 0x1000
#define COUNTER_WITHOUT_PERMIT 0x1000
#define COUNTER_NEED_ENABLE 0x2000
//Query list
#define QUERY_CODE 0x1
......
......@@ -1418,9 +1418,9 @@ void field::adjust_disable_check_list() {
checked.insert(checking);
if (checking->is_status(STATUS_TO_ENABLE | STATUS_TO_DISABLE))
continue;
pre_disable = checking->is_status(STATUS_DISABLED | STATUS_FORBIDDEN);
pre_disable = checking->get_status(STATUS_DISABLED | STATUS_FORBIDDEN);
checking->refresh_disable_status();
new_disable = checking->is_status(STATUS_DISABLED | STATUS_FORBIDDEN);
new_disable = checking->get_status(STATUS_DISABLED | STATUS_FORBIDDEN);
if (pre_disable != new_disable && checking->is_status(STATUS_EFFECT_ENABLED)) {
checking->filter_disable_related_cards();
if (pre_disable)
......@@ -1458,7 +1458,7 @@ void field::adjust_self_destroy_set() {
effect* peffect;
for(auto cit = cset.begin(); cit != cset.end(); ++cit) {
card* pcard = *cit;
if((!pcard->is_status(STATUS_DISABLED | STATUS_FORBIDDEN) && (peffect = check_unique_onfield(pcard, pcard->current.controler, pcard->current.location)))
if((!pcard->get_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))) {
core.self_destroy_set.insert(pcard);
pcard->temp.reason_effect = pcard->current.reason_effect;
......@@ -1583,7 +1583,7 @@ void field::set_spsummon_counter(uint8 playerid, bool add, bool chain) {
effect* peffect = *iter;
card* pcard = peffect->handler;
if(add) {
if(pcard->is_status(STATUS_EFFECT_ENABLED) && !pcard->is_status(STATUS_DISABLED | STATUS_FORBIDDEN) && pcard->is_position(POS_FACEUP)) {
if(pcard->is_status(STATUS_EFFECT_ENABLED) && !pcard->get_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)) {
pcard->spsummon_counter[playerid]++;
if(chain)
......@@ -1603,7 +1603,7 @@ int32 field::check_spsummon_counter(uint8 playerid, uint8 ct) {
effect* peffect = *iter;
card* pcard = peffect->handler;
uint16 val = (uint16)peffect->value;
if(pcard->is_status(STATUS_EFFECT_ENABLED) && !pcard->is_status(STATUS_DISABLED | STATUS_FORBIDDEN) && pcard->is_position(POS_FACEUP)) {
if(pcard->is_status(STATUS_EFFECT_ENABLED) && !pcard->get_status(STATUS_DISABLED | STATUS_FORBIDDEN) && pcard->is_position(POS_FACEUP)) {
if(pcard->spsummon_counter[playerid] + ct > val)
return FALSE;
}
......
......@@ -129,7 +129,7 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
cmit->second[0] = 0;
cmit->second[1] = 0;
}
if(!(countertype & COUNTER_NEED_ENABLE) && !(countertype & COUNTER_NEED_PERMIT))
if((countertype & COUNTER_WITHOUT_PERMIT) && !(countertype & COUNTER_NEED_ENABLE))
cmit->second[0] += count;
else
cmit->second[1] += count;
......
......@@ -4588,7 +4588,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
if(is_chain_disablable(cait->chain_count)) {
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))
|| (pcard->is_status(STATUS_DISABLED | STATUS_FORBIDDEN) && pcard->is_has_relation(*cait))) {
|| (pcard->get_status(STATUS_DISABLED | STATUS_FORBIDDEN) && pcard->is_has_relation(*cait))) {
if(!(cait->flag & CHAIN_DISABLE_EFFECT)) {
pduel->write_buffer8(MSG_CHAIN_DISABLED);
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