REM ****************************************************************************
REM  Campaigns Consolidation Project for KeeperFX strategy game.
REM ****************************************************************************
REM  Script for DD Level Caddis Fell
REM  Campaign: Deeper Dungeons
REM  Authors:  based on Bullfrog script
REM            KeeperFX CCP Team
REM  Date:     17 Dec 1996 - 9 Sep 2014
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)

SET_GENERATE_SPEED(500)

COMPUTER_PLAYER(PLAYER1,1)

START_MONEY(PLAYER0,250)
START_MONEY(PLAYER1,10000)

MAX_CREATURES(PLAYER0,20)
MAX_CREATURES(PLAYER1,30)

REM	Creature pool
ADD_CREATURE_TO_POOL(SORCEROR,10)
ADD_CREATURE_TO_POOL(BILE_DEMON,10)
ADD_CREATURE_TO_POOL(DRAGON,10)
ADD_CREATURE_TO_POOL(BUG,15)
ADD_CREATURE_TO_POOL(SPIDER,15)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,10)
ADD_CREATURE_TO_POOL(TROLL,5)
ADD_CREATURE_TO_POOL(ORC,10)
ADD_CREATURE_TO_POOL(VAMPIRE,5)
ADD_CREATURE_TO_POOL(FLY,10)

REM Creature availability
CREATURE_AVAILABLE(ALL_PLAYERS,SORCEROR,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,ORC,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,BILE_DEMON,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,BUG,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,SPIDER,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,DARK_MISTRESS,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,TROLL,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,FLY,1,0)
CREATURE_AVAILABLE(PLAYER1,VAMPIRE,1,0)
CREATURE_AVAILABLE(PLAYER1,DRAGON,1,0)

SET_CREATURE_FEAR_WOUNDED(FLY,30)

REM Room availability
ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TREASURE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,GUARD_POST,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,0) 
ROOM_AVAILABLE(ALL_PLAYERS,TORTURE,1,0) 
ROOM_AVAILABLE(ALL_PLAYERS,WORKSHOP,1,0) 
ROOM_AVAILABLE(ALL_PLAYERS,TEMPLE,1,0) 
ROOM_AVAILABLE(ALL_PLAYERS,GRAVEYARD,1,0) 
ROOM_AVAILABLE(PLAYER1,BRIDGE,1,0)
ROOM_AVAILABLE(PLAYER1,TRAINING,1,0)
ROOM_AVAILABLE(PLAYER1,PRISON,1,0) 

REM Spells availability
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_OBEY,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
REM MAGIC_AVAILABLE(PLAYER0,POWER_DESTROY_WALLS,1,0)

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

CREATE_PARTY(PARTY1)
	ADD_TO_PARTY(PARTY1,SAMURAI,5,100,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY2)
	ADD_TO_PARTY(PARTY2,ARCHER,5,100,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY3)
	ADD_TO_PARTY(PARTY3,MONK,6,100,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY4)
	ADD_TO_PARTY(PARTY4,SAMURAI,5,100,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY5)
	ADD_TO_PARTY(PARTY5,FLY,5,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY5,FLY,5,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY5,FLY,5,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY5,FLY,5,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY5,FLY,5,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY5,FLY,5,0,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY6)
	ADD_TO_PARTY(PARTY6,WIZARD,5,100,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY7)
	ADD_TO_PARTY(PARTY7,FLY,7,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY7,FLY,7,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY7,FLY,7,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY7,FLY,7,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY7,FLY,5,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY7,FLY,5,0,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY8)
	ADD_TO_PARTY(PARTY8,SAMURAI,5,100,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY9)
	ADD_TO_PARTY(PARTY9,MONK,10,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY9,MONK,10,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY9,GIANT,10,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY9,GIANT,10,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY9,MONK,10,500,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY10)
	ADD_TO_PARTY(PARTY10,MONK,10,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY10,MONK,10,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY10,THIEF,10,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY10,GIANT,10,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY10,GIANT,10,500,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY11)
	ADD_TO_PARTY(PARTY11,BARBARIAN,10,1000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY11,THIEF,10,100,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY11,GIANT,10,100,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY11,MONK,10,100,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY11,WITCH,10,100,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY12)
	ADD_TO_PARTY(PARTY12,FLY,7,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY12,FLY,5,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY12,FLY,5,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY12,FLY,5,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY12,FLY,5,0,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY15)
	ADD_TO_PARTY(PARTY15,KNIGHT,10,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY15,SAMURAI,10,100,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY15,SAMURAI,10,100,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY15,SAMURAI,10,100,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY15,WIZARD,10,100,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY15,WIZARD,10,100,ATTACK_ENEMIES,0)

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

