mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Issue #314: implemented apply and skillUsageSucceeded functions for MWClass::Npc
This commit is contained in:
parent
805b81bf6e
commit
84d846cf07
@ -343,4 +343,26 @@ namespace MWClass
|
||||
|
||||
return weight;
|
||||
}
|
||||
|
||||
bool Npc::apply (const MWWorld::Ptr& ptr, const std::string& id,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||
|
||||
/// \todo consider instant effects
|
||||
|
||||
return stats.mActiveSpells.addSpell (id);
|
||||
}
|
||||
|
||||
void Npc::skillUsageSucceeded (const MWWorld::Ptr& ptr, int skill, int usageType) const
|
||||
{
|
||||
MWMechanics::NpcStats& stats = getNpcStats (ptr);
|
||||
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
|
||||
|
||||
const ESM::Class *class_ = MWBase::Environment::get().getWorld()->getStore().classes.find (
|
||||
ref->base->cls);
|
||||
|
||||
stats.useSkill (skill, *class_, usageType);
|
||||
}
|
||||
}
|
||||
|
@ -76,6 +76,15 @@ namespace MWClass
|
||||
///< Returns total weight of objects inside this object (including modifications from magic
|
||||
/// effects). Throws an exception, if the object can't hold other objects.
|
||||
|
||||
virtual bool apply (const MWWorld::Ptr& ptr, const std::string& id,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
///< Apply \a id on \a ptr.
|
||||
/// \param actor Actor that is resposible for the ID being applied to \a ptr.
|
||||
/// \return Any effect?
|
||||
|
||||
virtual void skillUsageSucceeded (const MWWorld::Ptr& ptr, int skill, int usageType) const;
|
||||
///< Inform actor \a ptr that a skill use has succeeded.
|
||||
|
||||
static void registerSelf();
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user