REM ****************************************************************************
REM  Campaigns Consolidation Project for KeeperFX strategy game.
REM ****************************************************************************
REM  Script for DD Level Abbadon
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)

START_MONEY(PLAYER0,20000)

MAX_CREATURES(PLAYER0,10)

REM	Creature pool
ADD_CREATURE_TO_POOL(SORCEROR,5)
ADD_CREATURE_TO_POOL(BILE_DEMON,5)
ADD_CREATURE_TO_POOL(DRAGON,5)
ADD_CREATURE_TO_POOL(DEMONSPAWN,15)
ADD_CREATURE_TO_POOL(BUG,15)
ADD_CREATURE_TO_POOL(SPIDER,5)
ADD_CREATURE_TO_POOL(TROLL,5)
ADD_CREATURE_TO_POOL(ORC,5)

REM Creature availability
CREATURE_AVAILABLE(ALL_PLAYERS,SORCEROR,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,BILE_DEMON,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,DRAGON,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,DEMONSPAWN,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,BUG,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,SPIDER,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,TROLL,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,ORC,1,0)

REM Room availability - researchable
ROOM_AVAILABLE(ALL_PLAYERS,GUARD_POST,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,0)

REM Spells availability
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)

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

CREATE_PARTY(PARTY1)
	ADD_TO_PARTY(PARTY1,WIZARD,5,100,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY1,THIEF,4,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY1,BARBARIAN,4,100,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY2)
	ADD_TO_PARTY(PARTY2,FAIRY,7,100,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY2,WITCH,5,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY2,GIANT,4,0,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY3)
	ADD_TO_PARTY(PARTY3,FAIRY,10,200,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY3,ARCHER,8,400,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY3,BARBARIAN,7,400,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY3,FAIRY,10,200,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY4)
	ADD_TO_PARTY(PARTY4,WITCH,10,300,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY4,SAMURAI,8,400,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY4,THIEF,8,1000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY4,WITCH,10,300,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY5)
	ADD_TO_PARTY(PARTY5,WIZARD,10,100,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY5,GIANT,8,800,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY5,GIANT,8,800,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY5,WIZARD,10,100,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY6)
	ADD_TO_PARTY(PARTY6,BARBARIAN,8,100,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY6,BARBARIAN,7,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY6,BARBARIAN,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY6,ARCHER,7,0,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY7)
	ADD_TO_PARTY(PARTY7,BARBARIAN,10,400,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY7,BARBARIAN,10,400,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY7,GIANT,9,1000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY7,MONK,10,200,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY7,SAMURAI,10,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY7,ARCHER,10,200,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY8)
	ADD_TO_PARTY(PARTY8,FAIRY,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY8,FAIRY,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY8,FAIRY,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY8,WITCH,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY8,WITCH,10,0,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY9)
	ADD_TO_PARTY(PARTY9,FAIRY,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY9,FAIRY,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY9,WITCH,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY9,WITCH,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY9,WITCH,10,0,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY10)
	ADD_TO_PARTY(PARTY10,SAMURAI,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY10,SAMURAI,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY10,WIZARD,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY10,WIZARD,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY10,GIANT,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY10,GIANT,10,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY10,KNIGHT,10,0,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY11)
	ADD_TO_PARTY(PARTY11,THIEF,4,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY11,THIEF,4,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY11,THIEF,4,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY11,THIEF,4,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY11,ARCHER,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY11,ARCHER,6,0,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY12)
	ADD_TO_PARTY(PARTY12,FAIRY,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY12,FAIRY,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY12,FAIRY,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY12,FAIRY,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY12,FAIRY,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY12,FAIRY,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY12,FAIRY,6,0,ATTACK_ENEMIES,0)

