1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00
OpenMW/apps/openmw/mwworld/actionapply.cpp
2022-06-18 11:13:54 +02:00

36 lines
994 B
C++

#include "actionapply.hpp"
#include "class.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwmechanics/actorutil.hpp"
namespace MWWorld
{
ActionApply::ActionApply (const Ptr& object, const std::string& id)
: Action (false, object), mId (id)
{}
void ActionApply::executeImp (const Ptr& actor)
{
actor.getClass().consume(getTarget(), actor);
}
ActionApplyWithSkill::ActionApplyWithSkill (const Ptr& object, const std::string& id,
int skillIndex, int usageType)
: Action (false, object), mId (id), mSkillIndex (skillIndex), mUsageType (usageType)
{}
void ActionApplyWithSkill::executeImp (const Ptr& actor)
{
bool consumed = actor.getClass().consume(getTarget(), actor);
if (consumed && mUsageType != -1 && actor == MWMechanics::getPlayer())
actor.getClass().skillUsageSucceeded (actor, mSkillIndex, mUsageType);
}
}