From 02e83a198978af593cfb4f41ab811d9e0e0d00cc Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 6 Aug 2022 17:07:07 +0300 Subject: [PATCH] Fix Sharshooter bonus --- src/combat.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/combat.cc b/src/combat.cc index 56a4f52..8b51532 100644 --- a/src/combat.cc +++ b/src/combat.cc @@ -4230,6 +4230,11 @@ static int attackDetermineToHit(Object* attacker, int tile, Object* defender, in int perception = critterGetStat(attacker, STAT_PERCEPTION); + // SFALL: Fix Sharpshooter. + if (attacker == gDude) { + perception += 2 * perkGetRank(gDude, PERK_SHARPSHOOTER); + } + if (defender != NULL) { modifier = objectGetDistanceBetweenTiles(attacker, tile, defender, defender->tile); } else { @@ -4250,10 +4255,6 @@ static int attackDetermineToHit(Object* attacker, int tile, Object* defender, in modifier = -2 * perception; } - if (attacker == gDude) { - modifier -= 2 * perkGetRank(gDude, PERK_SHARPSHOOTER); - } - if (modifier >= 0) { if ((attacker->data.critter.combat.results & DAM_BLIND) != 0) { modifier *= -12;