LEVEL_VERSION(1)
SET_GENERATE_SPEED(400)
START_MONEY(ALL_PLAYERS,22500)
MAX_CREATURES(PLAYER5,35)
MAX_CREATURES(PLAYER0,20)
MAX_CREATURES(PLAYER1,25)
MAX_CREATURES(PLAYER2,20)
MAX_CREATURES(PLAYER3,25)
MAX_CREATURES(PLAYER6,20)

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

QUICK_OBJECTIVE(1,"This is a One versus 5. Plan everything Accordingly to flourish in this Situation.",PLAYER5)

SET_GAME_RULE(AlliesShareCta,1)
SET_GAME_RULE(AlliesShareDrop,1)
SET_GAME_RULE(AlliesShareVision,1)
SET_GAME_RULE(MapCreatureLimit,1000)


ALLY_PLAYERS(PLAYER0,PLAYER1,3)
ALLY_PLAYERS(PLAYER0,PLAYER2,3)
ALLY_PLAYERS(PLAYER0,PLAYER3,3)
ALLY_PLAYERS(PLAYER0,PLAYER6,3)
ALLY_PLAYERS(PLAYER1,PLAYER0,3)
ALLY_PLAYERS(PLAYER1,PLAYER2,3)
ALLY_PLAYERS(PLAYER1,PLAYER3,3)
ALLY_PLAYERS(PLAYER1,PLAYER6,3)
ALLY_PLAYERS(PLAYER2,PLAYER0,3)
ALLY_PLAYERS(PLAYER2,PLAYER1,3)
ALLY_PLAYERS(PLAYER2,PLAYER3,3)
ALLY_PLAYERS(PLAYER2,PLAYER4,3)
ALLY_PLAYERS(PLAYER3,PLAYER0,3)
ALLY_PLAYERS(PLAYER3,PLAYER1,3)
ALLY_PLAYERS(PLAYER3,PLAYER2,3)
ALLY_PLAYERS(PLAYER3,PLAYER6,3)
ALLY_PLAYERS(PLAYER6,PLAYER0,3)
ALLY_PLAYERS(PLAYER6,PLAYER1,3)
ALLY_PLAYERS(PLAYER6,PLAYER2,3)
ALLY_PLAYERS(PLAYER6,PLAYER3,3)


ADD_CREATURE_TO_POOL(TROLL,30)
ADD_CREATURE_TO_POOL(ORC,30)
ADD_CREATURE_TO_POOL(BILE_DEMON,30)
ADD_CREATURE_TO_POOL(DRAGON,30)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,30)
ADD_CREATURE_TO_POOL(DWARFA,30)
ADD_CREATURE_TO_POOL(BARBARIAN,30)
ADD_CREATURE_TO_POOL(MONK,30)
ADD_CREATURE_TO_POOL(FAIRY,30)
ADD_CREATURE_TO_POOL(WITCH,30)
ADD_CREATURE_TO_POOL(WIZARD,30)
ADD_CREATURE_TO_POOL(GIANT,30)
ADD_CREATURE_TO_POOL(SAMURAI,30)
ADD_CREATURE_TO_POOL(KNIGHT,30)

CREATURE_AVAILABLE(PLAYER0,TROLL,1,0)
CREATURE_AVAILABLE(PLAYER0,ORC,1,0)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,0)
CREATURE_AVAILABLE(PLAYER0,DRAGON,1,0)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,0)

CREATURE_AVAILABLE(PLAYER3,TROLL,1,0)
CREATURE_AVAILABLE(PLAYER3,ORC,1,0)
CREATURE_AVAILABLE(PLAYER3,BILE_DEMON,1,0)
CREATURE_AVAILABLE(PLAYER3,DRAGON,1,0)
CREATURE_AVAILABLE(PLAYER3,DARK_MISTRESS,1,0)

CREATURE_AVAILABLE(PLAYER1,DWARFA,1,0)
CREATURE_AVAILABLE(PLAYER1,BARBARIAN,1,0)
CREATURE_AVAILABLE(PLAYER1,MONK,1,0)
CREATURE_AVAILABLE(PLAYER1,FAIRY,1,0)
CREATURE_AVAILABLE(PLAYER1,WITCH,1,0)
CREATURE_AVAILABLE(PLAYER1,WIZARD,1,0)
CREATURE_AVAILABLE(PLAYER1,GIANT,1,0)
CREATURE_AVAILABLE(PLAYER1,SAMURAI,1,0)
CREATURE_AVAILABLE(PLAYER1,KNIGHT,1,0)

