REM KDK Level 15

SET_GENERATE_SPEED(500)

MAX_CREATURES(PLAYER0,27)
MAX_CREATURES(PLAYER1,22)
MAX_CREATURES(PLAYER2,34)

START_MONEY(PLAYER0,34500)
START_MONEY(PLAYER1,9600)
START_MONEY(PLAYER2,68800)

REM Computer Player stuff
COMPUTER_PLAYER(PLAYER1,0)
COMPUTER_PLAYER(PLAYER2,1)

ADD_CREATURE_TO_POOL(TROLL,19)
ADD_CREATURE_TO_POOL(TENTACLE,7)
ADD_CREATURE_TO_POOL(HELL_HOUND,8)
ADD_CREATURE_TO_POOL(SPIDER,16)
ADD_CREATURE_TO_POOL(BUG,3)
ADD_CREATURE_TO_POOL(BILE_DEMON,4)
ADD_CREATURE_TO_POOL(FLY,6)
ADD_CREATURE_TO_POOL(DEMONSPAWN,30)
ADD_CREATURE_TO_POOL(HORNY,1)
ADD_CREATURE_TO_POOL(SORCEROR,19)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,16)
ADD_CREATURE_TO_POOL(DRAGON,7)
ADD_CREATURE_TO_POOL(HELL_HOUND,7)
ADD_CREATURE_TO_POOL(VAMPIRE,5)
ADD_CREATURE_TO_POOL(ORC,22)

REM Creature_Availability

CREATURE_AVAILABLE(PLAYER0,HORNY,1,1)
CREATURE_AVAILABLE(PLAYER0,TENTACLE,1,1)
CREATURE_AVAILABLE(PLAYER0,HELL_HOUND,1,1)
CREATURE_AVAILABLE(PLAYER0,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER0,BUG,1,1)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER0,FLY,1,1)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,1)
CREATURE_AVAILABLE(PLAYER1,HORNY,1,1)
CREATURE_AVAILABLE(PLAYER1,HELL_HOUND,1,1)
CREATURE_AVAILABLE(PLAYER1,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER1,BUG,1,1)
CREATURE_AVAILABLE(PLAYER1,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER1,FLY,1,1)
CREATURE_AVAILABLE(PLAYER1,DEMONSPAWN,1,1)
CREATURE_AVAILABLE(PLAYER2,HORNY,1,1)
CREATURE_AVAILABLE(PLAYER2,HELL_HOUND,1,1)
CREATURE_AVAILABLE(PLAYER2,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER2,BUG,1,1)
CREATURE_AVAILABLE(PLAYER2,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER2,FLY,1,1)
CREATURE_AVAILABLE(PLAYER2,DEMONSPAWN,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,TROLL,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,ORC,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,VAMPIRE,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,SORCEROR,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,DRAGON,1,1)

REM Spells

MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_OBEY,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,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_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DESTROY_WALLS,1,0)
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_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_POSSESS,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_OBEY,1,0)
MAGIC_AVAILABLE(PLAYER1,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(PLAYER2,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(PLAYER1,POWER_LIGHTNING,1,0)

REM Room_Availability

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

REM doors & traps

TRAP_AVAILABLE(ALL_PLAYERS,ALARM,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
TRAP_AVAILABLE(PLAYER0,WORD_OF_POWER,1,0)
TRAP_AVAILABLE(PLAYER1,WORD_OF_POWER,1,0)
TRAP_AVAILABLE(PLAYER1,LIGHTNING,1,0)
TRAP_AVAILABLE(PLAYER1,BOULDER,1,0)
TRAP_AVAILABLE(PLAYER2,BOULDER,1,0)
TRAP_AVAILABLE(PLAYER2,LIGHTNING,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,BRACED,1,0)
DOOR_AVAILABLE(PLAYER1,WOOD,1,0)
DOOR_AVAILABLE(PLAYER2,WOOD,1,0)
DOOR_AVAILABLE(PLAYER0,MAGIC,1,0)

CREATE_PARTY(ONE)
    ADD_TO_PARTY(ONE,ARCHER,3,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,ARCHER,4,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,ARCHER,3,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,ARCHER,4,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,WIZARD,4,600,ATTACK_ENEMIES,0)

CREATE_PARTY(TWO)
    ADD_TO_PARTY(TWO,DWARFA,2,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,DWARFA,1,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,DWARFA,6,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,DWARFA,2,800,ATTACK_ENEMIES,0)

CREATE_PARTY(THREE)
    ADD_TO_PARTY(THREE,WITCH,3,1800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,WITCH,1,1800,ATTACK_ENEMIES,0)

CREATE_PARTY(FOUR)
    ADD_TO_PARTY(FOUR,BARBARIAN,4,900,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,BARBARIAN,6,900,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,BARBARIAN,7,900,ATTACK_ENEMIES,0)


DISPLAY_OBJECTIVE(113,PLAYER0)

IF(PLAYER0,GAME_TURN >= 15000)
    IF(PLAYER1,TOTAL_CREATURES >= 10)
        IF(PLAYER1,DUNGEON_DESTROYED == 0)
            DISPLAY_INFORMATION(114,PLAYER0)
        ENDIF
    ENDIF
ENDIF

IF(PLAYER0,GAME_TURN >= 20000)
    IF(PLAYER2,TOTAL_CREATURES >= 10)
        IF(PLAYER2,DUNGEON_DESTROYED == 0)
            DISPLAY_INFORMATION(115,PLAYER0)
        ENDIF
    ENDIF
ENDIF

IF(PLAYER0,FLAG0 == 0)
    DISPLAY_INFORMATION(117,PLAYER0)
    SET_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER0,FLAG0 == 0)
    DISPLAY_INFORMATION(118,PLAYER0)
    SET_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF_ACTION_POINT(2,PLAYER0)
    IF(PLAYER2,FLAG5 == 0)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,2,1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,2,1)
        SET_FLAG(PLAYER2,FLAG5,1)
    ENDIF
ENDIF

IF_ACTION_POINT(3,PLAYER0)
    IF(PLAYER2,FLAG5 == 0)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,2,1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,2,1)
        SET_FLAG(PLAYER2,FLAG5,1)
    ENDIF
ENDIF

IF_ACTION_POINT(1,PLAYER0)
    SET_TIMER(PLAYER_GOOD,TIMER0)
    IF(PLAYER_GOOD,TIMER0 >= 500)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,4,1)
        IF(PLAYER_GOOD,TIMER0 >= 1000)
            ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,5,1)
        ENDIF
    ENDIF
ENDIF

IF(PLAYER0,DUNGEON_DESTROYED == 1)
    LOSE_GAME
ENDIF

IF(PLAYER1,DUNGEON_DESTROYED == 1)
    IF(PLAYER2,DUNGEON_DESTROYED == 1)
        IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
            WIN_GAME
        ENDIF
    ENDIF
ENDIF
