2021-05-07 21:36:26 -04:00
|
|
|
#include "itemrequiredpolicy.h"
|
|
|
|
#include "item.h"
|
2021-05-15 19:44:19 -04:00
|
|
|
#include "actor.h"
|
2021-05-07 21:36:26 -04:00
|
|
|
|
|
|
|
ItemRequiredPolicy::ItemRequiredPolicy(const std::string& satisfaction, const std::string& dissatisfaction) :
|
|
|
|
Policy(satisfaction, dissatisfaction)
|
|
|
|
{}
|
|
|
|
|
|
|
|
ItemRequiredPolicy::~ItemRequiredPolicy()
|
|
|
|
{}
|
|
|
|
|
2021-05-15 19:44:19 -04:00
|
|
|
Policy::CheckResult ItemRequiredPolicy::check(const std::shared_ptr<Actor>& actor) const
|
2021-05-07 21:36:26 -04:00
|
|
|
{
|
2021-05-15 19:44:19 -04:00
|
|
|
bool success = actor->hasItem(_item);
|
2021-05-07 21:36:26 -04:00
|
|
|
return composeMessageFromResult(success);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ItemRequiredPolicy::setRequiredItem(const std::shared_ptr<Item> &item)
|
|
|
|
{
|
|
|
|
_item = item;
|
|
|
|
}
|