Commit cd93c0a5 authored by salix5's avatar salix5

remove field::reset_effect()

parent edf3d41c
......@@ -1003,8 +1003,8 @@ void card::apply_field_effect() {
if (current.controler == PLAYER_NONE)
return;
for (auto it = field_effect.begin(); it != field_effect.end(); ++it) {
if (it->second->in_range(current.location, current.sequence) || ((it->second->range & LOCATION_HAND)
&& (it->second->type & EFFECT_TYPE_TRIGGER_O) && !(it->second->code & EVENT_PHASE))) {
if (it->second->in_range(current.location, current.sequence)
|| ((it->second->range & LOCATION_HAND) && (it->second->type & EFFECT_TYPE_TRIGGER_O) && !(it->second->code & EVENT_PHASE))) {
pduel->game_field->add_effect(it->second);
}
}
......@@ -1017,8 +1017,8 @@ void card::cancel_field_effect() {
if (current.controler == PLAYER_NONE)
return;
for (auto it = field_effect.begin(); it != field_effect.end(); ++it) {
if (it->second->in_range(current.location, current.sequence) || ((it->second->range & LOCATION_HAND)
&& (it->second->type & EFFECT_TYPE_TRIGGER_O) && !(it->second->code & EVENT_PHASE))) {
if (it->second->in_range(current.location, current.sequence)
|| ((it->second->range & LOCATION_HAND) && (it->second->type & EFFECT_TYPE_TRIGGER_O) && !(it->second->code & EVENT_PHASE))) {
pduel->game_field->remove_effect(it->second);
}
}
......@@ -1098,7 +1098,8 @@ int32 card::add_effect(effect* peffect) {
}
}
it = single_effect.insert(std::make_pair(peffect->code, peffect));
} else if (peffect->type & EFFECT_TYPE_FIELD)
}
else if (peffect->type & EFFECT_TYPE_FIELD)
it = field_effect.insert(std::make_pair(peffect->code, peffect));
else if (peffect->type & EFFECT_TYPE_EQUIP) {
it = equip_effect.insert(std::make_pair(peffect->code, peffect));
......@@ -1106,7 +1107,8 @@ int32 card::add_effect(effect* peffect) {
check_target = equiping_target;
else
check_target = 0;
} else
}
else
return 0;
peffect->id = pduel->game_field->infos.field_id++;
peffect->card_type = data.type;
......
......@@ -140,7 +140,9 @@ int32 effect::is_available() {
status &= ~EFFECT_STATUS_AVAILABLE;
return res;
}
// reset_count:
// 0x00ff: count of effect reset
// 0xf000: max count of activation, 0x0f00: left count of activation
int32 effect::check_count_limit(uint8 playerid) {
if(is_flag(EFFECT_FLAG_COUNT_LIMIT)) {
if((reset_count & 0xf00) == 0)
......
......@@ -815,41 +815,6 @@ void field::remove_oath_effect(effect* reason_effect) {
}
}
}
void field::reset_effect(uint32 id, uint32 reset_type) {
int32 result;
for (auto it = effects.indexer.begin(); it != effects.indexer.end();) {
auto rm = it++;
auto peffect = rm->first;
auto pit = rm->second;
if (!peffect->is_flag(EFFECT_FLAG_FIELD_ONLY))
continue;
result = peffect->reset(id, reset_type);
if (result) {
if (!(peffect->type & EFFECT_TYPE_ACTIONS)) {
if (peffect->is_disable_related())
update_disable_check_list(peffect);
effects.aura_effect.erase(pit);
} else {
if (peffect->type & EFFECT_TYPE_IGNITION)
effects.ignition_effect.erase(pit);
else if (peffect->type & EFFECT_TYPE_ACTIVATE)
effects.activate_effect.erase(pit);
else if (peffect->type & EFFECT_TYPE_TRIGGER_O)
effects.trigger_o_effect.erase(pit);
else if (peffect->type & EFFECT_TYPE_TRIGGER_F)
effects.trigger_f_effect.erase(pit);
else if (peffect->type & EFFECT_TYPE_QUICK_O)
effects.quick_o_effect.erase(pit);
else if (peffect->type & EFFECT_TYPE_QUICK_F)
effects.quick_f_effect.erase(pit);
else if (peffect->type & EFFECT_TYPE_CONTINUOUS)
effects.continuous_effect.erase(pit);
}
effects.indexer.erase(peffect);
pduel->delete_effect(peffect);
}
}
}
void field::reset_phase(uint32 phase) {
for(auto eit = effects.pheff.begin(); eit != effects.pheff.end();) {
auto rm = eit++;
......
......@@ -341,7 +341,6 @@ public:
void add_effect(effect* peffect, uint8 owner_player = 2);
void remove_effect(effect* peffect);
void remove_oath_effect(effect* reason_effect);
void reset_effect(uint32 id, uint32 reset_type);
void reset_phase(uint32 phase);
void reset_chain();
void add_effect_code(uint32 code, uint32 playerid);
......
......@@ -172,7 +172,7 @@ int32 scriptlib::effect_set_type(lua_State *L) {
v |= EFFECT_TYPE_ACTIONS;
else
v &= ~EFFECT_TYPE_ACTIONS;
if(v & 0x550)
if(v & (EFFECT_TYPE_ACTIVATE | EFFECT_TYPE_IGNITION | EFFECT_TYPE_QUICK_O | EFFECT_TYPE_QUICK_F))
v |= EFFECT_TYPE_FIELD;
if(v & EFFECT_TYPE_ACTIVATE)
peffect->range = LOCATION_SZONE + LOCATION_FZONE + LOCATION_HAND;
......
......@@ -1262,6 +1262,7 @@ void field::raise_single_event(card* trigger_card, card_set* event_cards, uint32
new_event.event_value = event_value;
core.single_event.push_back(new_event);
}
// called by Duel.CheckEvent()
int32 field::check_event(uint32 code, tevent * pe) {
for(auto eit = core.point_event.begin(); eit != core.point_event.end(); ++eit) {
if(eit->event_code == code) {
......@@ -1279,6 +1280,7 @@ int32 field::check_event(uint32 code, tevent * pe) {
}
return FALSE;
}
// called by Duel.CheckActivateEffect()
int32 field::check_event_c(effect* peffect, uint8 playerid, int32 neglect_con, int32 neglect_cost, int32 copy_info, tevent* pe) {
if(peffect->code == EVENT_FREE_CHAIN) {
return peffect->is_activate_ready(playerid, nil_event, neglect_con, neglect_cost, FALSE);
......
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