REM ****************************************************
REM Mill Vault
REM
REM Assmist Isle Campaign by Kix
REM
REM v2.0 for DAT file objectives (by dayokay)
REM 13-Nov-2020
REM ****************************************************

LEVEL_VERSION(1)

START_MONEY(PLAYER0,5000)

ADD_CREATURE_TO_LEVEL(PLAYER0,KNIGHT,6,IMPORT(PLAYER0,CAMPAIGN_FLAG4),1,0)

DOOR_AVAILABLE(ALL_PLAYERS,STEEL,1,2)
TRAP_AVAILABLE(ALL_PLAYERS,LIGHTNING,1,1)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,0)

MAGIC_AVAILABLE(PLAYER0,POWER_POSSESS,0,0)
MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SIGHT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,1,0)

CREATE_PARTY(PA)
ADD_TO_PARTY(PA,WIZARD,1,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PA,ARCHER,1,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PA,BARBARIAN,1,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PA,THIEF,1,0,ATTACK_ROOMS,0)

CREATE_PARTY(PB)
ADD_TO_PARTY(PB,WIZARD,3,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PB,ARCHER,4,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PB,BARBARIAN,2,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PB,THIEF,4,0,ATTACK_ROOMS,0)

CREATE_PARTY(PC)
ADD_TO_PARTY(PC,FAIRY,4,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PC,FAIRY,4,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PC,SAMURAI,3,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PC,SAMURAI,3,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PC,GIANT,3,0,ATTACK_ROOMS,0)

CREATE_PARTY(PD)
ADD_TO_PARTY(PD,BARBARIAN,3,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PD,BARBARIAN,3,0,ATTACK_ROOMS,0)

CREATE_PARTY(PE)
ADD_TO_PARTY(PE,WITCH,6,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PE,ARCHER,6,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PE,MONK,6,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PE,WIZARD,6,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PE,DWARFA,7,0,ATTACK_ROOMS,0)

CREATE_PARTY(PF)
ADD_TO_PARTY(PF,BARBARIAN,6,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PF,BARBARIAN,6,0,ATTACK_ROOMS,0)

CREATE_PARTY(PG)
ADD_TO_PARTY(PG,SAMURAI,7,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PG,SAMURAI,6,0,ATTACK_ROOMS,0)

CREATE_PARTY(PH)
ADD_TO_PARTY(PH,MONK,7,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PH,BARBARIAN,7,0,ATTACK_ROOMS,0)

CREATE_PARTY(PI)
ADD_TO_PARTY(PI,ARCHER,10,0,ATTACK_ROOMS,0)
ADD_TO_PARTY(PI,GIANT,10,0,ATTACK_ROOMS,0)

CREATE_PARTY(FIN)
ADD_TO_PARTY(FIN,AVATAR,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN,KNIGHT,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN,KNIGHT,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN,ARCHER,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN,ARCHER,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN,FAIRY,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN,TIME_MAGE,10,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(FIN2)
ADD_TO_PARTY(FIN2,AVATAR,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN2,KNIGHT,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN2,KNIGHT,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN2,MONK,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN2,WIZARD,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN2,WIZARD,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN2,TIME_MAGE,10,0,ATTACK_DUNGEON_HEART,0)

REM
REM
REM

REM	QUICK_OBJECTIVE(1,"The plan for a first strike went bust. The people of this land have already launched an attack upon your dungeon and they are breaking out from every direction. It's up to you to take control. Withstand the smite and defeat the lord of the land.",ALL_PLAYERS)
DISPLAY_OBJECTIVE(135,ALL_PLAYERS)
REM	QUICK_INFORMATION(2,"There are 4 creature dwelling bases in this land: orc, samurai, warlock and bile demon forts. Choose the one to raid, get one of their troops to join you and they'll be joining your army from the portal at a maximum 6 of each (of level of the unit type you obtain as first). Be careful, however: they will be only willing to join you as long as you have at least one of a kind in your dungeon! They die off = it's over for them in this land.",ALL_PLAYERS)
DISPLAY_INFORMATION(136,ALL_PLAYERS)

ADD_CREATURE_TO_POOL(TROLL,6)
CREATURE_AVAILABLE(PLAYER0,TROLL,1,0)
ADD_CREATURE_TO_POOL(HELL_HOUND,1)
CREATURE_AVAILABLE(PLAYER0,HELL_HOUND,1,1)
ADD_CREATURE_TO_POOL(DEMONSPAWN,4)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,0)
ADD_CREATURE_TO_POOL(SPIDER,3)
CREATURE_AVAILABLE(PLAYER0,SPIDER,1,0)

