Various integer/floating point roll adjustments based on wiki

openmw-36
scrawl 10 years ago
parent 58a2ad663c
commit 5abeab21ed

@ -251,7 +251,7 @@ namespace MWClass
float hitchance = MWMechanics::getHitChance(ptr, victim, ref->mBase->mData.mCombat); float hitchance = MWMechanics::getHitChance(ptr, victim, ref->mBase->mData.mCombat);
if(OEngine::Misc::Rng::rollProbability() >= hitchance/100.0f) if(OEngine::Misc::Rng::roll0to99() >= hitchance)
{ {
victim.getClass().onHit(victim, 0.0f, false, MWWorld::Ptr(), ptr, false); victim.getClass().onHit(victim, 0.0f, false, MWWorld::Ptr(), ptr, false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr); MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);

@ -515,7 +515,7 @@ namespace MWClass
float hitchance = MWMechanics::getHitChance(ptr, victim, ptr.getClass().getSkill(ptr, weapskill)); float hitchance = MWMechanics::getHitChance(ptr, victim, ptr.getClass().getSkill(ptr, weapskill));
if (OEngine::Misc::Rng::rollProbability() >= hitchance / 100.0f) if (OEngine::Misc::Rng::roll0to99() >= hitchance)
{ {
othercls.onHit(victim, 0.0f, false, weapon, ptr, false); othercls.onHit(victim, 0.0f, false, weapon, ptr, false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr); MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);

@ -20,7 +20,7 @@ namespace MWGui
{ {
for (size_t i = 0; i<mSourceModel->getItemCount(); ++i) for (size_t i = 0; i<mSourceModel->getItemCount(); ++i)
{ {
if (chance <= OEngine::Misc::Rng::roll0to99()) if (OEngine::Misc::Rng::roll0to99() > chance)
mHiddenItems.push_back(mSourceModel->getItem(i)); mHiddenItems.push_back(mSourceModel->getItem(i));
} }
} }

@ -187,7 +187,7 @@ namespace MWMechanics
int skillValue = attacker.getClass().getSkill(attacker, int skillValue = attacker.getClass().getSkill(attacker,
weapon.getClass().getEquipmentSkill(weapon)); weapon.getClass().getEquipmentSkill(weapon));
if (OEngine::Misc::Rng::rollProbability() >= getHitChance(attacker, victim, skillValue) / 100.0f) if (OEngine::Misc::Rng::roll0to99() >= getHitChance(attacker, victim, skillValue))
{ {
victim.getClass().onHit(victim, 0.0f, false, projectile, attacker, false); victim.getClass().onHit(victim, 0.0f, false, projectile, attacker, false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, attacker); MWMechanics::reduceWeaponCondition(0.f, false, weapon, attacker);

@ -737,7 +737,7 @@ namespace MWMechanics
float x = 0; float x = 0;
float y = 0; float y = 0;
float roll = OEngine::Misc::Rng::rollClosedProbability() * 100; int roll = OEngine::Misc::Rng::roll0to99();
if (type == PT_Admire) if (type == PT_Admire)
{ {

Loading…
Cancel
Save