
SET_GENERATE_SPEED(400)

MAX_CREATURES(PLAYER0,15)
MAX_CREATURES(PLAYER1,10)


START_MONEY(PLAYER0,5000)
START_MONEY(PLAYER1,5000)


COMPUTER_PLAYER(PLAYER1,0)


ADD_CREATURE_TO_POOL(SORCEROR,20)
ADD_CREATURE_TO_POOL(DRAGON,25)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,20)
ADD_CREATURE_TO_POOL(BILE_DEMON,15)
ADD_CREATURE_TO_POOL(DEMONSPAWN,5)
ADD_CREATURE_TO_POOL(ORC,25)
ADD_CREATURE_TO_POOL(TROLL,3)
ADD_CREATURE_TO_POOL(TENTACLE,6)
ADD_CREATURE_TO_POOL(HELL_HOUND,20)


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


ROOM_AVAILABLE(ALL_PLAYERS,TORTURE,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,PRISON,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TREASURE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,GARDEN,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TRAINING,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,RESEARCH,1,0)


MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)


DOOR_AVAILABLE(ALL_PLAYERS,WOOD,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)



DISPLAY_OBJECTIVE(84,PLAYER0)


REM **** PARTYS ********

CREATE_PARTY(ONE)
	ADD_TO_PARTY(ONE,THIEF,3,1000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(ONE,BARBARIAN,5,1000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(ONE,THIEF,3,1000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(ONE,THIEF,3,1000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(ONE,THIEF,3,1000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(ONE,THIEF,3,1000,ATTACK_ENEMIES,0)

CREATE_PARTY(TWO)
	ADD_TO_PARTY(TWO,ARCHER,5,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TWO,BARBARIAN,7,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TWO,ARCHER,5,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TWO,ARCHER,5,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TWO,ARCHER,5,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TWO,ARCHER,5,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TWO,ARCHER,5,500,ATTACK_ENEMIES,0)

CREATE_PARTY(THREE)
	ADD_TO_PARTY(THREE,WIZARD,5,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(THREE,BARBARIAN,8,2000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(THREE,WIZARD,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(THREE,WIZARD,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(THREE,WIZARD,5,0,ATTACK_ENEMIES,0)

CREATE_PARTY(FOUR)
	ADD_TO_PARTY(FOUR,WIZARD,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FOUR,WIZARD,9,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FOUR,WIZARD,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FOUR,WIZARD,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FOUR,WITCH,9,1000,ATTACK_ENEMIES,0)

CREATE_PARTY(FIVE)
	ADD_TO_PARTY(FIVE,WIZARD,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FIVE,WIZARD,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FIVE,WIZARD,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FIVE,WIZARD,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FIVE,WIZARD,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(FIVE,WIZARD,8,0,ATTACK_ENEMIES,0)

CREATE_PARTY(DEFEND1)
	ADD_TO_PARTY(DEFEND1,VAMPIRE,9,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DEFEND1,VAMPIRE,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DEFEND1,VAMPIRE,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DEFEND1,VAMMPIRE,7,0,ATTACK_ENEMIES,0)

CREATE_PARTY(DEFEND2)
	ADD_TO_PARTY(DEFEND2,MONK,9,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DEFEND2,MONK,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DEFEND2,MONK,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DEFEND2,MONK,7,0,ATTACK_ENEMIES,0)

CREATE_PARTY(DEFEND3)
	ADD_TO_PARTY(DEFEND3,VAMPIRE,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DEFEND3,VAMPIRE,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DEFEND3,VAMPIRE,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DEFEND3,MONK,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DEFEND3,MONK,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DEFEND3,MONK,10,0,ATTACK_ENEMIES,0)


CREATE_PARTY(TROUBLE)
	ADD_TO_PARTY(TROUBLE,ARCHER,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TROUBLE,ARCHER,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TROUBLE,ARCHER,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TROUBLE,ARCHER,10,0,ATTACK_ENEMIES,0)

CREATE_PARTY(KNIGHT)
	ADD_TO_PARTY(KNIGHT,AVATAR,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(KNIGHT,AVATAR,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(KNIGHT,AVATAR,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(KNIGHT,AVATAR,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(KNIGHT,AVATAR,10,0,ATTACK_ENEMIES,0)


REM **** FIND ROOMS ********

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

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

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

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

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

IF(PLAYER0,WORKSHOP > 0)
	ROOM_AVAILABLE(ALL_PLAYERS,WORKSHOP,1,1)
	ADD_CREATURE_TO_POOL( TROLL, 1)
ENDIF

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




REM **** ACTIONS ********

IF(PLAYER1,DUNGEON_DESTROYED==1)
	DISPLAY_OBJECTIVE(85,PLAYER0)
ENDIF

IF(PLAYER0,TOTAL_GOLD_MINED > 500)
	SET_TIMER(PLAYER0,TIMER0)
	SET_TIMER(PLAYER0,TIMER1)
ENDIF

IF_ACTION_POINT(2,PLAYER0)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,4,DUNGEON,0,6,1000)
	SET_FLAG(PLAYER0,FLAG0,1)
	DISPLAY_OBJECTIVE(86,PLAYER0)
ENDIF




IF(PLAYER0,TIMER0 >= 2500)
	IF(PLAYER0,FLAG0 < 1)
		IF(PLAYER0,TIMER1 <= 15000)
 				NEXT_COMMAND_REUSABLE
				ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,-3,1)
 				NEXT_COMMAND_REUSABLE
				SET_TIMER(PLAYER0,TIMER0)
		ENDIF
	ENDIF
ENDIF

IF(PLAYER0,TIMER0 >= 3000)
	IF(PLAYER0,FLAG0 < 1)
		IF(PLAYER0,TIMER1 >= 15000)
			IF(PLAYER0,TIMER1 <= 25000)
 				NEXT_COMMAND_REUSABLE
				ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,-3,1)
 				NEXT_COMMAND_REUSABLE
				SET_TIMER(PLAYER0,TIMER0)
			ENDIF
		ENDIF
	ENDIF
ENDIF


IF(PLAYER0,TIMER1 >= 14000)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,5,DUNGEON,0,5,1000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,-3,1)
ENDIF


IF(PLAYER0,TIMER1 >= 20000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,-3,1)
ENDIF


IF(PLAYER0,TIMER0 >= 4500)
	IF(PLAYER0,FLAG0 < 1)
		IF(PLAYER0,TIMER1 >= 25000)
			IF(PLAYER0,TIMER1 <= 45000)
 				NEXT_COMMAND_REUSABLE
				ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,-3,1)
 				NEXT_COMMAND_REUSABLE
				SET_TIMER(PLAYER0,TIMER0)
			ENDIF
		ENDIF
	ENDIF
ENDIF


IF(PLAYER0,TIMER1 >= 32000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIVE,-3,1)
ENDIF


IF_ACTION_POINT(3,PLAYER0)
	SET_TIMER(PLAYER0,TIMER2)
	SET_TIMER(PLAYER0,TIMER3)
ENDIF


IF(PLAYER0,TIMER2 >= 2500)
	IF(PLAYER0,TIMER3 <= 11500)
		IF(PLAYER0,FLAG0 < 2)	
 				NEXT_COMMAND_REUSABLE
				ADD_PARTY_TO_LEVEL(PLAYER_GOOD,DEFEND1,-1,1)
 				NEXT_COMMAND_REUSABLE
				ADD_PARTY_TO_LEVEL(PLAYER_GOOD,DEFEND2,-2,1)
 				NEXT_COMMAND_REUSABLE
				SET_TIMER(PLAYER0,TIMER2)
		ENDIF
	ENDIF
ENDIF


IF(PLAYER0,TIMER3 >= 13500)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,DEFEND3,-3,2)
ENDIF





IF(PLAYER0, ALL_DUNGEONS_DESTROYED == 1)
	SET_FLAG(PLAYER0,FLAG0,2)
	DISPLAY_OBJECTIVE(87,PLAYER0)
	SET_TIMER(PLAYER0,TIMER4)
ENDIF



IF(PLAYER0,TIMER4 > 3600)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT,-4,1)
ENDIF


IF(PLAYER0,TIMER4 > 4000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TROUBLE,-1,3)
	SET_FLAG(PLAYER0,FLAG0,3)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TROUBLE,-2,3)
ENDIF




IF(PLAYER0, ALL_DUNGEONS_DESTROYED == 1)
	IF(PLAYER_GOOD,AVATAR==0)
		IF(PLAYER0,FLAG0==3)
			DISPLAY_OBJECTIVE(88,PLAYER0)
			WIN_GAME
		ENDIF
	ENDIF
ENDIF
