summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-06-19 17:46:57 +0200 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-06-19 17:46:57 +0200 |
commit | 14d48ecb01938208ba6acad78bf84f51af69c28c (patch) | |
tree | 5628598bc71b3b45a89b3e91780cf6c4fb52924c | |
parent | bb52f791e29320bab0f0ae9763d248bcaf521fd5 (diff) |
True range is not number of steps, but actual dist.
-rw-r--r-- | src/battlemap/src/Struct/RangeIndicator.elm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/battlemap/src/Struct/RangeIndicator.elm b/src/battlemap/src/Struct/RangeIndicator.elm index 20a75c7..04eafe0 100644 --- a/src/battlemap/src/Struct/RangeIndicator.elm +++ b/src/battlemap/src/Struct/RangeIndicator.elm @@ -34,7 +34,8 @@ type alias SearchParameters = maximum_distance: Int, maximum_attack_range: Int, minimum_defense_range: Int, - cost_function: (Struct.Location.Type -> Int) + cost_function: (Struct.Location.Type -> Int), + true_range_fun: (Struct.Location.Type -> Int) } type alias LocatedIndicator = @@ -94,7 +95,7 @@ generate_neighbor search_params neighbor_loc dir src_indicator = else (src_indicator.distance + node_cost) new_atk_range = (src_indicator.atk_range + 1) - new_true_range = (src_indicator.true_range + 1) + new_true_range = (search_params.true_range_fun neighbor_loc) can_defend = (new_true_range > search_params.minimum_defense_range) in if (new_dist > search_params.maximum_distance) @@ -331,7 +332,8 @@ generate location max_dist atk_range def_range cost_fun = maximum_distance = max_dist, maximum_attack_range = atk_range, minimum_defense_range = def_range, - cost_function = (cost_fun) + cost_function = (cost_fun), + true_range_fun = (Struct.Location.dist location) } ) |