Commit a8c9e816 authored by Chen Bill's avatar Chen Bill

fix EFFECT_COUNT_CODE_SINGLE activation count

parent e50541ee
......@@ -171,6 +171,7 @@ public:
uint64_t cardid{};
uint32_t fieldid{};
uint32_t fieldid_r{}; //real field id, updated when moving to new location
uint32_t activate_count_id{}; //updated when moving to new location or flipping
uint16_t turnid{};
uint16_t turn_counter{};
uint8_t unique_pos[2]{};
......
......@@ -168,7 +168,7 @@ int32_t effect::check_count_limit(uint8_t playerid) {
uint32_t limit_type = count_code & 0xf0000000U;
int32_t count = count_limit_max;
if(limit_code == EFFECT_COUNT_CODE_SINGLE) {
if(pduel->game_field->get_effect_code(limit_type | get_handler()->fieldid, PLAYER_NONE) >= count)
if(pduel->game_field->get_effect_code(limit_type | get_handler()->activate_count_id, PLAYER_NONE) >= count)
return FALSE;
} else {
if(pduel->game_field->get_effect_code(count_code, playerid) >= count)
......@@ -677,7 +677,7 @@ void effect::dec_count(uint8_t playerid) {
uint32_t limit_code = count_code & MAX_CARD_ID;
uint32_t limit_type = count_code & 0xf0000000;
if(limit_code == EFFECT_COUNT_CODE_SINGLE)
pduel->game_field->add_effect_code(limit_type | get_handler()->fieldid, PLAYER_NONE);
pduel->game_field->add_effect_code(limit_type | get_handler()->activate_count_id, PLAYER_NONE);
else
pduel->game_field->add_effect_code(count_code, playerid);
}
......
......@@ -183,6 +183,7 @@ void field::add_card(uint8_t playerid, card* pcard, uint8_t location, uint8_t se
pcard->apply_field_effect();
pcard->fieldid = infos.field_id++;
pcard->fieldid_r = pcard->fieldid;
pcard->activate_count_id = pcard->fieldid;
if(check_unique_onfield(pcard, pcard->current.controler, pcard->current.location))
pcard->unique_fieldid = UINT_MAX;
pcard->turnid = infos.turn_id;
......
......@@ -2005,6 +2005,7 @@ int32_t field::flip_summon(uint16_t step, uint8_t sumplayer, card * target, uint
target->summon_player = sumplayer;
target->summon_info |= SUMMON_TYPE_FLIP;
target->fieldid = infos.field_id++;
target->activate_count_id = target->fieldid;
core.phase_action = TRUE;
pduel->write_buffer8(MSG_FLIPSUMMONING);
pduel->write_buffer32(target->data.code);
......@@ -4909,6 +4910,7 @@ int32_t field::change_position(uint16_t step, group * targets, effect * reason_e
core.hint_timing[pcard->current.controler] |= TIMING_POS_CHANGE;
if((opos & POS_FACEDOWN) && (npos & POS_FACEUP)) {
pcard->fieldid = infos.field_id++;
pcard->activate_count_id = pcard->fieldid;
if(check_unique_onfield(pcard, pcard->current.controler, pcard->current.location))
pcard->unique_fieldid = UINT_MAX;
if(pcard->current.location == LOCATION_MZONE) {
......
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