diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index bd5fa1b11..c191af30b 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -1719,11 +1719,11 @@ namespace MWMechanics { if (werewolf) { - player->saveSkillsAttributes(); - player->setWerewolfSkillsAttributes(); + player->saveStats(); + player->setWerewolfStats(); } else - player->restoreSkillsAttributes(); + player->restoreStats(); } // Werewolfs can not cast spells, so we need to unset the prepared spell if there is one. diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index 19bf7f55e..34c5f713d 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -47,37 +47,45 @@ namespace MWWorld mPlayer.mData.setPosition(playerPos); } - void Player::saveSkillsAttributes() + void Player::saveStats() { MWMechanics::NpcStats& stats = getPlayer().getClass().getNpcStats(getPlayer()); + for (int i=0; i& gmst = MWBase::Environment::get().getWorld()->getStore().get(); + MWMechanics::CreatureStats& creatureStats = getPlayer().getClass().getCreatureStats(getPlayer()); + MWMechanics::NpcStats& npcStats = getPlayer().getClass().getNpcStats(getPlayer()); + MWMechanics::DynamicStat health = creatureStats.getDynamic(0); + creatureStats.setHealth(int(health.getBase() / gmst.find("fWereWolfHealth")->getFloat())); for (int i=0; i& gmst = MWBase::Environment::get().getWorld()->getStore().get(); - MWMechanics::NpcStats& stats = getPlayer().getClass().getNpcStats(getPlayer()); + MWMechanics::CreatureStats& creatureStats = getPlayer().getClass().getCreatureStats(getPlayer()); + MWMechanics::NpcStats& npcStats = getPlayer().getClass().getNpcStats(getPlayer()); + MWMechanics::DynamicStat health = creatureStats.getDynamic(0); + creatureStats.setHealth(int(health.getBase() * gmst.find("fWereWolfHealth")->getFloat())); for(size_t i = 0;i < ESM::Attribute::Length;++i) { // Oh, Bethesda. It's "Intelligence". std::string name = "fWerewolf"+((i==ESM::Attribute::Intelligence) ? std::string("Intellegence") : ESM::Attribute::sAttributeNames[i]); - MWMechanics::AttributeValue value = stats.getAttribute(i); + MWMechanics::AttributeValue value = npcStats.getAttribute(i); value.setBase(int(gmst.find(name)->getFloat())); - stats.setAttribute(i, value); + npcStats.setAttribute(i, value); } for(size_t i = 0;i < ESM::Skill::Length;i++) @@ -90,9 +98,9 @@ namespace MWWorld std::string name = "fWerewolf"+((i==ESM::Skill::Mercantile) ? std::string("Merchantile") : ESM::Skill::sSkillNames[i]); - MWMechanics::SkillValue value = stats.getSkill(i); + MWMechanics::SkillValue value = npcStats.getSkill(i); value.setBase(int(gmst.find(name)->getFloat())); - stats.setSkill(i, value); + npcStats.setSkill(i, value); } } @@ -366,8 +374,8 @@ namespace MWWorld if (player.mObject.mNpcStats.mWerewolfDeprecatedData && player.mObject.mNpcStats.mIsWerewolf) { - saveSkillsAttributes(); - setWerewolfSkillsAttributes(); + saveStats(); + setWerewolfStats(); } getPlayer().getClass().getCreatureStats(getPlayer()).getAiSequence().clear(); diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index 4ba66e37e..aabbe7015 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -46,7 +46,7 @@ namespace MWWorld int mCurrentCrimeId; // the id assigned witnesses int mPaidCrimeId; // the last id paid off (0 bounty) - // Saved skills and attributes prior to becoming a werewolf + // Saved stats prior to becoming a werewolf MWMechanics::SkillValue mSaveSkills[ESM::Skill::Length]; MWMechanics::AttributeValue mSaveAttributes[ESM::Attribute::Length]; @@ -56,9 +56,9 @@ namespace MWWorld Player(const ESM::NPC *player); - void saveSkillsAttributes(); - void restoreSkillsAttributes(); - void setWerewolfSkillsAttributes(); + void saveStats(); + void restoreStats(); + void setWerewolfStats(); // For mark/recall magic effects void markPosition (CellStore* markedCell, const ESM::Position& markedPosition);