void TerminalAbstractState::displayCard(CardId id, bool displayValue, int value) { auto cardData = _context.client->getCardData(id); assert(cardData->isCreature() or cardData->isSpell()); if(cardData->isCreature()) { const ClientCreatureData* castedCardData{dynamic_cast<const ClientCreatureData*>(cardData)}; assert(castedCardData != nullptr); if (displayValue) displayNumberedEntry(std::string(castedCardData->getName()) + " (creature)", value); else displayEntry(std::string(castedCardData->getName()) + " (creature)"); displayEntry(std::string("cost: ") + std::to_string(castedCardData->getCost()) + ", attack: " + std::to_string(castedCardData->getAttack()) + ", health: " + std::to_string(castedCardData->getHealth()) + ", shield: " + std::to_string(castedCardData->getShield()) + "-" + std::to_string(castedCardData->getShieldType()), '-', 1); displayEntry(castedCardData->getDescription(), '-', 1); } else { const ClientSpellData* castedCardData{dynamic_cast<const ClientSpellData*>(cardData)}; assert(castedCardData != nullptr); if (displayValue) displayNumberedEntry(std::string(castedCardData->getName()) + " (spell)", value); else displayEntry(std::string(castedCardData->getName()) + " (spell)"); displayEntry(std::string("cost: ") + std::to_string(castedCardData->getCost()), '-', 1); displayEntry(castedCardData->getDescription(), '-', 1); } }
/** * Check for whether a desired server would be OK for where we are. * The server is OK if it is the preferred server. If the object is * a creature, the server is also OK if the node is a border node and * the server has a subscription to the node. Non-creatures must always * be on the preferred server. */ bool PlanetProxyObject::wouldAuthorityBeOk(uint32 possibleServer) const { if (possibleServer == m_quadtreeNode->getPreferredServer()) return true; if (isCreature() && m_quadtreeNode->isBorderNode() && m_quadtreeNode->isServerSubscribed(possibleServer)) return true; else return false; }
/** * Remove statistics about this object from the GameServerData. * Should exactly undo addServerStatistics(). */ void PlanetProxyObject::removeServerStatistics() const { GameServerData *data=PlanetServer::getInstance().getGameServerData(m_authoritativeServer); if (data) { data->adjustObjectCount(-1); if (m_interestRadius!=0) { data->adjustInterestObjectCount(-1); if (isCreature()) data->adjustInterestCreatureObjectCount(-1); } } }