REM ********************************************
REM		  Razon's Library
REM             Script for Level 209
REM		   Steve Tupper
REM ********************************************



REM ************************************
REM ********** SETUP COMMANDS **********
REM ************************************


REM ********** Set up player information **********

REM *** Number of turns wait for new creature (max 12 turns per second depending on computer speed) ***
SET_GENERATE_SPEED(100)

REM *** money sart with - duh ***
START_MONEY(PLAYER0, 100000)

REM *** remember max of 255 in all dungeons on level at any time ***
MAX_CREATURES(PLAYER0, 30)


REM ********** Set up rooms, traps, doors and magic **********

REM *** rooms available to players also ENTRANCE but don't need here ***
ROOM_AVAILABLE(PLAYER0, BRIDGE,    1, 1)
ROOM_AVAILABLE(PLAYER0, GUARD_POST,1, 0)
ROOM_AVAILABLE(PLAYER0, TREASURE,  1, 0)
ROOM_AVAILABLE(PLAYER0, RESEARCH,  1, 0)
ROOM_AVAILABLE(PLAYER0, PRISON,    1, 0)
ROOM_AVAILABLE(PLAYER0, TORTURE,   1, 0)
ROOM_AVAILABLE(PLAYER0, TRAINING,  1, 0)
ROOM_AVAILABLE(PLAYER0, WORKSHOP,  1, 0)
ROOM_AVAILABLE(PLAYER0, SCAVENGER, 1, 0)
ROOM_AVAILABLE(PLAYER0, TEMPLE,    1, 0)
ROOM_AVAILABLE(PLAYER0, GRAVEYARD, 1, 0)
ROOM_AVAILABLE(PLAYER0, BARRACKS,  1, 0)
ROOM_AVAILABLE(PLAYER0, GARDEN,    1, 0)
ROOM_AVAILABLE(PLAYER0, LAIR,      1, 0)

REM *** doors available to players ***
DOOR_AVAILABLE(PLAYER0, BRACED,1,0)
DOOR_AVAILABLE(PLAYER0, STEEL, 1,0)
DOOR_AVAILABLE(PLAYER0, MAGIC, 1,0)

REM *** traps available to players ***
TRAP_AVAILABLE(PLAYER0, POISON_GAS,   1,0)
TRAP_AVAILABLE(PLAYER0, LIGHTNING,    1,0)
TRAP_AVAILABLE(PLAYER0, WORD_OF_POWER,1,0)
TRAP_AVAILABLE(PLAYER0, LAVA,         1,0)


REM ********** Set up creature information **********

REM *** remember to have enough to cover all players ***
ADD_CREATURE_TO_POOL(TROLL,        5)
ADD_CREATURE_TO_POOL(DRAGON,       4)
ADD_CREATURE_TO_POOL(DEMONSPAWN,   20)
ADD_CREATURE_TO_POOL(FLY,          20)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,4)
ADD_CREATURE_TO_POOL(SORCEROR,     50)
ADD_CREATURE_TO_POOL(BILE_DEMON,   4)
ADD_CREATURE_TO_POOL(BUG,          20)
ADD_CREATURE_TO_POOL(HELL_HOUND,   15)
ADD_CREATURE_TO_POOL(ORC,          10)

REM *** the 1 field must be in here ***
CREATURE_AVAILABLE(PLAYER0,TROLL,        1, 1)
CREATURE_AVAILABLE(PLAYER0,DRAGON,       1, 1)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,   1, 1)
CREATURE_AVAILABLE(PLAYER0,FLY,          1, 1)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1, 1)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,     1, 1)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,   1, 1)
CREATURE_AVAILABLE(PLAYER0,BUG,          1, 1)
CREATURE_AVAILABLE(PLAYER0,HELL_HOUND,   1, 1)
CREATURE_AVAILABLE(PLAYER0,ORC,          1, 1)
REM *** You may need these for prisons, torture, temples and graveyards also remember sorceror for temple ***
CREATURE_AVAILABLE(PLAYER0,SKELETON,     1, 0)
CREATURE_AVAILABLE(PLAYER0,VAMPIRE,      1, 0)
CREATURE_AVAILABLE(PLAYER0,GHOST,        1, 0)
CREATURE_AVAILABLE(PLAYER0,HORNY,        1, 0)


