REM ****************************************************
REM Lighthouse Underground
REM
REM Assmist Isle Campaign by Kix
REM
REM v2.0 for DAT file objectives (by dayokay)
REM 14-Nov-2020
REM ****************************************************

LEVEL_VERSION(1)

START_MONEY(PLAYER0,0)

ROOM_AVAILABLE(ALL_PLAYERS,TREASURE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,0)
ROOM_AVAILABLE(PLAYER0,RESEARCH,1,0)

IF(PLAYER0,LAIR>0)
	ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
	TUTORIAL_FLASH_BUTTON(8,90)
ENDIF
IF(PLAYER0,GARDEN>0)
	ROOM_AVAILABLE(ALL_PLAYERS,GARDEN,1,1)
	TUTORIAL_FLASH_BUTTON(7,90)
ENDIF

MAGIC_AVAILABLE(PLAYER0,POWER_HAND,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_SLAP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SIGHT,1,0)
TRAP_AVAILABLE(PLAYER0,POISON_GAS,1,0)
DOOR_AVAILABLE(PLAYER0,WOOD,1,0)


SET_CREATURE_HEALTH(WIZARD,7400)
SET_CREATURE_HEALTH(THIEF,7000)
SET_CREATURE_HEALTH(DWARFA,6000)
SET_CREATURE_HEALTH(HELL_HOUND,3500)
SET_CREATURE_HEALTH(SAMURAI,4000)
SET_CREATURE_HEALTH(WITCH,4000)
SET_CREATURE_HEALTH(MONK,7600)

SET_GENERATE_SPEED(400)
ADD_CREATURE_TO_POOL(​TENTACLE,​12)
CREATURE_AVAILABLE(PLAYER0,TENTACLE,1,0)
ADD_CREATURE_TO_POOL(SORCEROR,​6)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,0)
ADD_CREATURE_TO_POOL(TROLL,​4)
CREATURE_AVAILABLE(PLAYER0,TROLL,1,0)

IF(PLAYER0,BILE_DEMON>0)
	ADD_CREATURE_TO_POOL(BILE_DEMON,​4)
	CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,0)
ENDIF

ADD_CREATURE_TO_POOL(SPIDER,5)
CREATURE_AVAILABLE(PLAYER0,SPIDER,1,0)
ADD_CREATURE_TO_POOL(DEMONSPAWN,5)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,12)


SET_CREATURE_MAX_LEVEL(PLAYER0,TENTACLE,4)
SET_CREATURE_MAX_LEVEL(PLAYER0,ORC,4)
SET_CREATURE_MAX_LEVEL(PLAYER0,DARK_MISTRESS,4)
SET_CREATURE_MAX_LEVEL(PLAYER0,DRAGON,4)
SET_CREATURE_MAX_LEVEL(PLAYER0,SORCEROR,4)
SET_CREATURE_MAX_LEVEL(PLAYER0,TROLL,4)
SET_CREATURE_MAX_LEVEL(PLAYER0,VAMPIRE,4)
SET_CREATURE_MAX_LEVEL(PLAYER0,BILE_DEMON,4)
SET_CREATURE_MAX_LEVEL(PLAYER0,SPIDER,4)
SET_CREATURE_MAX_LEVEL(PLAYER0,DEMONSPAWN,4)
SET_CREATURE_MAX_LEVEL(PLAYER0,HORNY,4)
SET_CREATURE_MAX_LEVEL(PLAYER0,SKELETON,4)
SET_CREATURE_MAX_LEVEL(PLAYER0,GHOST,4)
MAX_CREATURES(PLAYER0,30)


