Commit e652b1d5 authored by DailyShana's avatar DailyShana

update EFFECT_INDESTRUCTABLE_COUNT

parent 94153dac
...@@ -1330,6 +1330,7 @@ void card::reset(uint32 id, uint32 reset_type) { ...@@ -1330,6 +1330,7 @@ void card::reset(uint32 id, uint32 reset_type) {
if(id & 0x47c0000) if(id & 0x47c0000)
clear_relate_effect(); clear_relate_effect();
if(id & 0x5fc0000) { if(id & 0x5fc0000) {
indestructable_effects.clear();
announced_cards.clear(); announced_cards.clear();
attacked_cards.clear(); attacked_cards.clear();
announce_count = 0; announce_count = 0;
......
...@@ -93,6 +93,7 @@ public: ...@@ -93,6 +93,7 @@ public:
typedef std::unordered_set<std::pair<effect*, uint16>, effect_relation_hash> effect_relation; typedef std::unordered_set<std::pair<effect*, uint16>, effect_relation_hash> effect_relation;
typedef std::unordered_map<card*, uint32> relation_map; typedef std::unordered_map<card*, uint32> relation_map;
typedef std::map<uint16, std::array<uint16, 2> > counter_map; typedef std::map<uint16, std::array<uint16, 2> > counter_map;
typedef std::map<uint32, int32> effect_count;
class attacker_map : public std::unordered_map<uint16, std::pair<card*, uint32> > { class attacker_map : public std::unordered_map<uint16, std::pair<card*, uint32> > {
public: public:
void addcard(card* pcard); void addcard(card* pcard);
...@@ -133,6 +134,7 @@ public: ...@@ -133,6 +134,7 @@ public:
card* overlay_target; card* overlay_target;
relation_map relations; relation_map relations;
counter_map counters; counter_map counters;
effect_count indestructable_effects;
attacker_map announced_cards; attacker_map announced_cards;
attacker_map attacked_cards; attacker_map attacked_cards;
attacker_map battled_cards; attacker_map battled_cards;
......
...@@ -2643,18 +2643,30 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -2643,18 +2643,30 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
pcard->filter_effect(EFFECT_INDESTRUCTABLE_COUNT, &eset); pcard->filter_effect(EFFECT_INDESTRUCTABLE_COUNT, &eset);
if (eset.size()) { if (eset.size()) {
bool is_destructable = true; bool is_destructable = true;
for (int32 i = 0; i < eset.size(); ++i) { for(int32 i = 0; i < eset.size(); ++i) {
if(!eset[i]->is_flag(EFFECT_FLAG_COUNT_LIMIT) || (eset[i]->reset_count & 0xf00) == 0) if(eset[i]->is_flag(EFFECT_FLAG_COUNT_LIMIT)) {
continue; if((eset[i]->reset_count & 0xf00) == 0)
pduel->lua->add_param(pcard->current.reason_effect, PARAM_TYPE_EFFECT); continue;
pduel->lua->add_param(pcard->current.reason, PARAM_TYPE_INT); pduel->lua->add_param(pcard->current.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(pcard->current.reason_player, PARAM_TYPE_INT); pduel->lua->add_param(pcard->current.reason, PARAM_TYPE_INT);
if(eset[i]->check_value_condition(3)) { pduel->lua->add_param(pcard->current.reason_player, PARAM_TYPE_INT);
eset[i]->dec_count(); if(eset[i]->check_value_condition(3)) {
if(reason_player != 5) eset[i]->dec_count();
indestructable_effect_set.insert(eset[i]); indestructable_effect_set.insert(eset[i]);
is_destructable = false; is_destructable = false;
break; }
} else {
pduel->lua->add_param(pcard->current.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(pcard->current.reason, PARAM_TYPE_INT);
pduel->lua->add_param(pcard->current.reason_player, PARAM_TYPE_INT);
int32 ct;
if(ct = eset[i]->get_value(3)) {
auto it = pcard->indestructable_effects.insert(std::make_pair(eset[i]->id, 0));
if(++it.first->second <= ct) {
indestructable_effect_set.insert(eset[i]);
is_destructable = false;
}
}
} }
} }
if(!is_destructable) { if(!is_destructable) {
...@@ -2837,19 +2849,35 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -2837,19 +2849,35 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
if (eset.size()) { if (eset.size()) {
bool indes = false; bool indes = false;
for (int32 i = 0; i < eset.size(); ++i) { for (int32 i = 0; i < eset.size(); ++i) {
if(!eset[i]->is_flag(EFFECT_FLAG_COUNT_LIMIT) || (eset[i]->reset_count & 0xf00) == 0) if(eset[i]->is_flag(EFFECT_FLAG_COUNT_LIMIT)) {
continue; if((eset[i]->reset_count & 0xf00) == 0)
pduel->lua->add_param(pcard->current.reason_effect, PARAM_TYPE_EFFECT); continue;
pduel->lua->add_param(pcard->current.reason, PARAM_TYPE_INT); pduel->lua->add_param(pcard->current.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(pcard->current.reason_player, PARAM_TYPE_INT); pduel->lua->add_param(pcard->current.reason, PARAM_TYPE_INT);
if(eset[i]->check_value_condition(3)) { pduel->lua->add_param(pcard->current.reason_player, PARAM_TYPE_INT);
eset[i]->dec_count(); if(eset[i]->check_value_condition(3)) {
pduel->write_buffer8(MSG_HINT); eset[i]->dec_count();
pduel->write_buffer8(HINT_CARD); pduel->write_buffer8(MSG_HINT);
pduel->write_buffer8(0); pduel->write_buffer8(HINT_CARD);
pduel->write_buffer32(eset[i]->owner->data.code); pduel->write_buffer8(0);
indes = true; pduel->write_buffer32(eset[i]->owner->data.code);
break; indes = true;
}
} else {
pduel->lua->add_param(pcard->current.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(pcard->current.reason, PARAM_TYPE_INT);
pduel->lua->add_param(pcard->current.reason_player, PARAM_TYPE_INT);
int32 ct;
if(ct = eset[i]->get_value(3)) {
auto it = pcard->indestructable_effects.insert(std::make_pair(eset[i]->id, 0));
if(++it.first->second <= ct) {
pduel->write_buffer8(MSG_HINT);
pduel->write_buffer8(HINT_CARD);
pduel->write_buffer8(0);
pduel->write_buffer32(eset[i]->owner->data.code);
indes = true;
}
}
} }
} }
if(indes) { if(indes) {
......
...@@ -3902,6 +3902,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) { ...@@ -3902,6 +3902,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
pcard->set_status(STATUS_SPSUMMON_TURN, FALSE); pcard->set_status(STATUS_SPSUMMON_TURN, FALSE);
pcard->set_status(STATUS_SET_TURN, FALSE); pcard->set_status(STATUS_SET_TURN, FALSE);
pcard->set_status(STATUS_FORM_CHANGED, FALSE); pcard->set_status(STATUS_FORM_CHANGED, FALSE);
pcard->indestructable_effects.clear();
pcard->announce_count = 0; pcard->announce_count = 0;
pcard->attacked_count = 0; pcard->attacked_count = 0;
pcard->announced_cards.clear(); pcard->announced_cards.clear();
......
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