Пример #1
0
std::vector<ColoredString> Engine::getActorsBenethPlayersFeet()
{
    std::vector< ColoredString > items;
    MapPtr map = getWorld().getCurrentMap();

    if ( map )
    {
        std::function<bool(amarlon::ActorPtr)> filterFun = [&](ActorPtr a) -> bool
        {
            return a != Actor::Player;
        };

        std::vector<ActorPtr> actorsOnTile = map->getActors(Actor::Player->getX(), Actor::Player->getY(), &filterFun);

        for ( ActorPtr actor : actorsOnTile )
        {
            std::string msg = actor->getName();

            PickablePtr pickable = actor->getFeature<Pickable>();
            if ( pickable && pickable->getAmount() > 1 )
            {
                msg = msg + " (" + std::to_string(pickable->getAmount()) + ")";
            }

            items.push_back( ColoredString( msg, TCODColor::darkLime ) );
        }
    }

    return items;
}
Пример #2
0
std::string Wearer::debug(const std::string &linebreak)
{
  std::string d = " " + linebreak + "-----WEARER-----"+linebreak;
  for(auto slot : _itemSlots)
  {
    ActorPtr eq = equipped(slot.first);
    bool blocked = isBlocked(slot.first);
    PickablePtr p = eq ? eq->getFeature<Pickable>() : nullptr;
    d += ItemSlotType2Str(slot.first);
    d +=  ": "
        + (eq ? eq->getName() : "<none>")
        + (p ? " [" + toStr(p->getAmount()) + "]" : "" )
        + ( blocked ? " [BLOCKED] " : "" ) + linebreak;
  }
  d.append("----------------"+linebreak);
  return d;
}
Пример #3
0
int BagManager::getAmountToDrop(ActorPtr toDrop)
{
  int amount = 1;

  PickablePtr pickable = toDrop->getFeature<Pickable>();
  if ( pickable && pickable->isStackable() )
  {
    amount = Engine::instance().windowManager()
                               .getWindow<gui::AmountWindow>()
                               .setMaxAmount( pickable->getAmount() )
                               .show()
                               .downcast<gui::AmountWindow>()
                               .getAmount();
  }

  return amount;
}