CREATE_PARTY(T1)
ADD_TO_PARTY(T1,TENTACLE,2,1000,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(T1,TENTACLE,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(T1,TENTACLE,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(T1,TENTACLE,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(T1,TENTACLE,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(T1,TENTACLE,1,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(T2)
ADD_TO_PARTY(T2,TENTACLE,5,3000,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(T2,TENTACLE,4,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(T2,TENTACLE,4,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(T2,TENTACLE,4,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(T2,TENTACLE,4,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(T2,TENTACLE,4,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(KN)
ADD_TO_PARTY(KN,AVATAR,9,5000,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(KN,KNIGHT,9,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(KN,KNIGHT,9,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(KN,BARBARIAN,9,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(KN,BARBARIAN,9,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(KN,GIANT,9,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(GUARDS)
ADD_TO_PARTY(GUARDS,HELL_HOUND,9,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(GUARDS,DRAWFROM(WIZARD,MONK,WITCH,THIEF,DWARFA,SAMURAI),10,0,ATTACK_DUNGEON_HEART,0)

IF(PLAYER0,WORKSHOP>12)
	ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,1)
	TUTORIAL_FLASH_BUTTON(13,90)
ENDIF

IF(PLAYER0,TRAINING>0)
	ROOM_AVAILABLE(PLAYER0,TRAINING,1,1)
	TUTORIAL_FLASH_BUTTON(10,90)
ENDIF




rem rem rem rem rem rem rem rem rem rem rem rem rem rem rem rem rem rem rem rem rem rem rem rem rem rem 
REM timer0 intro
REM timer1 warden
REM timer2 AVATAR

REM flag1 wardenspawned
REM flag2 AVATARspawned
REM flag3 win
REM flag4 bridge

REM	QUICK_OBJECTIVE(1,"The plans have failed: protectors of this land have banished you down here, not far away from an entrance leading to the lighthouse on surface. With no gold, rooms or army and walled in, the heroes backed up as you pose no danger. The only people still here are accompanied by some water dwelling creatures who are not used to your creatures anymore and will not hesitate to attack you.",ALL_PLAYERS)
	DISPLAY_OBJECTIVE(22,ALL_PLAYERS)

SET_TIMER(PLAYER0,TIMER0)

IF(PLAYER0,TIMER0>500)
REM	QUICK_OBJECTIVE(2,"Lucky for you, one of the samurais tried to use a tentacle to ... to .. Well let's just say the tentacle got really pissed and joined you. Quickly, Keeper! This is your chance!",ALL_PLAYERS)
	DISPLAY_OBJECTIVE(23,ALL_PLAYERS)
	ADD_CREATURE_TO_LEVEL(PLAYER0,TENTACLE,1,1,1,1200)
	REVEAL_MAP_LOCATION(PLAYER0,1,30)
ENDIF

IF(PLAYER0,IMP>0)
	SET_TIMER(PLAYER0,TIMER1)
	BONUS_LEVEL_TIME(80000)
	REM "Hearing unusual noise from your dungeon, a vigorous lighthouse guard accompanied by his two-headed pet is heading to your dungeon. Defeat them and the victory is yours."
	DISPLAY_OBJECTIVE(24,ALL_PLAYERS)
	REM "Your creatures have difficulty training in this miserable land, and your bridge builders are slow and incompetent! Are you ruthless enough to prevail Keeper?"
	DISPLAY_INFORMATION(25,ALL_PLAYERS)
	REM	QUICK_INFORMATION(8,"Hint: the lighthouse guardians are no ordinary heroes. Prepare very well for them.",-1)
	DISPLAY_INFORMATION(26,-1)
ENDIF

IF(PLAYER0,TIMER1>80000)
	REM	QUICK_OBJECTIVE(5,"Here they are. Hurry up, Keeper, as the lord of the land with is army is on his way. Defeat the warden and off you go!",-1)
	DISPLAY_OBJECTIVE(27,-1)
	BONUS_LEVEL_TIME(0)
	BONUS_LEVEL_TIME(9000)
	SET_TIMER(PLAYER0,TIMER2)

	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,GUARDS,-1,1)
	rem bell
	PLAY_MESSAGE(PLAYER0,SOUND,45)

	SET_FLAG(PLAYER0,FLAG1,1)
	SET_FLAG(PLAYER0,FLAG2,0)
	SET_FLAG(PLAYER0,FLAG3,0)
ENDIF

IF(PLAYER0,FLAG2>0)
	IF(PLAYER_GOOD,AVATAR==0)
		SET_FLAG(PLAYER0,FLAG3,1)
	ENDIF
ENDIF

IF(PLAYER0,FLAG2==0)
IF(PLAYER0,FLAG1>0)
	IF(PLAYER_GOOD,WIZARD==0)
	IF(PLAYER_GOOD,MONK==0)
	IF(PLAYER_GOOD,THIEF==0)
	IF(PLAYER_GOOD,HELL_HOUND==0)
	IF(PLAYER_GOOD,DWARFA==0)
	IF(PLAYER_GOOD,WITCH==0)
	IF(PLAYER_GOOD,SAMURAI==0)
		SET_FLAG(PLAYER0,FLAG3,1)
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
ENDIF
ENDIF

IF(PLAYER0,TIMER2>9000)
REM	QUICK_OBJECTIVE(6,"The lord of the land has arrived. Good luck.",-1)
	DISPLAY_OBJECTIVE(28,-1)
	REM presence of avatar
	PLAY_MESSAGE(PLAYER0,SPEECH,107)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,KN,-1,2)
	BONUS_LEVEL_TIME(0)
	SET_FLAG(PLAYER0,FLAG2,1)
ENDIF

IF_AVAILABLE(PLAYER0,BRIDGE>0)
	SET_FLAG(PLAYER0,FLAG4,1)
ENDIF

IF(PLAYER0,FLAG4>0)
	IF(PLAYER0,BRIDGE>0)
		NEXT_COMMAND_REUSABLE
		ROOM_AVAILABLE(PLAYER0,BRIDGE,0,0)
	ENDIF
	IF(PLAYER0,BRIDGE==0)
		NEXT_COMMAND_REUSABLE
		ROOM_AVAILABLE(PLAYER0,BRIDGE,1,1)
	ENDIF
ENDIF

IF(PLAYER0,TIMER1>10690)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,T1,DRAWFROM(-1,-2),1)
ENDIF

IF(PLAYER0,TIMER1>17690)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,T1,DRAWFROM(-1,-2),2)
ENDIF
IF(PLAYER0,TIMER1>38550)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,T2,DRAWFROM(-1,-2),1)
ENDIF
IF(PLAYER0,TIMER1>52000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,T2,DRAWFROM(-1,-2),2)
ENDIF
IF(PLAYER0,TIMER1>65000)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,T2,DRAWFROM(-1,-2),3)
ENDIF

IF(PLAYER0,TIMER1>71123)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,T2,DRAWFROM(-1,-2),4)
ENDIF

IF_ACTION_POINT(2,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,T2,2,1)
ENDIF

IF(PLAYER0,BILE_DEMON>4)
	CREATURE_AVAILABLE(PLAYER0,SPIDER,0,0)
ENDIF

IF(PLAYER0,FLAG3>=1)
REM	QUICK_OBJECTIVE(7,"Victory! The lighthouse sentinel lies dead!",ALL_PLAYERS)
	DISPLAY_OBJECTIVE(29,ALL_PLAYERS)
	BONUS_LEVEL_TIME(0)
	WIN_GAME
ENDIF
