mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-02 07:21:07 +00:00
Don't touch base stats when turning into a werewolf
This commit is contained in:
parent
c166341ec0
commit
debdcf2953
@ -77,6 +77,7 @@
|
|||||||
Bug #6324: Special Slave Companions: Can't buy the slave companions
|
Bug #6324: Special Slave Companions: Can't buy the slave companions
|
||||||
Bug #6326: Detect Enchantment/Key should detect items in unresolved containers
|
Bug #6326: Detect Enchantment/Key should detect items in unresolved containers
|
||||||
Bug #6327: Blocking roots the character in place
|
Bug #6327: Blocking roots the character in place
|
||||||
|
Bug #6333: Werewolf stat changes should be implemented as damage/fortifications
|
||||||
Bug #6343: Magic projectile speed doesn't take race weight into account
|
Bug #6343: Magic projectile speed doesn't take race weight into account
|
||||||
Bug #6347: PlaceItem/PlaceItemCell/PlaceAt should work with levelled creatures
|
Bug #6347: PlaceItem/PlaceItemCell/PlaceAt should work with levelled creatures
|
||||||
Bug #6354: SFX abruptly cut off after crossing max distance; implement soft fading of sound effects
|
Bug #6354: SFX abruptly cut off after crossing max distance; implement soft fading of sound effects
|
||||||
|
@ -1865,8 +1865,8 @@ namespace MWMechanics
|
|||||||
{
|
{
|
||||||
const MWWorld::Store<ESM::GameSetting>& gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
const MWWorld::Store<ESM::GameSetting>& gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
MWMechanics::NpcStats &stats = actor.getClass().getNpcStats(actor);
|
MWMechanics::NpcStats &stats = actor.getClass().getNpcStats(actor);
|
||||||
|
auto& skill = stats.getSkill(ESM::Skill::Acrobatics);
|
||||||
stats.getSkill(ESM::Skill::Acrobatics).setBase(gmst.find("fWerewolfAcrobatics")->mValue.getInteger());
|
skill.setModifier(gmst.find("fWerewolfAcrobatics")->mValue.getFloat() - skill.getModified());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::cleanupSummonedCreature(const MWWorld::Ptr &caster, int creatureActorId)
|
void MechanicsManager::cleanupSummonedCreature(const MWWorld::Ptr &caster, int creatureActorId)
|
||||||
|
@ -58,9 +58,9 @@ namespace MWWorld
|
|||||||
MWMechanics::NpcStats& stats = getPlayer().getClass().getNpcStats(getPlayer());
|
MWMechanics::NpcStats& stats = getPlayer().getClass().getNpcStats(getPlayer());
|
||||||
|
|
||||||
for (int i=0; i<ESM::Skill::Length; ++i)
|
for (int i=0; i<ESM::Skill::Length; ++i)
|
||||||
mSaveSkills[i] = stats.getSkill(i);
|
mSaveSkills[i] = stats.getSkill(i).getModified();
|
||||||
for (int i=0; i<ESM::Attribute::Length; ++i)
|
for (int i=0; i<ESM::Attribute::Length; ++i)
|
||||||
mSaveAttributes[i] = stats.getAttribute(i);
|
mSaveAttributes[i] = stats.getAttribute(i).getModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::restoreStats()
|
void Player::restoreStats()
|
||||||
@ -69,11 +69,20 @@ namespace MWWorld
|
|||||||
MWMechanics::CreatureStats& creatureStats = getPlayer().getClass().getCreatureStats(getPlayer());
|
MWMechanics::CreatureStats& creatureStats = getPlayer().getClass().getCreatureStats(getPlayer());
|
||||||
MWMechanics::NpcStats& npcStats = getPlayer().getClass().getNpcStats(getPlayer());
|
MWMechanics::NpcStats& npcStats = getPlayer().getClass().getNpcStats(getPlayer());
|
||||||
MWMechanics::DynamicStat<float> health = creatureStats.getDynamic(0);
|
MWMechanics::DynamicStat<float> health = creatureStats.getDynamic(0);
|
||||||
creatureStats.setHealth(int(health.getBase() / gmst.find("fWereWolfHealth")->mValue.getFloat()));
|
creatureStats.setHealth(health.getBase() / gmst.find("fWereWolfHealth")->mValue.getFloat());
|
||||||
for (int i=0; i<ESM::Skill::Length; ++i)
|
for (int i=0; i<ESM::Skill::Length; ++i)
|
||||||
npcStats.setSkill(i, mSaveSkills[i]);
|
{
|
||||||
|
auto& skill = npcStats.getSkill(i);
|
||||||
|
skill.restore(skill.getDamage());
|
||||||
|
skill.setModifier(mSaveSkills[i] - skill.getBase());
|
||||||
|
}
|
||||||
for (int i=0; i<ESM::Attribute::Length; ++i)
|
for (int i=0; i<ESM::Attribute::Length; ++i)
|
||||||
npcStats.setAttribute(i, mSaveAttributes[i]);
|
{
|
||||||
|
auto attribute = npcStats.getAttribute(i);
|
||||||
|
attribute.restore(attribute.getDamage());
|
||||||
|
attribute.setModifier(mSaveAttributes[i] - attribute.getBase());
|
||||||
|
npcStats.setAttribute(i, attribute);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::setWerewolfStats()
|
void Player::setWerewolfStats()
|
||||||
@ -82,7 +91,7 @@ namespace MWWorld
|
|||||||
MWMechanics::CreatureStats& creatureStats = getPlayer().getClass().getCreatureStats(getPlayer());
|
MWMechanics::CreatureStats& creatureStats = getPlayer().getClass().getCreatureStats(getPlayer());
|
||||||
MWMechanics::NpcStats& npcStats = getPlayer().getClass().getNpcStats(getPlayer());
|
MWMechanics::NpcStats& npcStats = getPlayer().getClass().getNpcStats(getPlayer());
|
||||||
MWMechanics::DynamicStat<float> health = creatureStats.getDynamic(0);
|
MWMechanics::DynamicStat<float> health = creatureStats.getDynamic(0);
|
||||||
creatureStats.setHealth(int(health.getBase() * gmst.find("fWereWolfHealth")->mValue.getFloat()));
|
creatureStats.setHealth(health.getBase() * gmst.find("fWereWolfHealth")->mValue.getFloat());
|
||||||
for(size_t i = 0;i < ESM::Attribute::Length;++i)
|
for(size_t i = 0;i < ESM::Attribute::Length;++i)
|
||||||
{
|
{
|
||||||
// Oh, Bethesda. It's "Intelligence".
|
// Oh, Bethesda. It's "Intelligence".
|
||||||
@ -90,7 +99,7 @@ namespace MWWorld
|
|||||||
ESM::Attribute::sAttributeNames[i]);
|
ESM::Attribute::sAttributeNames[i]);
|
||||||
|
|
||||||
MWMechanics::AttributeValue value = npcStats.getAttribute(i);
|
MWMechanics::AttributeValue value = npcStats.getAttribute(i);
|
||||||
value.setBase(int(gmst.find(name)->mValue.getFloat()));
|
value.setModifier(gmst.find(name)->mValue.getFloat() - value.getModified());
|
||||||
npcStats.setAttribute(i, value);
|
npcStats.setAttribute(i, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,9 +113,8 @@ namespace MWWorld
|
|||||||
std::string name = "fWerewolf"+((i==ESM::Skill::Mercantile) ? std::string("Merchantile") :
|
std::string name = "fWerewolf"+((i==ESM::Skill::Mercantile) ? std::string("Merchantile") :
|
||||||
ESM::Skill::sSkillNames[i]);
|
ESM::Skill::sSkillNames[i]);
|
||||||
|
|
||||||
MWMechanics::SkillValue value = npcStats.getSkill(i);
|
MWMechanics::SkillValue& value = npcStats.getSkill(i);
|
||||||
value.setBase(int(gmst.find(name)->mValue.getFloat()));
|
value.setModifier(gmst.find(name)->mValue.getFloat() - value.getModified());
|
||||||
npcStats.setSkill(i, value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,14 +324,12 @@ namespace MWWorld
|
|||||||
|
|
||||||
for (int i=0; i<ESM::Skill::Length; ++i)
|
for (int i=0; i<ESM::Skill::Length; ++i)
|
||||||
{
|
{
|
||||||
mSaveSkills[i].setBase(0);
|
mSaveSkills[i] = 0.f;
|
||||||
mSaveSkills[i].setModifier(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<ESM::Attribute::Length; ++i)
|
for (int i=0; i<ESM::Attribute::Length; ++i)
|
||||||
{
|
{
|
||||||
mSaveAttributes[i].setBase(0);
|
mSaveAttributes[i] = 0.f;
|
||||||
mSaveAttributes[i].setModifier(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mMarkedPosition.pos[0] = 0;
|
mMarkedPosition.pos[0] = 0;
|
||||||
@ -360,9 +366,9 @@ namespace MWWorld
|
|||||||
player.mHasMark = false;
|
player.mHasMark = false;
|
||||||
|
|
||||||
for (int i=0; i<ESM::Attribute::Length; ++i)
|
for (int i=0; i<ESM::Attribute::Length; ++i)
|
||||||
mSaveAttributes[i].writeState(player.mSaveAttributes[i]);
|
player.mSaveAttributes[i] = mSaveAttributes[i];
|
||||||
for (int i=0; i<ESM::Skill::Length; ++i)
|
for (int i=0; i<ESM::Skill::Length; ++i)
|
||||||
mSaveSkills[i].writeState(player.mSaveSkills[i]);
|
player.mSaveSkills[i] = mSaveSkills[i];
|
||||||
|
|
||||||
player.mPreviousItems = mPreviousItems;
|
player.mPreviousItems = mPreviousItems;
|
||||||
|
|
||||||
@ -384,13 +390,7 @@ namespace MWWorld
|
|||||||
throw std::runtime_error ("invalid player state record (object state)");
|
throw std::runtime_error ("invalid player state record (object state)");
|
||||||
}
|
}
|
||||||
if (reader.getFormat() < 17)
|
if (reader.getFormat() < 17)
|
||||||
{
|
|
||||||
convertMagicEffects(player.mObject.mCreatureStats, player.mObject.mInventory, &player.mObject.mNpcStats);
|
convertMagicEffects(player.mObject.mCreatureStats, player.mObject.mInventory, &player.mObject.mNpcStats);
|
||||||
for(std::size_t i = 0; i < ESM::Attribute::Length; ++i)
|
|
||||||
player.mSaveAttributes[i].mMod = 0.f;
|
|
||||||
for(std::size_t i = 0; i < ESM::Skill::Length; ++i)
|
|
||||||
player.mSaveSkills[i].mMod = 0.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player.mObject.mEnabled)
|
if (!player.mObject.mEnabled)
|
||||||
{
|
{
|
||||||
@ -401,14 +401,23 @@ namespace MWWorld
|
|||||||
mPlayer.load (player.mObject);
|
mPlayer.load (player.mObject);
|
||||||
|
|
||||||
for (int i=0; i<ESM::Attribute::Length; ++i)
|
for (int i=0; i<ESM::Attribute::Length; ++i)
|
||||||
mSaveAttributes[i].readState(player.mSaveAttributes[i]);
|
mSaveAttributes[i] = player.mSaveAttributes[i];
|
||||||
for (int i=0; i<ESM::Skill::Length; ++i)
|
for (int i=0; i<ESM::Skill::Length; ++i)
|
||||||
mSaveSkills[i].readState(player.mSaveSkills[i]);
|
mSaveSkills[i] = player.mSaveSkills[i];
|
||||||
|
|
||||||
if (player.mObject.mNpcStats.mWerewolfDeprecatedData && player.mObject.mNpcStats.mIsWerewolf)
|
if (player.mObject.mNpcStats.mIsWerewolf)
|
||||||
{
|
{
|
||||||
saveStats();
|
if (player.mObject.mNpcStats.mWerewolfDeprecatedData)
|
||||||
setWerewolfStats();
|
{
|
||||||
|
saveStats();
|
||||||
|
setWerewolfStats();
|
||||||
|
}
|
||||||
|
else if (reader.getFormat() < 19)
|
||||||
|
{
|
||||||
|
setWerewolfStats();
|
||||||
|
if (player.mSetWerewolfAcrobatics)
|
||||||
|
MWBase::Environment::get().getMechanicsManager()->applyWerewolfAcrobatics(getPlayer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayer().getClass().getCreatureStats(getPlayer()).getAiSequence().clear();
|
getPlayer().getClass().getCreatureStats(getPlayer()).getAiSequence().clear();
|
||||||
|
@ -53,8 +53,8 @@ namespace MWWorld
|
|||||||
PreviousItems mPreviousItems;
|
PreviousItems mPreviousItems;
|
||||||
|
|
||||||
// Saved stats prior to becoming a werewolf
|
// Saved stats prior to becoming a werewolf
|
||||||
MWMechanics::SkillValue mSaveSkills[ESM::Skill::Length];
|
float mSaveSkills[ESM::Skill::Length];
|
||||||
MWMechanics::AttributeValue mSaveAttributes[ESM::Attribute::Length];
|
float mSaveAttributes[ESM::Attribute::Length];
|
||||||
|
|
||||||
bool mAttackingOrSpell;
|
bool mAttackingOrSpell;
|
||||||
bool mJumping;
|
bool mJumping;
|
||||||
|
@ -44,13 +44,43 @@ void ESM::Player::load (ESMReader &esm)
|
|||||||
checkPrevItems = false;
|
checkPrevItems = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool intFallback = esm.getFormat() < 11;
|
if(esm.getFormat() < 19)
|
||||||
if (esm.hasMoreSubs())
|
|
||||||
{
|
{
|
||||||
for (int i=0; i<ESM::Attribute::Length; ++i)
|
bool intFallback = esm.getFormat() < 11;
|
||||||
mSaveAttributes[i].load(esm, intFallback);
|
bool clearModified = esm.getFormat() < 17 && !mObject.mNpcStats.mIsWerewolf;
|
||||||
for (int i=0; i<ESM::Skill::Length; ++i)
|
if (esm.hasMoreSubs())
|
||||||
mSaveSkills[i].load(esm, intFallback);
|
{
|
||||||
|
for (int i=0; i<ESM::Attribute::Length; ++i)
|
||||||
|
{
|
||||||
|
StatState<float> attribute;
|
||||||
|
attribute.load(esm, intFallback);
|
||||||
|
if (clearModified)
|
||||||
|
attribute.mMod = 0.f;
|
||||||
|
mSaveAttributes[i] = attribute.mBase + attribute.mMod - attribute.mDamage;
|
||||||
|
if (mObject.mNpcStats.mIsWerewolf)
|
||||||
|
mObject.mCreatureStats.mAttributes[i] = attribute;
|
||||||
|
}
|
||||||
|
for (int i=0; i<ESM::Skill::Length; ++i)
|
||||||
|
{
|
||||||
|
StatState<float> skill;
|
||||||
|
skill.load(esm, intFallback);
|
||||||
|
if (clearModified)
|
||||||
|
skill.mMod = 0.f;
|
||||||
|
mSaveSkills[i] = skill.mBase + skill.mMod - skill.mDamage;
|
||||||
|
if (mObject.mNpcStats.mIsWerewolf)
|
||||||
|
{
|
||||||
|
if(i == ESM::Skill::Acrobatics)
|
||||||
|
mSetWerewolfAcrobatics = mObject.mNpcStats.mSkills[i].mBase != skill.mBase;
|
||||||
|
mObject.mNpcStats.mSkills[i] = skill;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mSetWerewolfAcrobatics = false;
|
||||||
|
esm.getHNT(mSaveAttributes, "WWAT");
|
||||||
|
esm.getHNT(mSaveSkills, "WWSK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,8 +109,6 @@ void ESM::Player::save (ESMWriter &esm) const
|
|||||||
esm.writeHNString ("PREV", it->second);
|
esm.writeHNString ("PREV", it->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<ESM::Attribute::Length; ++i)
|
esm.writeHNT("WWAT", mSaveAttributes);
|
||||||
mSaveAttributes[i].save(esm);
|
esm.writeHNT("WWSK", mSaveSkills);
|
||||||
for (int i=0; i<ESM::Skill::Length; ++i)
|
|
||||||
mSaveSkills[i].save(esm);
|
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ namespace ESM
|
|||||||
CellId mCellId;
|
CellId mCellId;
|
||||||
float mLastKnownExteriorPosition[3];
|
float mLastKnownExteriorPosition[3];
|
||||||
unsigned char mHasMark;
|
unsigned char mHasMark;
|
||||||
|
bool mSetWerewolfAcrobatics;
|
||||||
ESM::Position mMarkedPosition;
|
ESM::Position mMarkedPosition;
|
||||||
CellId mMarkedCell;
|
CellId mMarkedCell;
|
||||||
std::string mBirthsign;
|
std::string mBirthsign;
|
||||||
@ -30,8 +31,8 @@ namespace ESM
|
|||||||
int mCurrentCrimeId;
|
int mCurrentCrimeId;
|
||||||
int mPaidCrimeId;
|
int mPaidCrimeId;
|
||||||
|
|
||||||
StatState<float> mSaveAttributes[ESM::Attribute::Length];
|
float mSaveAttributes[ESM::Attribute::Length];
|
||||||
StatState<float> mSaveSkills[ESM::Skill::Length];
|
float mSaveSkills[ESM::Skill::Length];
|
||||||
|
|
||||||
typedef std::map<std::string, std::string> PreviousItems; // previous equipped items, needed for bound spells
|
typedef std::map<std::string, std::string> PreviousItems; // previous equipped items, needed for bound spells
|
||||||
PreviousItems mPreviousItems;
|
PreviousItems mPreviousItems;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "esmwriter.hpp"
|
#include "esmwriter.hpp"
|
||||||
|
|
||||||
unsigned int ESM::SavedGame::sRecordId = ESM::REC_SAVE;
|
unsigned int ESM::SavedGame::sRecordId = ESM::REC_SAVE;
|
||||||
int ESM::SavedGame::sCurrentFormat = 18;
|
int ESM::SavedGame::sCurrentFormat = 19;
|
||||||
|
|
||||||
void ESM::SavedGame::load (ESMReader &esm)
|
void ESM::SavedGame::load (ESMReader &esm)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user