REM ********************************************
REM  Burdened Imps' Level Pack for KeeperFX
REM  Script for Level 220, Moonshadow Keep
REM  Version 1.00
REM ********************************************

REM Basic stuff

SET_GENERATE_SPEED(400)
MAX_CREATURES(PLAYER0,20)
START_MONEY(PLAYER0,20000)

SET_CREATURE_MAX_LEVEL(PLAYER0,THIEF,10)

ADD_CREATURE_TO_POOL(FLY,20)
ADD_CREATURE_TO_POOL(BUG,20)
ADD_CREATURE_TO_POOL(DEMONSPAWN,20)
ADD_CREATURE_TO_POOL(SPIDER,20)
ADD_CREATURE_TO_POOL(SORCEROR,20)
ADD_CREATURE_TO_POOL(TROLL,20)
ADD_CREATURE_TO_POOL(BILE_DEMON,20)
ADD_CREATURE_TO_POOL(ORC,20)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,20)
ADD_CREATURE_TO_POOL(DRAGON,20)
ADD_CREATURE_TO_POOL(HELL_HOUND,20)
ADD_CREATURE_TO_POOL(TENTACLE,20)
ADD_CREATURE_TO_POOL(SKELETON,20)
ADD_CREATURE_TO_POOL(GHOST,20)
ADD_CREATURE_TO_POOL(VAMPIRE,20)

CREATURE_AVAILABLE(PLAYER0,FLY,1,1)
CREATURE_AVAILABLE(PLAYER0,BUG,1,1)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,0,0)
CREATURE_AVAILABLE(PLAYER0,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,1)
CREATURE_AVAILABLE(PLAYER0,TROLL,1,1)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER0,ORC,1,1)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER0,DRAGON,1,1)
CREATURE_AVAILABLE(PLAYER0,HELL_HOUND,1,1)
CREATURE_AVAILABLE(PLAYER0,TENTACLE,1,1)
CREATURE_AVAILABLE(PLAYER0,SKELETON,0,0)
CREATURE_AVAILABLE(PLAYER0,GHOST,0,0)
CREATURE_AVAILABLE(PLAYER0,VAMPIRE,0,0)

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

TRAP_AVAILABLE(PLAYER0,ALARM,1,0)
TRAP_AVAILABLE(PLAYER0,POISON_GAS,1,0)
TRAP_AVAILABLE(PLAYER0,LIGHTNING,1,0)
TRAP_AVAILABLE(PLAYER0,LAVA,0,0)
TRAP_AVAILABLE(PLAYER0,BOULDER,0,0)
TRAP_AVAILABLE(PLAYER0,WORD_OF_POWER,1,0)
DOOR_AVAILABLE(PLAYER0,WOOD,0,0)
DOOR_AVAILABLE(PLAYER0,BRACED,0,0)
DOOR_AVAILABLE(PLAYER0,STEEL,1,0)
DOOR_AVAILABLE(PLAYER0,MAGIC,1,0)

MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_OBEY,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SIGHT,0,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,0,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,0,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_LIGHTNING,0,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,0,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DESTROY_WALLS,0,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_ARMAGEDDON,0,0)

IF(PLAYER0,BRIDGE >= 1)
    ROOM_AVAILABLE(PLAYER0,BRIDGE,1,1)
ENDIF
IF(PLAYER0,WORKSHOP >= 1)
    ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,1)
ENDIF
IF(PLAYER0,BARRACKS >= 1)
    ROOM_AVAILABLE(PLAYER0,BARRACKS,1,1)
ENDIF
IF(PLAYER0,PRISON >= 1)
    ROOM_AVAILABLE(PLAYER0,PRISON,1,1)
ENDIF
IF(PLAYER0,TORTURE >= 1)
    ROOM_AVAILABLE(PLAYER0,TORTURE,1,1)
ENDIF
IF(PLAYER0,GRAVEYARD >= 1)
    ROOM_AVAILABLE(PLAYER0,GRAVEYARD,1,1)
ENDIF
IF(PLAYER0,SCAVENGER >= 1)
    ROOM_AVAILABLE(PLAYER0,SCAVENGER,1,1)
ENDIF

REM ----------------------- Hero groups

CREATE_PARTY(ATTACK_ONE)
    ADD_TO_PARTY(ATTACK_ONE,WIZARD,5,800,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_ONE,BARBARIAN,5,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_ONE,BARBARIAN,5,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_ONE,ARCHER,5,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_ONE,ARCHER,5,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_ONE,THIEF,5,400,STEAL_GOLD,0)
    ADD_TO_PARTY(ATTACK_ONE,THIEF,5,400,STEAL_GOLD,0)

