SET_GENERATE_SPEED(400)

START_MONEY(PLAYER0,20000)

SET_TIMER(PLAYER0,TIMER0)
SET_FLAG(PLAYER0,FLAG0,0)

ROOM_AVAILABLE(PLAYER0,TREASURE,1,1)
ROOM_AVAILABLE(PLAYER0,LAIR,1,1)
ROOM_AVAILABLE(PLAYER0,GARDEN,1,1)
ROOM_AVAILABLE(PLAYER0,RESEARCH,1,1)
ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,1)
ROOM_AVAILABLE(PLAYER0,PRISON,1,1)
ROOM_AVAILABLE(PLAYER0,TORTURE,1,1)
ROOM_AVAILABLE(PLAYER0,TEMPLE,1,1)

DOOR_AVAILABLE(PLAYER0,MAGIC,1,0)

DISPLAY_OBJECTIVE(37,PLAYER0)

CREATE_PARTY(KNIGHTS)
  ADD_TO_PARTY(KNIGHTS,KNIGHT,10,5000,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(KNIGHTS,KNIGHT,10,5000,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(KNIGHTS,KNIGHT,10,5000,ATTACK_ENEMIES,0)

IF(PLAYER0,TIMER0 >= 1200)
  ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHTS,-1,DUNGEON,0,10,1000)
  ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHTS,-2,DUNGEON,0,10,1000)
ENDIF

CREATE_PARTY(AVATARS)
  ADD_TO_PARTY(AVATARS,AVATAR,10,20000,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(AVATARS,AVATAR,10,20000,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(AVATARS,AVATAR,10,20000,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(AVATARS,AVATAR,10,20000,ATTACK_ENEMIES,0)

IF_ACTION_POINT(1,PLAYER0)
  ROOM_AVAILABLE(PLAYER0,BRIDGE,1,1)
  DISPLAY_OBJECTIVE(42,PLAYER0)
  ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,AVATARS,-3,ACTION_POINT,1,10,1000)
ENDIF

CREATE_PARTY(HORNIES)
  ADD_TO_PARTY(HORNIES,HORNY,10,10000,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(HORNIES,HORNY,10,10000,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(HORNIES,HORNY,10,10000,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(HORNIES,HORNY,10,10000,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(HORNIES,HORNY,10,10000,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(HORNIES,HORNY,10,10000,ATTACK_ENEMIES,0)

IF_ACTION_POINT(2,PLAYER0)
  ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HORNIES,-4,4)
ENDIF

IF(PLAYER0,AVATAR>1)
  DISPLAY_OBJECTIVE(38,PLAYER0)
ENDIF

IF(PLAYER_GOOD,DUNGEON_DESTROYED == 1)
  ADD_PARTY_TO_LEVEL(PLAYER_GOOD,AVATARS,PLAYER0,2)
  SET_FLAG(PLAYER0,FLAG0,1)
  DISPLAY_OBJECTIVE(39,PLAYER0)
ENDIF

IF(PLAYER0,FLAG0 == 1)
  IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
    DISPLAY_OBJECTIVE(22,PLAYER0)
    WIN_GAME
  ENDIF
ENDIF

IF(PLAYER0,DUNGEON_DESTROYED==1)
  DISPLAY_OBJECTIVE(40,PLAYER0)
  LOSE_GAME
ENDIF
