REM Generic Script Base 30.7.96

REM WILL NOT WORK DUE TO LACK OF TIMES_BROKEN_INTO COMMAND

REM Level 109

LEVEL_VERSION(1)

REM Higher Game Functions
	REM NEUTRAL_ENTRANCE_LEVEL(0)
	SET_GENERATE_SPEED(800)



	MAX_CREATURES(PLAYER0,25)

		REM Player0
			START_MONEY(PLAYER0,2000)

REM CREATURE_INBY(TROLL,0)
REM CREATURE_INBY(DEMONSPAWN,0)
REM CREATURE_INBY(FLY,2)
REM CREATURE_INBY(SORCEROR,1)
REM CREATURE_INBY(BUG,2)
REM CREATURE_INBY(SPIDER,1)
REM CREATURE_INBY(BUG,2)

ADD_CREATURE_TO_POOL(TROLL,1)
ADD_CREATURE_TO_POOL(DEMONSPAWN,1)
ADD_CREATURE_TO_POOL(FLY,3)
ADD_CREATURE_TO_POOL(SORCEROR,2)
ADD_CREATURE_TO_POOL(BUG,6)
ADD_CREATURE_TO_POOL(SPIDER,2)
ADD_CREATURE_TO_POOL(TENTACLE,5)


REM Player Properties

REM Player 0

	REM Creature_Availability

		CREATURE_AVAILABLE(PLAYER0,TROLL,1,0)
		CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,0)
		CREATURE_AVAILABLE(PLAYER0,FLY,1,0)
		CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,0)
		CREATURE_AVAILABLE(PLAYER0,BUG,1,0)
		CREATURE_AVAILABLE(PLAYER0,SPIDER,1,0)
		REM CREATURE_AVAILABLE(PLAYER0,TENTACLE,1,0)

	REM Room_Availability

		ROOM_AVAILABLE(PLAYER0,TREASURE,1,1)
		ROOM_AVAILABLE(PLAYER0,RESEARCH,1,1)
		ROOM_AVAILABLE(PLAYER0,TRAINING,1,1)
		ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,0)
		ROOM_AVAILABLE(PLAYER0,BARRACKS,1,1)
		ROOM_AVAILABLE(PLAYER0,GARDEN,1,1)
		ROOM_AVAILABLE(PLAYER0,LAIR,1,1)
		ROOM_AVAILABLE(PLAYER0,BRIDGE,1,0)

	REM Spells
		
		MAGIC_AVAILABLE(PLAYER0,POWER_HAND,1,1)
		MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
		MAGIC_AVAILABLE(PLAYER0,POWER_SLAP,1,1)
		MAGIC_AVAILABLE(PLAYER0,POWER_SIGHT,1,1)
		MAGIC_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS,1,1)
		MAGIC_AVAILABLE(PLAYER0,POWER_SPEED,1,1)

	REM  doors & traps

		REM DOOR_AVAILABLE(PLAYER0,WOODEN,1,5)
		DOOR_AVAILABLE(PLAYER0,WOOD,1,5)

REM Player_Good

			
		REM CREATURE_AVAILABLE(PLAYER_GOOD,WIZARD,1,1)
		REM CREATURE_AVAILABLE(PLAYER_GOOD,ARCHER,1,1)                                         
		REM CREATURE_AVAILABLE(PLAYER_GOOD,DWARFA,1,1)
		REM CREATURE_AVAILABLE(PLAYER_GOOD,KNIGHT,1,1) 
		REM CREATURE_AVAILABLE(PLAYER_GOOD,TUNNELLER,1,1)
		REM CREATURE_AVAILABLE(PLAYER_GOOD,THIEF,1,1)