CREATE_PARTY(ATTACK_TWO)
    ADD_TO_PARTY(ATTACK_TWO,WIZARD,7,800,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_TWO,MONK,7,800,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_TWO,MONK,7,800,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_TWO,THIEF,7,400,STEAL_GOLD,0)
    ADD_TO_PARTY(ATTACK_TWO,THIEF,7,400,STEAL_GOLD,0)
    ADD_TO_PARTY(ATTACK_TWO,BARBARIAN,7,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_TWO,BARBARIAN,7,400,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(ATTACK_THREE)
    ADD_TO_PARTY(ATTACK_THREE,WIZARD,9,800,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_THREE,GIANT,9,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_THREE,GIANT,9,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_THREE,MONK,9,800,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_THREE,MONK,9,800,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_THREE,SAMURAI,9,800,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_THREE,WITCH,9,800,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(ATTACK_FOUR)
    ADD_TO_PARTY(ATTACK_FOUR,WIZARD,10,1200,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_FOUR,SAMURAI,10,800,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_FOUR,SAMURAI,10,800,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_FOUR,MONK,10,800,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_FOUR,BARBARIAN,10,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_FOUR,BARBARIAN,10,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_FOUR,WITCH,10,800,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(PRISON)
    ADD_TO_PARTY(PRISON,BARBARIAN,9,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(PRISON,BARBARIAN,9,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(PRISON,BARBARIAN,9,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(PRISON,SAMURAI,9,800,ATTACK_ENEMIES,0)

CREATE_PARTY(HALLWAY_ONE)
    ADD_TO_PARTY(HALLWAY_ONE,FAIRY,10,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HALLWAY_ONE,FAIRY,10,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HALLWAY_ONE,WITCH,10,800,ATTACK_ENEMIES,0)

CREATE_PARTY(HALLWAY_TWO)
    ADD_TO_PARTY(HALLWAY_TWO,SAMURAI,10,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HALLWAY_TWO,THIEF,10,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HALLWAY_TWO,SAMURAI,10,800,ATTACK_ENEMIES,0)

CREATE_PARTY(BOSS_ASSIST)
    ADD_TO_PARTY(BOSS_ASSIST,GIANT,10,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BOSS_ASSIST,BARBARIAN,10,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BOSS_ASSIST,WITCH,10,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BOSS_ASSIST,FAIRY,10,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BOSS_ASSIST,MONK,10,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BOSS_ASSIST,SAMURAI,10,800,ATTACK_ENEMIES,0)

CREATE_PARTY(HAUNTED)
    ADD_TO_PARTY(HAUNTED,GHOST,5,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HAUNTED,GHOST,5,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HAUNTED,GHOST,5,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HAUNTED,GHOST,5,0,ATTACK_ENEMIES,0)

CREATE_PARTY(TENTACLES)
    ADD_TO_PARTY(TENTACLES,TENTACLE,8,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TENTACLES,TENTACLE,8,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TENTACLES,TENTACLE,8,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TENTACLES,TENTACLE,8,0,ATTACK_ENEMIES,0)

CREATE_PARTY(BRIDGE_TWO)
    ADD_TO_PARTY(BRIDGE_TWO,BARBARIAN,8,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRIDGE_TWO,BARBARIAN,7,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRIDGE_TWO,BARBARIAN,7,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRIDGE_TWO,GIANT,7,400,ATTACK_ENEMIES,0)

CREATE_PARTY(UNHOLY)
    ADD_TO_PARTY(UNHOLY,WITCH,10,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(UNHOLY,HORNY,10,0,ATTACK_ENEMIES,0)

CREATE_PARTY(CAVE)
    ADD_TO_PARTY(CAVE,BARBARIAN,7,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(CAVE,BARBARIAN,7,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(CAVE,GIANT,7,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(CAVE,GIANT,7,400,ATTACK_ENEMIES,0)

CREATE_PARTY(BOSS)
    ADD_TO_PARTY(BOSS,KNIGHT,10,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BOSS,WIZARD,10,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BOSS,ARCHER,10,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BOSS,ARCHER,10,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BOSS,ARCHER,10,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BOSS,ARCHER,10,400,ATTACK_ENEMIES,0)

CREATE_PARTY(BRIDGE_ONE)
    ADD_TO_PARTY(BRIDGE_ONE,DWARFA,5,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRIDGE_ONE,DWARFA,5,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRIDGE_ONE,DWARFA,5,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRIDGE_ONE,DWARFA,5,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRIDGE_ONE,DWARFA,5,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRIDGE_ONE,DWARFA,5,400,ATTACK_ENEMIES,0)

CREATE_PARTY(ATTACK_FIVE)
    ADD_TO_PARTY(ATTACK_FIVE,ARCHER,10,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_FIVE,ARCHER,10,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_FIVE,MONK,10,800,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_FIVE,BARBARIAN,10,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_FIVE,BARBARIAN,10,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_FIVE,GIANT,10,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ATTACK_FIVE,GIANT,10,400,ATTACK_DUNGEON_HEART,0)

REM ----------------------- Win/Lose conditions/Objectives

DISPLAY_OBJECTIVE(10,ALL_PLAYERS)
REM QUICK_OBJECTIVE(0,"Moonshadow Keep. Home to many knights and wizards of moral excellence. They truly are a stain on this world and deserving of certain death. Speed is of the essence, Keeper, restore this old dungeon as fast as you can. I can already hear heroes readying themselves to meet you.",PLAYER0)

IF(PLAYER0,DUNGEON_DESTROYED == 1)
    LOSE_GAME
ENDIF

IF(PLAYER_GOOD,KNIGHT == 0)
    IF(PLAYER_GOOD,WIZARD == 0)
        SET_FLAG(PLAYER_GOOD,FLAG1,1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,FLAG1 == 1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BOSS_ASSIST,3,2)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BOSS,3,1)
    SET_FLAG(PLAYER_GOOD,FLAG2,1)
    
    DISPLAY_OBJECTIVE(11,ALL_PLAYERS)
REM     QUICK_OBJECTIVE(3,"A final and desperate attempt to reclaim this land, Keeper. They should have fled when they had the chance. Make them regret their choice.",PLAYER0)
ENDIF

IF(PLAYER_GOOD,FLAG2 == 1)
    IF(PLAYER_GOOD,KNIGHT == 0)
        IF(PLAYER_GOOD,WIZARD == 0)
            DISPLAY_OBJECTIVE(12,ALL_PLAYERS)
REM QUICK_OBJECTIVE(2,"All knights and wizards have been defeated. Without their leadership and wisdom this land has no choice but to bow down before your will. Expertly done, Keeper.",PLAYER0)
            WIN_GAME
        ENDIF
    ENDIF
ENDIF

REM ----------------------- Spawns

SET_TIMER(PLAYER0,TIMER0)
IF(PLAYER0,TIMER0 >= 35000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ATTACK_ONE,-1,1)
    DISPLAY_INFORMATION(13,ALL_PLAYERS)
    REM QUICK_INFORMATION(4,"Be warned, Keeper! A band of heroes has left the keep and are heading for your domain!")
ENDIF

IF(PLAYER0,TIMER0 >= 50000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ATTACK_TWO,-2,1)
    DISPLAY_INFORMATION(14,ALL_PLAYERS)
    REM QUICK_INFORMATION(5,"Be advised, Keeper, more heroes have left the safety of their home to destroy your dungeon.")
ENDIF

IF(PLAYER0,TIMER0 >= 70000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ATTACK_THREE,-3,1)
    DISPLAY_INFORMATION(15,ALL_PLAYERS)
    REM QUICK_INFORMATION(6,"Beware! Another group of heroes left the keep! See that they receive an unexpected, fitting and gruesome end.")
ENDIF

IF(PLAYER0,TIMER0 >= 80000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ATTACK_FOUR,-2,1)
    DISPLAY_INFORMATION(16,ALL_PLAYERS)
    REM QUICK_INFORMATION(7,"Keeper, here comes Yet another attempt to destroy your dungeon heart. How pathetic.")
ENDIF

IF(PLAYER0,TIMER0 >= 97000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ATTACK_FOUR,-3,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ATTACK_FIVE,-2,1)
    DISPLAY_INFORMATION(17,ALL_PLAYERS)
    REM QUICK_INFORMATION(8,"A large group of heroes have left the keep once more to make a final, desperate attempt to destroy you. I thought you'd like to know.")
ENDIF

IF(PLAYER0,TIMER0 >= 100000)
    DISPLAY_OBJECTIVE(18,ALL_PLAYERS)
REM QUICK_OBJECTIVE(1,"The heroes have given up their pointless attacks on your dungeon and are cowering inside their fortress. The time has come to hunt them down. Put every so called noble knight and wizard out of his misery. Any other hero slain is more meat for your creatures to feast upon.",PLAYER0)
ENDIF

IF_ACTION_POINT(7,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PRISON,7,1)
ENDIF

IF_ACTION_POINT(8,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HALLWAY_ONE,8,1)
ENDIF

IF_ACTION_POINT(9,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HALLWAY_TWO,9,1)
ENDIF

IF_ACTION_POINT(11,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HAUNTED,11,1)
ENDIF

IF_ACTION_POINT(12,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TENTACLES,12,1)
ENDIF

IF_ACTION_POINT(13,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BRIDGE_TWO,13,1)
ENDIF

IF_ACTION_POINT(14,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,UNHOLY,14,1)
ENDIF

IF_ACTION_POINT(15,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,CAVE,15,1)
ENDIF

IF_ACTION_POINT(2,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BRIDGE_ONE,2,1)
ENDIF

IF_ACTION_POINT(10,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,FAIRY,10,3,8,800)
ENDIF

IF_ACTION_POINT(16,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,SAMURAI,1,2,10,800)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BARBARIAN,1,2,10,400)
ENDIF