CREATURE_AVAILABLE(PLAYER6,DWARFA,1,0)
CREATURE_AVAILABLE(PLAYER6,BARBARIAN,1,0)
CREATURE_AVAILABLE(PLAYER6,MONK,1,0)
CREATURE_AVAILABLE(PLAYER6,FAIRY,1,0)
CREATURE_AVAILABLE(PLAYER6,WITCH,1,0)
CREATURE_AVAILABLE(PLAYER6,WIZARD,1,0)
CREATURE_AVAILABLE(PLAYER6,GIANT,1,0)
CREATURE_AVAILABLE(PLAYER6,SAMURAI,1,0)
CREATURE_AVAILABLE(PLAYER6,KNIGHT,1,0)

ADD_CREATURE_TO_POOL(AACOLYTE,40)
ADD_CREATURE_TO_POOL(AASSASSIN,40)
ADD_CREATURE_TO_POOL(AEXECUTIONER,40)
ADD_CREATURE_TO_POOL(AMERCENARY,40)
ADD_CREATURE_TO_POOL(ANECROMANCER,40)
ADD_CREATURE_TO_POOL(ANECROMANCERZOMBIE,40)
ADD_CREATURE_TO_POOL(APLAGUEDOCTOR,40)
ADD_CREATURE_TO_POOL(ASERVANT,40)
ADD_CREATURE_TO_POOL(AWARLOCK,40)
ADD_CREATURE_TO_POOL(AWITCH,40)
ADD_CREATURE_TO_POOL(ATYRANT,40)
ADD_CREATURE_TO_POOL(AVIXEN,40)
ADD_CREATURE_TO_POOL(DBBLACKKNIGHT,40)

CREATURE_AVAILABLE(PLAYER5,AACOLYTE,1,0)
CREATURE_AVAILABLE(PLAYER5,AASSASSIN,1,0)
CREATURE_AVAILABLE(PLAYER5,AEXECUTIONER,1,0)
CREATURE_AVAILABLE(PLAYER5,AMERCENARY,1,0)
CREATURE_AVAILABLE(PLAYER5,ANECROMANCER,1,0)
CREATURE_AVAILABLE(PLAYER5,ANECROMANCERZOMBIE,1,0)
CREATURE_AVAILABLE(PLAYER5,APLAGUEDOCTOR,1,0)
CREATURE_AVAILABLE(PLAYER5,ASERVANT,1,0)
CREATURE_AVAILABLE(PLAYER5,AWARLOCK,1,0)
CREATURE_AVAILABLE(PLAYER5,AWITCH,1,0)
CREATURE_AVAILABLE(PLAYER5,ATYRANT,1,0)
CREATURE_AVAILABLE(PLAYER5,AVIXEN,1,0)
CREATURE_AVAILABLE(PLAYER5,DBBLACKKNIGHT,1,0)

CREATURE_AVAILABLE(PLAYER2,AACOLYTE,1,0)
CREATURE_AVAILABLE(PLAYER2,AASSASSIN,1,0)
CREATURE_AVAILABLE(PLAYER2,AEXECUTIONER,1,0)
CREATURE_AVAILABLE(PLAYER2,AMERCENARY,1,0)
CREATURE_AVAILABLE(PLAYER2,ANECROMANCER,1,0)
CREATURE_AVAILABLE(PLAYER2,ANECROMANCERZOMBIE,1,0)
CREATURE_AVAILABLE(PLAYER2,APLAGUEDOCTOR,1,0)
CREATURE_AVAILABLE(PLAYER2,ASERVANT,1,0)
CREATURE_AVAILABLE(PLAYER2,AWARLOCK,1,0)
CREATURE_AVAILABLE(PLAYER2,AWITCH,1,0)
CREATURE_AVAILABLE(PLAYER2,ATYRANT,1,0)
CREATURE_AVAILABLE(PLAYER2,AVIXEN,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(PLAYER5,BRIDGE,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)

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_CAVE_IN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,1,1)

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

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

REM PARTY TIME

