REM Play Level Superblah

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

SET_GENERATE_SPEED(400)

MAX_CREATURES(PLAYER0,29)
MAX_CREATURES(PLAYER2,36)

START_MONEY(PLAYER0,10000)
START_MONEY(PLAYER1,9000000)
START_MONEY(PLAYER2,25000)
START_MONEY(PLAYER3,9000000)

COMPUTER_PLAYER(PLAYER2,3)
COMPUTER_PLAYER(PLAYER_GOOD,0)

ALLY_PLAYERS(PLAYER1,PLAYER2)
ALLY_PLAYERS(PLAYER1,PLAYER3)
ALLY_PLAYERS(PLAYER2,PLAYER3)

ADD_CREATURE_TO_POOL(FLY,40)
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,10)
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)

SET_TIMER(PLAYER2,TIMER0)

IF(PLAYER2,TIMER0 >= 500)
    IF(PLAYER2,FLY < 7)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER2,FLY,2,1,5,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER2,TIMER0)
    ENDIF
ENDIF

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)

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

MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)
MAGIC_AVAILABLE(PLAYER2,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_CAVE_IN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,1,0)
SET_TIMER(PLAYER0,TIMER0)

IF(PLAYER0,TIMER0 >= 500)
    IF(PLAYER0,TOTAL_IMPS < 20)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER0,IMP,3,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 ********** Triggers & End game **********

DISPLAY_OBJECTIVE(19,PLAYER0)

IF(PLAYER0,BATTLES_WON >= 8)
    SET_TIMER(PLAYER_GOOD,TIMER0)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 3000)
    SET_TIMER(PLAYER_GOOD,TIMER1)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,ARCHER,1,2,8,0)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 4000)
    SET_TIMER(PLAYER_GOOD,TIMER2)
    DISPLAY_INFORMATION(21,PLAYER0)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 5000)
    SET_TIMER(PLAYER_GOOD,TIMER3)
    DISPLAY_INFORMATION(20,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,THIEF,1,3,7,0)
ENDIF

IF(PLAYER_GOOD,TIMER1 >= 3000)
    NEXT_COMMAND_REUSABLE
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,WIZARD,1,3,7,0)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER_GOOD,TIMER1)
ENDIF

IF(PLAYER_GOOD,TIMER2 >= 3000)
    NEXT_COMMAND_REUSABLE
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GIANT,1,2,10,0)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER_GOOD,TIMER2)
ENDIF

IF(PLAYER_GOOD,TIMER3 >= 3000)
    NEXT_COMMAND_REUSABLE
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BARBARIAN,1,4,5,0)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER_GOOD,TIMER3)
ENDIF

IF(PLAYER1,TOTAL_CREATURES == 0)
    IF(PLAYER3,TOTAL_CREATURES == 0)
        IF(PLAYER2,DUNGEON_DESTROYED == 1)
            DISPLAY_OBJECTIVE(22,PLAYER0)
            WIN_GAME
        ENDIF
    ENDIF
ENDIF