IF(PLAYER0,GAME_TURN>15000)
	SET_TIMER(PLAYER0,TIMER0)
REM	QUICK_INFORMATION(8,"Occupying a fort also provides a small income and their knowledge. Get the samurai fort to be able to build training room, orcs' for guard post, warlocks' for bridge and bile demons' for workshop.",ALL_PLAYERS)
DISPLAY_INFORMATION(137,ALL_PLAYERS)
REM	QUICK_INFORMATION(3,"Hint: you will not get torture chamber in this land. Get rid of the prisoners as soon as possible, for the heroes will try to rescue them on their way to erase you!",ALL_PLAYERS)
DISPLAY_INFORMATION(138,ALL_PLAYERS)
ENDIF


IF(PLAYER0,TIMER0>2000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PA,-1,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PA,-3,1)
ENDIF

IF(PLAYER0,TIMER0>6500)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PA,-2,2)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PA,-4,2)
ENDIF

IF(PLAYER0,TIMER0>16000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PB,-1,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PB,-3,1)
ENDIF

IF(PLAYER0,TIMER0>23000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PB,-2,2)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PB,-4,2)
ENDIF

IF(PLAYER0,TIMER0>27000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PC,-1,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PC,-4,1)
ENDIF

IF(PLAYER0,TIMER0>32000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PC,-2,2)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PC,-3,2)
ENDIF

IF(PLAYER0,TIMER0>37000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PD,-1,3)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PD,-2,3)
ENDIF

IF(PLAYER0,TIMER0>41000)
	ADD_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FLAG0<15)
		IF(PLAYER0,FLAG1==0)
			NEXT_COMMAND_REUSABLE
			ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GIANT,DRAWFROM(-1,-2,-3,-4),1,10,0)
		ENDIF
		IF(PLAYER0,FLAG1==1)
			NEXT_COMMAND_REUSABLE
			ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,WIZARD,DRAWFROM(-1,-2,-3,-4),1,10,0)
		ENDIF
		IF(PLAYER0,FLAG1==2)
			NEXT_COMMAND_REUSABLE
			ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BARBARIAN,DRAWFROM(-1,-2,-3,-4),1,10,0)
		ENDIF
		IF(PLAYER0,FLAG1==3)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PG,-1,1)
		ENDIF
		IF(PLAYER0,FLAG1==4)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PH,-4,1)
		ENDIF
		IF(PLAYER0,FLAG1==5)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PI,-4,1)
		ENDIF
		IF(PLAYER0,FLAG1==7)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PI,-4,2)
		ENDIF
		IF(PLAYER0,FLAG1==9)
			REM presence of avatar
			PLAY_MESSAGE(PLAYER0,SPEECH,107)
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIN,DRAWFROM(-3,-4),1)
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIN2,DRAWFROM(-1,-2),1)
			REM ADD_PARTY_TO_LEVEL(PLAYER_GOOD,DRAWFROM(FIN,FIN2),DRAWFROM(-1,-2),1)
			SET_FLAG(PLAYER0,FLAG2,1)
			REM	"The Lord of the Land has arrived. I can smell his fear. Defeat him and the realm is yours."
			DISPLAY_OBJECTIVE(139,ALL_PLAYERS)
		ENDIF
	ENDIF
	IF(PLAYER0,FLAG0>=25)
		NEXT_COMMAND_REUSABLE
		SET_FLAG(PLAYER0,FLAG0,0)
		NEXT_COMMAND_REUSABLE
		ADD_TO_FLAG(PLAYER0,FLAG1,1)
	ENDIF
ENDIF

