From df4382f2e01c3857b156fa82ba03d7a0994a4618 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sun, 14 Aug 2022 22:46:28 +0300 Subject: [PATCH] Fix Silent Death bonus for critical hits --- src/combat.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/combat.cc b/src/combat.cc index 42e2188..3e48336 100644 --- a/src/combat.cc +++ b/src/combat.cc @@ -3845,6 +3845,16 @@ static int attackCompute(Attack* attack) switch (roll) { case ROLL_CRITICAL_SUCCESS: damageMultiplier = attackComputeCriticalHit(attack); + + // SFALL: Fix Silent Death bonus not being applied to critical hits. + if ((attackType == ATTACK_TYPE_MELEE || attackType == ATTACK_TYPE_UNARMED) && attack->attacker == gDude) { + if (perkHasRank(gDude, PERK_SILENT_DEATH) + && !_is_hit_from_front(gDude, attack->defender) + && dudeHasState(DUDE_STATE_SNEAKING) + && gDude != attack->defender->data.critter.combat.whoHitMe) { + damageMultiplier *= 2; + } + } // FALLTHROUGH case ROLL_SUCCESS: attack->attackerFlags |= DAM_HIT;