mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-10 06:44:29 +00:00
Enchanted arrows should not be added to victim (Fixes #2306)
This commit is contained in:
parent
67491c7164
commit
d34c8526f6
@ -29,7 +29,7 @@ Ogre::Radian signedAngle(Ogre::Vector3 v1, Ogre::Vector3 v2, Ogre::Vector3 norma
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyEnchantment (const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim, const MWWorld::Ptr& object, const Ogre::Vector3& hitPosition)
|
bool applyEnchantment (const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim, const MWWorld::Ptr& object, const Ogre::Vector3& hitPosition)
|
||||||
{
|
{
|
||||||
std::string enchantmentName = !object.isEmpty() ? object.getClass().getEnchantment(object) : "";
|
std::string enchantmentName = !object.isEmpty() ? object.getClass().getEnchantment(object) : "";
|
||||||
if (!enchantmentName.empty())
|
if (!enchantmentName.empty())
|
||||||
@ -41,8 +41,10 @@ void applyEnchantment (const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim,
|
|||||||
MWMechanics::CastSpell cast(attacker, victim);
|
MWMechanics::CastSpell cast(attacker, victim);
|
||||||
cast.mHitPosition = hitPosition;
|
cast.mHitPosition = hitPosition;
|
||||||
cast.cast(object);
|
cast.cast(object);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -216,15 +218,16 @@ namespace MWMechanics
|
|||||||
damage *= gmst.find("fCombatKODamageMult")->getFloat();
|
damage *= gmst.find("fCombatKODamageMult")->getFloat();
|
||||||
|
|
||||||
// Apply "On hit" effect of the weapon
|
// Apply "On hit" effect of the weapon
|
||||||
applyEnchantment(attacker, victim, weapon, hitPosition);
|
bool appliedEnchantment = applyEnchantment(attacker, victim, weapon, hitPosition);
|
||||||
if (weapon != projectile)
|
if (weapon != projectile)
|
||||||
applyEnchantment(attacker, victim, projectile, hitPosition);
|
appliedEnchantment = applyEnchantment(attacker, victim, projectile, hitPosition);
|
||||||
|
|
||||||
if (damage > 0)
|
if (damage > 0)
|
||||||
MWBase::Environment::get().getWorld()->spawnBloodEffect(victim, hitPosition);
|
MWBase::Environment::get().getWorld()->spawnBloodEffect(victim, hitPosition);
|
||||||
|
|
||||||
// Arrows shot at enemies have a chance to turn up in their inventory
|
// Non-enchanted arrows shot at enemies have a chance to turn up in their inventory
|
||||||
if (victim != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
if (victim != MWBase::Environment::get().getWorld()->getPlayerPtr()
|
||||||
|
&& !appliedEnchantment)
|
||||||
{
|
{
|
||||||
float fProjectileThrownStoreChance = gmst.find("fProjectileThrownStoreChance")->getFloat();
|
float fProjectileThrownStoreChance = gmst.find("fProjectileThrownStoreChance")->getFloat();
|
||||||
if ((::rand()/(RAND_MAX+1.0)) < fProjectileThrownStoreChance/100.f)
|
if ((::rand()/(RAND_MAX+1.0)) < fProjectileThrownStoreChance/100.f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user