Commit b8f08756 authored by salix5's avatar salix5

get_attack_target()

Now it will not consider EFFECT_CANNOT_BE_BATTLE_TARGET when checking current attack target before entering damage step.
parent 62b1ed73
......@@ -1645,7 +1645,7 @@ int32 field::effect_replace_check(uint32 code, const tevent& e) {
}
return FALSE;
}
int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack) {
int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack, bool choose_target) {
uint8 p = pcard->current.controler;
effect* peffect;
card* atarget;
......@@ -1762,14 +1762,21 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
atarget = *cit;
if(!atarget)
continue;
if(atarget->is_affected_by_effect(EFFECT_IGNORE_BATTLE_TARGET))
continue;
mcount++;
if(atarget->is_affected_by_effect(EFFECT_CANNOT_BE_BATTLE_TARGET, pcard))
continue;
if(pcard->is_affected_by_effect(EFFECT_CANNOT_SELECT_BATTLE_TARGET, atarget))
continue;
v->push_back(atarget);
if(choose_target){
if(atarget->is_affected_by_effect(EFFECT_IGNORE_BATTLE_TARGET))
continue;
mcount++;
if(atarget->is_affected_by_effect(EFFECT_CANNOT_BE_BATTLE_TARGET, pcard))
continue;
if(pcard->is_affected_by_effect(EFFECT_CANNOT_SELECT_BATTLE_TARGET, atarget))
continue;
v->push_back(atarget);
}
else {
if(!atarget->is_affected_by_effect(EFFECT_IGNORE_BATTLE_TARGET))
mcount++;
v->push_back(atarget);
}
}
if((mcount == 0 || pcard->is_affected_by_effect(EFFECT_DIRECT_ATTACK) || core.attack_player)
&& !pcard->is_affected_by_effect(EFFECT_CANNOT_DIRECT_ATTACK) && dir)
......
......@@ -384,7 +384,7 @@ public:
uint32 get_field_counter(uint8 self, uint8 s, uint8 o, uint16 countertype);
int32 effect_replace_check(uint32 code, const tevent& e);
int32 get_attack_target(card* pcard, card_vector* v, uint8 chain_attack = FALSE);
int32 get_attack_target(card* pcard, card_vector* v, uint8 chain_attack = FALSE, bool choose_target = true);
void attack_all_target_check();
int32 check_synchro_material(card* pcard, int32 findex1, int32 findex2, int32 min, int32 max, card* smat, group* mg);
int32 check_tuner_material(card* pcard, card* tuner, int32 findex1, int32 findex2, int32 min, int32 max, card* smat, group* mg);
......
......@@ -3101,10 +3101,9 @@ int32 field::process_battle_command(uint16 step) {
return FALSE;
}
core.select_cards.clear();
auto atype = get_attack_target(core.attacker, &core.select_cards, core.chain_attack);
get_attack_target(core.attacker, &core.select_cards, core.chain_attack, false);
if(!core.attack_target && !core.attacker->operation_param
|| core.attack_target && atype <= 3
&& std::find(core.select_cards.begin(), core.select_cards.end(), core.attack_target) == core.select_cards.end())
|| core.attack_target && std::find(core.select_cards.begin(), core.select_cards.end(), core.attack_target) == core.select_cards.end())
rollback = true;
// go to damage step
if(!rollback) {
......
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