REM -------------------------------------------------------------------------------------------------------------------------------------------
REM Post Undead Keeper
REM Chaerith
REM Made by Duke Ragereaver
REM -------------------------------------------------------------------------------------------------------------------------------------------

COMPUTER_PLAYER(PLAYER3,0)

REM -------------------------------------------------------------------------------------------------------------------------------------------
START_MONEY(PLAYER0,10000)
START_MONEY(PLAYER3,100000)

REM -------------------------------------------------------------------------------------------------------------------------------------------

MAX_CREATURES(PLAYER0,17)
MAX_CREATURES(PLAYER3,32)

REM -------------------------------------------------------------------------------------------------------------------------------------------

SET_GENERATE_SPEED(700)
ADD_CREATURE_TO_POOL(SPIDER,20)
ADD_CREATURE_TO_POOL(GHOST,20)
ADD_CREATURE_TO_POOL(VAMPIRE,1)

REM -------------------------------------------------------------------------------------------------------------------------------------------

CREATURE_AVAILABLE(ALL_PLAYERS,GHOST,1,1)
CREATURE_AVAILABLE(PLAYER3,VAMPIRE,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,SPIDER,1,1)

REM -------------------------------------------------------------------------------------------------------------------------------------------

ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,GARDEN,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TRAINING,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,RESEARCH,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,WORKSHOP,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,GUARD_POST,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TORTURE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TREASURE,1,1)
ROOM_AVAILABLE(PLAYER3,TEMPLE,1,0)
ROOM_AVAILABLE(PLAYER3,GRAVEYARD,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,0)

SET_COMPUTER_PROCESS(PLAYER3,"BUILD A GRAVEYARD ROOM",0,5,6,11,0)
SET_TIMER(PLAYER0,TIMER0)
SET_TIMER(PLAYER3,TIMER0)

IF(PLAYER0,TIMER0 >= 700)
    IF(PLAYER0,TOTAL_CREATURES < 17)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER0,SKELETON,1,1,1,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER0,TIMER0)
    ENDIF
ENDIF

IF(PLAYER0,TIMER2 >= 700)
    IF(PLAYER3,TOTAL_CREATURES < 32)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER3,SKELETON,2,1,1,0)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER3,TIMER0)
    ENDIF
ENDIF

IF(PLAYER3,WORKSHOP >= 72)
    NEXT_COMMAND_REUSABLE
    ROOM_AVAILABLE(PLAYER3,WORKSHOP,0,0)
ENDIF

IF(PLAYER3,WORKSHOP < 72)
    NEXT_COMMAND_REUSABLE
    ROOM_AVAILABLE(PLAYER3,WORKSHOP,1,1)
ENDIF

REM -------------------------------------------------------------------------------------------------------------------------------------------


MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)
MAGIC_AVAILABLE(PLAYER3,POWER_SIGHT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(PLAYER1,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(PLAYER3,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,1,0)

REM -------------------------------------------------------------------------------------------------------------------------------------------

TRAP_AVAILABLE(PLAYER0,ALARM,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,STEEL,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,LAVA,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,MAGIC,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,LIGHTNING,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,WORD_OF_POWER,1,0)

REM -------------------------------------------------------------------------------------------------------------------------------------------

CREATE_PARTY(ONE)
    ADD_TO_PARTY(ONE,THIEF,5,200,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,THIEF,4,150,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,THIEF,4,300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,ARCHER,4,250,DEFEND_PARTY,0)
    ADD_TO_PARTY(ONE,DWARFA,3,200,STEAL_GOLD,0)

CREATE_PARTY(TWO)
    ADD_TO_PARTY(TWO,BARBARIAN,4,300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,BARBARIAN,5,350,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(TWO,ARCHER,4,250,DEFEND_PARTY,0)
    ADD_TO_PARTY(TWO,ARCHER,5,300,DEFEND_PARTY,0)

CREATE_PARTY(THREE)
    ADD_TO_PARTY(THREE,MONK,5,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,MONK,4,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(THREE,ARCHER,3,300,DEFEND_PARTY,0)
    ADD_TO_PARTY(THREE,ARCHER,3,300,DEFEND_PARTY,0)

CREATE_PARTY(FOUR)
    ADD_TO_PARTY(FOUR,SAMURAI,7,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,GIANT,6,750,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(FOUR,WIZARD,7,400,DEFEND_PARTY,0)
    ADD_TO_PARTY(FOUR,ARCHER,6,400,DEFEND_PARTY,0)

CREATE_PARTY(BRUTES)
    ADD_TO_PARTY(BRUTES,GIANT,6,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRUTES,GIANT,6,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRUTES,GIANT,6,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRUTES,GIANT,6,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRUTES,GIANT,6,400,DEFEND_PARTY,0)
    ADD_TO_PARTY(BRUTES,GIANT,6,400,DEFEND_PARTY,0)

CREATE_PARTY(SCOUTS)
    ADD_TO_PARTY(SCOUTS,DWARFA,8,500,STEAL_GOLD,0)
    ADD_TO_PARTY(SCOUTS,THIEF,8,600,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(SCOUTS,THIEF,8,500,DEFEND_PARTY,0)
    ADD_TO_PARTY(SCOUTS,THIEF,8,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(SCOUTS,ARCHER,9,300,DEFEND_PARTY,0)
    ADD_TO_PARTY(SCOUTS,ARCHER,8,200,DEFEND_PARTY,0)
    ADD_TO_PARTY(SCOUTS,ARCHER,8,200,DEFEND_PARTY,0)

CREATE_PARTY(MYSTIC)
    ADD_TO_PARTY(MYSTIC,MONK,8,500,DEFEND_PARTY,0)
    ADD_TO_PARTY(MYSTIC,WIZARD,8,750,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(MYSTIC,MONK,9,1000,DEFEND_PARTY,0)
    ADD_TO_PARTY(MYSTIC,WITCH,8,500,STEAL_SPELLS,0)
    ADD_TO_PARTY(MYSTIC,SAMURAI,8,500,DEFEND_PARTY,0)

CREATE_PARTY(ELITES)
    ADD_TO_PARTY(ELITES,KNIGHT,10,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ELITES,WIZARD,8,1250,STEAL_SPELLS,0)
    ADD_TO_PARTY(ELITES,BARBARIAN,8,800,DEFEND_PARTY,0)
    ADD_TO_PARTY(ELITES,GIANT,8,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ELITES,SAMURAI,9,750,DEFEND_PARTY,0)
    ADD_TO_PARTY(ELITES,BARBARIAN,8,800,DEFEND_PARTY,0)
    ADD_TO_PARTY(ELITES,GIANT,8,800,ATTACK_ENEMIES,0)


REM -------------------------------------------------------------------------------------------------------------------------------------------

QUICK_OBJECTIVE(0,"The Heroes have restored a fortress here that belonged to some legendary Samurai warrior. Alas, he was slain along with his men and his castle fell into ruin. I must say this was not a smart move on the Heroes' part because the piles of corpses will provide you with a steady amount of warriors. However, you are not the only one with the ability of necromancy, Nex seeks to make this realm a paradise of darkness. Destroy her, and raze this fortress to the ground. It seems like deja vu all over again!",PLAYER0)

IF_ACTION_POINT(3,PLAYER0)
    SET_TIMER(PLAYER_GOOD,TIMER0)
ENDIF

IF_ACTION_POINT(4,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,-1,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,-1,1)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 1750)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,-1,1)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 3750)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,-2,1)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 5000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,-1,1)
ENDIF

IF_ACTION_POINT(5,PLAYER0)
    SET_TIMER(PLAYER_GOOD,TIMER1)
ENDIF

IF(PLAYER_GOOD,TIMER1 >= 1875)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BRUTES,-3,1)
ENDIF

IF(PLAYER_GOOD,TIMER1 >= 3750)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,-4,1)
ENDIF

IF_ACTION_POINT(6,PLAYER0)
    SET_TIMER(PLAYER_GOOD,TIMER2)
ENDIF

IF(PLAYER_GOOD,TIMER2 >= 500)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BRUTES,-5,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SCOUTS,-6,1)
ENDIF

IF(PLAYER_GOOD,TIMER2 >= 1500)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MYSTIC,-8,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ELITES,-7,1)
    SET_FLAG(PLAYER_GOOD,FLAG1,1)
ENDIF

IF(PLAYER0,ALL_DUNGEONS_DESTROYED == 1)
    IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
        IF(PLAYER_GOOD,FLAG1 == 1)
            QUICK_OBJECTIVE(1,"Nex wanted to make this realm a paradise of darkness. It will be one but, rightfully, under your banner!",PLAYER0)
            WIN_GAME
        ENDIF
    ENDIF
ENDIF
