REM -------------------------------------------------------------------------------------------------------------------------------------------
REM Undead Keeper
REM Drachenfeld
REM Made by Duke Ragereaver
REM -------------------------------------------------------------------------------------------------------------------------------------------

COMPUTER_PLAYER(PLAYER1,1)
COMPUTER_PLAYER(PLAYER2,1)
COMPUTER_PLAYER(PLAYER3,0)

ALLY_PLAYERS(PLAYER1,PLAYER3)
ALLY_PLAYERS(PLAYER2,PLAYER3)
ALLY_PLAYERS(PLAYER1,PLAYER2)

SET_COMPUTER_PROCESS(PLAYER1,"BUILD A GRAVEYARD ROOM",0,5,6,11,0)

REM "You are outnumbered here, so use the land itself to your advantage. Speaking of that; this ancient realm is full of riches, all for you for the taking. Also, your library has been captured by some vile rogue warlocks in the east, make them regret it with their lifes."
DISPLAY_OBJECTIVE(11,PLAYER0)

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

START_MONEY(PLAYER0,30000)
START_MONEY(PLAYER1,250000)
START_MONEY(PLAYER2,250000)
START_MONEY(PLAYER3,250000)


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

SET_GENERATE_SPEED(500)
ADD_CREATURE_TO_POOL(TROLL,20)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,30)
ADD_CREATURE_TO_POOL(SKELETON,25)
ADD_CREATURE_TO_POOL(BILE_DEMON,12)
ADD_CREATURE_TO_POOL(SORCEROR,20)
ADD_CREATURE_TO_POOL(ORC,30)
ADD_CREATURE_TO_POOL(DRAGON,7)
ADD_CREATURE_TO_POOL(SPIDER,10)
ADD_CREATURE_TO_POOL(TENTACLE,20)
ADD_CREATURE_TO_POOL(VAMPIRE,5)
ADD_CREATURE_TO_POOL(GHOST,15)

SET_CREATURE_HEALTH(DRAGON,950)

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

MAX_CREATURES(PLAYER0,27)
MAX_CREATURES(PLAYER1,17)
MAX_CREATURES(PLAYER2,20)
MAX_CREATURES(PLAYER3,26)

IF(PLAYER0,TOTAL_CREATURES >= 24)
	MAX_CREATURES(PLAYER2,24)
	MAX_CREATURES(PLAYER3,34)
ENDIF

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

REM Human player

CREATURE_AVAILABLE(PLAYER0,SKELETON,1,1)
CREATURE_AVAILABLE(PLAYER0,GHOST,1,1)
CREATURE_AVAILABLE(PLAYER0,VAMPIRE,1,1)

REM Blue Keeper

CREATURE_AVAILABLE(PLAYER1,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER1,VAMPIRE,1,1)
CREATURE_AVAILABLE(PLAYER1,DRAGON,1,1)
CREATURE_AVAILABLE(PLAYER1,TENTACLE,1,1)
CREATURE_AVAILABLE(PLAYER1,TROLL,1,1)

REM Green Keeper

CREATURE_AVAILABLE(PLAYER2,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER2,TROLL,1,1)
CREATURE_AVAILABLE(PLAYER2,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER2,SORCEROR,1,1)
CREATURE_AVAILABLE(PLAYER2,ORC,1,1)
CREATURE_AVAILABLE(PLAYER2,DRAGON,1,1)
CREATURE_AVAILABLE(PLAYER2,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER2,TENTACLE,1,1)

REM Yellow Keeper

CREATURE_AVAILABLE(PLAYER3,TROLL,1,1)
CREATURE_AVAILABLE(PLAYER3,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER3,SORCEROR,1,1)
CREATURE_AVAILABLE(PLAYER3,ORC,1,1)
CREATURE_AVAILABLE(PLAYER3,DRAGON,1,1)
CREATURE_AVAILABLE(PLAYER3,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER3,TENTACLE,1,1)


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

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

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

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

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

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

IF(PLAYER0,TORTURE > 0)
    ROOM_AVAILABLE(ALL_PLAYERS,TORTURE,1,1)
ENDIF

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

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_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(PLAYER2,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(PLAYER1,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(PLAYER3,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(PLAYER3,POWER_LIGHTNING,1,0)

REM Human player
MAGIC_AVAILABLE(PLAYER0,POWER_DISEASE,1,0)


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

DOOR_AVAILABLE(ALL_PLAYERS,STEEL,1,0)
DOOR_AVAILABLE(PLAYER1,MAGIC,1,0)
DOOR_AVAILABLE(PLAYER2,MAGIC,1,0)
DOOR_AVAILABLE(PLAYER3,MAGIC,1,0)

TRAP_AVAILABLE(PLAYER0,ALARM,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
TRAP_AVAILABLE(PLAYER1,LIGHTNING,1,0)
TRAP_AVAILABLE(PLAYER2,LIGHTNING,1,0)
TRAP_AVAILABLE(PLAYER3,LIGHTNING,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,WORD_OF_POWER,1,0)

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

CREATE_PARTY(HELP1)
    ADD_TO_PARTY(HELP1,DEMONSPAWN,2,300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HELP1,DEMONSPAWN,2,300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HELP1,SPIDER,2,300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HELP1,SPIDER,2,300,ATTACK_ENEMIES,0)

CREATE_PARTY(HELP2)
    ADD_TO_PARTY(HELP2,HELL_HOUND,4,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HELP2,HELL_HOUND,4,400,ATTACK_ENEMIES,0)

CREATE_PARTY(HELP3)
    ADD_TO_PARTY(HELP3,HORNY,2,1000,ATTACK_DUNGEON_HEART,0)

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

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

IF(PLAYER_GOOD,TIMER0 >= 50)
    IF(PLAYER_GOOD,SORCEROR > 0)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HELP1,2,1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 200)
    IF(PLAYER_GOOD,SORCEROR > 0)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HELP2,2,1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 450)
    IF(PLAYER_GOOD,SORCEROR > 0)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HELP3,2,1)
    ENDIF
ENDIF

IF_ACTION_POINT(3,PLAYER0)
    ROOM_AVAILABLE(PLAYER0,BRIDGE,1,1)
    TUTORIAL_FLASH_BUTTON(18,PLAYER0)
ENDIF

IF(PLAYER0,RESEARCH >= 1)
    REM "Excellent, now we can research spells and rooms!"
    DISPLAY_OBJECTIVE(12,PLAYER0)
ENDIF


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

IF(PLAYER0,ALL_DUNGEONS_DESTROYED == 1)
    REM "Another one bites the dust. Let us not waste too much time on these rookies, there are more challenges on the horizon."
    DISPLAY_OBJECTIVE(13,PLAYER0)
    WIN_GAME
ENDIF
