public function castSpell(Spell $spell) { if ($spell instanceof Effect) { $spell->activate(); } else { $spell->apply($this); } $this->playerMana -= $spell->getCost(); $this->manaSpent += $spell->getCost(); }