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) {
int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly) {
if(!is_can_add_counter(playerid, countertype, count, singly))
return FALSE;
uint16 cttype = countertype;
if((countertype & COUNTER_NEED_ENABLE) && !(countertype & COUNTER_NEED_PERMIT))
cttype &= 0xfff;
uint16 cttype = countertype & ~COUNTER_NEED_ENABLE;
auto pr = counters.insert(std::make_pair(cttype, counter_map::mapped_type()));
auto cmit = pr.first;
if(pr.second) {
......@@ -1564,7 +1562,7 @@ int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8
pcount = mcount;
}
}
if(!(countertype & COUNTER_NEED_ENABLE))
if((countertype & COUNTER_WITHOUT_PERMIT) && !(countertype & COUNTER_NEED_ENABLE))
cmit->second[0] += pcount;
else
cmit->second[1] += pcount;
......@@ -1608,11 +1606,9 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count,
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_WITHOUT_PERMIT) && !is_affected_by_effect(EFFECT_COUNTER_PERMIT + (countertype & 0xffff)))
return FALSE;
uint16 cttype = countertype;
if((countertype & COUNTER_NEED_ENABLE) && !(countertype & COUNTER_NEED_PERMIT))
cttype &= 0xfff;
uint16 cttype = countertype & ~COUNTER_NEED_ENABLE;
int32 limit = -1;
int32 cur = 0;
auto cmit = counters.find(cttype);
......
......@@ -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
......
......@@ -122,16 +122,14 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 countertype = lua_tointeger(L, 2);
uint32 count = lua_tointeger(L, 3);
uint16 cttype = countertype;
if((countertype & COUNTER_NEED_ENABLE) && !(countertype & COUNTER_NEED_PERMIT))
cttype &= 0xfff;
uint16 cttype = countertype & ~COUNTER_NEED_ENABLE;
auto pr = pcard->counters.insert(std::make_pair(cttype, card::counter_map::mapped_type()));
auto cmit = pr.first;
if(pr.second) {
cmit->second[0] = 0;
cmit->second[1] = 0;
}
if(!(countertype & COUNTER_NEED_ENABLE))
if((countertype & COUNTER_WITHOUT_PERMIT) && !(countertype & COUNTER_NEED_ENABLE))
cmit->second[0] += count;
else
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