REM	Heroic Invasion 1.0.0 level 442
REM	Author: Mothrayas, Created on 28 Dec 2009
REM	Updated to add messaging through a pot file by dayokay Dec2020

SET_GENERATE_SPEED(550)

MAX_CREATURES(PLAYER0,41)

START_MONEY(PLAYER0,10000)

ADD_CREATURE_TO_POOL(BILE_DEMON,16)
ADD_CREATURE_TO_POOL(DRAGON,18)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,9)
ADD_CREATURE_TO_POOL(TENTACLE,7)
ADD_CREATURE_TO_POOL(SORCEROR,18)
ADD_CREATURE_TO_POOL(TROLL,13)
ADD_CREATURE_TO_POOL(ORC,12)

CREATURE_AVAILABLE(PLAYER0,DRAGON,1,1)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,1)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER0,TENTACLE,1,1)
CREATURE_AVAILABLE(PLAYER0,TROLL,1,1)
CREATURE_AVAILABLE(PLAYER0,ORC,1,1)

ROOM_AVAILABLE(PLAYER0,GUARD_POST,1,0)
ROOM_AVAILABLE(PLAYER0,TREASURE,1,1)
ROOM_AVAILABLE(PLAYER0,RESEARCH,1,1)
ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,0)
ROOM_AVAILABLE(PLAYER0,GARDEN,1,1)
ROOM_AVAILABLE(PLAYER0,LAIR,1,1)
ROOM_AVAILABLE(PLAYER0,GRAVEYARD,1,0)
ROOM_AVAILABLE(PLAYER0,TORTURE,1,0)
ROOM_AVAILABLE(PLAYER0,TRAINING,1,1)
ROOM_AVAILABLE(PLAYER0,BARRACKS,1,0)
ROOM_AVAILABLE(PLAYER0,TEMPLE,1,0)

MAGIC_AVAILABLE(PLAYER0,POWER_HAND,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_OBEY,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_SLAP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_SPEED,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_DISEASE,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_DESTROY_WALLS,1,0)

TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,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)



CREATE_PARTY(LOW1)
ADD_TO_PARTY(LOW1,THIEF,4,500,STEAL_GOLD,0)
ADD_TO_PARTY(LOW1,THIEF,4,500,STEAL_GOLD,0)
ADD_TO_PARTY(LOW1,DWARFA,4,500,STEAL_GOLD,0)
ADD_TO_PARTY(LOW1,DWARFA,4,500,STEAL_GOLD,0)

