/** * Spend mana for a spell * * @param Spell $spell * * @return bool */ public function spendMana($spell) { $this->mp -= $spell->getCost(); if ($this->mp <= 0) { return false; } return true; }
public function isSpellAvailable(Spell $spell) { if ($spell instanceof Effect && $spell->isActive()) { return false; } return $spell->getCost() <= $this->playerMana; }