From 3db4177ebf2d3c8cca27e352644c1efa1a1a3580 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Mon, 30 Sep 2019 18:12:54 +0200 Subject: Ensure same char can do multiple AoOs. --- src/battle/mechanic/action/btl_action_move.erl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/battle/mechanic/action/btl_action_move.erl b/src/battle/mechanic/action/btl_action_move.erl index 97cec25..eed7add 100644 --- a/src/battle/mechanic/action/btl_action_move.erl +++ b/src/battle/mechanic/action/btl_action_move.erl @@ -21,7 +21,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec generate_attacks_of_opportunity_candidates +-spec generate_attack_of_opportunity_candidates ( btl_character:either(), shr_location:type(), @@ -29,7 +29,7 @@ non_neg_integer() ) -> list(attack_candidate_ref()). -generate_attacks_of_opportunity_candidates +generate_attack_of_opportunity_candidates ( Character, Location, @@ -103,9 +103,12 @@ detect_attacks_of_opportunity (Location, Candidates, RemainingStepsCount) -> - CandidateAttackRange ), if - (Range =< 0) -> {FutureCandidates, [CandidateIX|Attackers]}; + (Range =< 0) -> + {[Candidate|FutureCandidates], [CandidateIX|Attackers]}; + (Range =< RemainingStepsCount) -> {[Candidate|FutureCandidates], Attackers}; + true -> {FutureCandidates, Attackers} end end, @@ -343,7 +346,7 @@ get_path_cost_and_destination (CharacterIX, Character, Update, Path) -> ForbiddenLocations = generate_forbidden_locations(CharacterIX, Characters), AttacksOfOpportunityCandidates = - generate_attacks_of_opportunity_candidates + generate_attack_of_opportunity_candidates ( Character, Location, -- cgit v1.2.3-70-g09d2