| 96 | } |
| 97 | |
| 98 | void SpellEyeEvil::checkSpellCast(GameMap* gameMap, const InputManager& inputManager, InputCommand& inputCommand) |
| 99 | { |
| 100 | Player* player = gameMap->getLocalPlayer(); |
| 101 | |
| 102 | Tile* tile = gameMap->getTile(inputManager.mXPos, inputManager.mYPos); |
| 103 | if(tile == nullptr) |
| 104 | return; |
| 105 | |
| 106 | int32_t playerMana = static_cast<int32_t>(player->getSeat()->getMana()); |
| 107 | int32_t price = ConfigManager::getSingleton().getSpellConfigInt32("EyeEvilPrice"); |
| 108 | if(inputManager.mCommandState == InputCommandState::infoOnly) |
| 109 | { |
| 110 | if(playerMana < price) |
| 111 | { |
| 112 | std::string txt = formatCastSpell(SpellType::eyeEvil, price); |
| 113 | inputCommand.displayText(Ogre::ColourValue::Red, txt); |
| 114 | } |
| 115 | else |
| 116 | { |
| 117 | std::string txt = formatCastSpell(SpellType::eyeEvil, price); |
| 118 | inputCommand.displayText(Ogre::ColourValue::White, txt); |
| 119 | } |
| 120 | inputCommand.selectSquaredTiles(inputManager.mXPos, inputManager.mYPos, inputManager.mXPos, |
| 121 | inputManager.mYPos); |
| 122 | return; |
| 123 | } |
| 124 | |
| 125 | if(inputManager.mCommandState == InputCommandState::building) |
| 126 | { |
| 127 | std::string txt = formatCastSpell(SpellType::eyeEvil, price); |
| 128 | inputCommand.displayText(Ogre::ColourValue::White, txt); |
| 129 | std::vector<Tile*> tiles; |
| 130 | tiles.push_back(tile); |
| 131 | inputCommand.selectTiles(tiles); |
| 132 | return; |
| 133 | } |
| 134 | |
| 135 | inputCommand.unselectAllTiles(); |
| 136 | |
| 137 | ClientNotification *clientNotification = SpellManager::createSpellClientNotification(SpellType::eyeEvil); |
| 138 | gameMap->tileToPacket(clientNotification->mPacket, tile); |
| 139 | |
| 140 | ODClient::getSingleton().queueClientNotification(clientNotification); |
| 141 | } |
| 142 | |
| 143 | bool SpellEyeEvil::castSpell(GameMap* gameMap, Player* player, ODPacket& packet) |
| 144 | { |
nothing calls this directly
no test coverage detected