Commit 0d2d78fc authored by salix5's avatar salix5

edit

parent 9516857b
......@@ -999,7 +999,7 @@ void card::cancel_field_effect() {
if(unique_code && (current.location & unique_location))
pduel->game_field->remove_unique_card(this);
}
void card::enable_field_effect(int32 enabled) {
void card::enable_field_effect(bool enabled) {
if (current.location == 0)
return;
if ((enabled && get_status(STATUS_EFFECT_ENABLED)) || (!enabled && !get_status(STATUS_EFFECT_ENABLED)))
......@@ -1390,6 +1390,7 @@ void card::reset_effect_count() {
peffect->recharge();
}
}
// refresh STATUS_DISABLED based on EFFECT_DISABLE and EFFECT_CANNOT_DISABLE
int32 card::refresh_disable_status() {
int32 pre_dis = is_status(STATUS_DISABLED);
filter_immune_effect();
......@@ -1687,6 +1688,7 @@ void card::filter_single_continuous_effect(int32 code, effect_set* eset, uint8 s
if(sort)
eset->sort();
}
// refresh this->immune_effect
void card::filter_immune_effect() {
effect* peffect;
immune_effect.clear();
......@@ -1712,6 +1714,9 @@ void card::filter_immune_effect() {
}
immune_effect.sort();
}
// for all disable-related peffect of this,
// 1. put all cards in the target of peffect into effects.disable_check_set, effects.disable_check_list
// 2. add equiping_target of peffect into effects.disable_check_set, effects.disable_check_list
void card::filter_disable_related_cards() {
for (auto it = indexer.begin(); it != indexer.end(); ++it) {
effect* peffect = it->first;
......@@ -1858,6 +1863,7 @@ void card::filter_spsummon_procedure_g(uint8 playerid, effect_set* peset) {
pduel->game_field->core.reason_player = op;
}
}
// return: an effect with code which affects this or 0
effect* card::is_affected_by_effect(int32 code) {
effect* peffect;
auto rg = single_effect.equal_range(code);
......@@ -2319,6 +2325,7 @@ int32 card::is_setable_szone(uint8 playerid, uint8 ignore_fd) {
pduel->game_field->restore_lp_cost();
return TRUE;
}
// return: this is affected by peffect or not
int32 card::is_affect_by_effect(effect* peffect) {
if(is_status(STATUS_SUMMONING))
return FALSE;
......
......@@ -187,7 +187,7 @@ public:
void xyz_remove(card* mat);
void apply_field_effect();
void cancel_field_effect();
void enable_field_effect(int32 enabled);
void enable_field_effect(bool enabled);
int32 add_effect(effect* peffect);
void remove_effect(effect* peffect);
void remove_effect(effect* peffect, effect_container::iterator it);
......
......@@ -376,7 +376,7 @@ int32 effect::is_activate_check(uint8 playerid, const tevent& e, int32 neglect_c
pduel->game_field->restore_lp_cost();
return result;
}
// check if pcard is the target of a field effect
// check if pcard is the target of the field effect this
int32 effect::is_target(card* pcard) {
if(type & EFFECT_TYPE_ACTIONS)
return FALSE;
......
......@@ -897,6 +897,7 @@ void field::filter_field_effect(uint32 code, effect_set* eset, uint8 sort) {
if(sort)
eset->sort();
}
// put all cards in the target of peffect into cset
void field::filter_affected_cards(effect* peffect, card_set* cset) {
if ((peffect->type & EFFECT_TYPE_ACTIONS) || !(peffect->type & EFFECT_TYPE_FIELD) || peffect->is_flag(EFFECT_FLAG_PLAYER_TARGET))
return;
......@@ -1389,6 +1390,7 @@ int32 field::get_overlay_count(uint8 self, uint8 s, uint8 o) {
}
return count;
}
// put all cards in the target of peffect into effects.disable_check_set, effects.disable_check_list
void field::update_disable_check_list(effect* peffect) {
card_set cset;
filter_affected_cards(peffect, &cset);
......
......@@ -43,7 +43,7 @@ int32 scriptlib::debug_add_card(lua_State *L) {
pduel->game_field->add_card(playerid, pcard, location, sequence);
pcard->current.position = position;
if(!(location & LOCATION_ONFIELD) || (position & POS_FACEUP)) {
pcard->enable_field_effect(TRUE);
pcard->enable_field_effect(true);
pduel->game_field->adjust_instant();
}
if(proc)
......
......@@ -599,7 +599,7 @@ int32 scriptlib::duel_move_to_field(lua_State *L) {
uint32 positions = lua_tointeger(L, 5);
uint32 enable = lua_toboolean(L, 6);
duel* pduel = pcard->pduel;
pcard->enable_field_effect(FALSE);
pcard->enable_field_effect(false);
pduel->game_field->adjust_instant();
pduel->game_field->move_to_field(pcard, move_player, playerid, destination, positions, enable);
pduel->game_field->core.subunits.begin()->type = PROCESSOR_MOVETOFIELD_S;
......@@ -616,7 +616,7 @@ int32 scriptlib::duel_return_to_field(lua_State *L) {
if(lua_gettop(L) > 1)
pos = lua_tointeger(L, 2);
duel* pduel = pcard->pduel;
pcard->enable_field_effect(FALSE);
pcard->enable_field_effect(false);
pduel->game_field->adjust_instant();
pduel->game_field->refresh_location_info_instant();
pduel->game_field->move_to_field(pcard, pcard->previous.controler, pcard->previous.controler, pcard->previous.location, pos, TRUE, 1);
......@@ -974,7 +974,7 @@ int32 scriptlib::duel_equip_complete(lua_State *L) {
for(auto cit = pduel->game_field->core.equiping_cards.begin(); cit != pduel->game_field->core.equiping_cards.end(); ++cit) {
card* equip_card = *cit;
if(equip_card->is_position(POS_FACEUP))
equip_card->enable_field_effect(TRUE);
equip_card->enable_field_effect(true);
etargets.insert(equip_card->equiping_target);
}
pduel->game_field->adjust_instant();
......
......@@ -140,7 +140,7 @@ extern "C" DECL_DLLEXPORT void new_card(ptr pduel, uint32 code, uint8 owner, uin
ptduel->game_field->add_card(playerid, pcard, location, sequence);
pcard->current.position = position;
if(!(location & LOCATION_ONFIELD) || (position & POS_FACEUP)) {
pcard->enable_field_effect(TRUE);
pcard->enable_field_effect(true);
ptduel->game_field->adjust_instant();
}
if(location & LOCATION_ONFIELD) {
......
This diff is collapsed.
......@@ -4243,7 +4243,7 @@ int32 field::add_chain(uint16 step) {
}
}
if(peffect->handler->current.location == LOCATION_HAND) {
peffect->handler->enable_field_effect(FALSE);
peffect->handler->enable_field_effect(false);
peffect->handler->set_status(STATUS_ACT_FROM_HAND, TRUE);
move_to_field(peffect->handler, peffect->handler->current.controler, peffect->handler->current.controler, LOCATION_SZONE, POS_FACEUP);
} else {
......@@ -4567,12 +4567,12 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
card* pcard = peffect->handler;
if((peffect->type & EFFECT_TYPE_ACTIVATE) && pcard->is_has_relation(*cait)) {
pcard->set_status(STATUS_ACTIVATED, TRUE);
pcard->enable_field_effect(TRUE);
pcard->enable_field_effect(true);
if(core.duel_options & DUEL_OBSOLETE_RULING) {
if(pcard->data.type & TYPE_FIELD) {
card* fscard = player[1 - pcard->current.controler].list_szone[5];
if(fscard && fscard->is_position(POS_FACEUP))
fscard->enable_field_effect(FALSE);
fscard->enable_field_effect(false);
}
}
adjust_instant();
......@@ -4717,7 +4717,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
}
for(auto cit = core.delayed_enable_set.begin(); cit != core.delayed_enable_set.end(); ++cit) {
if((*cit)->current.location == LOCATION_MZONE)
(*cit)->enable_field_effect(TRUE);
(*cit)->enable_field_effect(true);
}
core.delayed_enable_set.clear();
adjust_all();
......
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