REM ****************************************************************************
REM  Campaigns Consolidation Project for KeeperFX strategy game.
REM ****************************************************************************
REM  Script for Level Hearth
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 powers for the player:
REM   POWER_CHICKEN - If the player can reach it
REM New manufacture for the player:
REM   TRAP_ALARM - not really new; anyway originally wan't available
REM Removed:
REM   DOOR_MAGIC - I think the workshop isn't big enough to build one and the player doesn't have time to put one
REM   TRAP_WORD_OF_POWER - Workshop isn't big enough
REM   TRAP_LAVA - Workshop isn't big enough

SET_GENERATE_SPEED(400)

MAX_CREATURES(PLAYER0,30)

START_MONEY(PLAYER0,10000)

ADD_CREATURE_TO_POOL(DEMONSPAWN,20)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,20)
ADD_CREATURE_TO_POOL(SORCEROR,30)
ADD_CREATURE_TO_POOL(TROLL,20)
ADD_CREATURE_TO_POOL(BILE_DEMON,10)
ADD_CREATURE_TO_POOL(HELL_HOUND,30)
ADD_CREATURE_TO_POOL(DRAGON,15)
ADD_CREATURE_TO_POOL(ORC,15)

REM	Creature availability
CREATURE_AVAILABLE(PLAYER0,TROLL,1,1)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,1)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,1)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER0,HELL_HOUND,1,1)
CREATURE_AVAILABLE(PLAYER0,DRAGON,1,1)
CREATURE_AVAILABLE(PLAYER0,ORC,1,1)
	
REM	Room availability
ROOM_AVAILABLE(ALL_PLAYERS,TREASURE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,GARDEN,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TRAINING,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,RESEARCH,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,WORKSHOP,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,GUARD_POST,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,PRISON,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,SCAVENGER,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TORTURE,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,PRISON,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TEMPLE,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,GRAVEYARD,1,0)

REM	Spells availability
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SIGHT,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CALL_TO_ARMS,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,1,0)

REM	Doors and traps availability
DOOR_AVAILABLE(ALL_PLAYERS,BRACED,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,STEEL,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,BOULDER,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,LIGHTNING,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,ALARM,1,0)

CREATE_PARTY(FIRST)
    ADD_TO_PARTY(FIRST,BARBARIAN,2,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FIRST,GIANT,2,1500,ATTACK_ENEMIES,0)

