| 147 | } |
| 148 | |
| 149 | bool SpellCallToWar::castSpell(GameMap* gameMap, Player* player, ODPacket& packet) |
| 150 | { |
| 151 | Tile* tile = gameMap->tileFromPacket(packet); |
| 152 | if(tile == nullptr) |
| 153 | return false; |
| 154 | |
| 155 | int32_t playerMana = static_cast<int32_t>(player->getSeat()->getMana()); |
| 156 | int32_t manaCost = ConfigManager::getSingleton().getSpellConfigInt32("CallToWarPrice"); |
| 157 | if(playerMana < manaCost) |
| 158 | return false; |
| 159 | |
| 160 | if(!player->getSeat()->takeMana(manaCost)) |
| 161 | return false; |
| 162 | |
| 163 | SpellCallToWar* spell = new SpellCallToWar(gameMap); |
| 164 | spell->setSeat(player->getSeat()); |
| 165 | spell->addToGameMap(); |
| 166 | Ogre::Vector3 spawnPosition(static_cast<Ogre::Real>(tile->getX()), |
| 167 | static_cast<Ogre::Real>(tile->getY()), |
| 168 | static_cast<Ogre::Real>(0.0)); |
| 169 | spell->createMesh(); |
| 170 | spell->setPosition(spawnPosition); |
| 171 | |
| 172 | return true; |
| 173 | } |
| 174 | |
| 175 | Spell* SpellCallToWar::getSpellFromStream(GameMap* gameMap, std::istream &is) |
| 176 | { |
nothing calls this directly
no test coverage detected