REM Play Level Barbarian Stronghold

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

SET_GENERATE_SPEED(450)

MAX_CREATURES(PLAYER0,24)

START_MONEY(PLAYER0,54321)

ALLY_PLAYERS(PLAYER_GOOD,PLAYER1)

ADD_CREATURE_TO_POOL(BUG,12)
ADD_CREATURE_TO_POOL(SPIDER,12)
ADD_CREATURE_TO_POOL(SORCEROR,12)
ADD_CREATURE_TO_POOL(BILE_DEMON,12)
ADD_CREATURE_TO_POOL(DRAGON,12)
ADD_CREATURE_TO_POOL(TROLL,16)
ADD_CREATURE_TO_POOL(ORC,16)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,12)
ADD_CREATURE_TO_POOL(TENTACLE,12)

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

CREATURE_AVAILABLE(ALL_PLAYERS,BUG,1,1)
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,TROLL,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,GUARD_POST,1,0)
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)
ROOM_AVAILABLE(ALL_PLAYERS,SCAVENGER,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_SIGHT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_OBEY,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)

IF(PLAYER0,SCAVENGER >= 9)
    IF(PLAYER0,TEMPLE >= 9)
        MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CALL_TO_ARMS,1,0)
    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,LAVA,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,BOULDER,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,WORD_OF_POWER,1,0)

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

IF(PLAYER0,DUNGEON_DESTROYED == 1)
    LOSE_GAME
ENDIF

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

CREATE_PARTY(ONE)
    ADD_TO_PARTY(ONE,BARBARIAN,9,0,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ONE,BARBARIAN,9,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,BARBARIAN,9,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,BARBARIAN,9,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,GIANT,10,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,GIANT,10,0,ATTACK_ENEMIES,0)

CREATE_PARTY(TWO)
    ADD_TO_PARTY(TWO,HELL_HOUND,8,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,HELL_HOUND,8,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,HELL_HOUND,8,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,HELL_HOUND,8,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,BARBARIAN,9,0,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(TWO,GIANT,10,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,GIANT,10,0,ATTACK_ENEMIES,0)

CREATE_PARTY(THREE)
    ADD_TO_PARTY(THREE,BARBARIAN,9,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,BARBARIAN,9,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,BARBARIAN,9,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,BARBARIAN,9,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,HELL_HOUND,8,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,HELL_HOUND,8,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,HELL_HOUND,8,0,ATTACK_ENEMIES,0)

CREATE_PARTY(FOUR)
    ADD_TO_PARTY(FOUR,AVATAR,9,0,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(FOUR,KNIGHT,10,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,GIANT,10,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,KNIGHT,10,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,GIANT,10,0,ATTACK_ENEMIES,0)

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

SET_TIMER(PLAYER0,TIMER0)
SET_TIMER(PLAYER0,TIMER1)

IF(PLAYER0,TIMER0 >= 10)
    NEXT_COMMAND_REUSABLE
    RESET_ACTION_POINT(1)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER0,TIMER0)
ENDIF

IF(PLAYER0,TIMER1 >= 1800)
    IF_ACTION_POINT(1,PLAYER0)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GIANT,2,1,10,0)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GIANT,3,1,10,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER0,TIMER1)
    ENDIF
ENDIF

IF_ACTION_POINT(12,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,10,2,2,0)
ENDIF

IF_ACTION_POINT(13,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,10,2,2,0)
ENDIF

IF_ACTION_POINT(14,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,10,2,2,0)
ENDIF

IF_ACTION_POINT(15,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,10,2,2,0)
ENDIF

IF_ACTION_POINT(16,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,10,2,2,0)
ENDIF

IF_ACTION_POINT(17,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,10,2,2,0)
ENDIF

IF_ACTION_POINT(18,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,11,2,2,0)
ENDIF

IF_ACTION_POINT(19,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,11,2,2,0)
ENDIF

IF_ACTION_POINT(20,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,11,2,2,0)
ENDIF

IF_ACTION_POINT(21,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,11,2,2,0)
ENDIF

IF_ACTION_POINT(22,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,11,2,2,0)
ENDIF

IF_ACTION_POINT(23,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,11,2,2,0)
ENDIF

IF(PLAYER0,TOTAL_CREATURES >= 20)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DWARFA,4,4,3,400)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DWARFA,5,4,3,400)
ENDIF

IF(PLAYER0,TOTAL_CREATURES >= 24)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,HELL_HOUND,4,3,5,0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,HELL_HOUND,5,3,5,0)
    SET_TIMER(PLAYER0,TIMER2)
    SET_TIMER(PLAYER_GOOD,TIMER0)
ENDIF

IF(PLAYER0,TIMER2 >= 2500)
    SET_TIMER(PLAYER_GOOD,TIMER1)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BARBARIAN,4,3,4,400)
ENDIF

IF(PLAYER0,TIMER2 >= 5000)
    SET_TIMER(PLAYER_GOOD,TIMER2)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BARBARIAN,5,3,4,400)
ENDIF

IF(PLAYER0,TIMER2 >= 7500)
    SET_TIMER(PLAYER_GOOD,TIMER3)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,HELL_HOUND,4,3,5,0)
ENDIF

IF(PLAYER0,TIMER2 >= 10000)
    SET_TIMER(PLAYER_GOOD,TIMER4)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,HELL_HOUND,5,3,5,0)
ENDIF

IF(PLAYER0,TIMER2 >= 12500)
    SET_TIMER(PLAYER_GOOD,TIMER5)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BARBARIAN,4,3,6,0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BARBARIAN,5,3,6,0)
ENDIF

IF(PLAYER0,TIMER2 >= 30000)
    SET_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 15000)
    IF(PLAYER0,FLAG0 == 0)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,4,1)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER0)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER1 >= 15000)
    IF(PLAYER0,FLAG0 == 0)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,5,1)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER2 >= 15000)
    IF(PLAYER0,FLAG0 == 0)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,4,1)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER2)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER3 >= 15000)
    IF(PLAYER0,FLAG0 == 0)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,5,1)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER3)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER4 >= 15000)
    IF(PLAYER0,FLAG0 == 0)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,4,1)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER4)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER5 >= 15000)
    IF(PLAYER0,FLAG0 == 0)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,5,1)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER5)
    ENDIF
ENDIF

IF(PLAYER0,FLAG0 == 1)
    SET_TIMER(PLAYER_GOOD,TIMER6)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,7,ACTION_POINT,6,8,0)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,8,ACTION_POINT,9,8,0)
    ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,0)
ENDIF

IF(PLAYER_GOOD,TIMER6 >= 1000)
    NEXT_COMMAND_REUSABLE
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BARBARIAN,-1,1,10,0)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER_GOOD,TIMER6)
ENDIF

IF(PLAYER_GOOD,BARBARIAN == 0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,-1,1)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BARBARIAN,-1,5,10,0)
    IF(PLAYER_GOOD,AVATAR == 0)
        WIN_GAME
    ENDIF
ENDIF
