// ****************************************************************************
//
// Logic 94: Death handler
// This logic is run when the player dies.
// The death message displayed depends on the value of death_type.
//
// ****************************************************************************

#include "defines.txt"

if (death_type != 255) {   // if death_type = 255, the death message has
                           // already been displayed
  accept.input();
  cancel.line();
  program.control();
  clear.lines(23, 24, 0);
  thankyou_timer = 12;

  if (death_type == 1) { 
    print("Your own magic consumes you. As most members of the Sorcerer's Underground Movement will tell you, being haphazard with your spells is not a recipe for long life.");
  }

  if (death_type == 2) { 
  print("Good. You've tested the gravity of this strange new world. Interestingly enough, it is still at an adequate level to kill upon impact with the ground.");
  print("Luckily, you don't hit the ground. You just plummet through infinity for the rest of your life, which isn't very long without food or water.");
  }

  if (death_type == 3) { 
  print("Well, you might not have survived the encounter, but at least you've made contact with alien life. Perhaps if you get resurrected sometime soon there'll be a promising career as a diplomat ahead of you.");
  }

  if (death_type == 4) { 
  print("Guess you did something wrong with that last spell, hmm?");
  print("Well, either that or you can't read your own handwriting.");
  }

  load.sound(2);
  sound(2,f250);

  death_type = 255;  // set death_type to 255 so this logic does not display
                     // the death message again
}

thankyou_timer--;

if (thankyou_timer == 1) { 
  print("Thanks for playing The Sorcerer's Appraisal. Looks like you need a bit more practise in the magical arts.");
}

if (controller(key_activiate_menu)) { 
  menu.input();
}

if ((controller(menu_help) || 
     said("help"))) { 
  call(92);
}

if ((controller(menu_restore) || 
     said("restore", "game") ||
     said("restore"))) { 
  restore.game();
}

if ((controller(menu_restart) || 
     said("restart", "game") ||
     said("restart"))) { 
  restart.game();
}

if ((controller(menu_inventory) ||
     said("inventory"))) { 
  status();
}

if ((controller(menu_quit) || 
     said("quit"))) { 
  stop.sound();
  quit(0);
}

if (input_recieved && 
    !input_parsed) { 
  print("Why do you cling to life so desperately? You're dead. Accept it. Now reload or restart.");
}

return();