CREATE_PARTY(ONE)
REM First Entrance AP1 grp.
	ADD_TO_PARTY(ONE,THIEF,1,500,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(ONE,THIEF,1,500,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(ONE,ARCHER,1,300,ATTACK_DUNGEON_HEART,0)


CREATE_PARTY(TWO)
REM	AP2 for SW gold deposit add twice with short time delay
	ADD_TO_PARTY(TWO,ARCHER,2,400,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(TWO,ARCHER,2,400,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(TWO,ARCHER,2,400,ATTACK_DUNGEON_HEART,0)


CREATE_PARTY(THREE)
REM	AP4 for all dwarves dead trigger
	ADD_TO_PARTY(THREE,DWARFA,3,600,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(THREE,DWARFA,3,600,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(THREE,DWARFA,3,600,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(THREE,DWARFA,3,600,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(FOUR)
REM	AP6 for hero dungeon break-in pincer
	ADD_TO_PARTY(FOUR,ARCHER,3,500,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(FOUR,ARCHER,3,500,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(FOUR,ARCHER,3,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(FIVE)
REM AP7 for entrance 3
	ADD_TO_PARTY(FIVE,DWARFA,3,600,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(FIVE,DWARFA,3,600,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(FIVE,DWARFA,3,600,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(FIVE,ARCHER,3,500,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(FIVE,ARCHER,3,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(SIX)
REM AP9 for SE gold trigger
	ADD_TO_PARTY(SIX,WIZARD,2,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(SIX,WIZARD,2,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(SIX,WIZARD,2,300,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(SEVEN)
REM AP14 for FLANKER GROUP
	ADD_TO_PARTY(SEVEN,THIEF,1,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(SEVEN,THIEF,1,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(SEVEN,THIEF,1,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(SEVEN,THIEF,1,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(SEVEN,THIEF,1,300,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(SEVEN,THIEF,1,300,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(EIGHT)
REM final knight party
	ADD_TO_PARTY(EIGHT,WIZARD,3,600,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(EIGHT,WIZARD,3,600,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(EIGHT,KNIGHT,3,600,ATTACK_DUNGEON_HEART,0)

REM CREATE_TEXT(0"BUILD UP YOUR DUNGEON, BUILD A RESEARCH ROOM AND SEE WHAT IT HAS TO OFFER YOU")
DISPLAY_OBJECTIVE(108, PLAYER0)

REM CREATE_TEXT(1"YOU HAVE DISCOVERED A LOST CAVE, HOME OF THE TENTACLES. TAKE THEM INTO YOUR DUNGEON, OTHERS ARE SURE TO FOLLOW THEM TO YOU.")
REM CREATE_TEXT(2,"YOU HAVE RESEARCH A WORKSHOP, WITH IT, DOORS AND TRAPS WILL BECOME AVAILABLE TO YOU")

IF_ACTION_POINT(10,PLAYER0)
	REM 1, "You have discovered a lost cave, home of the Tentacles. Take them into your dungeon; others are sure to follow them to you.", 10)
	DISPLAY_OBJECTIVE(109, PLAYER0)
	CREATURE_AVAILABLE(PLAYER0,TENTACLE,1,10)
ENDIF

REM RESEARCH(PLAYER0,ROOM,WORKSHOP,100)
	
REM IF(PLAYER0,RESEARCH >= 100)
IF_AVAILABLE(PLAYER0,WORKSHOP == 1)
	REM ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,1)
	REM 2, "You have researched a Workshop; with it, doors and traps will become available to you.", ALL_PLAYERS)
	DISPLAY_OBJECTIVE(110, PLAYER0)
ENDIF

IF(PLAYER0,WORKSHOP >= 9)
	REM 3,"Dispense with the particularly obnoxious Dwarves which wander this region while you build a well defended Dungeon.",ALL_PLAYERS)
	DISPLAY_OBJECTIVE(111, PLAYER0)
ENDIF

IF_ACTION_POINT(3,PLAYER0)
	IF(PLAYER0,TOTAL_CREATURES >= 1)
	REM ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,1,DUNGEON,0,0,250)
	REM ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,1,1)
	ADD_TUNNELLER_PARTY_TO_LEVEL(​PLAYER_GOOD,​ONE,1,​DUNGEON,​0,​1,​250)
	ENDIF
ENDIF

IF_ACTION_POINT(12,PLAYER0)
	REM ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,2,DUNGEON,0,0,250)
	REM ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,2,1)
	ADD_TUNNELLER_PARTY_TO_LEVEL(​PLAYER_GOOD,​TWO,2,​DUNGEON,​0,​1,​250)
	SET_TIMER(PLAYER_GOOD,TIMER0)
		IF(PLAYER_GOOD,TIMER0 >= 1000)
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,2,1)
		ENDIF
ENDIF

SET_FLAG(PLAYER_GOOD,FLAG0,0)

IF(PLAYER_GOOD,DWARFA == 0)
	SET_FLAG(PLAYER_GOOD,FLAG0,1)
	REM 4,"The final battle is at hand. Find and destroy the heroic stronghold.",5)
	DISPLAY_OBJECTIVE(112, 5)
ENDIF

IF_ACTION_POINT(11,PLAYER0)
	IF(PLAYER_GOOD,FLAG0 == 1)
	REM ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,4,DUNGEON,0,0,250)
	REM ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,4,1)
	ADD_TUNNELLER_PARTY_TO_LEVEL(​PLAYER_GOOD,​THREE,4,​DUNGEON,​0,​1,​250)
	ENDIF
ENDIF

IF_ACTION_POINT(5,PLAYER0)
	IF(PLAYER_GOOD,FLAG0 == 1)
	REM ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,6,DUNGEON,0,1,300)
	REM ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,6,1)
	ADD_TUNNELLER_PARTY_TO_LEVEL(​PLAYER_GOOD,​TWO,6,​DUNGEON,​0,​2,​300)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIVE,15,1)
	REM ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,14,DUNGEON,0,1,300)
	REM ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SEVEN,14,1)
	ADD_TUNNELLER_PARTY_TO_LEVEL(​PLAYER_GOOD,​SEVEN,14,​DUNGEON,​0,​2,​300)
		IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,EIGHT,15,1)
			IF(PLAYER_GOOD,KNIGHT == 0)
				IF(PLAYER_GOOD,DUNGEON_DESTROYED == 1)
				WIN_GAME
				ENDIF
			ENDIF
		ENDIF
	ENDIF
ENDIF
REM SET_FLAG(PLAYER_GOOD,FLAG4,0)

REM IF(PLAYER_GOOD,KNIGHT == 1)
	REM SET_FLAG(PLAYER_GOOD,FLAG4,4)
REM ENDIF

REM IF(PLAYER_GOOD,FLAG4 <= 3)
IF(PLAYER0,TIMES_BROKEN_INTO <= 3)
	REM IF_ACTION_POINT(8,PLAYER_GOOD)
	IF_ACTION_POINT(8,PLAYER0)
		REM ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,7,DUNGEON,0,1,300)
		REM ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIVE,7,1)
		ADD_TUNNELLER_PARTY_TO_LEVEL(​PLAYER_GOOD,​FIVE,7,​DUNGEON,​0,​2,​300)
	ENDIF
	IF_ACTION_POINT(13,PLAYER0)
		ADD_TUNNELLER_PARTY_TO_LEVEL(​PLAYER_GOOD,​SIX,9,​DUNGEON,​0,​2,​300)
	ENDIF
ENDIF

REM IF(PLAYER_GOOD,FLAG4 <= 3)
	REM IF_ACTION_POINT(13,PLAYER0)
	REM ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,9,DUNGEON,0,1,300)
	REM ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SIX,9,1)
	REM ADD_TUNNELLER_PARTY_TO_LEVEL(​PLAYER_GOOD,​SIX,9,​DUNGEON,​0,​2,​300)
	REM ENDIF
REM ENDIF

REM IF(PLAYER0,DUNGEON_DESTROYED == 1)
REM	LOSE_GAME
REM ENDIF
