REM ********************************************
REM  Ancient Keeper campaign for KeeperFX
REM  Script for Level 1, Red Carpet
REM  Version 1.00
REM ********************************************

SET_GENERATE_SPEED(500)

DISPLAY_OBJECTIVE(1,PLAYER0)
DISPLAY_INFORMATION(125,PLAYER0)

START_MONEY(PLAYER0,1000)

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

MAX_CREATURES(PLAYER0,11)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,10)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,1)

ROOM_AVAILABLE(PLAYER0,TREASURE,1,0)
ROOM_AVAILABLE(PLAYER0,LAIR,1,0)
ROOM_AVAILABLE(PLAYER0,GARDEN,1,0)
ROOM_AVAILABLE(PLAYER0,TRAINING,1,0)
ROOM_AVAILABLE(PLAYER0,BRIDGE,1,0)
ROOM_AVAILABLE(PLAYER0,GUARD_POST,1,0)
ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,0)
ROOM_AVAILABLE(PLAYER0,TORTURE,1,0)
ROOM_AVAILABLE(PLAYER0,TEMPLE,1,0)

MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_SPEED,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_OBEY,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_DISEASE,1,1)

DOOR_AVAILABLE(PLAYER0,MAGIC,1,0)

IF(PLAYER0,ENTRANCE == 0)
  IF(PLAYER0,TIMER0 > 5000)
    NEXT_COMMAND_REUSABLE
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,ARCHER,-1,5,10,1000)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER0,TIMER0)
  ENDIF
ENDIF

IF(PLAYER0,WORKSHOP > 1)
  IF(PLAYER0,TOTAL_CREATURES > 6)
    DISPLAY_OBJECTIVE(4,PLAYER0)
  ENDIF
ENDIF

IF(PLAYER0,ENTRANCE > 0)
  MAGIC_AVAILABLE(PLAYER0,POWER_DISEASE,0,0)
  ROOM_AVAILABLE(PLAYER0,GUARD_POST,0,0)
ENDIF

CREATE_PARTY(DESTROY)
  ADD_TO_PARTY(DESTROY,HORNY,10,1000,ATTACK_ROOMS,0)
  ADD_TO_PARTY(DESTROY,HORNY,10,1000,ATTACK_ROOMS,0)

IF(PLAYER0,FLAG0 == 0)
  IF(PLAYER_GOOD,TOTAL_CREATURES <= 7)
    SET_FLAG(PLAYER0,FLAG0,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,DESTROY,1,1)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DWARFA,1,2,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DWARFA,2,2,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DWARFA,3,2,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,THIEF,4,2,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,THIEF,5,2,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,THIEF,6,2,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,MONK,7,2,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,MONK,8,2,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,MONK,9,2,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,WIZARD,10,2,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,WIZARD,11,2,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,WIZARD,12,2,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,FAIRY,13,6,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,FAIRY,14,6,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,SAMURAI,15,6,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,SAMURAI,16,6,10,1000)
  ENDIF
ENDIF

IF(PLAYER0,FLAG0 == 1)
  IF_ACTION_POINT(18,PLAYER0)
    SET_FLAG(PLAYER0,FLAG0,2)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-2,DUNGEON_HEART,0,9,100)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-3,DUNGEON_HEART,0,9,100)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-2,ACTION_POINT,17,9,100)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-3,ACTION_POINT,17,9,100)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-2,DUNGEON_HEART,0,9,100)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-3,DUNGEON_HEART,0,9,100)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-2,ACTION_POINT,17,9,100)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-3,ACTION_POINT,17,9,100)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-2,DUNGEON_HEART,0,9,100)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-3,DUNGEON_HEART,0,9,100)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-2,ACTION_POINT,17,9,100)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-3,ACTION_POINT,17,9,100)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,KNIGHT,17,10,10,1000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,AVATAR,17,1,10,10000)
    DISPLAY_OBJECTIVE(7,PLAYER0)
  ENDIF
ENDIF

IF(PLAYER0,FLAG0 == 2)
  IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
    DISPLAY_OBJECTIVE(6,PLAYER0)
    WIN_GAME
  ENDIF
ENDIF

IF(PLAYER0,FLAG0 > 0)
  IF(PLAYER0,TOTAL_CREATURES == 0)
    DISPLAY_OBJECTIVE(5,PLAYER0)
    LOSE_GAME
  ENDIF
ENDIF

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