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) { ...@@ -1645,7 +1645,7 @@ int32 field::effect_replace_check(uint32 code, const tevent& e) {
} }
return FALSE; 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; uint8 p = pcard->current.controler;
effect* peffect; effect* peffect;
card* atarget; card* atarget;
...@@ -1762,6 +1762,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack) ...@@ -1762,6 +1762,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
atarget = *cit; atarget = *cit;
if(!atarget) if(!atarget)
continue; continue;
if(choose_target){
if(atarget->is_affected_by_effect(EFFECT_IGNORE_BATTLE_TARGET)) if(atarget->is_affected_by_effect(EFFECT_IGNORE_BATTLE_TARGET))
continue; continue;
mcount++; mcount++;
...@@ -1771,6 +1772,12 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack) ...@@ -1771,6 +1772,12 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
continue; continue;
v->push_back(atarget); 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) if((mcount == 0 || pcard->is_affected_by_effect(EFFECT_DIRECT_ATTACK) || core.attack_player)
&& !pcard->is_affected_by_effect(EFFECT_CANNOT_DIRECT_ATTACK) && dir) && !pcard->is_affected_by_effect(EFFECT_CANNOT_DIRECT_ATTACK) && dir)
pcard->operation_param = 1; pcard->operation_param = 1;
......
...@@ -384,7 +384,7 @@ public: ...@@ -384,7 +384,7 @@ public:
uint32 get_field_counter(uint8 self, uint8 s, uint8 o, uint16 countertype); uint32 get_field_counter(uint8 self, uint8 s, uint8 o, uint16 countertype);
int32 effect_replace_check(uint32 code, const tevent& e); 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(); 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_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); 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) { ...@@ -3101,10 +3101,9 @@ int32 field::process_battle_command(uint16 step) {
return FALSE; return FALSE;
} }
core.select_cards.clear(); 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 if(!core.attack_target && !core.attacker->operation_param
|| core.attack_target && atype <= 3 || core.attack_target && std::find(core.select_cards.begin(), core.select_cards.end(), core.attack_target) == core.select_cards.end())
&& std::find(core.select_cards.begin(), core.select_cards.end(), core.attack_target) == core.select_cards.end())
rollback = true; rollback = true;
// go to damage step // go to damage step
if(!rollback) { 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