REM KDK Level 16

SET_GENERATE_SPEED(750)

MAX_CREATURES(PLAYER0,24)
MAX_CREATURES(PLAYER1,26)

START_MONEY(PLAYER0,20000)
START_MONEY(PLAYER1,48950)

REM Computer Player stuff
COMPUTER_PLAYER(PLAYER1,0)
SET_COMPUTER_CHECKS(PLAYER1,"CHECK FOR NEUTRAL PLACES",15000,0,0,0,65000)
REM CheckEvery	AttackPercent	CTADuration	MinForAttack	LastCheck
SET_COMPUTER_CHECKS(PLAYER1,"CHECK FOR QUICK ATTACK",700,70,3000,8,12500)
SET_COMPUTER_PROCESS(PLAYER1,"ATTACK SAFE ATTACK",-1,100,17,100,0)
SET_COMPUTER_PROCESS(PLAYER1,"ATTACK PLAN 1",-1,100,17,100,0)

ADD_CREATURE_TO_POOL(TROLL,14)
ADD_CREATURE_TO_POOL(HELL_HOUND,5)
ADD_CREATURE_TO_POOL(SPIDER,9)
ADD_CREATURE_TO_POOL(DEMONSPAWN,10)
ADD_CREATURE_TO_POOL(ORC,20)
ADD_CREATURE_TO_POOL(BILE_DEMON,5)
ADD_CREATURE_TO_POOL(TENTACLE,8)
ADD_CREATURE_TO_POOL(SKELETON,9)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,6)
ADD_CREATURE_TO_POOL(SORCEROR,21)
ADD_CREATURE_TO_POOL(DRAGON,40)

CREATURE_AVAILABLE(PLAYER1,SKELETON,1,1)
CREATURE_AVAILABLE(PLAYER1,TENTACLE,1,1)
CREATURE_AVAILABLE(PLAYER1,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER1,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER1,DEMONSPAWN,1,1)
CREATURE_AVAILABLE(PLAYER1,DRAGON,1,1)
CREATURE_AVAILABLE(PLAYER1,TROLL,1,1)
CREATURE_AVAILABLE(PLAYER0,TROLL,1,1)
CREATURE_AVAILABLE(PLAYER0,HELL_HOUND,1,1)
CREATURE_AVAILABLE(PLAYER0,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,1)
CREATURE_AVAILABLE(PLAYER0,DRAGON,1,1)

REM Spells

MAGIC_AVAILABLE(PLAYER1,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(PLAYER1,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(PLAYER1,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_OBEY,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_POSSESS,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_SIGHT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,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)

REM Room_Availability

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

REM doors & traps

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

CREATE_PARTY(ONE)
    ADD_TO_PARTY(ONE,ARCHER,5,750,ATTACK_ENEMIES,200)
    ADD_TO_PARTY(ONE,ARCHER,5,750,ATTACK_ENEMIES,200)
    ADD_TO_PARTY(ONE,ARCHER,5,750,ATTACK_ENEMIES,200)
    ADD_TO_PARTY(ONE,THIEF,7,1750,ATTACK_ENEMIES,200)


CREATE_PARTY(TWO)
    ADD_TO_PARTY(TWO,DWARFA,5,800,ATTACK_ENEMIES,50)
    ADD_TO_PARTY(TWO,DWARFA,5,800,ATTACK_ENEMIES,50)
    ADD_TO_PARTY(TWO,DWARFA,5,800,ATTACK_ENEMIES,50)
    ADD_TO_PARTY(TWO,DWARFA,5,800,ATTACK_ENEMIES,50)
    ADD_TO_PARTY(TWO,ARCHER,5,800,ATTACK_ENEMIES,50)

CREATE_PARTY(THREE)
    ADD_TO_PARTY(THREE,BARBARIAN,6,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,BARBARIAN,6,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,BARBARIAN,6,1000,ATTACK_ENEMIES,0)


CREATE_PARTY(FOUR)
    ADD_TO_PARTY(FOUR,WIZARD,5,1200,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,WIZARD,5,1200,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,WIZARD,5,1200,ATTACK_ENEMIES,0)

CREATE_PARTY(FIVE)
    ADD_TO_PARTY(FIVE,GIANT,8,2000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FIVE,ARCHER,2,300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FIVE,ARCHER,2,300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FIVE,ARCHER,2,300,ATTACK_ENEMIES,0)

CREATE_PARTY(SIX)
    ADD_TO_PARTY(SIX,THIEF,7,2000,STEAL_GOLD,0)
    ADD_TO_PARTY(SIX,THIEF,6,2000,STEAL_GOLD,0)
    ADD_TO_PARTY(SIX,THIEF,6,2000,STEAL_GOLD,0)
    ADD_TO_PARTY(SIX,THIEF,6,2000,STEAL_GOLD,0)

CREATE_PARTY(SEVEN)
    ADD_TO_PARTY(SEVEN,WITCH,4,1200,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(SEVEN,WITCH,4,1200,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(SEVEN,WITCH,4,1200,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(SEVEN,WITCH,4,1200,ATTACK_ENEMIES,0)

CREATE_PARTY(ELITE)
    ADD_TO_PARTY(ELITE,SAMURAI,9,4000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ELITE,WIZARD,8,2000,STEAL_SPELLS,0)
    ADD_TO_PARTY(ELITE,BARBARIAN,8,2000,STEAL_GOLD,0)
    ADD_TO_PARTY(ELITE,GIANT,7,2000,STEAL_SPELLS,0)

REM CREATE_TEXT(0,120"MAKE HASTE TO SUBJUGATE YOUR ADVERSARY HERE, YOU WILL NOT FIND ANY EASY PATH THROUGH THIS LEVEL, YOU MUST FIGHT FOR EVERY ADVANTAGE.")
DISPLAY_OBJECTIVE(120,PLAYER0)

IF_ACTION_POINT(1,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,2,1)
ENDIF

IF_ACTION_POINT(4,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,-1,1)
    SET_TIMER(PLAYER_GOOD,TIMER0)
    IF(PLAYER_GOOD,TIMER0 >= 1500)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,-1,1)
    ENDIF
ENDIF

IF_ACTION_POINT(7,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,-4,1)
ENDIF

IF_ACTION_POINT(6,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIVE,-5,1)
ENDIF

IF_ACTION_POINT(5,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SIX,-3,1)
ENDIF

IF_ACTION_POINT(3,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SEVEN,-2,1)
ENDIF

IF_ACTION_POINT(8,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,three,9,1)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,10,DUNGEON,0,6,500)
ENDIF

IF(PLAYER0,TOTAL_CREATURES >= 17)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,10,DUNGEON,0,6,500)
ENDIF

IF(PLAYER1,TOTAL_CREATURES >= 17)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,10,DUNGEON,1,6,500)
ENDIF

IF(PLAYER0,DUNGEON_DESTROYED == 1)
    LOSE_GAME
ENDIF

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