mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
Merge pull request #2311 from Capostrophic/random
Use dice rolls instead of chance for spell magnitude (bug #4945)
This commit is contained in:
commit
9b716a2f8d
@ -54,6 +54,7 @@
|
||||
Bug #4932: Invalid records matching when loading save with edited plugin
|
||||
Bug #4938: Strings from subrecords with actually empty headers can't be empty
|
||||
Bug #4942: Hand-to-Hand attack type is chosen randomly when "always use best attack" is turned off
|
||||
Bug #4945: Poor random magic magnitude distribution
|
||||
Bug #4947: Player character doesn't use lip animation
|
||||
Bug #4948: Footstep sounds while levitating on ground level
|
||||
Bug #4963: Enchant skill progress is incorrect
|
||||
|
@ -534,8 +534,7 @@ namespace MWMechanics
|
||||
|
||||
if (magnitudeMult > 0 && !absorbed)
|
||||
{
|
||||
float random = Misc::Rng::rollClosedProbability();
|
||||
float magnitude = effectIt->mMagnMin + (effectIt->mMagnMax - effectIt->mMagnMin) * random;
|
||||
float magnitude = effectIt->mMagnMin + Misc::Rng::rollDice(effectIt->mMagnMax - effectIt->mMagnMin + 1);
|
||||
magnitude *= magnitudeMult;
|
||||
|
||||
if (!target.getClass().isActor())
|
||||
|
@ -94,7 +94,10 @@ namespace MWMechanics
|
||||
for (unsigned int i=0; i<spell->mEffects.mList.size();++i)
|
||||
{
|
||||
if (spell->mEffects.mList[i].mMagnMin != spell->mEffects.mList[i].mMagnMax)
|
||||
random[i] = Misc::Rng::rollClosedProbability();
|
||||
{
|
||||
int delta = spell->mEffects.mList[i].mMagnMax - spell->mEffects.mList[i].mMagnMin;
|
||||
random[i] = Misc::Rng::rollDice(delta + 1) / static_cast<float>(delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -637,15 +637,15 @@ void MWWorld::InventoryStore::updateMagicEffects(const Ptr& actor)
|
||||
bool existed = (mPermanentMagicEffectMagnitudes.find((**iter).getCellRef().getRefId()) != mPermanentMagicEffectMagnitudes.end());
|
||||
if (!existed)
|
||||
{
|
||||
// Roll some dice, one for each effect
|
||||
params.resize(enchantment.mEffects.mList.size());
|
||||
for (unsigned int i=0; i<params.size();++i)
|
||||
params[i].mRandom = Misc::Rng::rollClosedProbability();
|
||||
|
||||
// Try resisting each effect
|
||||
int i=0;
|
||||
for (const ESM::ENAMstruct& effect : enchantment.mEffects.mList)
|
||||
{
|
||||
int delta = effect.mMagnMax - effect.mMagnMin;
|
||||
// Roll some dice, one for each effect
|
||||
params[i].mRandom = Misc::Rng::rollDice(delta + 1) / static_cast<float>(delta);
|
||||
// Try resisting each effect
|
||||
params[i].mMultiplier = MWMechanics::getEffectMultiplier(effect.mEffectID, actor, actor);
|
||||
++i;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user