spells(); $spell = get_spell($id); $has_spell = false; foreach ($user_spells as $us) if ($us['id'] === $id) $has_spell = true; if ($has_spell !== true) { $page = 'You have not yet learned this spell. Please go back and try again.'; } elseif ($spell['type'] !== 1) { $page = 'This is not a healing spell. Please go back and try again.'; } elseif (user()->currentmp < $spell['mp']) { $page = 'You do not have enough Magic Points to cast this spell. Please go back and try again.'; } elseif (user()->currentaction === 'Fighting') { $page = 'You cannot use the Quick Spells list during a fight. Please go back and select the Healing Spell you wish to use from the Spells box on the main fighting screen to continue.'; } elseif (user()->currenthp == user()->maxhp) { $page = 'Your HP is already full. You don\'t need to use a Healing spell now.'; } else { $restored = user()->restore_hp($spell['attribute']); user()->currentmp -= $spell['mp']; user()->save(); $page = <<exploring. HTML; } page_title('Casting '.$spell['name']); return is_htmx() ? $page : display($page, ''); }