REM ****************************************************************************
REM  Campaigns Consolidation Project for KeeperFX strategy game.
REM ****************************************************************************
REM  Script for Level Cosyton
REM  Campaign: DK Original
REM  Authors:  based on Bullfrog script
REM            KeeperFX CCP Team
REM  Date:     17 Aug 1997 - 06 Feb 2011
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 ****************************************************************************

REM New rooms for the player:
REM   TRAINING - when basic 3 are built
REM New creatures for the player:
REM   DEMON_SPAWN - from start (but needs TRAINING for attraction)

START_MONEY(PLAYER0,2500)
SET_GENERATE_SPEED(350)
MAX_CREATURES(PLAYER0,14)

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

SET_CREATURE_MAX_LEVEL(PLAYER0,DEMONSPAWN,10)

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

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

ADD_CREATURE_TO_POOL(BUG,3)
ADD_CREATURE_TO_POOL(FLY,3)
ADD_CREATURE_TO_POOL(DEMONSPAWN,24)

SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,KNIGHT,2)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,THIEF,2)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,DWARFA,2)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,TUNNELLER,2)

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

CREATE_PARTY(THIEVES)
    ADD_TO_PARTY(THIEVES,THIEF,1,200,STEAL_GOLD,0)

CREATE_PARTY(DWARVES)
    ADD_TO_PARTY(DWARVES,DWARFA,1,200,ATTACK_ENEMIES,0)

CREATE_PARTY(ELITE)
    ADD_TO_PARTY(ELITE,DWARFA,1,200,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ELITE,THIEF,1,200,ATTACK_ENEMIES,0)

CREATE_PARTY(LANDLORD)
    ADD_TO_PARTY(LANDLORD,KNIGHT,1,2000,ATTACK_ENEMIES,0)

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

REM "First of all, establish a basic dungeon. Remember, you will need to build a treasure room, a lair and a hatchery and you will also need to claim a creature entrance."
DISPLAY_OBJECTIVE(24,PLAYER0)

IF(PLAYER0,GAME_TURN >= 10)
REM "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_INFORMATION(23)
ENDIF

IF(PLAYER0,GAME_TURN >= 1000)
REM "When your imps have no active tasks, they will run around reinforcing your dungeon. Rooms with reinforced walls are more efficient."
    DISPLAY_INFORMATION(22)
ENDIF

IF(PLAYER0,LAIR >= 9)
	SET_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER0,TREASURE >= 9)
	SET_FLAG(PLAYER0,FLAG5,1)
ENDIF

IF(PLAYER0,GARDEN >= 9)
	SET_FLAG(PLAYER0,FLAG6,1)
ENDIF

IF(PLAYER0,ENTRANCE > 0)
	SET_FLAG(PLAYER0,FLAG2,1)
ENDIF

IF(PLAYER0,FLAG0 == 1)
	IF(PLAYER0,FLAG5 == 1)
		IF(PLAYER0,FLAG6 == 1)
			IF(PLAYER0,FLAG2 == 1)
				ROOM_AVAILABLE(PLAYER0,TRAINING,1,1)
				TUTORIAL_FLASH_BUTTON(10,-1)
REM				"You will need stronger creatures. Build a 3x3 training room to make your creatures stronger, and to give them new spells and abilities."
				DISPLAY_OBJECTIVE(25,PLAYER0)
				SET_TIMER(PLAYER1,TIMER2)
				SET_FLAG(PLAYER0,FLAG0,2)
				SET_TIMER(PLAYER0,TIMER2)
			ENDIF
		ENDIF
	ENDIF
ENDIF

IF(PLAYER0,FLAG0 != 2)
	IF(PLAYER0,GAME_TURN > 10000)
		IF(PLAYER0,LAIR > 0)
			IF(PLAYER0,TREASURE > 0)
				IF(PLAYER0,GARDEN > 0)
					IF(PLAYER0,ENTRANCE > 0)
						ROOM_AVAILABLE(PLAYER0,TRAINING,1,1)
						TUTORIAL_FLASH_BUTTON(10,-1)