CREATE_PARTY(p1)
	ADD_TO_PARTY(p1,ARCHER,1,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p1,BARBARIAN,1,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p1,MONK,1,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p1,WIZARD,1,300,ATTACK_DUNGEON_HEART,0)


CREATE_PARTY(p2)
	ADD_TO_PARTY(p2,WITCH,3,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p2,SAMURAI,3,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p2,GIANT,3,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p2,DWARFA,3,300,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(p3)
	ADD_TO_PARTY(p3,KNIGHT,5,500,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p3,BARBARIAN,5,500,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p3,FAIRY,5,500,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p3,THIEF,5,500,ATTACK_DUNGEON_HEART,0)
	
CREATE_PARTY(p4)
	ADD_TO_PARTY(p4,KNIGHT,8,800,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p4,WIZARD,8,800,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p4,SAMURAI,8,800,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p4,MONK,8,800,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p4,TIME_MAGE,8,800,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(p5)
	ADD_TO_PARTY(p5,KNIGHT,10,800,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p5,FAIRY,10,800,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p5,FAIRY,10,800,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p5,BARBARIAN,10,800,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p5,BARBARIAN,10,800,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p5,GIANT,10,800,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p5,GIANT,10,800,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p5,SAMURAI,10,800,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(p5,SAMURAI,10,800,ATTACK_DUNGEON_HEART,0)




REM WAVE TIMERS

IF(PLAYER5,ENTRANCE >= 1)
	SET_TIMER(PLAYER0,TIMER0)
ENDIF

IF(PLAYER5,FLAG0 == 0)

	IF(PLAYER0,TIMER0 >= 12000)
		ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,p1,1,DUNGEON_HEART,5,1,2500)
		SET_TIMER(PLAYER0,TIMER1)
	ENDIF

	IF(PLAYER0,TIMER1 >= 6000)
		ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,p2,3,DUNGEON_HEART,5,1,2500)
		SET_TIMER(PLAYER0,TIMER2)
	ENDIF


	IF(PLAYER0,TIMER2 >= 6500)
		ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,p3,5,DUNGEON_HEART,5,1,2500)
		SET_TIMER(PLAYER0,TIMER3)
	ENDIF

	IF(PLAYER0,TIMER3 >= 6500)
		ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,p4,8,DUNGEON_HEART,5,1,2500)
		SET_TIMER(PLAYER0,TIMER4)
	ENDIF


	IF(PLAYER0,TIMER4 >= 6500)
		NEXT_COMMAND_REUSABLE
		ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,p5,10,DUNGEON_HEART,5,1,2500)
		NEXT_COMMAND_REUSABLE
		SET_TIMER(PLAYER0,TIMER4)
	ENDIF
ENDIF

REM WAVE END CONDITION

IF(PLAYER5,TEMPLE >= 1)
	SET_FLAG(PLAYER5,FLAG0,1)
ENDIF

IF_ACTION_POINT(1,PLAYER5)
	QUICK_INFORMATION(2,"Now quick, go ahead and claim everything to stop the onslaughts",1)
ENDIF







REM IMP LIMITATION

IF_CONTROLS(PLAYER0,ASLAVE < 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
 ENDIF

IF_CONTROLS(PLAYER0,ASLAVE >= 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER0,POWER_IMP,0,0)
ENDIF

IF_CONTROLS(PLAYER1,ASLAVE < 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER1,POWER_IMP,1,1)
 ENDIF

IF_CONTROLS(PLAYER1,ASLAVE >= 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER1,POWER_IMP,0,0)
ENDIF

IF_CONTROLS(PLAYER2,ASLAVE < 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER2,POWER_IMP,1,1)
 ENDIF

IF_CONTROLS(PLAYER2,ASLAVE >= 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER2,POWER_IMP,0,0)
ENDIF

IF_CONTROLS(PLAYER5,ASLAVE < 25)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER5,POWER_IMP,1,1)
 ENDIF

IF_CONTROLS(PLAYER5,ASLAVE >= 25)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER5,POWER_IMP,0,0)
ENDIF

IF_CONTROLS(PLAYER6,ASLAVE < 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER6,POWER_IMP,1,1)
 ENDIF

IF_CONTROLS(PLAYER6,ASLAVE >= 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER6,POWER_IMP,0,0)
ENDIF




IF(PLAYER5,ALL_DUNGEONS_DESTROYED == 1)
	WIN_GAME
ENDIF
