Allow negative values for ai stats

pull/593/head
Evil Eye 4 years ago
parent f8c068ee34
commit 61e014a765

@ -98,6 +98,7 @@
Bug #5758: Paralyzed actors behavior is inconsistent with vanilla Bug #5758: Paralyzed actors behavior is inconsistent with vanilla
Bug #5762: Movement solver is insufficiently robust Bug #5762: Movement solver is insufficiently robust
Bug #5821: NPCs from mods getting removed if mod order was changed Bug #5821: NPCs from mods getting removed if mod order was changed
Bug #5835: OpenMW doesn't accept negative values for NPC's hello, alarm, fight, and flee
Feature #390: 3rd person look "over the shoulder" Feature #390: 3rd person look "over the shoulder"
Feature #1536: Show more information about level on menu Feature #1536: Show more information about level on menu
Feature #2386: Distant Statics in the form of Object Paging Feature #2386: Distant Statics in the form of Object Paging

@ -18,8 +18,10 @@ namespace MWMechanics
} }
template<typename T> template<typename T>
T Stat<T>::getModified() const T Stat<T>::getModified(bool capped) const
{ {
if(!capped)
return mModified;
return std::max(static_cast<T>(0), mModified); return std::max(static_cast<T>(0), mModified);
} }

@ -28,7 +28,7 @@ namespace MWMechanics
const T& getBase() const; const T& getBase() const;
T getModified() const; T getModified(bool capped = true) const;
T getCurrentModified() const; T getCurrentModified() const;
T getModifier() const; T getModifier() const;
T getCurrentModifier() const; T getCurrentModifier() const;

@ -241,7 +241,7 @@ namespace MWScript
{ {
MWWorld::Ptr ptr = R()(runtime); MWWorld::Ptr ptr = R()(runtime);
runtime.push(ptr.getClass().getCreatureStats (ptr).getAiSetting (mIndex).getModified()); runtime.push(ptr.getClass().getCreatureStats (ptr).getAiSetting (mIndex).getModified(false));
} }
}; };
template<class R> template<class R>
@ -276,9 +276,7 @@ namespace MWScript
Interpreter::Type_Integer value = runtime[0].mInteger; Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop(); runtime.pop();
MWMechanics::Stat<int> stat = ptr.getClass().getCreatureStats(ptr).getAiSetting(mIndex); ptr.getClass().getCreatureStats(ptr).setAiSetting(mIndex, value);
stat.setModified(value, 0);
ptr.getClass().getCreatureStats(ptr).setAiSetting(mIndex, stat);
ptr.getClass().setBaseAISetting(ptr.getCellRef().getRefId(), mIndex, value); ptr.getClass().setBaseAISetting(ptr.getCellRef().getRefId(), mIndex, value);
} }
}; };

Loading…
Cancel
Save