REM Play Level Final Countdown

REM ******* Basic settings *******

SET_GENERATE_SPEED(275)

MAX_CREATURES(PLAYER0,30)

START_MONEY(PLAYER0,66600)

ADD_CREATURE_TO_POOL(SPIDER,20)
ADD_CREATURE_TO_POOL(SORCEROR,20)
ADD_CREATURE_TO_POOL(BILE_DEMON,15)
ADD_CREATURE_TO_POOL(DRAGON,15)
ADD_CREATURE_TO_POOL(ORC,20)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,15)
ADD_CREATURE_TO_POOL(TENTACLE,15)

REM ********** Available creatures **********

CREATURE_AVAILABLE(ALL_PLAYERS,SPIDER,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,SORCEROR,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,BILE_DEMON,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,DRAGON,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,ORC,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,TENTACLE,1,1)

REM ********** Available rooms **********

ROOM_AVAILABLE(ALL_PLAYERS,TREASURE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,GARDEN,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TRAINING,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,RESEARCH,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,WORKSHOP,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TEMPLE,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,GRAVEYARD,1,0)

REM ********** Available spells **********

MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,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_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,1,0)

SET_TIMER(PLAYER_GOOD,TIMER0)

IF(PLAYER_GOOD,TIMER0 >= 25)
    IF(PLAYER0,TOTAL_IMPS >= 31)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,-1,1,10,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER0)
    ENDIF
ENDIF

REM ********** Available doors & traps **********

DOOR_AVAILABLE(ALL_PLAYERS,WOOD,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,BRACED,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,STEEL,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,MAGIC,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,ALARM,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,LIGHTNING,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,WORD_OF_POWER,1,0)

REM ********** Game settings **********

IF(PLAYER0,DUNGEON_DESTROYED == 1)
    LOSE_GAME
ENDIF

SET_CREATURE_HEALTH(AVATAR,3500)

REM ********** Parties **********

CREATE_PARTY(ONE)
    ADD_TO_PARTY(ONE,THIEF,5,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,THIEF,5,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,THIEF,5,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,DWARFA,3,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,DWARFA,3,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,ARCHER,3,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,ARCHER,3,0,ATTACK_ENEMIES,0)

CREATE_PARTY(TWO)
    ADD_TO_PARTY(TWO,KNIGHT,10,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,KNIGHT,10,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,BARBARIAN,9,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,BARBARIAN,9,0,ATTACK_ENEMIES,0)

CREATE_PARTY(THREE)
    ADD_TO_PARTY(THREE,SAMURAI,10,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,SAMURAI,10,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,SAMURAI,10,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,SAMURAI,10,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,SAMURAI,10,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,SAMURAI,10,0,ATTACK_ENEMIES,0)

REM ********** Triggers & End game **********

ADD_CREATURE_TO_LEVEL(PLAYER0,GHOST,6,1,1,0)

IF(PLAYER_GOOD,TENTACLE == 2)
    SET_TIMER(PLAYER_GOOD,TIMER1)
ENDIF

IF(PLAYER_GOOD,TIMER1 >= 3750)
    NEXT_COMMAND_REUSABLE
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,-1,1)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER_GOOD,TIMER1)
ENDIF

SET_TIMER(PLAYER_GOOD,TIMER2)

IF(PLAYER_GOOD,TIMER2 >= 20000)
    SET_TIMER(PLAYER_GOOD,TIMER3)
    SET_TIMER(PLAYER_GOOD,TIMER4)
    SET_TIMER(PLAYER_GOOD,TIMER5)
    SET_TIMER(PLAYER_GOOD,TIMER7)
    SET_TIMER(PLAYER0,TIMER0)
    SET_TIMER(PLAYER0,TIMER1)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,AVATAR,6,1,10,0)
    IF(PLAYER_GOOD,AVATAR == 0)
        WIN_GAME
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER2 >= 29000)
    SET_TIMER(PLAYER_GOOD,TIMER6)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,WITCH,3,1,10,0)
ENDIF

IF(PLAYER_GOOD,TIMER2 >= 110000)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,6,ACTION_POINT,7,10,0)
ENDIF

IF(PLAYER_GOOD,TIMER3 >= 9000)
    IF(PLAYER_GOOD,TIMER2 < 110000)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,WIZARD,1,1,10,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER3)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER4 >= 9000)
    IF(PLAYER_GOOD,TIMER2 < 110000)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GIANT,2,1,10,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER4)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER5 >= 18000)
    IF(PLAYER_GOOD,TIMER2 < 110000)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,FAIRY,3,1,10,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER5)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER6 >= 18000)
    IF(PLAYER_GOOD,TIMER2 < 110000)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,WITCH,3,1,10,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER6)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER7 >= 9000)
    IF(PLAYER_GOOD,TIMER2 < 110000)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,MONK,4,1,10,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER7)
    ENDIF
ENDIF

IF(PLAYER0,TIMER0 >= 9000)
    IF(PLAYER_GOOD,TIMER2 < 110000)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,SAMURAI,5,1,10,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER0,TIMER0)
    ENDIF
ENDIF

IF(PLAYER0,TIMER1 >= 27000)
    IF(PLAYER_GOOD,TIMER2 < 110000)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,KNIGHT,6,1,10,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER0,TIMER1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TOTAL_CREATURES < 5)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,6,1)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,-1,5,10,0)
ENDIF
