REM KDK Level 17

START_MONEY(PLAYER0,27800)
SET_GENERATE_SPEED(350)
MAX_CREATURES(PLAYER0,18)

SET_CREATURE_MAX_LEVEL(PLAYER0,DEMONSPAWN,10)

ADD_CREATURE_TO_POOL(BUG,5)
ADD_CREATURE_TO_POOL(ORC,30)
ADD_CREATURE_TO_POOL(TENTACLE,15)
ADD_CREATURE_TO_POOL(VAMPIRE,3)
ADD_CREATURE_TO_POOL(BILE_DEMON,9)
ADD_CREATURE_TO_POOL(SORCEROR,7)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,15)
ADD_CREATURE_TO_POOL(DRAGON,5)
ADD_CREATURE_TO_POOL(TROLL,7)
ADD_CREATURE_TO_POOL(FLY,8)
ADD_CREATURE_TO_POOL(DEMONSPAWN,2)

CREATURE_AVAILABLE(PLAYER_GOOD,MONK,1,1)
CREATURE_AVAILABLE(PLAYER_GOOD,THIEF,1,1)
CREATURE_AVAILABLE(PLAYER_GOOD,TUNNELLER,1,1)
CREATURE_AVAILABLE(PLAYER_GOOD,KNIGHT,1,1)
CREATURE_AVAILABLE(PLAYER0,TROLL,1,1)
CREATURE_AVAILABLE(PLAYER0,ORC,1,1)
CREATURE_AVAILABLE(PLAYER0,TENTACLE,1,1)
CREATURE_AVAILABLE(PLAYER0,VAMPIRE,1,1)
CREATURE_AVAILABLE(PLAYER0,BUG,1,1)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,1)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER0,FLY,1,1)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,1)
CREATURE_AVAILABLE(PLAYER0,DRAGON,1,1)

MAGIC_AVAILABLE(PLAYER0,POWER_SPEED,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_DESTROY_WALLS,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_HAND,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_SLAP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_POSSESS,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_SIGHT,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_HEAL_CREATURE,1,0)

ROOM_AVAILABLE(PLAYER0,GRAVEYARD,1,0)
ROOM_AVAILABLE(PLAYER0,TRAINING,1,1)
ROOM_AVAILABLE(PLAYER0,TREASURE,1,1)
ROOM_AVAILABLE(PLAYER0,GARDEN,1,1)
ROOM_AVAILABLE(PLAYER0,RESEARCH,1,1)
ROOM_AVAILABLE(PLAYER0,LAIR,1,1)
ROOM_AVAILABLE(PLAYER0,PRISON,1,0)
ROOM_AVAILABLE(PLAYER0,TEMPLE,1,0)
ROOM_AVAILABLE(PLAYER0,BRIDGE,1,0)
ROOM_AVAILABLE(PLAYER0,TORTURE,1,0)


SET_TIMER(PLAYER0,TIMER0)

IF(PLAYER0,TIMER0 >= 1000)
    REM CREATE_TEXT(21,22"WHEN YOUR IMPS HAVE NO ACTIVE TASKS, THEY WILL RUN AROUND REINFORCING YOUR DUNGEON.  ROOMS WITH REINFORCED WALLS ARE MORE EFFICIENT.")
    DISPLAY_INFORMATION(22,PLAYER0)
ENDIF

CREATE_PARTY(THIEVES)
    ADD_TO_PARTY(THIEVES,THIEF,1,200,STEAL_GOLD,0)

CREATE_PARTY(DWARVES)
    ADD_TO_PARTY(DWARVES,DWARFA,1,200,ATTACK_ENEMIES,0)

CREATE_PARTY(ELITE)
    ADD_TO_PARTY(ELITE,DWARFA,1,200,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ELITE,THIEF,1,200,ATTACK_ENEMIES,0)

SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,KNIGHT,2)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,THIEF,2)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,DWARFA,2)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,TUNNELLER,2)

SET_CREATURE_STRENGTH(KNIGHT,40)
SET_CREATURE_ARMOUR(KNIGHT,50)


CREATE_PARTY(KNIGHT)
    ADD_TO_PARTY(KNIGHT,KNIGHT,1,2000,ATTACK_ENEMIES,0)

REM CREATE_TEXT(15,23"POSSESS CREATURES BY CHOOSING THE POSSESS SPELL FROM THE SPELLS MENU AND LEFT-CLICK ON THE CREATURE YOU WANT TO CONTROL.  RIGHT-CLICK TO GET BACK TO NORMAL VIEW.")
DISPLAY_INFORMATION(23,PLAYER0)
REM CREATE_TEXT(2,24"FIRST OF ALL, ESTABLISH A BASIC DUNGEON.  REMEMBER, YOU WILL NEED TO BUILD A TREASURE ROOM, A LAIR AND A HATCHERY AND YOU WILL ALSO NEED TO CLAIM A CREATURE ENTRANCE.")
DISPLAY_OBJECTIVE(24,PLAYER0)


IF(PLAYER0,LAIR >= 9)
    SET_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER0,TREASURE >= 9)
    SET_FLAG(PLAYER0,FLAG5,1)
ENDIF

IF(PLAYER0,GARDEN >= 9)
    SET_FLAG(PLAYER0,FLAG6,1)
ENDIF

IF(PLAYER0,ENTRANCE > 0)
    SET_FLAG(PLAYER0,FLAG2,1)
ENDIF

