REM Play Level Ancient Fortress

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

SET_GENERATE_SPEED(300)

MAX_CREATURES(PLAYER0,24)
MAX_CREATURES(PLAYER1,20)

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

COMPUTER_PLAYER(PLAYER1,0)

ALLY_PLAYERS(PLAYER1,PLAYER3)
ALLY_PLAYERS(PLAYER1,PLAYER_GOOD)
ALLY_PLAYERS(PLAYER3,PLAYER_GOOD)

ADD_CREATURE_TO_POOL(FLY,20)
ADD_CREATURE_TO_POOL(BUG,20)
ADD_CREATURE_TO_POOL(SPIDER,9)
ADD_CREATURE_TO_POOL(DEMONSPAWN,10)
ADD_CREATURE_TO_POOL(SORCEROR,7)
ADD_CREATURE_TO_POOL(BILE_DEMON,3)
ADD_CREATURE_TO_POOL(DRAGON,3)
ADD_CREATURE_TO_POOL(TROLL,20)
ADD_CREATURE_TO_POOL(ORC,18)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,6)
ADD_CREATURE_TO_POOL(HELL_HOUND,20)

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

CREATURE_AVAILABLE(PLAYER0,FLY,1,1)
CREATURE_AVAILABLE(PLAYER0,BUG,1,1)
CREATURE_AVAILABLE(PLAYER0,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,1)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,1)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER1,DRAGON,1,1)
CREATURE_AVAILABLE(PLAYER0,TROLL,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,ORC,1,1)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,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,GARDEN,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TRAINING,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,RESEARCH,1,1)
ROOM_AVAILABLE(PLAYER0,GUARD_POST,1,0)
ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,0)
ROOM_AVAILABLE(PLAYER0,PRISON,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_SIGHT,1,0)
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(PLAYER0,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_PROTECT,1,0)

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

DOOR_AVAILABLE(ALL_PLAYERS,WOOD,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,BRACED,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

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

CREATE_PARTY(ONE)
    ADD_TO_PARTY(ONE,ORC,6,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,ORC,5,0,DEFEND_PARTY,0)
    ADD_TO_PARTY(ONE,ORC,5,0,DEFEND_PARTY,0)
    ADD_TO_PARTY(ONE,ORC,4,0,DEFEND_PARTY,0)
    ADD_TO_PARTY(ONE,ORC,4,0,DEFEND_PARTY,0)
    ADD_TO_PARTY(ONE,ORC,4,0,DEFEND_PARTY,0)

CREATE_PARTY(TWO)
    ADD_TO_PARTY(TWO,BARBARIAN,6,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,BARBARIAN,6,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,BARBARIAN,6,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,BARBARIAN,6,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,BARBARIAN,3,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,BARBARIAN,2,0,ATTACK_ENEMIES,0)

CREATE_PARTY(THREE)
    ADD_TO_PARTY(THREE,ORC,4,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,ORC,3,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,TROLL,3,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,ORC,4,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,TROLL,2,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,ORC,3,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,TROLL,5,0,ATTACK_ENEMIES,0)

CREATE_PARTY(FOUR)
    ADD_TO_PARTY(FOUR,BARBARIAN,4,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,BARBARIAN,5,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,GIANT,6,0,DEFEND_PARTY,0)
    ADD_TO_PARTY(FOUR,BARBARIAN,4,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,BARBARIAN,3,0,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,GIANT,5,0,DEFEND_PARTY,0)

CREATE_PARTY(FIVE)
    ADD_TO_PARTY(FIVE,ORC,8,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FIVE,ORC,7,0,DEFEND_PARTY,0)
    ADD_TO_PARTY(FIVE,ORC,7,0,DEFEND_PARTY,0)
    ADD_TO_PARTY(FIVE,ORC,7,0,DEFEND_PARTY,0)

CREATE_PARTY(SIX)
    ADD_TO_PARTY(SIX,BUG,5,0,ATTACK_ROOMS,0)

CREATE_PARTY(SEVEN)
    ADD_TO_PARTY(SEVEN,KNIGHT,10,2000,DEFEND_PARTY,0)
    ADD_TO_PARTY(SEVEN,GIANT,10,0,DEFEND_PARTY,0)
    ADD_TO_PARTY(SEVEN,GIANT,10,0,DEFEND_PARTY,0)
    ADD_TO_PARTY(SEVEN,GIANT,10,0,DEFEND_PARTY,0)
    ADD_TO_PARTY(SEVEN,BARBARIAN,9,0,DEFEND_PARTY,0)
    ADD_TO_PARTY(SEVEN,BARBARIAN,9,0,DEFEND_PARTY,0)
    ADD_TO_PARTY(SEVEN,BARBARIAN,9,0,DEFEND_PARTY,0)

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

SET_TIMER(PLAYER_GOOD,TIMER0)
SET_TIMER(PLAYER_GOOD,TIMER1)
SET_TIMER(PLAYER_GOOD,TIMER7)
SET_TIMER(PLAYER1,TIMER1)

IF(PLAYER_GOOD,TIMER0 >= 2500)
    SET_TIMER(PLAYER_GOOD,TIMER2)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 5000)
    SET_TIMER(PLAYER_GOOD,TIMER3)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 5100)
    SET_TIMER(PLAYER_GOOD,TIMER4)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 7500)
    SET_TIMER(PLAYER_GOOD,TIMER5)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,1,DUNGEON_HEART,0,3,300)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,2,DUNGEON_HEART,0,3,300)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,1,DUNGEON_HEART,0,2,200)
    ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,2,DUNGEON_HEART,0,2,200)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 9000)
    SET_TIMER(PLAYER_GOOD,TIMER6)
    SET_TIMER(PLAYER1,TIMER0)
