REM ****************************************************************************
REM  Campaigns Consolidation Project for KeeperFX strategy game.
REM ****************************************************************************
REM  Script for Level Flowerhat
REM  Campaign: DK Original
REM  Authors:  based on Bullfrog script
REM            KeeperFX CCP Team
REM  Date:     17 Dec 1996 - 11 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   BRIDGE - Researchable
REM   WORKSHOP - When other rooms are built
REM New creatures for the player:
REM   TROLL - Attracted by WORKSHOP
REM New powers for the player:
REM   POWER_CALL_TO_ARMS - Researchable
REM   POWER_HEAL_CREATURE - Researchable
REM New manufacture for the player:
REM   DOOR_WOOD - Manufacture
REM   TRAP_POISON_GAS - Manufacture

SET_GENERATE_SPEED(400)

MAX_CREATURES(PLAYER0,20)

START_MONEY(PLAYER0,3000)

ADD_CREATURE_TO_POOL(FLY,5)
ADD_CREATURE_TO_POOL(BUG,10)
ADD_CREATURE_TO_POOL(DEMONSPAWN,20)
ADD_CREATURE_TO_POOL(TROLL,20)
ADD_CREATURE_TO_POOL(SORCEROR,5)

SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,KNIGHT,3)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,THIEF,3)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,DWARFA,3)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,TUNNELLER,3)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,ARCHER,3)
SET_CREATURE_MAX_LEVEL(PLAYER_GOOD,BARBARIAN,2)

SET_CREATURE_MAX_LEVEL(PLAYER0,DEMONSPAWN,10)

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

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

DOOR_AVAILABLE(PLAYER0,WOOD,1,0)
TRAP_AVAILABLE(PLAYER0,POISON_GAS,1,0)

MAGIC_AVAILABLE(PLAYER0,POWER_SLAP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_HAND,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_SPEED,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_HEAL_CREATURE,1,0)

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

REM "Build up a dungeon including a treasure room, a lair, a hatchery, a training room and a research room. Also dig to and claim an entrance. Do not venture north yet as there are powerful enemies there."
DISPLAY_OBJECTIVE(45,PLAYER0)

IF_AVAILABLE(PLAYER0,BRIDGE == 1)
REM	"Your researchers have given you the ability to lay down bridges. You will need them to cross over lava."
	DISPLAY_INFORMATION(46)
ENDIF

IF(PLAYER0,TREASURE > 0)
	SET_FLAG(PLAYER1,FLAG0,1)
ENDIF

IF(PLAYER0,LAIR > 0)
	SET_FLAG(PLAYER1,FLAG1,1)
ENDIF

IF(PLAYER0,GARDEN > 0)
	SET_FLAG(PLAYER1,FLAG2,1)
ENDIF

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

IF(PLAYER0,RESEARCH > 0)
	SET_FLAG(PLAYER1,FLAG4,1)
ENDIF

IF(PLAYER0,ENTRANCE > 0)
	SET_FLAG(PLAYER1,FLAG6,1)
ENDIF

IF(PLAYER1,FLAG0 == 1)
	IF(PLAYER1,FLAG1 == 1)
		IF(PLAYER1,FLAG2 == 1)
			IF(PLAYER1,FLAG3 == 1)
				IF(PLAYER1,FLAG4 == 1)
					IF(PLAYER1,FLAG6 == 1)
REM						"When you are happy with your dungeon, build a 3x3 workshop which is now available to you. There, your creatures will be able to build doors and traps."
						DISPLAY_OBJECTIVE(47,PLAYER0)
						ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,1)
						TUTORIAL_FLASH_BUTTON(13,-1)
					ENDIF
				ENDIF
			ENDIF
		ENDIF
	ENDIF
ENDIF

IF(PLAYER0,WORKSHOP >= 9)
REM	"To manufacture traps and doors, you will need to place creatures within the workshop. Some creatures are better engineers than others."
	DISPLAY_INFORMATION(48)
	SET_FLAG(PLAYER1,FLAG5,1)
ENDIF

IF(PLAYER1,FLAG5 == 1)
	IF_AVAILABLE(PLAYER0,BRIDGE == 1)
		IF_ACTION_POINT(2,PLAYER0)