IF(PLAYER0,FLAG0 == 1)
    IF(PLAYER0,FLAG5 == 1)
        IF(PLAYER0,FLAG6 == 1)
            IF(PLAYER0,FLAG2 == 1)
                TUTORIAL_FLASH_BUTTON(10,-1)
                REM CREATE_TEXT(30,25"YOU WILL NEED STRONGER CREATURES.  BUILD A 3X3 TRAINING ROOM TO MAKE YOUR CREATURES STRONGER, AND TO GIVE THEM NEW SPELLS AND ABILITIES.")
                DISPLAY_OBJECTIVE(25,PLAYER0)
                SET_FLAG(PLAYER0,FLAG0,2)
                SET_TIMER(PLAYER0,TIMER2)
            ENDIF
        ENDIF
    ENDIF
ENDIF

IF(PLAYER0,FLAG0 != 2)
    IF(PLAYER0,GAME_TURN > 10000)
        IF(PLAYER0,LAIR > 0)
            IF(PLAYER0,TREASURE > 0)
                IF(PLAYER0,GARDEN > 0)
                    IF(PLAYER0,ENTRANCE > 0)
                        TUTORIAL_FLASH_BUTTON(10,-1)
                        REM CREATE_TEXT(30,25"YOU WILL NEED STRONGER CREATURES.  BUILD A 3X3 TRAINING ROOM TO MAKE YOUR CREATURES STRONGER, AND TO GIVE THEM NEW SPELLS AND ABILITIES.")
                        DISPLAY_OBJECTIVE(25,PLAYER0)
                        SET_TIMER(PLAYER0,TIMER2)
                        SET_FLAG(PLAYER0,FLAG0,2)
                    ENDIF
                ENDIF
            ENDIF
        ENDIF
    ENDIF
ENDIF


IF(PLAYER0,TRAINING >= 9)
    SET_FLAG(PLAYER0,FLAG3,1)
ENDIF

IF(PLAYER0,TIMER2 > 7000)
    IF(PLAYER0,TRAINING > 0)
        SET_FLAG(PLAYER0,FLAG3,1)
    ENDIF
ENDIF


IF(PLAYER0,FLAG3 == 1)
    REM CREATE_TEXT(25,26"GOOD.  NOW GET YOUR IMPS TO FORTIFY THE WALLS IN YOUR ROOMS.  THIS WILL INCREASE THE EFFICIENCY OF THE ROOMS AND REPEL INVADERS.")
    DISPLAY_OBJECTIVE(26,PLAYER0)
    REM CREATE_TEXT(32,27"A TRAINING ROOM WILL ATTRACT FIGHTERS, ESPECIALLY DEMON SPAWN.  FIGHTERS ARE GOOD FOR TRAINING.")
    DISPLAY_INFORMATION(27,PLAYER0)
    IF(PLAYER0,DEMONSPAWN > 0)
        REM CREATE_TEXT(31,28"TO TRAIN CREATURES, PUT THEM IN THE TRAINING ROOM.  THE NUMBER THAT YOU WILL SEE COMING OUT IS THE AMOUNT IT COSTS A CREATURE TO TRAIN.")
        DISPLAY_INFORMATION(28,PLAYER0)
    ENDIF
ENDIF

REM info to tell player to slap creatures
IF(PLAYER0,DEMONSPAWN > 0)
    REM CREATE_TEXT(35,29"REMEMBER, YOU CAN SPEED UP THE CREATURES TRAINING BY SLAPPING THEM WHILE THEY'RE IN THE TRAINING ROOM.")
    DISPLAY_INFORMATION(29,PLAYER0)
ENDIF


IF(PLAYER0,DEMONSPAWN >= 2)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,THIEVES,1,DUNGEON,0,1,500)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,DWARVES,1,1)
    REM CREATE_TEXT(33,30"THE HEROES ARE ON THEIR WAY.  MAKE SURE YOUR CREATURES ARE WELL TRAINED AND READY FOR THE ATTACK.")
    DISPLAY_OBJECTIVE(30,PLAYER0)
    IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
        IF(PLAYER0,TOTAL_CREATURES >= 8)
            ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,-1,DUNGEON,0,1,500)
            IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
                IF(PLAYER0,TOTAL_CREATURES >= 8)
                    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT,-1,1)
                    IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
                        REM CREATE_TEXT(34,31"CONGRATULATIONS.  YOU HAVE CONQUERED THE ENEMY HORDES.")
                        DISPLAY_OBJECTIVE(31,PLAYER0)
                        WIN_GAME
                    ENDIF
                ENDIF
            ENDIF
        ENDIF
    ENDIF
ENDIF


IF_ACTION_POINT(2,PLAYER0)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,THIEVES,1,DUNGEON,0,1,500)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,DWARVES,1,1)
    REM CREATE_TEXT(33,32"THE HEROES ARE ON THEIR WAY.  MAKE SURE YOUR CREATURES ARE WELL TRAINED AND READY FOR THE ATTACK.")
    DISPLAY_OBJECTIVE(32,PLAYER0)
    IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
        IF(PLAYER0,TOTAL_CREATURES >= 8)
            ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,-1,DUNGEON,0,1,500)
            IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
                IF(PLAYER0,TOTAL_CREATURES >= 8)
                    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT,-1,1)
                    IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
                        REM CREATE_TEXT(34,33"CONGRATULATIONS.  YOU HAVE CONQUERED THE ENEMY HORDES.")
                        DISPLAY_OBJECTIVE(33,PLAYER0)
                        WIN_GAME
                    ENDIF
                ENDIF
            ENDIF
        ENDIF
    ENDIF
ENDIF
