public function findBestSpellToCast(Boss $boss, EffectTracker $effectTracker) { if ($this->recharge > 0 && $effectTracker->has(Spells\RechargeSpell::class) === false && $this->mana >= 229 && $this->mana < 402) { $this->recharge--; return new Spells\RechargeSpell(); } if ($this->shield > 0 && $effectTracker->has(Spells\ShieldSpell::class) === false && $this->health <= $boss->getDamage() * 3 && $this->mana >= 113) { $this->shield--; return new Spells\ShieldSpell(); } if ($this->drain > 0 && $effectTracker->has(Spells\DrainSpell::class) === false && $this->mana >= 73) { $this->drain--; return new Spells\DrainSpell(); } if ($boss->getHealth() <= 8 && $this->mana >= 53) { return new Spells\MagicMissileSpell(); } if ($effectTracker->has(Spells\PoisonSpell::class) === false && $this->mana >= 173) { return new Spells\PoisonSpell(); } if ($this->mana >= 53) { return new Spells\MagicMissileSpell(); } throw new OutOfManaException(); }