REM ************************************************
REM ********** CONDITIONS & GAME COMMANDS **********
REM ************************************************

REM *** condition = variable followed by either == != > < <= >= followed by a whole number (integer) ***
NEXT_COMMAND_REUSABLE
IF(PLAYER0, TIMER1 > 2500)
   NEXT_COMMAND_REUSABLE
   IF(PLAYER0, TIMER2 < 50000)
      NEXT_COMMAND_REUSABLE
      SET_TIMER(PLAYER0, TIMER1)
      NEXT_COMMAND_REUSABLE
      ADD_CREATURE_TO_LEVEL(PLAYER_GOOD, KNIGHT,   -1, 1, 10, 1000)
      NEXT_COMMAND_REUSABLE
      ADD_CREATURE_TO_LEVEL(PLAYER_GOOD, ARCHER,   -2, 5, 10, 400)
      NEXT_COMMAND_REUSABLE
      ADD_CREATURE_TO_LEVEL(PLAYER_GOOD, WIZARD,   -3, 1, 10, 2000)
      NEXT_COMMAND_REUSABLE
      ADD_CREATURE_TO_LEVEL(PLAYER_GOOD, BARBARIAN,-4, 2, 10, 100)
      NEXT_COMMAND_REUSABLE
      ADD_CREATURE_TO_LEVEL(PLAYER_GOOD, MONK,     -5, 3, 10, 3000)
   ENDIF
ENDIF

REM *** if PLAYER? creature sets foot near action pt ***
IF_ACTION_POINT(1, PLAYER0)
  SET_TIMER(PLAYER0, TIMER1)
  SET_TIMER(PLAYER0, TIMER2)
ENDIF

REM *** Might require this to be in an IF statement, also needs to be less than certain number of characters to appear ? = 1 - 30. Cannot use ALL_PLAYERS ***
QUICK_OBJECTIVE(1, "The legend goes thus: Razon was the most powerful of your kind to ever roam the world, so powerful was he that all the good forces in all the lands were forced to unite against him. However he was not easy to find. Razon saught shelter in the greatest dungeon ever created and it is there that he built his legendary library.", PLAYER0)

IF(PLAYER0, GAME_TURN > 50)
  QUICK_INFORMATION(2, "Razon was finally betrayed by an evil sorceror, bribed by the kings of the world to reveal Razon's hiding place. Razon was attacked by the good armies and for many days the battle was faught. Eventually, seeing defeat was near Razon hatched one final plan.")
ENDIF
IF(PLAYER0, GAME_TURN > 100)
  QUICK_INFORMATION(3, "After hiding many of his spells and treasures, Razon sealed his library with four great doors of gold and then cast one final mighty spell. The land itself came alive and consumed the dungeon and buried the armies in millions of tons of solid rock.")
ENDIF
IF(PLAYER0, GAME_TURN > 150)
  QUICK_INFORMATION(4, "And what of Razon and his betrayer? Razon was never heard of again, maybe he escaped, maybe he was destroyed by his own magic, no one knows. The evil sorceror's fate was not so mysterious - sealed in the library he was doomed to haunt it's halls for eternity.")
ENDIF
IF(PLAYER0, GAME_TURN > 300)
  QUICK_INFORMATION(5, "The where-abouts of Razon's Library is lost in time but you master believe you know where it may be. For centuries the heroes of this land have performed an unusual ritual, its meaning lost even to them. Their strongest warriors take turns in guarding a block of gold! The fools have no idea.")
ENDIF
IF(PLAYER0, GAME_TURN > 350)
  QUICK_INFORMATION(6, "Find Razon's Library master and you will gain the power to destroy the heroes in this country. There are obstacles however. The caverns are said to be the home of spiders and the magic in the area has been sapped - a good omen perhaps?")
ENDIF


REM ************************************************
REM ********** WIN / LOSE GAME CONDITIONS **********
REM ************************************************

REM *** Win or lose condition ***
IF(PLAYER0, TIMER2 > 50000)
   IF(PLAYER_GOOD, TOTAL_CREATURES == 0)
      WIN_GAME
   ENDIF
ENDIF