CREATE_PARTY(PARTY14)
	ADD_TO_PARTY(PARTY14,GIANT,5,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY14,SAMURAI,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY14,ARCHER,7,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY14,THIEF,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY14,ARCHER,7,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY14,SAMURAI,6,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(PARTY14,GIANT,5,0,ATTACK_ENEMIES,0)

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

IF(PLAYER0,TREASURE > 0)
	IF(PLAYER0,LAIR > 0)
		IF(PLAYER0,GARDEN > 0)
			IF(PLAYER0,TRAINING > 0)
				IF(PLAYER0,RESEARCH > 0)
					DISPLAY_OBJECTIVE(902,PLAYER0)
				ENDIF
			ENDIF
		ENDIF
	ENDIF
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.

REM When reached just behind entrance of the smaller hero fortress, left passage
IF_ACTION_POINT(1,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY1,1,1)
ENDIF

REM When reached just behind entrance of the smaller hero fortress, right passage
IF_ACTION_POINT(2,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY2,2,1)
ENDIF

REM TODO Create such AP
IF_ACTION_POINT(3,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY3,3,1)
ENDIF

REM TODO Create such AP
IF_ACTION_POINT(4,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY4,4,1)
ENDIF

REM TODO Create such AP
IF_ACTION_POINT(5,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY5,5,1)
ENDIF

REM When reached deep chamber filled with Samurai in the smaller hero fortress
IF_ACTION_POINT(6,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY6,6,1)
ENDIF

REM TODO Create such AP
IF_ACTION_POINT(7,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY7,7,1)
ENDIF

REM When reached lava lake inside larger hero fortress, higher part
IF_ACTION_POINT(8,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY8,8,1)
ENDIF

REM When reached lava lake inside larger hero fortress, lower part
IF_ACTION_POINT(9,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY9,9,1)
ENDIF

REM When reached hero heart at end of larger hero fortress - final place
IF_ACTION_POINT(10,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY10,10,1)
	SET_FLAG(PLAYER0,FLAG0,1)
ENDIF

REM When reached secret chamber with Heal spell at top left
IF_ACTION_POINT(11,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY11,11,1)
ENDIF

REM When reached lava lake leading to entrance of the smaller hero fortress
IF_ACTION_POINT(12,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY12,12,1)
ENDIF

REM When reached a place behind Lava where Conceal Spell is located
IF_ACTION_POINT(13,PLAYER0)
	TRAP_AVAILABLE(ALL_PLAYERS,BOULDER,1,0)
ENDIF

REM When reached gems inside smaller hero fortress
IF_ACTION_POINT(14,PLAYER0)
	IF(PLAYER0,MONEY >= 25000)
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY14,14,1)
	ENDIF
ENDIF

REM "You have come to this realm with little to assist you so you must explore to gain more power. Keep an eye out for any loathsome heroes who may try to thwart your progress."
DISPLAY_OBJECTIVE(898,PLAYER0)

REM Room availability - given when claimed

IF(PLAYER0,TREASURE > 0)
	ROOM_AVAILABLE(ALL_PLAYERS,TREASURE,1,1)
ENDIF

IF(PLAYER0,LAIR > 0)
	ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
ENDIF

IF(PLAYER0,GARDEN > 0)
	ROOM_AVAILABLE(ALL_PLAYERS,GARDEN,1,1)
ENDIF

IF(PLAYER0,TRAINING > 0)
	ROOM_AVAILABLE(ALL_PLAYERS,TRAINING,1,1)
ENDIF

IF(PLAYER0,RESEARCH > 0)
	ROOM_AVAILABLE(ALL_PLAYERS,RESEARCH,1,1)
ENDIF

IF(PLAYER0,BARRACKS > 0)
	ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,1)
ENDIF

IF(PLAYER0,PRISON > 0)
	ROOM_AVAILABLE(ALL_PLAYERS,PRISON,1,1)
ENDIF

IF(PLAYER0,WORKSHOP > 0)
	ROOM_AVAILABLE(ALL_PLAYERS,WORKSHOP,1,1)
ENDIF

IF(PLAYER0,BRIDGE > 0)
	  ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,1)
ENDIF

REM	Win conditions
IF(PLAYER0,FLAG0 == 1)
	IF_CONTROLS(PLAYER_GOOD,KNIGHT <= 0)
		IF(PLAYER_GOOD,DUNGEON_DESTROYED == 1)
			WIN_GAME
		ENDIF
	ENDIF
ENDIF

IF_CONTROLS(PLAYER0,DARK_MISTRESS >= 1)
	REM "Well done, Keeper. The Mistress you have discovered is an excellent prize."
	DISPLAY_INFORMATION(923,ALL_PLAYERS)
ENDIF

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