Commit b4cdb965 authored by scrawl's avatar scrawl Committed by cc9cii

Move rng to components

(cherry picked from commit 8c810e36)

# Conflicts:
#	apps/openmw/engine.cpp
#	apps/openmw/mwclass/npc.cpp
#	components/misc/rng.cpp
#	components/sceneutil/lightcontroller.cpp
#	libs/openengine/CMakeLists.txt
parent 4b0aeb40
......@@ -11,7 +11,7 @@
#include <SDL.h>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include <components/compiler/extensions0.hpp>
......@@ -194,7 +194,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
, mNewGame (false)
, mCfgMgr(configurationManager)
{
OEngine::Misc::Rng::init();
Misc::Rng::init();
std::srand ( static_cast<unsigned int>(std::time(NULL)) );
MWClass::registerClasses();
......
#include "creature.hpp"
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include <components/esm/loadcrea.hpp>
#include <components/esm/creaturestate.hpp>
......@@ -250,7 +250,7 @@ namespace MWClass
float hitchance = MWMechanics::getHitChance(ptr, victim, ref->mBase->mData.mCombat);
if(OEngine::Misc::Rng::rollProbability() >= hitchance/100.0f)
if(Misc::Rng::rollProbability() >= hitchance/100.0f)
{
victim.getClass().onHit(victim, 0.0f, false, MWWorld::Ptr(), ptr, false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
......@@ -376,7 +376,7 @@ namespace MWClass
float agilityTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified() * getGmst().fKnockDownMult->getFloat();
float knockdownTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified()
* getGmst().iKnockDownOddsMult->getInt() * 0.01f + getGmst().iKnockDownOddsBase->getInt();
if (ishealth && agilityTerm <= damage && knockdownTerm <= OEngine::Misc::Rng::roll0to99())
if (ishealth && agilityTerm <= damage && knockdownTerm <= Misc::Rng::roll0to99())
{
getCreatureStats(ptr).setKnockedDown(true);
......@@ -680,7 +680,7 @@ namespace MWClass
++sound;
}
if(!sounds.empty())
return sounds[OEngine::Misc::Rng::rollDice(sounds.size())]->mSound;
return sounds[Misc::Rng::rollDice(sounds.size())]->mSound;
}
if (type == ESM::SoundGenerator::Land)
......
......@@ -2,9 +2,7 @@
#include <memory>
#include <OgreSceneNode.h>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include <components/esm/loadmgef.hpp>
#include <components/esm/loadnpc.hpp>
......@@ -382,7 +380,7 @@ namespace MWClass
float hitchance = MWMechanics::getHitChance(ptr, victim, ptr.getClass().getSkill(ptr, weapskill));
if (OEngine::Misc::Rng::rollProbability() >= hitchance / 100.0f)
if (Misc::Rng::rollProbability() >= hitchance / 100.0f)
{
othercls.onHit(victim, 0.0f, false, weapon, ptr, false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
......@@ -512,7 +510,7 @@ namespace MWClass
const GMST& gmst = getGmst();
int chance = store.get<ESM::GameSetting>().find("iVoiceHitOdds")->getInt();
if (OEngine::Misc::Rng::roll0to99() < chance)
if (Misc::Rng::roll0to99() < chance)
{
MWBase::Environment::get().getDialogueManager()->say(ptr, "hit");
}
......@@ -521,7 +519,7 @@ namespace MWClass
float agilityTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified() * gmst.fKnockDownMult->getFloat();
float knockdownTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified()
* gmst.iKnockDownOddsMult->getInt() * 0.01f + gmst.iKnockDownOddsBase->getInt();
if (ishealth && agilityTerm <= damage && knockdownTerm <= OEngine::Misc::Rng::roll0to99())
if (ishealth && agilityTerm <= damage && knockdownTerm <= Misc::Rng::roll0to99())
{
getCreatureStats(ptr).setKnockedDown(true);
......@@ -547,7 +545,7 @@ namespace MWClass
MWWorld::InventoryStore::Slot_RightPauldron, MWWorld::InventoryStore::Slot_RightPauldron,
MWWorld::InventoryStore::Slot_LeftGauntlet, MWWorld::InventoryStore::Slot_RightGauntlet
};
int hitslot = hitslots[OEngine::Misc::Rng::rollDice(20)];
int hitslot = hitslots[Misc::Rng::rollDice(20)];
float unmitigatedDamage = damage;
float x = damage / (damage + getArmorRating(ptr));
......
#include <MyGUI_ScrollBar.h>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
......@@ -85,7 +85,7 @@ namespace MWGui
std::set<int> skills;
for (int day=0; day<mDays; ++day)
{
int skill = OEngine::Misc::Rng::rollDice(ESM::Skill::Length);
int skill = Misc::Rng::rollDice(ESM::Skill::Length);
skills.insert(skill);
MWMechanics::SkillValue& value = player.getClass().getNpcStats(player).getSkill(skill);
......
......@@ -15,7 +15,7 @@
#include <MyGUI_Gui.h>
#include <MyGUI_TextBox.h>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include <components/settings/settings.hpp>
......@@ -148,7 +148,7 @@ namespace MWGui
if (!mResources.empty())
{
std::string const & randomSplash = mResources.at(OEngine::Misc::Rng::rollDice(mResources.size()));
std::string const & randomSplash = mResources.at(Misc::Rng::rollDice(mResources.size()));
Ogre::TextureManager::getSingleton ().load (randomSplash, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
......
#include "pickpocketitemmodel.hpp"
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include "../mwmechanics/npcstats.hpp"
#include "../mwworld/class.hpp"
......@@ -20,7 +20,7 @@ namespace MWGui
{
for (size_t i = 0; i<mSourceModel->getItemCount(); ++i)
{
if (chance <= OEngine::Misc::Rng::roll0to99())
if (chance <= Misc::Rng::roll0to99())
mHiddenItems.push_back(mSourceModel->getItem(i));
}
}
......
......@@ -5,7 +5,7 @@
#include <MyGUI_ScrollView.h>
#include <MyGUI_Gui.h>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include <components/esm/records.hpp>
......@@ -165,7 +165,7 @@ void Recharge::onItemClicked(MyGUI::Widget *sender)
intelligenceTerm = 1;
float x = (npcStats.getSkill(ESM::Skill::Enchant).getModified() + intelligenceTerm + luckTerm) * stats.getFatigueTerm();
int roll = OEngine::Misc::Rng::roll0to99();
int roll = Misc::Rng::roll0to99();
if (roll < x)
{
std::string soul = gem.getCellRef().getSoul();
......
......@@ -4,7 +4,7 @@
#include <MyGUI_InputManager.h>
#include <MyGUI_ControllerManager.h>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include <components/widgets/numericeditbox.hpp>
......@@ -368,7 +368,7 @@ namespace MWGui
else
x += abs(int(npcTerm - pcTerm));
int roll = OEngine::Misc::Rng::rollDice(100) + 1;
int roll = Misc::Rng::rollDice(100) + 1;
if(roll > x || (mCurrentMerchantOffer < 0) != (mCurrentBalance < 0)) //trade refused
{
MWBase::Environment::get().getWindowManager()->
......
......@@ -2,7 +2,7 @@
#include <MyGUI_ProgressBar.h>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include <components/widgets/box.hpp>
#include <components/settings/settings.hpp>
......@@ -156,7 +156,7 @@ namespace MWGui
{
// figure out if player will be woken while sleeping
float fSleepRandMod = world->getStore().get<ESM::GameSetting>().find("fSleepRandMod")->getFloat();
if (OEngine::Misc::Rng::rollProbability() > fSleepRandMod)
if (Misc::Rng::rollProbability() > fSleepRandMod)
{
float fSleepRestMod = world->getStore().get<ESM::GameSetting>().find("fSleepRestMod")->getFloat();
mInterruptAt = hoursToWait - int(fSleepRestMod * hoursToWait);
......
#include "activespells.hpp"
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include <components/misc/stringops.hpp>
......@@ -231,7 +231,7 @@ namespace MWMechanics
{
for (TContainer::iterator it = mSpells.begin(); it != mSpells.end(); )
{
if (OEngine::Misc::Rng::roll0to99() < chance)
if (Misc::Rng::roll0to99() < chance)
mSpells.erase(it++);
else
++it;
......
......@@ -2,7 +2,7 @@
#include <OgreMath.h>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include <components/esm/aisequence.hpp>
......@@ -395,7 +395,7 @@ namespace MWMechanics
if (!distantCombat) attackType = chooseBestAttack(weapon, movement);
else attackType = ESM::Weapon::AT_Chop; // cause it's =0
strength = OEngine::Misc::Rng::rollClosedProbability();
strength = Misc::Rng::rollClosedProbability();
// Note: may be 0 for some animations
timerAttack = minMaxAttackDuration[attackType][0] +
......@@ -406,7 +406,7 @@ namespace MWMechanics
{
const MWWorld::ESMStore &store = world->getStore();
int chance = store.get<ESM::GameSetting>().find("iVoiceAttackOdds")->getInt();
if (OEngine::Misc::Rng::roll0to99() < chance)
if (Misc::Rng::roll0to99() < chance)
{
MWBase::Environment::get().getDialogueManager()->say(actor, "attack");
}
......@@ -513,17 +513,17 @@ namespace MWMechanics
{
if(movement.mPosition[0] || movement.mPosition[1])
{
timerCombatMove = 0.1f + 0.1f * OEngine::Misc::Rng::rollClosedProbability();
timerCombatMove = 0.1f + 0.1f * Misc::Rng::rollClosedProbability();
combatMove = true;
}
// only NPCs are smart enough to use dodge movements
else if(actorClass.isNpc() && (!distantCombat || (distantCombat && distToTarget < rangeAttack/2)))
{
//apply sideway movement (kind of dodging) with some probability
if (OEngine::Misc::Rng::rollClosedProbability() < 0.25)
if (Misc::Rng::rollClosedProbability() < 0.25)
{
movement.mPosition[0] = OEngine::Misc::Rng::rollProbability() < 0.5 ? 1.0f : -1.0f;
timerCombatMove = 0.05f + 0.15f * OEngine::Misc::Rng::rollClosedProbability();
movement.mPosition[0] = Misc::Rng::rollProbability() < 0.5 ? 1.0f : -1.0f;
timerCombatMove = 0.05f + 0.15f * Misc::Rng::rollClosedProbability();
combatMove = true;
}
}
......@@ -638,7 +638,7 @@ namespace MWMechanics
float s2 = speed2 * t;
float t_swing =
minMaxAttackDuration[ESM::Weapon::AT_Thrust][0] +
(minMaxAttackDuration[ESM::Weapon::AT_Thrust][1] - minMaxAttackDuration[ESM::Weapon::AT_Thrust][0]) * OEngine::Misc::Rng::rollClosedProbability();
(minMaxAttackDuration[ESM::Weapon::AT_Thrust][1] - minMaxAttackDuration[ESM::Weapon::AT_Thrust][0]) * Misc::Rng::rollClosedProbability();
if (t + s2/speed1 <= t_swing)
{
......@@ -750,10 +750,10 @@ ESM::Weapon::AttackType chooseBestAttack(const ESM::Weapon* weapon, MWMechanics:
if (weapon == NULL)
{
//hand-to-hand deal equal damage for each type
float roll = OEngine::Misc::Rng::rollClosedProbability();
float roll = Misc::Rng::rollClosedProbability();
if(roll <= 0.333f) //side punch
{
movement.mPosition[0] = OEngine::Misc::Rng::rollClosedProbability() ? 1.0f : -1.0f;
movement.mPosition[0] = Misc::Rng::rollClosedProbability() ? 1.0f : -1.0f;
movement.mPosition[1] = 0;
attackType = ESM::Weapon::AT_Slash;
}
......@@ -777,10 +777,10 @@ ESM::Weapon::AttackType chooseBestAttack(const ESM::Weapon* weapon, MWMechanics:
float total = static_cast<float>(slash + chop + thrust);
float roll = OEngine::Misc::Rng::rollClosedProbability();
float roll = Misc::Rng::rollClosedProbability();
if(roll <= (slash/total))
{
movement.mPosition[0] = (OEngine::Misc::Rng::rollClosedProbability() < 0.5f) ? 1.0f : -1.0f;
movement.mPosition[0] = (Misc::Rng::rollClosedProbability() < 0.5f) ? 1.0f : -1.0f;
movement.mPosition[1] = 0;
attackType = ESM::Weapon::AT_Slash;
}
......
......@@ -3,7 +3,7 @@
#include <OgreVector3.h>
#include <OgreSceneNode.h>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include <components/esm/aisequence.hpp>
......@@ -329,7 +329,7 @@ namespace MWMechanics
static float fVoiceIdleOdds = MWBase::Environment::get().getWorld()->getStore()
.get<ESM::GameSetting>().find("fVoiceIdleOdds")->getFloat();
float roll = OEngine::Misc::Rng::rollProbability() * 10000.0f;
float roll = Misc::Rng::rollProbability() * 10000.0f;
// In vanilla MW the chance was FPS dependent, and did not allow proper changing of fVoiceIdleOdds
// due to the roll being an integer.
......@@ -504,7 +504,7 @@ namespace MWMechanics
if(!storage.mPathFinder.isPathConstructed())
{
assert(mAllowedNodes.size());
unsigned int randNode = OEngine::Misc::Rng::rollDice(mAllowedNodes.size());
unsigned int randNode = Misc::Rng::rollDice(mAllowedNodes.size());
// NOTE: initially constructed with local (i.e. cell) co-ordinates
Ogre::Vector3 destNodePos(PathFinder::MakeOgreVector3(mAllowedNodes[randNode]));
......@@ -631,7 +631,7 @@ namespace MWMechanics
.get<ESM::GameSetting>().find("fIdleChanceMultiplier")->getFloat();
unsigned short idleChance = static_cast<unsigned short>(fIdleChanceMultiplier * mIdle[counter]);
unsigned short randSelect = (int)(OEngine::Misc::Rng::rollProbability() * int(100 / fIdleChanceMultiplier));
unsigned short randSelect = (int)(Misc::Rng::rollProbability() * int(100 / fIdleChanceMultiplier));
if(randSelect < idleChance && randSelect > idleRoll)
{
playedIdle = counter+2;
......@@ -653,7 +653,7 @@ namespace MWMechanics
state.moveIn(new AiWanderStorage());
int index = OEngine::Misc::Rng::rollDice(mAllowedNodes.size());
int index = Misc::Rng::rollDice(mAllowedNodes.size());
ESM::Pathgrid::Point dest = mAllowedNodes[index];
// apply a slight offset to prevent overcrowding
......
......@@ -7,7 +7,7 @@
#include <stdexcept>
#include <map>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include <components/esm/loadskil.hpp>
#include <components/esm/loadappa.hpp>
......@@ -298,7 +298,7 @@ void MWMechanics::Alchemy::addPotion (const std::string& name)
newRecord.mName = name;
int index = OEngine::Misc::Rng::rollDice(6);
int index = Misc::Rng::rollDice(6);
assert (index>=0 && index<6);
static const char *meshes[] = { "standard", "bargain", "cheap", "fresh", "exclusive", "quality" };
......@@ -474,7 +474,7 @@ MWMechanics::Alchemy::Result MWMechanics::Alchemy::create (const std::string& na
return Result_RandomFailure;
}
if (getAlchemyFactor() < OEngine::Misc::Rng::roll0to99())
if (getAlchemyFactor() < Misc::Rng::roll0to99())
{
removeIngredients();
return Result_RandomFailure;
......
......@@ -2,7 +2,7 @@
#include <OgreSceneNode.h>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
......@@ -109,7 +109,7 @@ namespace MWMechanics
int iBlockMinChance = gmst.find("iBlockMinChance")->getInt();
x = std::min(iBlockMaxChance, std::max(iBlockMinChance, x));
if (OEngine::Misc::Rng::roll0to99() < x)
if (Misc::Rng::roll0to99() < x)
{
// Reduce shield durability by incoming damage
int shieldhealth = shield->getClass().getItemHealth(*shield);
......@@ -187,7 +187,7 @@ namespace MWMechanics
int skillValue = attacker.getClass().getSkill(attacker,
weapon.getClass().getEquipmentSkill(weapon));
if (OEngine::Misc::Rng::rollProbability() >= getHitChance(attacker, victim, skillValue) / 100.0f)
if (Misc::Rng::rollProbability() >= getHitChance(attacker, victim, skillValue) / 100.0f)
{
victim.getClass().onHit(victim, 0.0f, false, projectile, attacker, false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, attacker);
......@@ -225,7 +225,7 @@ namespace MWMechanics
&& !appliedEnchantment)
{
float fProjectileThrownStoreChance = gmst.find("fProjectileThrownStoreChance")->getFloat();
if (OEngine::Misc::Rng::rollProbability() < fProjectileThrownStoreChance / 100.f)
if (Misc::Rng::rollProbability() < fProjectileThrownStoreChance / 100.f)
victim.getClass().getContainerStore(victim).add(projectile, 1, victim);
}
......@@ -292,7 +292,7 @@ namespace MWMechanics
saveTerm *= 1.25f * normalisedFatigue;
float x = std::max(0.f, saveTerm - OEngine::Misc::Rng::roll0to99());
float x = std::max(0.f, saveTerm - Misc::Rng::roll0to99());
int element = ESM::MagicEffect::FireDamage;
if (i == 1)
......
#ifndef OPENMW_MECHANICS_DISEASE_H
#define OPENMW_MECHANICS_DISEASE_H
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp"
......@@ -51,7 +51,7 @@ namespace MWMechanics
continue;
int x = static_cast<int>(fDiseaseXferChance * 100 * resist);
if (OEngine::Misc::Rng::rollDice(10000) < x)
if (Misc::Rng::rollDice(10000) < x)
{
// Contracted disease!
actor.getClass().getCreatureStats(actor).getSpells().add(it->first);
......
#include "enchanting.hpp"
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include "../mwworld/manualref.hpp"
#include "../mwworld/class.hpp"
......@@ -70,7 +70,7 @@ namespace MWMechanics
if(mSelfEnchanting)
{
if(getEnchantChance() <= (OEngine::Misc::Rng::roll0to99()))
if(getEnchantChance() <= (Misc::Rng::roll0to99()))
return false;
mEnchanter.getClass().skillUsageSucceeded (mEnchanter, ESM::Skill::Enchant, 2);
......
#ifndef OPENMW_MECHANICS_LEVELLEDLIST_H
#define OPENMW_MECHANICS_LEVELLEDLIST_H
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include "../mwworld/ptr.hpp"
#include "../mwworld/esmstore.hpp"
......@@ -24,7 +24,7 @@ namespace MWMechanics
failChance += levItem->mChanceNone;
if (OEngine::Misc::Rng::roll0to99() < failChance)
if (Misc::Rng::roll0to99() < failChance)
return std::string();
std::vector<std::string> candidates;
......@@ -53,7 +53,7 @@ namespace MWMechanics
}
if (candidates.empty())
return std::string();
std::string item = candidates[OEngine::Misc::Rng::rollDice(candidates.size())];
std::string item = candidates[Misc::Rng::rollDice(candidates.size())];
// Vanilla doesn't fail on nonexistent items in levelled lists
if (!MWBase::Environment::get().getWorld()->getStore().find(Misc::StringUtils::lowerCase(item)))
......
......@@ -2,7 +2,7 @@
#include "mechanicsmanagerimp.hpp"
#include "npcstats.hpp"
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include <components/esm/stolenitems.hpp>
......@@ -741,7 +741,7 @@ namespace MWMechanics
float x = 0;
float y = 0;
float roll = OEngine::Misc::Rng::rollClosedProbability() * 100;
float roll = Misc::Rng::rollClosedProbability() * 100;
if (type == PT_Admire)
{
......@@ -1399,7 +1399,7 @@ namespace MWMechanics
float target = x - y;
return (OEngine::Misc::Rng::roll0to99() >= target);
return (Misc::Rng::roll0to99() >= target);
}
void MechanicsManager::startCombat(const MWWorld::Ptr &ptr, const MWWorld::Ptr &target)
......
#include "pickpocket.hpp"
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include "../mwworld/class.hpp"
#include "../mwworld/esmstore.hpp"
......@@ -41,7 +41,7 @@ namespace MWMechanics
int iPickMaxChance = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
.find("iPickMaxChance")->getInt();
int roll = OEngine::Misc::Rng::roll0to99();
int roll = Misc::Rng::roll0to99();
if (t < pcSneak / iPickMinChance)
{
return (roll > int(pcSneak / iPickMinChance));
......
......@@ -2,7 +2,7 @@
#include <boost/format.hpp>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
......@@ -48,7 +48,7 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair)
float x = (0.1f * pcStrength + 0.1f * pcLuck + armorerSkill) * fatigueTerm;
int roll = OEngine::Misc::Rng::roll0to99();
int roll = Misc::Rng::roll0to99();
if (roll <= x)
{
int y = static_cast<int>(fRepairAmountMult * toolQuality * roll);
......
#include "security.hpp"
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include "../mwworld/class.hpp"
#include "../mwworld/containerstore.hpp"
......@@ -50,7 +50,7 @@ namespace MWMechanics
else
{
MWBase::Environment::get().getMechanicsManager()->objectOpened(mActor, lock);
if (OEngine::Misc::Rng::roll0to99() <= x)
if (Misc::Rng::roll0to99() <= x)
{
lock.getClass().unlock(lock);
resultMessage = "#{sLockSuccess}";
......@@ -91,7 +91,7 @@ namespace MWMechanics
else
{
MWBase::Environment::get().getMechanicsManager()->objectOpened(mActor, trap);
if (OEngine::Misc::Rng::roll0to99() <= x)
if (Misc::Rng::roll0to99() <= x)
{
trap.getCellRef().setTrap("");
......
......@@ -4,7 +4,7 @@
#include <boost/format.hpp>
#include <openengine/misc/rng.hpp>
#include <components/misc/rng.hpp>
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp"
......@@ -282,7 +282,7 @@ namespace MWMechanics
if (castChance > 0)
x *= 50 / castChance;
float roll = OEngine::Misc::Rng::rollClosedProbability() * 100;
float roll = Misc::Rng::rollClosedProbability() * 100;
if (magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude)
roll -= resistance;
......@@ -385,7 +385,7 @@ namespace MWMechanics
target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::ResistCommonDisease).getMagnitude()
: target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::ResistBlightDisease).getMagnitude();
if (OEngine::Misc::Rng::roll0to99() <= x)
if (Misc::Rng::roll0to99() <= x)
{