Commit 219162ca authored by salix5's avatar salix5 Committed by GitHub

remove COUNTER_NEED_ENABLE (#366)

parent b75bb919
...@@ -2125,7 +2125,7 @@ int32 card::destination_redirect(uint8 destination, uint32 reason) { ...@@ -2125,7 +2125,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, 0)) if(!is_can_add_counter(playerid, countertype, count, singly, 0))
return FALSE; return FALSE;
uint16 cttype = countertype & ~COUNTER_NEED_ENABLE; uint16 cttype = countertype;
auto pr = counters.emplace(cttype, counter_map::mapped_type()); auto pr = counters.emplace(cttype, counter_map::mapped_type());
auto cmit = pr.first; auto cmit = pr.first;
if(pr.second) { if(pr.second) {
...@@ -2145,7 +2145,7 @@ int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 ...@@ -2145,7 +2145,7 @@ int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8
pcount = mcount; pcount = mcount;
} }
} }
if((countertype & COUNTER_WITHOUT_PERMIT) && !(countertype & COUNTER_NEED_ENABLE)) if(countertype & COUNTER_WITHOUT_PERMIT)
cmit->second[0] += pcount; cmit->second[0] += pcount;
else else
cmit->second[1] += pcount; cmit->second[1] += pcount;
...@@ -2188,8 +2188,6 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, ...@@ -2188,8 +2188,6 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count,
return FALSE; return FALSE;
if(!loc && (!(current.location & LOCATION_ONFIELD) || !is_position(POS_FACEUP))) if(!loc && (!(current.location & LOCATION_ONFIELD) || !is_position(POS_FACEUP)))
return FALSE; return FALSE;
if((countertype & COUNTER_NEED_ENABLE) && is_status(STATUS_DISABLED))
return FALSE;
} }
uint32 check = countertype & COUNTER_WITHOUT_PERMIT; uint32 check = countertype & COUNTER_WITHOUT_PERMIT;
if(!check) { if(!check) {
...@@ -2215,7 +2213,7 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, ...@@ -2215,7 +2213,7 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count,
} }
if(!check) if(!check)
return FALSE; return FALSE;
uint16 cttype = countertype & ~COUNTER_NEED_ENABLE; uint16 cttype = countertype;
int32 limit = -1; int32 limit = -1;
int32 cur = 0; int32 cur = 0;
auto cmit = counters.find(cttype); auto cmit = counters.find(cttype);
......
...@@ -366,7 +366,7 @@ public: ...@@ -366,7 +366,7 @@ public:
#define SUMMON_TYPE_LINK 0x4c000000 #define SUMMON_TYPE_LINK 0x4c000000
//Counter //Counter
#define COUNTER_WITHOUT_PERMIT 0x1000 #define COUNTER_WITHOUT_PERMIT 0x1000
#define COUNTER_NEED_ENABLE 0x2000 //#define COUNTER_NEED_ENABLE 0x2000
#define ASSUME_CODE 1 #define ASSUME_CODE 1
#define ASSUME_TYPE 2 #define ASSUME_TYPE 2
......
...@@ -127,14 +127,14 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) { ...@@ -127,14 +127,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 = (uint32)lua_tointeger(L, 2); uint32 countertype = (uint32)lua_tointeger(L, 2);
uint32 count = (uint32)lua_tointeger(L, 3); uint32 count = (uint32)lua_tointeger(L, 3);
uint16 cttype = countertype & ~COUNTER_NEED_ENABLE; uint16 cttype = countertype;
auto pr = pcard->counters.emplace(cttype, card::counter_map::mapped_type()); auto pr = pcard->counters.emplace(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_WITHOUT_PERMIT) && !(countertype & COUNTER_NEED_ENABLE)) if(countertype & COUNTER_WITHOUT_PERMIT)
cmit->second[0] += count; cmit->second[0] += count;
else else
cmit->second[1] += count; cmit->second[1] += 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