
SET_GENERATE_SPEED(500)

MAX_CREATURES(PLAYER0,20)
MAX_CREATURES(PLAYER3,30)


START_MONEY(PLAYER0,25000)
START_MONEY(PLAYER3,10000)


COMPUTER_PLAYER(PLAYER3,6)


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,25)
ADD_CREATURE_TO_POOL(DEMONSPAWN,10)
ADD_CREATURE_TO_POOL(SPIDER,5)
ADD_CREATURE_TO_POOL(ORC,25)
ADD_CREATURE_TO_POOL(TROLL,8)
ADD_CREATURE_TO_POOL(TENTACLE,6)
ADD_CREATURE_TO_POOL(HELL_HOUND,20)
ADD_CREATURE_TO_POOL(FLY,3)


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)
CREATURE_AVAILABLE(PLAYER0,FLY,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,1)
ROOM_AVAILABLE(PLAYER0,BRIDGE,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,GUARD_POST,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,WORKSHOP,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TEMPLE,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,GRAVEYARD,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)
MAGIC_AVAILABLE(PLAYER3,POWER_SIGHT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_DISEASE,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_OBEY,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_ARMAGEDDON,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_DESTROY_WALLS,1,0)


TRAP_AVAILABLE(PLAYER0,LAVA,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,STEEL,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)


RESEARCH(ALL_PLAYERS,ROOM,BRIDGE,3000)
RESEARCH(PLAYER3,MAGIC,POWER_SIGHT,5000)
RESEARCH(ALL_PLAYERS,ROOM,GUARD_POST,5000)
RESEARCH(ALL_PLAYERS,MAGIC,POWER_CALL_TO_ARMS,5000)
RESEARCH(ALL_PLAYERS,ROOM,WORKSHOP,15000)
RESEARCH(ALL_PLAYERS,MAGIC,POWER_HOLD_AUDIENCE,15000)
RESEARCH(ALL_PLAYERS,MAGIC,POWER_SPEED,10000)
RESEARCH(ALL_PLAYERS,ROOM,PRISON,20000)
RESEARCH(ALL_PLAYERS,MAGIC,POWER_CONCEAL,15000)
RESEARCH(ALL_PLAYERS,ROOM,BARRACKS,15000)
RESEARCH(ALL_PLAYERS,MAGIC,POWER_PROTECT,15000)
RESEARCH(ALL_PLAYERS,MAGIC,POWER_HEAL_CREATURE,15000)
RESEARCH(ALL_PLAYERS,ROOM,TORTURE,20000)
RESEARCH(ALL_PLAYERS,MAGIC,POWER_CAVE_IN,25000)
RESEARCH(ALL_PLAYERS,ROOM,TEMPLE,25000)
RESEARCH(ALL_PLAYERS,MAGIC,POWER_LIGHTNING,25000)
RESEARCH(ALL_PLAYERS,MAGIC,POWER_OBEY,15000)
RESEARCH(ALL_PLAYERS,ROOM,GRAVEYARD,50000)
RESEARCH(ALL_PLAYERS,MAGIC,POWER_CHICKEN,25000)
RESEARCH(PLAYER0,MAGIC,POWER_DISEASE,50000)
RESEARCH(PLAYER0,MAGIC,POWER_ARMAGEDDON,300000)
RESEARCH(PLAYER0,MAGIC,POWER_DESTROY_WALLS,300000)


DISPLAY_OBJECTIVE(79,PLAYER0)


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

CREATE_PARTY(TROUBLE1)
	ADD_TO_PARTY(TROUBLE1,WIZARD,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TROUBLE1,WIZARD,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TROUBLE1,WIZARD,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TROUBLE1,MONK,10,0,ATTACK_ENEMIES,0)


CREATE_PARTY(TROUBLE2)
	ADD_TO_PARTY(TROUBLE2,SAMURAI,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TROUBLE2,SAMURAI,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TROUBLE2,DRAGON,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TROUBLE2,SAMURAI,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TROUBLE2,DRAGON,10,0,ATTACK_ENEMIES,0)


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


	SET_TIMER(PLAYER3,TIMER0)
	SET_TIMER(PLAYER3,TIMER1)
	SET_TIMER(PLAYER3,TIMER2)


IF(PLAYER3,TIMER0 >= 1200)
	IF(PLAYER3,IMP <= 20)
        NEXT_COMMAND_REUSABLE
	ADD_CREATURE_TO_LEVEL(PLAYER3,IMP,PLAYER3,2,1,500)
        NEXT_COMMAND_REUSABLE
	SET_TIMER(PLAYER3,TIMER0)
    ENDIF
ENDIF

IF(PLAYER3,ENTRANCE > 0)
IF(PLAYER3,TIMER1 >= 1000)
	IF(PLAYER3,VAMPIRE <= 10)
		NEXT_COMMAND_REUSABLE
		ADD_CREATURE_TO_LEVEL(PLAYER3,VAMPIRE,PLAYER3,1,1,0)
		NEXT_COMMAND_REUSABLE
		SET_TIMER(PLAYER3,TIMER1)
	ENDIF
ENDIF
ENDIF

IF(PLAYER3,ENTRANCE > 0)
IF(PLAYER3,TIMER2 >= 500)
	IF(PLAYER3,SKELETON <= 10)
    		NEXT_COMMAND_REUSABLE
		ADD_CREATURE_TO_LEVEL(PLAYER3,SKELETON,PLAYER3,1,1,0)
		NEXT_COMMAND_REUSABLE
		SET_TIMER(PLAYER3,TIMER2)
	ENDIF
ENDIF
ENDIF




IF(PLAYER3,WORKSHOP > 27)
	ROOM_AVAILABLE(PLAYER3,WORKSHOP,0,0)
ENDIF



IF(PLAYER0,ENTRANCE > 0)
	DISPLAY_INFORMATION(80,PLAYER0)
	SET_TIMER(PLAYER0,TIMER0)
ENDIF


IF(PLAYER0, GAME_TURN > 13500)
	ROOM_AVAILABLE(PLAYER3,BRIDGE,1,1)
	DISPLAY_INFORMATION(69,PLAYER0)
ENDIF


IF(PLAYER0, GAME_TURN > 10000)
	IF(PLAYER3,TOTAL_CREATURES == 0)
		DISPLAY_OBJECTIVE(81,PLAYER0)
	ENDIF
ENDIF



IF(PLAYER0, ALL_DUNGEONS_DESTROYED == 1)
	DISPLAY_OBJECTIVE(82,PLAYER0)
	SET_TIMER(PLAYER0,TIMER1)
	MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
	MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CALL_TO_ARMS,0,0)
	MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SIGHT,0,0)
	MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,0,0)
	MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,0,0)
	MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,0,0)
	MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,0,0)
	MAGIC_AVAILABLE(ALL_PLAYERS,POWER_LIGHTNING,0,0)
	MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CAVE_IN,0,0)
	MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,0,0)
	MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CHICKEN,0,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_DISEASE,0,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_OBEY,0,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_ARMAGEDDON,0,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_DESTROY_WALLS,0,0)
ENDIF



IF(PLAYER0,TIMER1 > 2500)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TROUBLE1,-1,2)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TROUBLE2,-2,2)
ENDIF


IF(PLAYER0,TIMER1 > 7000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT,-1,2)
	SET_FLAG(PLAYER0,FLAG0,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT,-2,2)
ENDIF




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