REM Play Level Stronghold

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

SET_GENERATE_SPEED(500)

MAX_CREATURES(PLAYER0,28)

START_MONEY(PLAYER0,25000)

COMPUTER_PLAYER(PLAYER_GOOD,0)

ADD_CREATURE_TO_POOL(FLY,20)
ADD_CREATURE_TO_POOL(BUG,30)
ADD_CREATURE_TO_POOL(SPIDER,20)
ADD_CREATURE_TO_POOL(DEMONSPAWN,20)
ADD_CREATURE_TO_POOL(SORCEROR,20)
ADD_CREATURE_TO_POOL(BILE_DEMON,6)
ADD_CREATURE_TO_POOL(DRAGON,30)
ADD_CREATURE_TO_POOL(HELL_HOUND,30)


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

CREATURE_AVAILABLE(ALL_PLAYERS,FLY,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,BUG,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,SPIDER,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,DEMONSPAWN,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,HELL_HOUND,1,1)

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

ROOM_AVAILABLE(ALL_PLAYERS,TREASURE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TRAINING,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,RESEARCH,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TEMPLE,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(PLAYER0,POWER_IMP,1,1)
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_PROTECT,1,0)

SET_TIMER(PLAYER0,TIMER0)

IF(PLAYER0,TIMER0 >= 600)
    IF(PLAYER0,FLY < 7)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER0,FLY,9,1,1,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER0,TIMER0)
    ENDIF
ENDIF

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

IF(PLAYER0,DUNGEON_DESTROYED == 1)
    LOSE_GAME
ENDIF

SET_CREATURE_MAX_LEVEL(ALL_PLAYERS,THIEF,10)

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

CREATE_PARTY(ONE)
    ADD_TO_PARTY(ONE,THIEF,7,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,THIEF,5,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,ARCHER,8,200,ATTACK_ENEMIES,0)

CREATE_PARTY(TWO)
    ADD_TO_PARTY(TWO,DWARFA,5,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,ARCHER,5,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,BARBARIAN,6,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,BARBARIAN,6,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,THIEF,4,300,ATTACK_ENEMIES,0)

CREATE_PARTY(THREE)
    ADD_TO_PARTY(THREE,WIZARD,7,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,WIZARD,6,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,WIZARD,6,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,BARBARIAN,6,500,DEFEND_PARTY,0)
    ADD_TO_PARTY(THREE,BARBARIAN,6,500,DEFEND_PARTY,0)

CREATE_PARTY(FOUR)
    ADD_TO_PARTY(FOUR,BARBARIAN,7,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,BARBARIAN,7,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,BARBARIAN,7,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,FAIRY,6,1000,ATTACK_ENEMIES,0)

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

DISPLAY_OBJECTIVE(24,PLAYER0)

IF(PLAYER_GOOD,BATTLES_LOST >= 10)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,1,DUNGEON_HEART,0,4,100)
    DISPLAY_INFORMATION(25,PLAYER0)
ENDIF

IF(PLAYER_GOOD,BATTLES_LOST >= 18)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,2,DUNGEON_HEART,0,4,100)
    SET_TIMER(PLAYER_GOOD,TIMER0)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 2500)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,-1,DUNGEON_HEART,0,6,100)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 2700)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,-2,DUNGEON_HEART,0,7,100)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 2900)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,-1,DUNGEON_HEART,0,7,100)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,-3,DUNGEON_HEART,0,7,100)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 3000)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,-4,DUNGEON_HEART,0,7,100)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 3500)
    IF(PLAYER_GOOD,TUNNELLER == 0)
        ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,3,DUNGEON_HEART,0,9,100)
        ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,4,DUNGEON_HEART,0,9,100)
        ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,5,DUNGEON_HEART,0,9,100)
        ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,6,DUNGEON_HEART,0,9,100)
    ENDIF
ENDIF

SET_FLAG(PLAYER0,FLAG0,0)
SET_FLAG(PLAYER_GOOD,FLAG0,0)

IF(PLAYER0,TIMER0 >= 10000)
    SET_FLAG(PLAYER0,FLAG0,1)
    DISPLAY_INFORMATION(26,PLAYER0)
ENDIF

IF(PLAYER0,TIMER0 >= 17000)
    SET_FLAG(PLAYER0,FLAG0,2)
    DISPLAY_INFORMATION(27,PLAYER0)
ENDIF

IF(PLAYER0,TIMER0 >= 23000)
    SET_FLAG(PLAYER0,FLAG0,3)
    DISPLAY_INFORMATION(28,PLAYER0)
ENDIF

IF(PLAYER0,TIMER0 >= 29000)
    SET_FLAG(PLAYER0,FLAG0,4)
ENDIF

IF(PLAYER0,TIMER0 >= 350000)
    SET_FLAG(PLAYER0,FLAG0,5)
ENDIF

IF(PLAYER0,TIMER0 >= 40000)
    SET_FLAG(PLAYER0,FLAG0,6)
ENDIF

IF(PLAYER0,TIMER0 >= 50000)
    IF(PLAYER_GOOD,FLAG0 == 0)
        DISPLAY_OBJECTIVE(29,PLAYER0)
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,AVATAR,7,1,10,5000)
        ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,7,DUNGEON_HEART,0,10,100)
        SET_FLAG(PLAYER_GOOD,FLAG0,1)
    ENDIF
ENDIF

IF_ACTION_POINT(8,PLAYER0)
    IF(PLAYER_GOOD,FLAG0 == 0)
        DISPLAY_OBJECTIVE(30,PLAYER0)
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,AVATAR,7,1,10,5000)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,7,1)
        SET_FLAG(PLAYER_GOOD,FLAG0,1)
    ENDIF
ENDIF

IF_ACTION_POINT(8,PLAYER0)
    IF(PLAYER0,FLAG0 > 0)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,7,1)
    ENDIF
ENDIF

IF_ACTION_POINT(8,PLAYER0)
    IF(PLAYER0,FLAG0 > 1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,7,1)
    ENDIF
ENDIF

IF_ACTION_POINT(8,PLAYER0)
    IF(PLAYER0,FLAG0 > 2)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,7,1)
    ENDIF
ENDIF

IF_ACTION_POINT(8,PLAYER0)
    IF(PLAYER0,FLAG0 > 3)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,7,1)
    ENDIF
ENDIF

IF_ACTION_POINT(8,PLAYER0)
    IF(PLAYER0,FLAG0 > 4)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,7,1)
    ENDIF
ENDIF

IF_ACTION_POINT(8,PLAYER0)
    IF(PLAYER0,FLAG0 > 5)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,7,1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,FLAG0 == 1)
    IF(PLAYER_GOOD,AVATAR == 0)
        DISPLAY_OBJECTIVE(31,PLAYER0)
        WIN_GAME
    ENDIF
ENDIF
