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