ENDIF

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

IF(PLAYER_GOOD,TIMER2 >= 11300)
    NEXT_COMMAND_REUSABLE
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,-1,1)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER_GOOD,TIMER2)
ENDIF

IF(PLAYER_GOOD,TIMER3 >= 11300)
    NEXT_COMMAND_REUSABLE
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,-2,1)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER_GOOD,TIMER3)
ENDIF

IF(PLAYER_GOOD,TIMER4 >= 11300)
    NEXT_COMMAND_REUSABLE
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,-1,1)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER_GOOD,TIMER4)
ENDIF

IF(PLAYER_GOOD,TIMER5 >= 11300)
    NEXT_COMMAND_REUSABLE
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIVE,-2,1)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER_GOOD,TIMER5)
ENDIF

IF(PLAYER_GOOD,TIMER6 >= 11300)
    NEXT_COMMAND_REUSABLE
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,-1,1)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER_GOOD,TIMER6)
ENDIF

IF(PLAYER_GOOD,TIMER7 >= 8900)
    NEXT_COMMAND_REUSABLE
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SIX,-3,2)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER_GOOD,TIMER7)
ENDIF

IF(PLAYER1,TIMER0 >= 9000)
    NEXT_COMMAND_REUSABLE
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,-3,1)
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER1,TIMER0)
ENDIF

IF(PLAYER1,TIMER1 >= 3000)
    IF(PLAYER0,TOTAL_CREATURES >= 55)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TENTACLE,-3,18,10,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER1,TIMER1)
    ENDIF
ENDIF

IF_ACTION_POINT(4,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIVE,PLAYER1,1)
ENDIF

IF_ACTION_POINT(5,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIVE,PLAYER1,1)
ENDIF

IF_ACTION_POINT(6,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIVE,PLAYER1,1)
ENDIF

IF_ACTION_POINT(7,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIVE,PLAYER1,2)
ENDIF

IF_ACTION_POINT(8,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIVE,PLAYER1,2)
ENDIF

IF_ACTION_POINT(3,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIVE,PLAYER1,2)
ENDIF

IF_ACTION_POINT(9,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SEVEN,PLAYER1,1)
ENDIF

IF(PLAYER3,AVATAR == 0)
    IF(PLAYER1,DUNGEON_DESTROYED == 1)
        WIN_GAME
    ENDIF
ENDIF
