1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-05 03:06:40 +00:00

Merge pull request from Capostrophic/levelledlist

Fix chance none logic for nested levelled lists (bug )
This commit is contained in:
Andrei Kortunov 2019-09-21 20:58:13 +04:00 committed by GitHub
commit eb1245664f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions
CHANGELOG.md
apps/openmw/mwmechanics

View file

@ -149,6 +149,7 @@
Bug #5166: Scripts still should be executed after player's death 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 #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 #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 #1774: Handle AvoidNode
Feature #2229: Improve pathfinding AI Feature #2229: Improve pathfinding AI
Feature #3025: Analogue gamepad movement controls Feature #3025: Analogue gamepad movement controls

View file

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