REM ****************************************************************************
REM  Campaigns Consolidation Project for KeeperFX strategy game.
REM ****************************************************************************
REM  Script for Level Eversmile
REM  Campaign: New game plus
REM  Authors:  based on Bullfrog script
REM            KeeperFX CCP Team
REM            Loobinex
REM  Date:     17 Aug 1997 - 14 Mar 2015
REM  Copying and copyrights:
REM    This program is free software; you can redistribute it and/or modify
REM    it under the terms of the GNU General Public License as published by
REM    the Free Software Foundation; either version 2 of the License, or
REM    (at your option) any later version.
REM ****************************************************************************
LEVEL_VERSION(1)
RUN_AFTER_VICTORY(1)
REM New rooms for the player:
REM   TREASURE
REM   LAIR
REM   GARDEN
REM New creatures for the player:
REM   FLY
REM   BUG

REM Flags used:
REM  PLAYER0,FLAG0 - Progress state; 5-ready for 1st battle;
REM                  6-won 1st battle; 7-lord of the land has appeared.

SET_GENERATE_SPEED(350)

START_MONEY(PLAYER0,2000)

MAX_CREATURES(PLAYER0,6)

ADD_CREATURE_TO_POOL(FLY,2)
ADD_CREATURE_TO_POOL(BUG,12)

CREATURE_AVAILABLE(PLAYER0,FLY,1,1)
CREATURE_AVAILABLE(PLAYER0,BUG,1,0)

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

ROOM_AVAILABLE(PLAYER0,TREASURE,1,1)
ROOM_AVAILABLE(PLAYER0,LAIR,1,1)
ROOM_AVAILABLE(PLAYER0,GARDEN,1,1)

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

SET_CREATURE_FEAR_WOUNDED(TUNNELLER,0)
SET_CREATURE_FEAR_STRONGER(TUNNELLER,10000)
SET_CREATURE_FEAR_WOUNDED(THIEF,0)
SET_CREATURE_FEAR_STRONGER(THIEF,10000)
SET_CREATURE_FEAR_WOUNDED(KNIGHT,0)
SET_CREATURE_FEAR_STRONGER(KNIGHT,10000)

SET_CREATURE_STRENGTH(KNIGHT,30)
SET_CREATURE_ARMOUR(KNIGHT,30)
SET_CREATURE_STRENGTH(TUNNELLER,20)
SET_CREATURE_ARMOUR(TUNNELLER,20)
SET_CREATURE_STRENGTH(THIEF,25)

