LEVEL_VERSION(1)
SET_GENERATE_SPEED(600)

REM START MONEY
START_MONEY(PLAYER0,2500)
START_MONEY(PLAYER1,25000)
START_MONEY(PLAYER2,25000)
START_MONEY(PLAYER3,25000)

REM CREATURE LIMIT
MAX_CREATURES(PLAYER0,20)
MAX_CREATURES(PLAYER1,25)
MAX_CREATURES(PLAYER2,25)
MAX_CREATURES(PLAYER3,10)

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

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

ADD_CREATURE_TO_POOL(FLY,10)
ADD_CREATURE_TO_POOL(BUG,10)
ADD_CREATURE_TO_POOL(DEMONSPAWN,10)
ADD_CREATURE_TO_POOL(TROLL,20)
ADD_CREATURE_TO_POOL(SPIDER,10)
ADD_CREATURE_TO_POOL(HELL_HOUND,20)
ADD_CREATURE_TO_POOL(TENTACLE,20)
ADD_CREATURE_TO_POOL(SORCEROR,15)
ADD_CREATURE_TO_POOL(ORC,20)
ADD_CREATURE_TO_POOL(BILE_DEMON,25)
ADD_CREATURE_TO_POOL(DRAGON,30)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,25)

CREATURE_AVAILABLE(ALL_PLAYERS,FLY,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,BUG,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,DEMONSPAWN,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,TROLL,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,SPIDER,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,HELL_HOUND,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,TENTACLE,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,SORCEROR,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,ORC,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,BILE_DEMON,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,DRAGON,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,DARK_MISTRESS,1,0)

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

ROOM_AVAILABLE(PLAYER0,PRISON,0,0)
ROOM_AVAILABLE(PLAYER0,GRAVEYARD,0,0)

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


MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_POSSESS,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_OBEY,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_LIGHTNING,0,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_ARMAGEDDON,1,0)

MAGIC_AVAILABLE(PLAYER0,POWER_IMP,0,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SIGHT,0,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DESTROY_WALLS,0,0)

TRAP_AVAILABLE(ALL_PLAYERS,ALARM,0,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,LIGHTNING,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,LAVA,0,0)
TRAP_AVAILABLE(ALL_PLAYERS,BOULDER,0,0)
TRAP_AVAILABLE(ALL_PLAYERS,WORD_OF_POWER,1,0)

DOOR_AVAILABLE(ALL_PLAYERS,WOOD,0,0)
DOOR_AVAILABLE(ALL_PLAYERS,BRACED,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,STEEL,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,MAGIC,1,0)



REM PARTYS*************************
CREATE_PARTY(ONE)
	ADD_TO_PARTY(ONE,VAMPIRE,7,0,DEFEND_ROOMS,0)
	ADD_TO_PARTY(ONE,VAMPIRE,7,0,DEFEND_ROOMS,0)
	ADD_TO_PARTY(ONE,VAMPIRE,7,0,DEFEND_ROOMS,0)
	
CREATE_PARTY(TWO)
	ADD_TO_PARTY(TWO,GIANT,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TWO,GIANT,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TWO,BARBARIAN,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TWO,BARBARIAN,10,0,ATTACK_ENEMIES,0)

CREATE_PARTY(THREE)
	ADD_TO_PARTY(THREE,HORNY,10,0,DEFEND_ROOMS,0)
	ADD_TO_PARTY(THREE,GHOST,10,0,DEFEND_ROOMS,0)
	ADD_TO_PARTY(THREE,GHOST,10,0,DEFEND_ROOMS,0)
	ADD_TO_PARTY(THREE,GHOST,10,0,DEFEND_ROOMS,0)

CREATE_PARTY(FOUR)
	ADD_TO_PARTY(FOUR,DWARFA,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FOUR,DWARFA,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FOUR,WITCH,10,0,ATTACK_ENEMIES,0)

CREATE_PARTY(FIVE)
	ADD_TO_PARTY(FIVE,MONK,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FIVE,MONK,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FIVE,WIZARD,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FIVE,WIZARD,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FIVE,KNIGHT,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FIVE,SAMURAI,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FIVE,SAMURAI,10,0,ATTACK_ENEMIES,0)


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

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

IF_ACTION_POINT(3,PLAYER0)
	REM "You have entered the sacred chamber of the heroes which holds an artifact of great power. The good gods have sent a mighty force to stop you from stealing it."
	DISPLAY_INFORMATION(123)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,3,1)
ENDIF

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

IF_ACTION_POINT(5,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,5,1)
ENDIF

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



REM "A volcanic eruption has completely devastated this realm and destroyed your dungeon. Most of your creatures got buried alive by debris and the remaining ones got captured by the heroes and hidden in their secret caves. Fortunately, you still have one creature left. The enemy keepers are still weak, but are quickly getting stronger. Hurry up and free your captured creatures to dominate this realm again."
DISPLAY_OBJECTIVE(124)

IF(PLAYER_GOOD,GAME_TURN >= 200)
	REM "Keep this ghost alive at all costs. His abilities are the key to free your creatures and rebuild your dungeon."
	DISPLAY_INFORMATION(125)
ENDIF


IF(PLAYER0,IMP > 0)
	REM "Well done, Keeper! With these Imps you can rebuild your dungeon. Perhaps now is a good time to attack the heroes' dungeon heart. There are rumors that it is still very weak due to the volcanic eruption. Maybe even your little ghost is strong enough to destroy it. It is located to the east of your dungeon."
	DISPLAY_INFORMATION(126)
ENDIF


REM Decrease hero dungeon heart health
ADD_HEART_HEALTH(PLAYER_GOOD,-29000,0)
REM Remove hero heart regeneration
SET_TIMER(PLAYER0,TIMER0)
IF(PLAYER0,TIMER0 >= 8)
	NEXT_COMMAND_REUSABLE
	ADD_HEART_HEALTH(PLAYER_GOOD,-4,0)
	NEXT_COMMAND_REUSABLE
	SET_TIMER(PLAYER0,TIMER0)
ENDIF


REM special box ***********
REM "Mjollnir: Hammer of Thor."
SET_BOX_TOOLTIP_ID(1,127)

IF(PLAYER0, BOX1_ACTIVATED > 0)
	TUTORIAL_FLASH_BUTTON(25,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_LIGHTNING,1,1)
	REM "You can feel the power of the thunder god Thor coursing through your veins. You are now able to cast Lightning Strike!"
	DISPLAY_INFORMATION(128)
ENDIF



IF(PLAYER_GOOD,DUNGEON_DESTROYED == 1)
	ROOM_AVAILABLE(PLAYER0,BRIDGE,1,1)
	TUTORIAL_FLASH_BUTTON(18,200)
	REM "Destroying the heroes' dungeon heart has given you the ability to build bridges again. There are probably more of your creatures hidden somewhere in this realm. Try to free them or maybe claim an entrance from one of the enemy keepers to build an army."
	DISPLAY_INFORMATION(129)
ENDIF


REM Give enemy keeper bridge when enemy keepers are killed
IF(PLAYER3,DUNGEON_DESTROYED == 1)
	ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,1)
ENDIF

IF(PLAYER2,DUNGEON_DESTROYED == 1)
	ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,1)
ENDIF

IF(PLAYER1,DUNGEON_DESTROYED == 1)
	ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,1)
ENDIF


IF(PLAYER0,ALL_DUNGEONS_DESTROYED == 1)
	WIN_GAME
ENDIF
