1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Properly implement SetWerewolfAcrobatics

This commit is contained in:
Chris Robinson 2013-08-13 00:25:39 -07:00
parent 37ea0f3fb9
commit 2353ac1739
5 changed files with 21 additions and 2 deletions

View File

@ -389,6 +389,10 @@ namespace MWBase
/// Turn actor into werewolf or normal form. /// Turn actor into werewolf or normal form.
virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf) = 0; virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf) = 0;
/// Sets the NPC's Acrobatics skill to match the fWerewolfAcrobatics GMST.
/// It only applies to the current form the NPC is in.
virtual void applyWerewolfAcrobatics(const MWWorld::Ptr& actor) = 0;
}; };
} }

View File

@ -393,6 +393,11 @@ void MWMechanics::NpcStats::setWerewolf (bool set)
for(size_t i = 0;i < ESM::Skill::Length;i++) for(size_t i = 0;i < ESM::Skill::Length;i++)
{ {
mWerewolfSkill[i] = getSkill(i); mWerewolfSkill[i] = getSkill(i);
// Acrobatics is set separately for some reason.
if(i == ESM::Skill::Acrobatics)
continue;
// "Mercantile"! >_< // "Mercantile"! >_<
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]);

View File

@ -1076,8 +1076,8 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime) virtual void execute (Interpreter::Runtime& runtime)
{ {
// What to do? Stats (attributes, skills) are already set and unset with MWWorld::Ptr ptr = R()(runtime);
// BecomeWerewolf and UndoWerewolf. MWBase::Environment::get().getWorld()->applyWerewolfAcrobatics(ptr);
} }
}; };

View File

@ -1925,4 +1925,12 @@ namespace MWWorld
mRendering->rebuildPtr(actor); mRendering->rebuildPtr(actor);
} }
void World::applyWerewolfAcrobatics(const Ptr &actor)
{
const Store<ESM::GameSetting> &gmst = getStore().get<ESM::GameSetting>();
MWMechanics::NpcStats &stats = Class::get(actor).getNpcStats(actor);
stats.getSkill(ESM::Skill::Acrobatics).setModified(gmst.find("fWerewolfAcrobatics")->getFloat(), 0);
}
} }

View File

@ -432,6 +432,8 @@ namespace MWWorld
virtual bool isTeleportingEnabled() const; virtual bool isTeleportingEnabled() const;
virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf); virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf);
virtual void applyWerewolfAcrobatics(const MWWorld::Ptr& actor);
}; };
} }