Rem Level 139 (level1)

SET_GENERATE_SPEED(250)

MAX_CREATURES(PLAYER0,10)

START_MONEY(PLAYER0,2500)

ADD_CREATURE_TO_POOL(FLY,8)
ADD_CREATURE_TO_POOL(BUG,10)

CREATURE_AVAILABLE(PLAYER0,FLY,1,1)

ROOM_AVAILABLE(PLAYER0,TREASURE,1,1)

MAGIC_AVAILABLE(PLAYER0,POWER_HAND,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_SLAP,1,1)

CREATURE_AVAILABLE(PLAYER_GOOD,TUNNELLER,1,1)
CREATURE_AVAILABLE(PLAYER_GOOD,THIEF,1,1)
CREATURE_AVAILABLE(PLAYER_GOOD,KNIGHT,1,1)

SET_CREATURE_FEAR(TUNNELLER,0)
SET_CREATURE_FEAR(THIEF,0)
SET_CREATURE_FEAR(KNIGHT,0)

CREATE_PARTY(KNIGHT)
ADD_TO_PARTY(KNIGHT,KNIGHT,1,200,ATTACK_ENEMIES,0)

SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,KNIGHT,1)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,THIEF,1)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,TUNNELLER,1)

SET_CREATURE_MAX_LEVEL(PLAYER0,IMP,3)
SET_CREATURE_MAX_LEVEL(PLAYER0,BUG,3)
SET_CREATURE_MAX_LEVEL(PLAYER0,FLY,3)

SET_CREATURE_STRENGTH(KNIGHT,40)
SET_CREATURE_ARMOUR(KNIGHT,40)


REM *** START ***
REM *** FLAGS ARE ALWAYS 0, BUT FOR CLARITY I'LL DO IT ***
SET_FLAG(PLAYER0, FLAG0, 0)

IF(PLAYER0, GAME_TURN > 50)
	CREATE_TEXT(1,"WELCOME TO DUNGEON KEEPER.  YOUR FIRST OBJECTIVE IS TO CREATE A TREASURE ROOM.  SELECT IT FROM THE ROOMS MENU AND LAY DOWN A 3X3 TREASURE ROOM IN THE EMPTY ROOM TO THE WEST.")
	DISPLAY_OBJECTIVE(1,PLAYER0)
	TUTORIAL_FLASH_BUTTON(6,-1)
	SET_FLAG(PLAYER0, FLAG0, 1)
ENDIF


IF (PLAYER0, FLAG0 == 1)
	IF(PLAYER0,TREASURE >= 9)
		CREATE_TEXT(2,"WELL DONE.  PRESS THE RIGHT MOUSE BUTTON TO GET OUT OF ROOM LAYING MODE.  NOW MINE OUT ALL THE GOLD TO THE EAST BY TAGGING THE AREA WITH THE LEFT MOUSE BUTTON.  YOUR IMPS WILL DIG IT OUT AND PLACE IT IN THE TREASURE ROOM.")
		DISPLAY_OBJECTIVE(2,PLAYER0)
		SET_FLAG(PLAYER0, FLAG0, 2)
	ENDIF
ENDIF

REM *** BUILT TREASURE ROOM ***
IF (PLAYER0, FLAG0 == 2)
	IF(PLAYER0,TOTAL_GOLD_MINED >= 3000)
		CREATE_TEXT(3,"YOU CAN PICK UP CREATURES WITH THE LEFT MOUSE BUTTON OR SLAP THEM WITH THE RIGHT.  SLAPPING THEM WILL MAKE CREATURES WORK HARDER.  CREATURES CAN ALSO BE PICKED UP FROM THE CREATURES MENU AND YOU CAN CARRY UP TO EIGHT IN YOUR HAND.")
		DISPLAY_OBJECTIVE(3,PLAYER0)

		IF(PLAYER0,TOTAL_GOLD_MINED >= 5500)
			CREATE_TEXT(9,"POSSESS CREATURES BY CHOOSING THE POSSESS SPELL FROM THE SPELLS MENU AND LEFT-CLICK ON THE CREATURE YOU WANT TO CONTROL.  RIGHT-CLICK TO GET BACK TO NORMAL VIEW.")
			DISPLAY_OBJECTIVE(9,PLAYER0)
		ENDIF

		IF(PLAYER0,TOTAL_GOLD_MINED >= 7100)
			CREATE_TEXT(4,"WELL DONE.  IN PREPARATION FOR THE CREATURES WHO WILL SHORTLY BE ARRIVING INTO YOUR DUNGEON, LAY DOWN A LAIR IN THE AREA WHERE YOU MINED OUT THE GOLD.")
			DISPLAY_OBJECTIVE(4,PLAYER0)
			ROOM_AVAILABLE(PLAYER0,LAIR,1,1)
			TUTORIAL_FLASH_BUTTON(8,-1)

			IF(PLAYER0,LAIR >= 9)
				CREATE_TEXT(5,"NOW DIG TO THE FLASHING ENTRANCE TO THE NORTH.  YOUR IMPS WILL CLAIM THE ENTRANCE AUTOMATICALLY AND THIS WILL ENABLE CREATURES TO ENTER YOUR DUNGEON.")
				DISPLAY_OBJECTIVE(5,PLAYER0)
				SET_FLAG(PLAYER0, FLAG0, 3)
			ENDIF
		ENDIF
	ENDIF