REM                     "You will need stronger creatures. Build a 3x3 training room to make your creatures stronger, and to give them new spells and abilities."
						DISPLAY_OBJECTIVE(25,PLAYER0)
						SET_TIMER(PLAYER0,TIMER2)
						SET_FLAG(PLAYER0,FLAG0,2)
					ENDIF
				ENDIF
			ENDIF
		ENDIF
	ENDIF
ENDIF

IF(PLAYER0,TRAINING >= 9)
	SET_FLAG(PLAYER0,FLAG3,1)
ENDIF

IF(PLAYER0,TIMER2 > 7000)
	IF(PLAYER0,TRAINING > 0)
		SET_FLAG(PLAYER0,FLAG3,1)
	ENDIF
ENDIF

IF(PLAYER0,FLAG3 == 1)
REM	"Good. Now get your imps to fortify the walls in your rooms. This will increase the efficiency of the rooms and repel invaders."
	DISPLAY_OBJECTIVE(26,PLAYER0)
	CREATURE_AVAILABLE(PLAYER0,FLY,1,0)
	CREATURE_AVAILABLE(PLAYER0,BUG,1,0)
	CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,1)
REM	"A training room will attract fighters, especially demon spawn. Fighters are good for training."
	DISPLAY_INFORMATION(27)
	SET_TIMER(PLAYER1,TIMER0)
	IF(PLAYER0,DEMONSPAWN > 0)
REM		"To train creatures, put them in the training room. The number that you will see coming out is the amount it costs a creature to train."
		DISPLAY_INFORMATION(28)
	ENDIF
ENDIF

REM Info to tell player to slap creatures
IF(PLAYER0,DEMONSPAWN > 0)
	SET_TIMER(PLAYER1,TIMER2)
	IF(PLAYER1,TIMER2 >= 500)
REM		"Remember, you can speed up the creatures training by slapping them while they're in the training room."
		DISPLAY_INFORMATION(29)
	ENDIF
ENDIF

IF(PLAYER0,DEMONSPAWN >= 2)
	IF(PLAYER2,FLAG1 == 0)
		SET_FLAG(PLAYER2,FLAG0,1)
		CREATURE_AVAILABLE(PLAYER0,FLY,1,1)
		CREATURE_AVAILABLE(PLAYER0,BUG,1,1)
		CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,1)
		IF(PLAYER1,TIMER0 >= 4000)
			ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,THIEVES,1,DUNGEON,0,1,500)
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,DWARVES,1,1)
REM			"The heroes are on their way. Make sure your creatures are well trained and ready for the attack."
			DISPLAY_OBJECTIVE(30,PLAYER0)
			IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
				IF(PLAYER0,TOTAL_CREATURES >= 8)
					ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,-1,DUNGEON,0,1,500)
					IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
						IF(PLAYER0,TOTAL_CREATURES >= 8)
							ADD_PARTY_TO_LEVEL(PLAYER_GOOD,LANDLORD,-1,1)
							IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
REM								"Congratulations. You have conquered the enemy hordes."
								DISPLAY_OBJECTIVE(31,PLAYER0)
								WIN_GAME
							ENDIF
						ENDIF
					ENDIF
				ENDIF
			ENDIF
		ENDIF
	ENDIF
ENDIF

IF_ACTION_POINT(2,PLAYER0)
	IF(PLAYER2,FLAG0 == 0)
		SET_FLAG(PLAYER2,FLAG1,1)
		ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,THIEVES,1,DUNGEON,0,1,500)
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,DWARVES,1,1)
REM		"The heroes are on their way. Make sure your creatures are well trained and ready for the attack."
		DISPLAY_OBJECTIVE(32,PLAYER0)
		IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
			IF(PLAYER0,TOTAL_CREATURES >= 8)
				ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,-1,DUNGEON,0,1,500)
				IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
					IF(PLAYER0,TOTAL_CREATURES >= 8)
						ADD_PARTY_TO_LEVEL(PLAYER_GOOD,LANDLORD,-1,1)
						IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
REM                         "Congratulations. You have conquered the enemy hordes."
							DISPLAY_OBJECTIVE(33,PLAYER0)
							WIN_GAME
						ENDIF
					ENDIF
				ENDIF
			ENDIF
		ENDIF
	ENDIF
ENDIF
