1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +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.
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++)
{
mWerewolfSkill[i] = getSkill(i);
// Acrobatics is set separately for some reason.
if(i == ESM::Skill::Acrobatics)
continue;
// "Mercantile"! >_<
std::string name = "fWerewolf"+((i==ESM::Skill::Mercantile) ? std::string("Merchantile") :
ESM::Skill::sSkillNames[i]);

View File

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

View File

@ -1925,4 +1925,12 @@ namespace MWWorld
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 void setWerewolf(const MWWorld::Ptr& actor, bool werewolf);
virtual void applyWerewolfAcrobatics(const MWWorld::Ptr& actor);
};
}