REM "Choices, choices Keeper. Choose your path wisely. Some routes are more perilous than others ..."
DISPLAY_OBJECTIVE(913,PLAYER0)

IF(PLAYER0,ENTRANCE > 0)
	IF(PLAYER0,TOTAL_GOLD_MINED > 0)
		REM "The Lord of the Land is a pathetic individual who breeds fluffy bunnies. Pound him into the ground and..."
		DISPLAY_OBJECTIVE(916,PLAYER0)
	ENDIF
ENDIF

REM Room availability - buildable when found on map
IF(PLAYER0,BRIDGE > 0)
	ROOM_AVAILABLE(PLAYER0,BRIDGE,1,1)
ENDIF
IF(PLAYER0,TRAINING > 0)
	ROOM_AVAILABLE(PLAYER0,TRAINING,1,1)
ENDIF
IF(PLAYER0,PRISON > 0)
	ROOM_AVAILABLE(PLAYER0,PRISON,1,1)
ENDIF
IF(PLAYER0,GRAVEYARD > 0)
	ROOM_AVAILABLE(PLAYER0,GRAVEYARD,1,1)
ENDIF

REM Room availability - find but can't build
IF(PLAYER0,GARDEN > 0)
	ROOM_AVAILABLE(PLAYER0,GARDEN,0,0)
ENDIF
IF(PLAYER0,RESEARCH > 0)
	ROOM_AVAILABLE(PLAYER0,RESEARCH,0,0)
ENDIF

REM Action Points triggers - each AP on this level has a corresponding PARTY which is triggered
REM if PLAYER0 reaches that AP. For example, AP1 is associated to PARTY1, and so on.

IF_ACTION_POINT(1,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY1,1,1)
ENDIF

IF_ACTION_POINT(2,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY2,2,1)
ENDIF

IF_ACTION_POINT(3,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY3,3,1)
ENDIF

IF_ACTION_POINT(4,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY4,4,1)
ENDIF

IF_ACTION_POINT(5,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY5,4,4)
ENDIF

IF_ACTION_POINT(6,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY6,6,1)
ENDIF

IF_ACTION_POINT(7,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY7,4,4)
ENDIF

IF_ACTION_POINT(8,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY8,8,1)
ENDIF

IF_ACTION_POINT(9,PLAYER0)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY9,9,ACTION_POINT,16,5,500)
ENDIF

IF_ACTION_POINT(10,PLAYER0)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY10,10,ACTION_POINT,16,5,500)
ENDIF

IF_ACTION_POINT(11,PLAYER0)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY11,11,ACTION_POINT,16,5,500)
ENDIF

IF_ACTION_POINT(12,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY12,4,2)
ENDIF

IF_ACTION_POINT(15,PLAYER0)
	REM "A black shadow is creeping over this land. Now is the time to strike. Take control of your Vampire..."
	DISPLAY_OBJECTIVE(933,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY15,16,1)
	SET_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER1,PRISON >= 9)
	SET_CREATURE_TENDENCIES(PLAYER1,IMPRISON,1)
ENDIF

IF(PLAYER1,DUNGEON_DESTROYED == 1)
	IF(PLAYER_GOOD,DUNGEON_DESTROYED == 0)
		REM "Congratulations Keeper, you have a powerful army indeed. Do not grow complacent though, you still have another challenger to the south ..."
		DISPLAY_OBJECTIVE(915,PLAYER0)
	ENDIF
ENDIF

IF(PLAYER1,DUNGEON_DESTROYED == 0)
	IF(PLAYER_GOOD,DUNGEON_DESTROYED == 1)
		REM "Congratulations Keeper, you have a powerful army indeed. Do not grow complacent though, you still have another challenger to the north ..."
		DISPLAY_OBJECTIVE(914,PLAYER0)
	ENDIF
ENDIF

REM Allow to win only if both dungeons destroyed, all heroes killed and reached AP15
IF(PLAYER1,DUNGEON_DESTROYED == 1)
	IF(PLAYER0,FLAG0 == 1)
		IF(PLAYER_GOOD,DUNGEON_DESTROYED == 1)
			IF_CONTROLS(PLAYER_GOOD,KNIGHT <= 0)
				WIN_GAME
			ENDIF
		ENDIF
	ENDIF
ENDIF

REM ***  End of File  **********************************************************