ENDIF

REM *** BUILT LAIR ***
IF (PLAYER0, FLAG0 == 3)
	IF(PLAYER0,FLY >= 1)
		CREATE_TEXT(6,"YOUR FIRST MINION IS A FLY.  A FAST CREATURE, BUT VERY WEAK.")
		DISPLAY_OBJECTIVE(6,PLAYER0)
		CREATURE_AVAILABLE(PLAYER0,FLY,1,0)
		CREATURE_AVAILABLE(PLAYER0,BUG,1,1)

		IF(PLAYER0,BUG >= 1)
			CREATE_TEXT(7,"A BEETLE HAS JOINED YOU.  ALTHOUGH SLOWER THAN FLIES, THEY MAKE BETTER FIGHTERS.  BEETLES, HOWEVER, NEED TO EAT.  DIG OUT A 3X3 ROOM TO THE SOUTH AND LAY DOWN A HATCHERY.")
			DISPLAY_OBJECTIVE(7,PLAYER0)
			CREATURE_AVAILABLE(PLAYER0,FLY,1,1)
			ROOM_AVAILABLE(PLAYER0,GARDEN,1,1)
			TUTORIAL_FLASH_BUTTON(7,-1)
			IF(PLAYER0,GARDEN >= 9)
				CREATE_TEXT(8,"NOW ALLOW YOUR IMPS TO FORTIFY YOUR WALLS.  REMEMBER, YOU CAN SPEED UP YOUR IMPS BY SLAPPING THEM.")
				DISPLAY_OBJECTIVE(8,PLAYER0)
				SET_TIMER(PLAYER0,TIMER1)
				SET_FLAG(PLAYER0, FLAG0, 4)
			ENDIF
		ENDIF
	ENDIF
ENDIF

REM *** BUILT GARDEN ***
IF (PLAYER0, FLAG0 == 4)
	IF(PLAYER0,TOTAL_CREATURES >= 8)
		SET_FLAG(PLAYER0, FLAG0, 5)
	ENDIF
ENDIF

REM *** HAS EIGHT OR MORE CREATURES ***
IF (PLAYER0, FLAG0 == 5)
	IF(PLAYER0,TIMER1 >= 600)
		ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,1,DUNGEON,0,1,100)
		ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,1,DUNGEON,0,1,100)
		CREATE_TEXT(12,"BEWARE.  HEROES ARE ATTEMPTING TO BREAK INTO YOUR DUNGEON.  YOU CAN SEE THEM ON THE SMALL MAP IN THE TOP LEFT HAND CORNER OF THE SCREEN, OR ON THE BIG MAP BY PRESSING M.")
		DISPLAY_OBJECTIVE(12,PLAYER0)
		TUTORIAL_FLASH_BUTTON(37,-1)
		IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
			CREATE_TEXT(13,"CONGRATULATIONS.  YOU HAVE WON YOUR FIRST BATTLE.  HOWEVER, YOU WILL HAVE INCURRED THE WRATH OF THE LORD OF THE LAND.  PREPARE YOURSELF.")
			DISPLAY_OBJECTIVE(13,PLAYER0)
			SET_TIMER(PLAYER0,TIMER2)
			SET_FLAG(PLAYER0, FLAG0, 6)
		ENDIF
	ENDIF
ENDIF

REM *** HAS WON FIRST BATTLE ***
IF (PLAYER0, FLAG0 == 6)
	IF(PLAYER0,TIMER2 >= 500)
		IF(PLAYER0,TOTAL_CREATURES >= 8)
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT,1,1)
			CREATE_TEXT(14,"THE LORD OF THE LAND HAS ARRIVED.  KILL HIM TO CONQUER THIS REALM.")
			DISPLAY_OBJECTIVE(14,PLAYER)
		ENDIF
	ENDIF							
ENDIF								

REM *** END LEVEL CHECK - DOESNT NEED A FLAG AS THIRD BATTLE IS ALWAYS KNIGHT ***
REM *** HOWEVER IT MAY BE BETTER TO USE THE FLAG AND THEN TEST FOR PLAYER_GOOD, TOTAL_CREATURES == 0 ***
IF(PLAYER0,BATTLES_WON >= 3)
	CREATE_TEXT(15,"THE LORD IS DEFEATED.  WELL DONE.  YOU HAVE WHAT IT TAKES TO GO ON TO BECOME A TRULY EVIL DUNGEON KEEPER.")
	DISPLAY_OBJECTIVE(15,PLAYER0)
	WIN_GAME
ENDIF