SET_TIMER(PLAYER0,TIMER7)
IF(PLAYER0,TIMER7>555)
REM	QUICK_INFORMATION(5,"Hint: experienced imps will be coming from portal once you seize any fort.",ALL_PLAYERS)
	DISPLAY_INFORMATION(140,ALL_PLAYERS)
	NEXT_COMMAND_REUSABLE
	SET_TIMER(PLAYER0,TIMER7)
	IF(PLAYER0,SAMURAI>0)
	IF(PLAYER0,SAMURAI<6)
		NEXT_COMMAND_REUSABLE
		ADD_CREATURE_TO_LEVEL(PLAYER0,SAMURAI,1,1,1,0)
		NEXT_COMMAND_REUSABLE
		ADD_GOLD_TO_PLAYER(PLAYER0,1000)
	ENDIF
	ENDIF
	IF(PLAYER0,SORCEROR>0)
	IF(PLAYER0,SORCEROR<6)
		NEXT_COMMAND_REUSABLE
		ADD_CREATURE_TO_LEVEL(PLAYER0,SORCEROR,1,1,5,0)
		NEXT_COMMAND_REUSABLE
		ADD_GOLD_TO_PLAYER(PLAYER0,1000)
	ENDIF
	ENDIF
	IF(PLAYER0,BILE_DEMON>0)
	IF(PLAYER0,BILE_DEMON<6)
		NEXT_COMMAND_REUSABLE
		ADD_CREATURE_TO_LEVEL(PLAYER0,BILE_DEMON,1,1,4,0)
		NEXT_COMMAND_REUSABLE
		ADD_GOLD_TO_PLAYER(PLAYER0,1000)
	ENDIF
	ENDIF
	IF(PLAYER0,ORC>0)
	IF(PLAYER0,ORC<6)
		NEXT_COMMAND_REUSABLE
		ADD_CREATURE_TO_LEVEL(PLAYER0,ORC,1,1,1,0)
		NEXT_COMMAND_REUSABLE
		ADD_GOLD_TO_PLAYER(PLAYER0,1000)
	ENDIF
	ENDIF
ENDIF

IF(PLAYER0,FLAG2>0)
IF(PLAYER_GOOD,AVATAR==0)
REM	QUICK_OBJECTIVE(10,"Perfect. Another piece of land added to your domain.",ALL_PLAYERS)
	DISPLAY_OBJECTIVE(141,ALL_PLAYERS)
	WIN_GAME
ENDIF
ENDIF

IF(PLAYER0,SAMURAI>0)
	ADD_TO_FLAG(PLAYER0,FLAG3,1)
	ROOM_AVAILABLE(PLAYER0,TRAINING,1,1)
	TUTORIAL_FLASH_BUTTON(10,111)
ENDIF
IF(PLAYER0,BILE_DEMON>0)
	ADD_TO_FLAG(PLAYER0,FLAG3,1)
	ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,1)
	TUTORIAL_FLASH_BUTTON(13,111)
ENDIF
IF(PLAYER0,ORC>0)
	ADD_TO_FLAG(PLAYER0,FLAG3,1)
	ROOM_AVAILABLE(PLAYER0,GUARD_POST,1,1)
	TUTORIAL_FLASH_BUTTON(19,111)
ENDIF
IF(PLAYER0,SORCEROR>0)
	ADD_TO_FLAG(PLAYER0,FLAG3,1)
	ROOM_AVAILABLE(PLAYER0,BRIDGE,1,1)
	TUTORIAL_FLASH_BUTTON(18,100)
REM	QUICK_OBJECTIVE(9,"Careful keeper. Resources are insufficient to build more than one slab of bridge! Think well where you place it as that is the last slab of bridge you will ever build!",ALL_PLAYERS)
	DISPLAY_OBJECTIVE(142,ALL_PLAYERS)
ENDIF
IF(PLAYER0,BRIDGE>0)
	ROOM_AVAILABLE(PLAYER0,BRIDGE,0,0)
ENDIF

REVEAL_MAP_LOCATION(PLAYER0,2,9)
REVEAL_MAP_LOCATION(PLAYER0,3,9)
REVEAL_MAP_LOCATION(PLAYER0,4,9)
REVEAL_MAP_LOCATION(PLAYER0,5,9)

IF(PLAYER0,IMP<3)
REM QUICK_INFORMATION(4,"Hint: experienced imps will be coming from your portal once you seize any fort.",ALL_PLAYERS)
IF(PLAYER0,FLAG3>0)
	NEXT_COMMAND_REUSABLE
	ADD_CREATURE_TO_LEVEL(PLAYER0,IMP,1,1,10,0)
	ROOM_AVAILABLE(ALL_PLAYERS,GARDEN,1,0)
	TUTORIAL_FLASH_BUTTON(7,111)
ENDIF
ENDIF

IF(PLAYER0,SKELETON>8)
	NEXT_COMMAND_REUSABLE
	KILL_CREATURE(PLAYER0,SKELETON,LEAST_EXPERIENCED,1)
REM	QUICK_INFORMATION(7,"Autistic monks are at it again: their exorcistical incantation prevents you from getting any more undead creatures.",ALL_PLAYERS)
	DISPLAY_INFORMATION(143,ALL_PLAYERS)
ENDIF