CREATE_PARTY(LANDLORD)
	ADD_TO_PARTY(LANDLORD,KNIGHT,1,1000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(LANDLORD,THIEF,1,100,ATTACK_ENEMIES,0)
	
CREATE_PARTY(THIEVES)
	ADD_TO_PARTY(THIEVES,THIEF,1,100,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(THIEVES,THIEF,1,100,ATTACK_ENEMIES,0)
	
CREATE_PARTY(THIEVESTOO)
	ADD_TO_PARTY(THIEVESTOO,THIEF,1,100,ATTACK_ENEMIES,0)
	
REM ****************************************************************************

SET_BOX_TOOLTIP(0, "Hint Crate")
ADD_OBJECT_TO_LEVEL(SPECBOX_CUSTOM, 5, 0)
SET_FLAG(PLAYER0,FLAG7,0)


IF(PLAYER0,BOX0_ACTIVATED > 0)
	IF(PLAYER0,FLAG7 == 0)
		NEXT_COMMAND_REUSABLE
		QUICK_INFORMATION(25,"Look to the distance where you wouldn't look before. Can you hear it?",ALL_PLAYERS,897)
		NEXT_COMMAND_REUSABLE
		SET_TIMER(PLAYER0,TIMER7)
		NEXT_COMMAND_REUSABLE
		SET_FLAG(PLAYER0,BOX0_ACTIVATED,0)
		NEXT_COMMAND_REUSABLE
		SET_FLAG(PLAYER0,FLAG7,1)
	ENDIF
ENDIF

IF(PLAYER0,TIMER7 >= 100)
	IF(PLAYER0,FLAG7 == 1)
		NEXT_COMMAND_REUSABLE
		CREATE_EFFECT(54,5)
		NEXT_COMMAND_REUSABLE
		ADD_OBJECT_TO_LEVEL(SPECBOX_CUSTOM, 5, 0)
		NEXT_COMMAND_REUSABLE
		SET_FLAG(PLAYER0,FLAG7,0)
	ENDIF
ENDIF



REM New intro
QUICK_OBJECTIVE(1,"Welcome back, Keeper. This is the land where your conquest began. You know what to do.",ALL_PLAYERS)
IF(PLAYER0,TOTAL_CREATURES >= 4)
	SET_FLAG(PLAYER0,FLAG0,5)
ENDIF


REM Player excavates into water
IF_ACTION_POINT(3,PLAYER0)
	QUICK_OBJECTIVE(2,"Odd, the water is more fetid than I recall.",ALL_PLAYERS)
ENDIF

REM Player is alerted to second passage, either themself or by hero invasion
IF_ACTION_POINT(4,ALL_PLAYERS)
	QUICK_OBJECTIVE(3,"I don't remember this passage by the water either.",ALL_PLAYERS)
ENDIF

REM Has four or more creatures
IF(PLAYER0,FLAG0 >= 5)
	PLAY_MESSAGE(PLAYER0,SOUND,69)
	QUICK_INFORMATION(4,"Here they come, right on schedule.",ALL_PLAYERS)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,THIEVES,1,DUNGEON,0,1,200)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,THIEVESTOO,2,DUNGEON,0,1,200)
		IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
			QUICK_OBJECTIVE(5,"Hmm, there were more than I remember.",ALL_PLAYERS)
			SET_TIMER(PLAYER0,TIMER2)
			SET_FLAG(PLAYER0,FLAG0,6)
		ENDIF
ENDIF

REM Has won first battle
IF(PLAYER0,FLAG0 >= 6)
	IF(PLAYER0,TIMER2 >= 200)
		IF(PLAYER0,TOTAL_CREATURES >= 5)
			QUICK_OBJECTIVE(6,"And here's the Lord now. Seems he's even managed to bribe a few more of the local brigands. Crush them.",ALL_PLAYERS)
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,LANDLORD,1,1)
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THIEVES,2,1)
			SET_FLAG(PLAYER0,FLAG0,7)
		ENDIF
	ENDIF							
ENDIF								

REM END LEVEL CHECK - doesn't need a flag, as third battle is always LANDLORD,
REM however it may be better to use the flag and then test if good player has no creatures.
IF(PLAYER0,FLAG0 == 7)
	IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
		QUICK_OBJECTIVE(7,"The heroes seemed slightly more prepared than before, but they still underestimated you and paid the price. Well done Keeper.",ALL_PLAYERS)
		WIN_GAME
		LOCATE_HIDDEN_WORLD
	ENDIF
ENDIF

REM Player is alerted to second passage, either themself or by hero invasion
IF_ACTION_POINT(6,ALL_PLAYERS)
	QUICK_OBJECTIVE(8,"A surprising but not unwelcome secret. Well done, Keeper.",6)
	PLAY_MESSAGE(PLAYER0,SOUND,159)
	IF(PLAYER0,CAMPAIGN_FLAG0 == 0)
		SET_FLAG(PLAYER2,CAMPAIGN_FLAG0,1)
	ENDIF
	IF(PLAYER0,CAMPAIGN_FLAG0 == 2)
		SET_FLAG(PLAYER2,CAMPAIGN_FLAG0,3)
	ENDIF
	IF(PLAYER0,CAMPAIGN_FLAG0 == 4)
		SET_FLAG(PLAYER2,CAMPAIGN_FLAG0,5)
	ENDIF
	IF(PLAYER0,CAMPAIGN_FLAG0 == 6)
		SET_FLAG(PLAYER2,CAMPAIGN_FLAG0,7)
	ENDIF
ENDIF





REM ****************************************************************************