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

COMPUTER_PLAYER(PLAYER1,2)
COMPUTER_PLAYER(PLAYER2,2)

SET_GENERATE_SPEED(25)

START_MONEY(PLAYER0,0)
START_MONEY(PLAYER1,5)
START_MONEY(PLAYER2,5000)

MAX_CREATURES(PLAYER0,50)
REM Not setting the max for PLAYER1 and PLAYER2 causes default value from rules.cfg to be used
REM But that doesn't really matter - we can't attract creatures here

ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TREASURE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,GARDEN,1,1)
ROOM_AVAILABLE(PLAYER2,GUARD_POST,1,0)
ROOM_AVAILABLE(PLAYER2,RESEARCH,1,1)
ROOM_AVAILABLE(PLAYER2,WORKSHOP,1,1)
ROOM_AVAILABLE(PLAYER2,TORTURE,1,1)
ROOM_AVAILABLE(PLAYER2,BARRACKS,1,0)
ROOM_AVAILABLE(PLAYER2,TRAINING,1,1)

MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,0)
MAGIC_AVAILABLE(PLAYER2,POWER_HAND,1,1)
MAGIC_AVAILABLE(PLAYER2,POWER_IMP,1,1)
MAGIC_AVAILABLE(PLAYER2,POWER_SLAP,1,0)
MAGIC_AVAILABLE(PLAYER2,POWER_SIGHT,1,0) 
MAGIC_AVAILABLE(PLAYER2,POWER_OBEY,1,0)
MAGIC_AVAILABLE(PLAYER2,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(PLAYER2,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(PLAYER2,POWER_SPEED,1,0)
MAGIC_AVAILABLE(PLAYER2,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(PLAYER2,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(PLAYER2,POWER_LIGHTNING,1,0)

TRAP_AVAILABLE(PLAYER2,LIGHTNING,1,0)
TRAP_AVAILABLE(PLAYER2,POISON_GAS,1,0)

CREATE_PARTY(START_ONE)
	ADD_TO_PARTY(START_ONE,DWARFA,4,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(START_ONE,DWARFA,4,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(START_ONE,BARBARIAN,2,0,ATTACK_ENEMIES,0)		
	ADD_TO_PARTY(START_ONE,BARBARIAN,2,0,ATTACK_ENEMIES,0)		
	ADD_TO_PARTY(START_ONE,BARBARIAN,2,0,ATTACK_ENEMIES,0)

CREATE_PARTY(START_TWO)
	ADD_TO_PARTY(START_TWO,DWARFA,2,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(START_TWO,DWARFA,2,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(START_TWO,BARBARIAN,2,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(START_TWO,BARBARIAN,2,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(START_TWO,BARBARIAN,2,0,ATTACK_ENEMIES,0)

CREATE_PARTY(ATTACK_ONE)
	ADD_TO_PARTY(ATTACK_ONE,ARCHER,4,0,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(ATTACK_ONE,ARCHER,4,0,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(ATTACK_ONE,ARCHER,3,0,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(ATTACK_ONE,DWARFA,2,0,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(ATTACK_ONE,DWARFA,2,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(ATTACK_TWO)
	ADD_TO_PARTY(ATTACK_TWO,FAIRY,2,0,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(ATTACK_TWO,FAIRY,2,0,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(ATTACK_TWO,MONK,4,0,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(ATTACK_TWO,MONK,4,0,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(ATTACK_TWO,MONK,4,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(SHOCK_ONE)
	ADD_TO_PARTY(SHOCK_ONE,SAMURAI,3,200,ATTACK_DUNGEON_HEART,0)
	
CREATE_PARTY(SHOCK_TWO)
	ADD_TO_PARTY(SHOCK_TWO,THIEF,4,0,STEAL_GOLD,0)

CREATE_PARTY(SHOCK_THREE)
	ADD_TO_PARTY(SHOCK_TWO,GIANT,2,0,ATTACK_ROOMS,0)
	ADD_TO_PARTY(SHOCK_TWO,BARBARIAN,2,0,ATTACK_ROOMS,0)

CREATE_PARTY(DOOR_ONE)
	ADD_TO_PARTY(DOOR_ONE,DWARFA,7,250,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DOOR_ONE,ARCHER,6,250,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DOOR_ONE,ARCHER,5,250,ATTACK_ENEMIES,0)

CREATE_PARTY(WIZARD_ONE)
	ADD_TO_PARTY(WIZARD_ONE,ARCHER,3,250,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(WIZARD_ONE,ARCHER,6,500,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(WIZARD_ONE,ARCHER,2,200,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(WIZARD_ONE,ARCHER,5,450,ATTACK_ENEMIES,0)

CREATE_PARTY(WIZARD_TWO)
	ADD_TO_PARTY(WIZARD_TWO,BARBARIAN,5,550,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(WIZARD_TWO,BARBARIAN,6,600,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(WIZARD_TWO,MONK,5,550,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(WIZARD_TWO,MONK,7,650,ATTACK_ENEMIES,0)

CREATE_PARTY(WIZARD_THREE)
	ADD_TO_PARTY(WIZARD_THREE,GIANT,8,0,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(WIZARD_THREE,ARCHER,6,0,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(WIZARD_THREE,ARCHER,5,0,ATTACK_DUNGEON_HEART,0)

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

REM "A devious Wizard has cheated you of your magical powers. Use your only Spider and explore the realm. Find the Wizard, kill him and make an example of his foolishness."
DISPLAY_OBJECTIVE(925,PLAYER0)

IF_CONTROLS(PLAYER0,BILE_DEMON >= 1)
	REM "You have discovered a group of Bile Demons who will aid you in your fight."
	DISPLAY_INFORMATION(927,ALL_PLAYERS)
ENDIF

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

IF_ACTION_POINT(1,PLAYER0)
	SET_TIMER(PLAYER_GOOD,TIMER0)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 150)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,START_ONE,3,1)
ENDIF

IF_ACTION_POINT(2,PLAYER0)
	SET_TIMER(PLAYER_GOOD,TIMER1)
ENDIF

IF(PLAYER_GOOD,TIMER1 >= 80)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,START_TWO,4,1)
ENDIF

IF_ACTION_POINT(5,PLAYER0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GIANT,6,4,8,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GIANT,7,4,8,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GIANT,8,4,8,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GIANT,9,4,8,0)
ENDIF

IF_CONTROLS(PLAYER0,IMP >= 1)
	REM "You have found some Imps who consider it a great honour to serve you."
	DISPLAY_INFORMATION(926,ALL_PLAYERS)
	SET_FLAG(PLAYER0,FLAG1,1)
ENDIF

IF(PLAYER1,DUNGEON_DESTROYED == 1)
	REM "The destruction of this pathetic Keeper brings with it a useful bonus. You now have the ability to build Bridges..."
	DISPLAY_INFORMATION(928,ALL_PLAYERS)
	ROOM_AVAILABLE(PLAYER0,BRIDGE,1,1)
	SET_TIMER(PLAYER_GOOD,TIMER2)
ENDIF

IF(PLAYER_GOOD,TIMER2 >= 600)
	REM "A warning, Keeper. There is a stench of hero in the air."
	DISPLAY_INFORMATION(929,-1)
ENDIF

IF(PLAYER_GOOD,TIMER2 >= 800)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ATTACK_ONE,-1,2)
ENDIF

IF(PLAYER_GOOD,TIMER2 >= 850)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ATTACK_TWO,-1,1)
ENDIF

IF_ACTION_POINT(10,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SHOCK_ONE,11,3)
	SET_TIMER(PLAYER_GOOD,TIMER4)
ENDIF

IF(PLAYER_GOOD,TIMER4 >= 200)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SHOCK_TWO,12,3)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SHOCK_THREE,13,5)
ENDIF

IF_ACTION_POINT(14,PLAYER0)
	REM "You have done well to get this far Keeper. Do not become complacent, however. A great struggle lies ahead."
	DISPLAY_INFORMATION(930,ALL_PLAYERS)
ENDIF

IF_ACTION_POINT(15,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,DOOR_ONE,-2,2)
ENDIF

IF_ACTION_POINT(16,PLAYER0)
	SET_TIMER(PLAYER_GOOD,TIMER5)
ENDIF

IF(PLAYER_GOOD,TIMER5 >= 100)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WIZARD_ONE,17,1)
ENDIF

IF(PLAYER_GOOD,TIMER5 >= 250)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WIZARD_TWO,18,1)
ENDIF

IF(PLAYER_GOOD,TIMER5 >= 500)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WIZARD_THREE,19,1)
ENDIF

IF_ACTION_POINT(20,PLAYER0)
	REM "Before you lies the Wizard's domain. Defeat him and you will regain your powers."
	DISPLAY_INFORMATION(931,20)
ENDIF

REM	Once the WIZARD dies
IF_CONTROLS(PLAYER_GOOD,WIZARD <= 0)
	ROOM_AVAILABLE(PLAYER0,GUARD_POST,1,0)
	ROOM_AVAILABLE(PLAYER0,RESEARCH,1,1)
	ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,0)
	ROOM_AVAILABLE(PLAYER0,TORTURE,1,0)
	ROOM_AVAILABLE(PLAYER0,BARRACKS,1,1)
	ROOM_AVAILABLE(PLAYER0,TRAINING,1,1)
	MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
	MAGIC_AVAILABLE(PLAYER0,POWER_SIGHT,1,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS,1,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_HOLD_AUDIENCE,1,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_SPEED,1,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_CONCEAL,1,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_PROTECT,1,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_HEAL_CREATURE,1,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_LIGHTNING,1,0)
	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,LIGHTNING,1,0)
	TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
	TRAP_AVAILABLE(ALL_PLAYERS,LAVA,1,0)
	REM "Your magical powers are restored Keeper. You can finally show these fools what you are made of."
	DISPLAY_OBJECTIVE(932,PLAYER0)
ENDIF

REM	Outcome conditions

IF_CONTROLS(PLAYER0,TOTAL_CREATURES <= 0)
	IF(PLAYER0,FLAG1 == 0)
		LOSE_GAME
	ENDIF
ENDIF

IF_CONTROLS(PLAYER0,TOTAL_DIGGERS <= 0)
	IF(PLAYER0,FLAG1 == 1)
		IF_AVAILABLE(PLAYER0,POWER_IMP <= 0)
			IF(PLAYER0,RESEARCH <= 0)
				LOSE_GAME
			ENDIF
		ENDIF
	ENDIF
ENDIF

REM Win when both players are killed and wizard is dead
IF_CONTROLS(PLAYER_GOOD,WIZARD <= 0)
	IF(PLAYER1,DUNGEON_DESTROYED == 1)
		IF(PLAYER2,DUNGEON_DESTROYED == 1)
			WIN_GAME
		ENDIF
	ENDIF
ENDIF

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