Commit c14d91eb authored by salix5's avatar salix5

Revert "revert"

This reverts commit 2ebfb5b6.
parent 66d46cce
...@@ -1542,9 +1542,7 @@ int32 card::destination_redirect(uint8 destination, uint32 reason) { ...@@ -1542,9 +1542,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) {
...@@ -1564,7 +1562,7 @@ int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 ...@@ -1564,7 +1562,7 @@ int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8
pcount = mcount; pcount = mcount;
} }
} }
if(!(countertype & COUNTER_NEED_ENABLE)) if((countertype & COUNTER_WITHOUT_PERMIT) && !(countertype & COUNTER_NEED_ENABLE))
cmit->second[0] += pcount; cmit->second[0] += pcount;
else else
cmit->second[1] += pcount; cmit->second[1] += pcount;
...@@ -1608,11 +1606,9 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, ...@@ -1608,11 +1606,9 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count,
return FALSE; return FALSE;
if((countertype & COUNTER_NEED_ENABLE) && is_status(STATUS_DISABLED)) if((countertype & COUNTER_NEED_ENABLE) && is_status(STATUS_DISABLED))
return FALSE; return FALSE;
if((countertype & COUNTER_NEED_PERMIT) && !is_affected_by_effect(EFFECT_COUNTER_PERMIT + (countertype & 0xffff))) if(!(countertype & COUNTER_WITHOUT_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);
......
...@@ -430,7 +430,7 @@ public: ...@@ -430,7 +430,7 @@ public:
#define STATUS_FLIP_SUMMON_TURN 0x20000000 #define STATUS_FLIP_SUMMON_TURN 0x20000000
#define STATUS_SPSUMMON_TURN 0x40000000 #define STATUS_SPSUMMON_TURN 0x40000000
//Counter //Counter
#define COUNTER_NEED_PERMIT 0x1000 #define COUNTER_WITHOUT_PERMIT 0x1000
#define COUNTER_NEED_ENABLE 0x2000 #define COUNTER_NEED_ENABLE 0x2000
//Query list //Query list
#define QUERY_CODE 0x1 #define QUERY_CODE 0x1
......
...@@ -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_WITHOUT_PERMIT) && !(countertype & COUNTER_NEED_ENABLE))
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