REM ********************************************
REM  Ancient Keeper campaign for KeeperFX
REM  Script for Level 3
REM  Version 1.00
REM ********************************************

REM PRISONTRICK

START_MONEY(PLAYER0,50)
START_MONEY(PLAYER1,10000)
START_MONEY(PLAYER2,10000)
START_MONEY(PLAYER3,10000)

SET_FLAG(PLAYER0,FLAG0,0)

DISPLAY_OBJECTIVE(10,PLAYER0)

SET_GENERATE_SPEED(1300)

COMPUTER_PLAYER(PLAYER1,10)
COMPUTER_PLAYER(PLAYER2,10)
COMPUTER_PLAYER(PLAYER3,0)

MAX_CREATURES(PLAYER0,9)
MAX_CREATURES(PLAYER3,16)
MAX_CREATURES(PLAYER2,16)
MAX_CREATURES(PLAYER1,16)

ADD_CREATURE_TO_POOL(WIZARD,6)
ADD_CREATURE_TO_POOL(ORC,6)
ADD_CREATURE_TO_POOL(BILE_DEMON,6)
ADD_CREATURE_TO_POOL(SORCEROR,6)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,6)
ADD_CREATURE_TO_POOL(DEMONSPAWN,6)
ADD_CREATURE_TO_POOL(DRAGON,6)
ADD_CREATURE_TO_POOL(TROLL,6)
ADD_CREATURE_TO_POOL(MONK,6)
ADD_CREATURE_TO_POOL(ARCHER,6)
ADD_CREATURE_TO_POOL(BARBARIAN,6)

CREATURE_AVAILABLE(PLAYER0,WIZARD,1,1)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER1,BARBARIAN,1,1)
CREATURE_AVAILABLE(PLAYER2,ARCHER,1,1)
CREATURE_AVAILABLE(PLAYER2,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER2,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER3,MONK,1,1)
CREATURE_AVAILABLE(PLAYER3,ORC,1,1)
CREATURE_AVAILABLE(PLAYER3,BILE_DEMON,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,TROLL,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,SORCEROR,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,DEMONSPAWN,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,DRAGON,1,1)

MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_OBEY,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DESTROY_WALLS,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_POSSESS,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SIGHT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
MAGIC_AVAILABLE(PLAYER1,POWER_LIGHTNING,1,1)
MAGIC_AVAILABLE(PLAYER2,POWER_LIGHTNING,1,1)
MAGIC_AVAILABLE(PLAYER3,POWER_LIGHTNING,1,1)

ROOM_AVAILABLE(ALL_PLAYERS,GRAVEYARD,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TRAINING,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TREASURE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,WORKSHOP,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,GARDEN,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,RESEARCH,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TEMPLE,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TORTURE,1,0)
ROOM_AVAILABLE(PLAYER0,SCAVENGER,1,0)
ROOM_AVAILABLE(PLAYER2,SCAVENGER,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
ROOM_AVAILABLE(PLAYER0,PRISON,1,0)
ROOM_AVAILABLE(PLAYER2,PRISON,1,0)
ROOM_AVAILABLE(PLAYER3,PRISON,1,0)
ROOM_AVAILABLE(PLAYER3,BRIDGE,1,0)

TRAP_AVAILABLE(ALL_PLAYERS,ALARM,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,BOULDER,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,WORD_OF_POWER,1,0)
TRAP_AVAILABLE(PLAYER1,LIGHTNING,1,0)
TRAP_AVAILABLE(PLAYER2,LIGHTNING,1,1)
TRAP_AVAILABLE(PLAYER3,LIGHTNING,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,BRACED,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,MAGIC,1,0)
DOOR_AVAILABLE(PLAYER1,WOOD,1,0)
DOOR_AVAILABLE(PLAYER2,WOOD,1,0)
DOOR_AVAILABLE(PLAYER3,WOOD,1,0)

IF(PLAYER3,DUNGEON_DESTROYED==1)
  ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,1)
ENDIF

CREATE_PARTY(HEROES)
  ADD_TO_PARTY(HEROES,WITCH,10,0,DEFEND_PARTY,0)
  ADD_TO_PARTY(HEROES,WITCH,10,0,DEFEND_PARTY,0)
  ADD_TO_PARTY(HEROES,WITCH,10,0,DEFEND_PARTY,0)
  ADD_TO_PARTY(HEROES,GIANT,10,0,ATTACK_ROOMS,0)
  ADD_TO_PARTY(HEROES,GIANT,10,0,ATTACK_ROOMS,0)
  ADD_TO_PARTY(HEROES,GIANT,10,0,ATTACK_ROOMS,0)

CREATE_PARTY(ENDGAME)
  ADD_TO_PARTY(ENDGAME,AVATAR,10,0,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(ENDGAME,KNIGHT,10,0,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(ENDGAME,KNIGHT,10,0,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(ENDGAME,KNIGHT,10,0,ATTACK_ENEMIES,0)
  ADD_TO_PARTY(ENDGAME,FAIRY,10,0,DEFEND_PARTY,0)
  ADD_TO_PARTY(ENDGAME,FAIRY,10,0,DEFEND_PARTY,0)

IF_ACTION_POINT(2,PLAYER0)
  SET_TIMER(PLAYER0,TIMER1)
ENDIF

IF(PLAYER0,TIMER1>8000)
  DISPLAY_OBJECTIVE(26,PLAYER0)
  ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,HEROES,1,ACTION_POINT,2,10,0)
ENDIF

IF(PLAYER0,ALL_DUNGEONS_DESTROYED==1)
  SET_FLAG(PLAYER0,FLAG0,1)
  DISPLAY_OBJECTIVE(25,PLAYER0)
  ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ENDGAME,1,DUNGEON,0,10,0)
ENDIF

IF(PLAYER2,DUNGEON_DESTROYED != 1)
  IF(PLAYER1,PRISON<1)
    DISPLAY_OBJECTIVE(24,PLAYER0)
  ENDIF
ENDIF

IF(PLAYER3,DUNGEON_DESTROYED != 1)
  IF(PLAYER1,PRISON<1)
    DISPLAY_OBJECTIVE(24,PLAYER0)
  ENDIF
ENDIF

IF(PLAYER0,FLAG0==1)
  IF(PLAYER_GOOD,TOTAL_CREATURES<1)
    DISPLAY_OBJECTIVE(28,PLAYER0)
    WIN_GAME
  ENDIF
ENDIF

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