CREATE_PARTY(LOW2)
ADD_TO_PARTY(LOW2,ARCHER,4,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(LOW2,ARCHER,4,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(LOW2,BARBARIAN,3,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(LOW2,GIANT,3,500,ATTACK_ENEMIES,0)

CREATE_PARTY(LOW3)
ADD_TO_PARTY(LOW3,WIZARD,5,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(LOW3,GIANT,5,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(LOW3,WITCH,5,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(LOW3,MONK,5,500,ATTACK_ENEMIES,0)

CREATE_PARTY(MEDIUM1)
ADD_TO_PARTY(MEDIUM1,BARBARIAN,6,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MEDIUM1,BARBARIAN,6,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MEDIUM1,GIANT,6,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MEDIUM1,GIANT,6,500,ATTACK_ENEMIES,0)

CREATE_PARTY(MEDIUM2)
ADD_TO_PARTY(MEDIUM2,WIZARD,7,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MEDIUM2,WITCH,7,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MEDIUM2,MONK,6,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MEDIUM2,SAMURAI,6,500,ATTACK_ENEMIES,0)

CREATE_PARTY(ELITE1)
ADD_TO_PARTY(ELITE1,SAMURAI,7,1000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(ELITE1,SAMURAI,7,1000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(ELITE1,WIZARD,8,1000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(ELITE1,WIZARD,8,1000,ATTACK_ENEMIES,0)

CREATE_PARTY(ELITE2)
ADD_TO_PARTY(ELITE2,BARBARIAN,8,1000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(ELITE2,BARBARIAN,8,1000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(ELITE2,GIANT,8,1000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(ELITE2,GIANT,8,1000,ATTACK_ENEMIES,0)

CREATE_PARTY(ELITE3)
ADD_TO_PARTY(ELITE3,MONK,8,1000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(ELITE3,MONK,8,1000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(ELITE3,WITCH,8,1000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(ELITE3,WITCH,8,1000,ATTACK_ENEMIES,0)

CREATE_PARTY(KNIGHT_PARTY)
ADD_TO_PARTY(KNIGHT_PARTY,KNIGHT,10,12500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(KNIGHT_PARTY,SAMURAI,9,2000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(KNIGHT_PARTY,SAMURAI,9,2000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(KNIGHT_PARTY,SAMURAI,9,2000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(KNIGHT_PARTY,ARCHER,9,2000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(KNIGHT_PARTY,ARCHER,9,2000,ATTACK_ENEMIES,0)
ADD_TO_PARTY(KNIGHT_PARTY,ARCHER,9,2000,ATTACK_ENEMIES,0)

CREATE_PARTY(KNIGHT_SUPPORT)
ADD_TO_PARTY(KNIGHT_SUPPORT,WIZARD,10,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(KNIGHT_SUPPORT,WIZARD,10,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(KNIGHT_SUPPORT,WITCH,10,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(KNIGHT_SUPPORT,WITCH,10,500,ATTACK_ENEMIES,0)


REM Hero doors: 1,2-Hero Dungeon, 3,4-Northwest,5-Northeast,6-North,7,8-SouthEastDungeon,9-Southwest,10-FarSouthwest,11-FarSouthEast

REM "Beware Master, for many Keepers have tried to conquer this land but they have all failed. These Heroes are not to be underestimated, and your presence in this realm is already known! Prepare for a tough war. The local forces are numerous, and determined to eject you before you can establish an effective army. You must train your forces swiftly, as attacks must surely start soon!"
DISPLAY_OBJECTIVE(60,PLAYER0)

IF(PLAYER0,GAME_TURN >= 8400)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,LOW1,-10,DUNGEON,0,4,500)
	REM "Beware Keeper. An attack is on its way! Are your forces ready for battle?"
	DISPLAY_OBJECTIVE(61,PLAYER0)
ENDIF

IF(PLAYER0,GAME_TURN >= 9600)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,LOW1,-5,DUNGEON,0,4,500)
ENDIF

IF(PLAYER0,GAME_TURN >= 10800)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,LOW2,-9,DUNGEON,0,4,500)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,LOW3,-4,DUNGEON,0,5,500)
	REM "Yet more Heroes? These people are determined to defeat you. You must stay focussed Keeper!"
	DISPLAY_OBJECTIVE(62,PLAYER0)
ENDIF

IF(PLAYER0,GAME_TURN >= 12000)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,LOW1,-11,DUNGEON,0,4,500)
ENDIF

IF(PLAYER0,GAME_TURN >= 16000)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,LOW3,-6,DUNGEON,0,5,500)
ENDIF

IF(PLAYER0,GAME_TURN >= 20000)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,MEDIUM1,-3,DUNGEON,0,6,500)
	REM "Spies inform us that there are some abandoned magic spells to the South-West. These would be useful, but can you spare the time to find them? Oh, hang on, another raiding party is on its way! "
	DISPLAY_OBJECTIVE(63,PLAYER0)
ENDIF

IF(PLAYER0,GAME_TURN >= 24000)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,MEDIUM1,-7,DUNGEON,0,6,500)
ENDIF

IF(PLAYER0,GAME_TURN >= 30000)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE2,-11,DUNGEON,0,8,500)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE3,-3,DUNGEON,0,8,500)
	REM "Another hero raiding party?! Where are they coming from? These people are relentless!"
	DISPLAY_OBJECTIVE(64,PLAYER0)
ENDIF

IF(PLAYER0,GAME_TURN >= 31200)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE1,-4,DUNGEON,0,8,500)
ENDIF

IF(PLAYER0,GAME_TURN >= 36000)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE2,-7,DUNGEON,0,8,500)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE1,-5,DUNGEON,0,8,500)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE3,-8,DUNGEON,0,8,500)
	REM "Another hero raiding party?! Where are they coming from? These people are relentless!"
	DISPLAY_INFORMATION(64)
ENDIF


IF_ACTION_POINT(1,PLAYER0)
	IF(PLAYER_GOOD,FLAG2==0)
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT_PARTY,2,1)
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT_SUPPORT,-1,1)
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT_SUPPORT,-2,1)
		SET_FLAG(PLAYER_GOOD,FLAG0,1)
		SET_FLAG(PLAYER_GOOD,FLAG2,1)
		SET_TIMER(PLAYER_GOOD,TIMER0)
		REM "Apparently a Knight has gathered an army to finish you off, and is on his way. You must force your exhausted minions back into action!"
		DISPLAY_OBJECTIVE(65,PLAYER0)
	ENDIF
ENDIF

IF(PLAYER0,GAME_TURN>=42000)
	IF(PLAYER_GOOD,FLAG2==0)
		ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TUNNELLER,2,1,10,1000)
		ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT_SUPPORT,-1,DUNGEON,0,10,1500)
		ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT_SUPPORT,-2,DUNGEON,0,10,1500)
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT_PARTY,2,1)
		SET_FLAG(PLAYER_GOOD,FLAG0,1)
		SET_FLAG(PLAYER_GOOD,FLAG2,1)
		SET_TIMER(PLAYER_GOOD,TIMER0)
		REM "Now a Knight has gathered a tunnelling party to drive you from this realm. Have you found the time to research any useful spells yet Keeper? "
		DISPLAY_OBJECTIVE(66,PLAYER0)
	ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER0>=900)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,THIEF,3,8,9,1000)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,SAMURAI,-5,2,9,1000)
	SET_FLAG(PLAYER_GOOD,FLAG1,1)
ENDIF

IF(PLAYER_GOOD,FLAG0==1)
	IF(PLAYER_GOOD,FLAG1==1)
		IF(PLAYER_GOOD,TOTAL_CREATURES==0)
			IF(PLAYER_GOOD,DUNGEON_DESTROYED==1)
				REM "An impressive victory Keeper! I'm sure you will enjoy plundering this land in your own time, but your remaining minions must need a rest?!"
				DISPLAY_OBJECTIVE(67,PLAYER0)
				WIN_GAME
			ENDIF
		ENDIF
	ENDIF
ENDIF
