Skip to content

Commit

Permalink
Add to-hit for Vhi's targeter
Browse files Browse the repository at this point in the history
I'd meant to do this when I first added it, but I ran out of... charge.
  • Loading branch information
PleasingFungus committed Dec 8, 2022
1 parent 5c55548 commit 7324886
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crawl-ref/source/spl-transloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,14 @@ spret frog_hop(bool fail, dist *target)
return spret::success; // TODO
}

static vector<string> _desc_electric_charge_hit_chance(const monster_info& mi)
{
melee_attack attk(&you, nullptr);
attk.charge_pow = 1; // to give the accuracy bonus
const int acc_pct = to_hit_pct(mi, attk, true);
return vector<string>{make_stringf("%d%% to hit", acc_pct)};
}

bool find_charge_target(vector<coord_def> &target_path, int max_range,
targeter *hitfunc, dist &target)
{
Expand All @@ -448,6 +456,7 @@ bool find_charge_target(vector<coord_def> &target_path, int max_range,
args.prefer_farthest = true;
args.top_prompt = "Charge where?";
args.hitfunc = hitfunc;
args.get_desc_func = bind(_desc_electric_charge_hit_chance, placeholders::_1);
direction(target, args);

// TODO: deduplicate with _find_cblink_target
Expand Down

0 comments on commit 7324886

Please sign in to comment.