CREATE_PARTY(SECOND)
    ADD_TO_PARTY(SECOND,MONK,3,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(SECOND,MONK,3,1500,ATTACK_ENEMIES,0)

CREATE_PARTY(THIRD)
    ADD_TO_PARTY(THIRD,ARCHER,4,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THIRD,BARBARIAN,4,1500,ATTACK_ENEMIES,0)

CREATE_PARTY(FOURTH)
    ADD_TO_PARTY(FOURTH,WIZARD,4,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOURTH,GIANT,4,1500,ATTACK_ENEMIES,0)

CREATE_PARTY(FIFTH)
    ADD_TO_PARTY(FIFTH,WIZARD,5,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FIFTH,WIZARD,5,1750,ATTACK_ENEMIES,0)

CREATE_PARTY(SIXTH)
    ADD_TO_PARTY(SIXTH,MONK,6,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(SIXTH,MONK,6,1500,ATTACK_ENEMIES,0)

CREATE_PARTY(SEVENTH)
    ADD_TO_PARTY(SEVENTH,FAIRY,6,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(SEVENTH,FAIRY,6,1500,ATTACK_ENEMIES,0)

CREATE_PARTY(EIGHTH)
    ADD_TO_PARTY(EIGHTH,WITCH,8,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(EIGHTH,WITCH,8,1500,ATTACK_ENEMIES,0)

CREATE_PARTY(LANDLORD)
    ADD_TO_PARTY(LANDLORD,KNIGHT,6,10000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(LANDLORD,ARCHER,6,900,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(LANDLORD,BARBARIAN,6,900,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(LANDLORD,MONK,6,900,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(LANDLORD,FAIRY,8,900,ATTACK_ENEMIES,0)

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

SET_TIMER(PLAYER_GOOD,TIMER0)

SET_TIMER(PLAYER_GOOD,TIMER1)
IF(PLAYER_GOOD,FLAG0 == 0)
	IF(PLAYER_GOOD,TIMER0 >= 1000)
		IF(PLAYER_GOOD,TIMER1 > 1750)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIRST,3,1)
			NEXT_COMMAND_REUSABLE
			SET_TIMER(PLAYER_GOOD,TIMER1)
		ENDIF
	ENDIF
ENDIF

SET_TIMER(PLAYER_GOOD,TIMER2)
IF(PLAYER_GOOD,FLAG0 == 0)
	IF(PLAYER_GOOD,TIMER0 >= 1750)
		IF(PLAYER_GOOD,TIMER2 > 2250)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SECOND,1,1)
			NEXT_COMMAND_REUSABLE
			SET_TIMER(PLAYER_GOOD,TIMER2)
		ENDIF
	ENDIF
ENDIF

SET_TIMER(PLAYER_GOOD,TIMER3)
IF(PLAYER_GOOD,FLAG0 == 0)
	IF(PLAYER_GOOD,TIMER0 >= 2500)
		IF(PLAYER_GOOD,TIMER3 > 2750)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THIRD,2,1)
			NEXT_COMMAND_REUSABLE
			SET_TIMER(PLAYER_GOOD,TIMER3)
		ENDIF
	ENDIF
ENDIF

SET_TIMER(PLAYER_GOOD,TIMER4)
IF(PLAYER_GOOD,FLAG0 == 0)
	IF(PLAYER_GOOD,TIMER0 >= 3250)
		IF(PLAYER_GOOD,TIMER4 > 3500)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOURTH,4,1)
			NEXT_COMMAND_REUSABLE
			SET_TIMER(PLAYER_GOOD,TIMER4)
		ENDIF
	ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 13000)
	SET_FLAG(PLAYER_GOOD,FLAG0,1)
	IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
REM		"You have decimated the first wave. The final wave is on its way, and they're pissed off. Train up your creatures and prepare yourself."
		DISPLAY_OBJECTIVE(102,PLAYER0)
		SET_TIMER(PLAYER0,TIMER1)
		IF(PLAYER0,TIMER1 >= 3000)
REM			"Here they come..."
			DISPLAY_OBJECTIVE(103,PLAYER0)
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIFTH,1,1)
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SIXTH,2,1)
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SEVENTH,3,1)
			IF(PLAYER0,TIMER1 >= 5000)
				ADD_PARTY_TO_LEVEL(PLAYER_GOOD,EIGHTH,4,1)
				IF(PLAYER_GOOD,TOTAL_CREATURES < 3)
					ADD_PARTY_TO_LEVEL(PLAYER_GOOD,LANDLORD,1,1)
					IF(PLAYER_GOOD,KNIGHT == 0)
REM						"The heroes are decimated. This land, and its spoils, are yours."
						DISPLAY_OBJECTIVE(104,PLAYER0)
						WIN_GAME
					ENDIF
				ENDIF
			ENDIF	
		ENDIF
	ENDIF
ENDIF

REM Chaz,Matt,Louise,Nick,Mum and various others - HELLO

REM "This land is on its knees and as a last ditch defence of their realm, has prepared a full scale attack on you dungeon. Wipe out this force to control thi land."
DISPLAY_OBJECTIVE(105,PLAYER0)

IF_AVAILABLE(PLAYER0,POWER_CHICKEN == 1)
REM	"Your researchers have come up with a devastating spell, the spell of chicken. Cast it on a creature to transform them from a fiery beast into a clucking chicken. Marvellous."
   	DISPLAY_INFORMATION(97)
ENDIF

IF_AVAILABLE(PLAYER0,ALARM == 1)
REM	"Your engineers have built an alarm trap. It will warn you when triggered by enemies, but also call any nearby creatures to that point."
	DISPLAY_INFORMATION(98)
ENDIF
