22 lines
552 B
C++
22 lines
552 B
C++
#include "itemrequiredpolicy.h"
|
|
#include "item.h"
|
|
#include "actor.h"
|
|
|
|
ItemRequiredPolicy::ItemRequiredPolicy(const std::string& satisfaction, const std::string& dissatisfaction) :
|
|
Policy(satisfaction, dissatisfaction)
|
|
{}
|
|
|
|
ItemRequiredPolicy::~ItemRequiredPolicy()
|
|
{}
|
|
|
|
Policy::CheckResult ItemRequiredPolicy::check(const std::shared_ptr<Actor>& actor) const
|
|
{
|
|
bool success = actor->hasItem(_item);
|
|
return composeMessageFromResult(success);
|
|
}
|
|
|
|
void ItemRequiredPolicy::setRequiredItem(const std::shared_ptr<Item> &item)
|
|
{
|
|
_item = item;
|
|
}
|