Fix chance none logic for nested levelled lists (bug #5169)

pull/545/head
Capostrophic 5 years ago
parent 2d20905d93
commit 7c9a9d7de0

@ -149,6 +149,7 @@
Bug #5166: Scripts still should be executed after player's death
Bug #5167: Player can select and cast spells before magic menu is enabled
Bug #5168: Force1stPerson and Force3rdPerson commands are not really force view change
Bug #5169: Nested levelled items/creatures have significantly higher chance not to spawn
Feature #1774: Handle AvoidNode
Feature #2229: Improve pathfinding AI
Feature #3025: Analogue gamepad movement controls

@ -19,16 +19,14 @@ namespace MWMechanics
{
/// @return ID of resulting item, or empty if none
inline std::string getLevelledItem (const ESM::LevelledListBase* levItem, bool creature, unsigned char failChance=0)
inline std::string getLevelledItem (const ESM::LevelledListBase* levItem, bool creature)
{
const std::vector<ESM::LevelledListBase::LevelItem>& items = levItem->mList;
const MWWorld::Ptr& player = getPlayer();
int playerLevel = player.getClass().getCreatureStats(player).getLevel();
failChance += levItem->mChanceNone;
if (Misc::Rng::roll0to99() < failChance)
if (Misc::Rng::roll0to99() < levItem->mChanceNone)
return std::string();
std::vector<std::string> candidates;
@ -76,9 +74,9 @@ namespace MWMechanics
else
{
if (ref.getPtr().getTypeName() == typeid(ESM::ItemLevList).name())
return getLevelledItem(ref.getPtr().get<ESM::ItemLevList>()->mBase, false, failChance);
return getLevelledItem(ref.getPtr().get<ESM::ItemLevList>()->mBase, false);
else
return getLevelledItem(ref.getPtr().get<ESM::CreatureLevList>()->mBase, true, failChance);
return getLevelledItem(ref.getPtr().get<ESM::CreatureLevList>()->mBase, true);
}
}

Loading…
Cancel
Save