REM			"Good. Build up your dungeon and train up your creatures. When you feel ready, go north to crush the defenders of this sickly sweet land."
			DISPLAY_OBJECTIVE(49,PLAYER0)
		ENDIF
	ENDIF
ENDIF

IF(PLAYER1,FLAG5 == 1)
	IF_AVAILABLE(PLAYER0,BRIDGE == 0)
		IF_ACTION_POINT(2,PLAYER0)
REM			"Get your researchers to devise a way for you to cross over lava, which bars your way north to the heroes' dungeon.")
			DISPLAY_OBJECTIVE(50,PLAYER0)
		ENDIF
	ENDIF
ENDIF

IF(PLAYER1,FLAG5 == 1)
	CREATURE_AVAILABLE(PLAYER0,BUG,1,0)
	CREATURE_AVAILABLE(PLAYER0,FLY,1,0)
	CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,0)
	CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,0)
	CREATURE_AVAILABLE(PLAYER0,TROLL,1,1)
ENDIF

CREATE_PARTY(HERO1)
    ADD_TO_PARTY(HERO1,ARCHER,1,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HERO1,DWARFA,1,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HERO1,ARCHER,1,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HERO1,DWARFA,1,100,ATTACK_ENEMIES,0)

CREATE_PARTY(HERO2)
    ADD_TO_PARTY(HERO2,THIEF,1,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HERO2,THIEF,1,100,ATTACK_ENEMIES,0)

CREATE_PARTY(HERO3)
    ADD_TO_PARTY(HERO3,BARBARIAN,1,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HERO3,BARBARIAN,1,100,ATTACK_ENEMIES,0)

CREATE_PARTY(HERO4)
    ADD_TO_PARTY(HERO4,BARBARIAN,1,100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HERO4,ARCHER,2,100,ATTACK_ENEMIES,0)

CREATE_PARTY(KNIGHT)
    ADD_TO_PARTY(KNIGHT,KNIGHT,3,20000,ATTACK_ENEMIES,0)

IF_ACTION_POINT(1,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HERO1,3,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HERO3,7,1)
ENDIF

IF_ACTION_POINT(5,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HERO2,4,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HERO2,8,1)
ENDIF

IF_ACTION_POINT(6,PLAYER0)
REM	"You have reached the heroes' dungeon heart. Get your creatures to destroy it to conquer this land."
	DISPLAY_OBJECTIVE(51,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,KNIGHT,-1,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HERO4,-1,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HERO4,-1,1)
ENDIF

IF(PLAYER0,TROLL > 0)
	CREATURE_AVAILABLE(PLAYER0,BUG,1,1)
	CREATURE_AVAILABLE(PLAYER0,FLY,1,1)
	CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,1)
	CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,1)
	CREATURE_AVAILABLE(PLAYER0,TROLL,1,1)
REM	"A troll has joined you. They are excellent engineers who love to build in workshops."
	DISPLAY_INFORMATION(52)
ENDIF

IF_AVAILABLE(PLAYER0,WOOD == 1)
REM	"Your engineers have come up with a wooden door. Place them down in corridors. They will keep out the enemy but allow your creatures to pass. You can lock doors by tagging them."
	DISPLAY_INFORMATION(54)
ENDIF

IF_AVAILABLE(PLAYER0,POISON_GAS == 1)
REM	"Your engineers have manufactured a poison gas trap. Lay them down and when triggered, it will shroud that area in a deadly vapour."
	DISPLAY_INFORMATION(55)
ENDIF

IF_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS == 1)
REM	"You have researched the call to arms spell. Cast it once to gather creatures into a group, then cast it again to where you want that group to go. Call to arms is free on your land, but costs on all other land."
	DISPLAY_INFORMATION(56)
ENDIF

IF_AVAILABLE(PLAYER0,POWER_HEAL_CREATURE == 1)
	DISPLAY_INFORMATION(164)
ENDIF

IF(PLAYER_GOOD,DUNGEON_DESTROYED == 1)
REM "Well done. With the heroes' dungeon heart destroyed, their power is crushed. This land is ours."
    DISPLAY_OBJECTIVE(53,PLAYER0)
    WIN_GAME
ENDIF
