From a0f9a6718ffbfe4cc5cefd87a30492468a403662 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 15 Jun 2014 16:00:29 +0200 Subject: [PATCH] Disable fProjectileThrownStoreChance when shooting at player (Fixes #1490) --- apps/openmw/mwmechanics/combat.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmechanics/combat.cpp b/apps/openmw/mwmechanics/combat.cpp index be62e8315..6feb5879b 100644 --- a/apps/openmw/mwmechanics/combat.cpp +++ b/apps/openmw/mwmechanics/combat.cpp @@ -231,9 +231,13 @@ namespace MWMechanics if (damage > 0) MWBase::Environment::get().getWorld()->spawnBloodEffect(victim, hitPosition); - float fProjectileThrownStoreChance = gmst.find("fProjectileThrownStoreChance")->getFloat(); - if ((::rand()/(RAND_MAX+1.0)) < fProjectileThrownStoreChance/100.f) - victim.getClass().getContainerStore(victim).add(projectile, 1, victim); + // Arrows shot at enemies have a chance to turn up in their inventory + if (victim != MWBase::Environment::get().getWorld()->getPlayerPtr()) + { + float fProjectileThrownStoreChance = gmst.find("fProjectileThrownStoreChance")->getFloat(); + if ((::rand()/(RAND_MAX+1.0)) < fProjectileThrownStoreChance/100.f) + victim.getClass().getContainerStore(victim).add(projectile, 1, victim); + } victim.getClass().onHit(victim, damage, true, projectile, attacker, true); }