REM ****************************************************************************
REM  Campaigns Consolidation Project for KeeperFX strategy game.
REM ****************************************************************************
REM  Script for Level Lushmeadow-on-Down
REM  Campaign: DK Original
REM  Authors:  based on Bullfrog script
REM            KeeperFX CCP Team
REM  Date:     17 Dec 1996 - 08 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)
RUN_AFTER_VICTORY(1)

REM Computer player for first time
REM New rooms for the player:
REM   GUARD_POST - Researchable
REM   PRISON - When claimed on map
REM New creatures for the player:
REM   SPIDER - From start
REM   BILE_DEMON - When found on the map
REM   SKELETON - To find on the map
REM New powers for the player:
REM   POWER_SIGHT - Researchable

SET_GENERATE_SPEED(500)

REM Computer Player stuff
COMPUTER_PLAYER(PLAYER1,4)

START_MONEY(PLAYER0,2000)
START_MONEY(PLAYER1,5000)

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

ADD_CREATURE_TO_POOL(BUG,20)
ADD_CREATURE_TO_POOL(FLY,20)
ADD_CREATURE_TO_POOL(SPIDER,15)
ADD_CREATURE_TO_POOL(TROLL,20)
ADD_CREATURE_TO_POOL(DEMONSPAWN,20)
ADD_CREATURE_TO_POOL(SORCEROR,8)
ADD_CREATURE_TO_POOL(BILE_DEMON,3)

SET_CREATURE_MAX_LEVEL(ALL_PLAYERS,IMP,5)
SET_CREATURE_MAX_LEVEL(ALL_PLAYERS,BUG,5)
SET_CREATURE_MAX_LEVEL(ALL_PLAYERS,FLY,5)
SET_CREATURE_MAX_LEVEL(ALL_PLAYERS,SPIDER,5)
SET_CREATURE_MAX_LEVEL(ALL_PLAYERS,TROLL,5)
SET_CREATURE_MAX_LEVEL(ALL_PLAYERS,DEMONSPAWN,5)
SET_CREATURE_MAX_LEVEL(ALL_PLAYERS,SORCEROR,5)
SET_CREATURE_MAX_LEVEL(ALL_PLAYERS,BILE_DEMON,5)
SET_CREATURE_MAX_LEVEL(ALL_PLAYERS,SKELETON,5)

REM	Creature availability
CREATURE_AVAILABLE(ALL_PLAYERS,TROLL,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,DEMONSPAWN,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,FLY,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,SORCEROR,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,BUG,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,SPIDER,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,BILE_DEMON,1,0)
	
REM	Room availability
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(PLAYER1,TREASURE,1,0)
ROOM_AVAILABLE(PLAYER1,LAIR,1,0)
ROOM_AVAILABLE(PLAYER1,GARDEN,1,0)
ROOM_AVAILABLE(PLAYER1,TRAINING,1,0)
ROOM_AVAILABLE(PLAYER1,RESEARCH,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,WORKSHOP,1,0)
ROOM_AVAILABLE(PLAYER1,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_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_SIGHT,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)

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

CREATE_PARTY(SURPRISE)
	ADD_TO_PARTY(SURPRISE,ARCHER,4,400,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(SURPRISE,KNIGHT,5,4000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(SURPRISE,THIEF,4,400,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(SURPRISE,DWARFA,4,400,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(SURPRISE,BARBARIAN,4,400,ATTACK_ENEMIES,0)

rem - prevent prison convert snow-balling -
IF( PLAYER0, SKELETON > 2 )
    SET_GAME_RULE( PrisonSkeletonChance, 80 )
ENDIF
IF( PLAYER0,SKELETON > 5 )
    SET_GAME_RULE( PrisonSkeletonChance, 60 )
ENDIF
IF( PLAYER0,SKELETON > 8 )
    SET_GAME_RULE( PrisonSkeletonChance, 40 )
ENDIF
IF( PLAYER0,GHOST > 3 )
    SET_GAME_RULE( GhostConvertChance, 30 )
ENDIF

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

SET_FLAG(PLAYER0,FLAG0,0)
REM Prison flag

QUICK_OBJECTIVE(1,"There is another Keeper controlling this land, who has already started on an impressive dungeon and has pushed the Heroes away. He has already expanded out, so be careful you don't walk headfirst into danger.",PLAYER0)

IF(PLAYER0,PRISON == 0)
	IF(PLAYER0,FLAG0<=1)
		NEXT_COMMAND_REUSABLE
		ROOM_AVAILABLE(PLAYER0,PRISON,0,0)
	ENDIF
ENDIF

IF(PLAYER0,PRISON > 0)
	IF(PLAYER0,FLAG0==0)
		QUICK_OBJECTIVE(2,"While we hold this Prison, we have a chance to learn to study its design. Try not to lose it before we understand it.",PLAYER0)
		ROOM_AVAILABLE(PLAYER0,PRISON,1,0)
		SET_FLAG(PLAYER0,FLAG0,1)
	ENDIF
ENDIF

IF(PLAYER0,PRISON > 0)
	IF(PLAYER0,FLAG0==1)
		NEXT_COMMAND_REUSABLE
		ROOM_AVAILABLE(PLAYER0,PRISON,1,0)
	ENDIF
ENDIF

IF_AVAILABLE(PLAYER0,PRISON == 1)
	TUTORIAL_FLASH_BUTTON(69,-1)
	SET_FLAG(PLAYER0,FLAG0,2)
	QUICK_INFORMATION(3,"The dark magicks used to raise the dead take a toll on the land itself. You may find it increasingly difficult to raise Skeletons to your ranks.")
ENDIF

IF(PLAYER1,PRISON > 0)
	SET_CREATURE_TENDENCIES(PLAYER1,IMPRISON,1)
ENDIF

IF(PLAYER1,DUNGEON_DESTROYED >= 1)
	QUICK_OBJECTIVE(4,"Even his headstart did not stop you. Well done. Let's hope the Heroes don't notice that there's a new owner.",PLAYER0)
	WIN_GAME
	SET_TIMER(PLAYER0,TIMER0)
ENDIF

IF(PLAYER1,DUNGEON_DESTROYED >= 1)
	IF(PLAYER0,TIMER0 >= 1000)
		ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,SURPRISE,-1,DUNGEON,0,4,400)
		QUICK_OBJECTIVE(5,"It seems the goodly Heroes did indeed notice the new decor. More corpses to line the walls I suppose.",-1)
		SET_FLAG(PLAYER_GOOD,FLAG0,1)
	ENDIF
ENDIF

IF(PLAYER_GOOD,FLAG0 == 1)
	IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
		QUICK_OBJECTIVE(6,"Now that that's dealt with, take a look to see what they were guarding...")
	ENDIF
ENDIF

IF_ACTION_POINT(2,PLAYER0)
	IF(PLAYER2,CAMPAIGN_FLAG1 == 0)
		SET_FLAG(PLAYER2,CAMPAIGN_FLAG1,2)
	ENDIF
	IF(PLAYER2,CAMPAIGN_FLAG1 == 1)
		SET_FLAG(PLAYER2,CAMPAIGN_FLAG1,3)
	ENDIF
	IF(PLAYER2,CAMPAIGN_FLAG1 == 4)
		SET_FLAG(PLAYER2,CAMPAIGN_FLAG1,6)
	ENDIF
	IF(PLAYER2,CAMPAIGN_FLAG1 == 5)
		SET_FLAG(PLAYER2,CAMPAIGN_FLAG1,7)
	ENDIF
ENDIF

SET_BOX_TOOLTIP(0, "Hint Crate")
ADD_OBJECT_TO_LEVEL(SPECBOX_CUSTOM, 1, 0)
SET_FLAG(PLAYER0,FLAG7,0)

IF(PLAYER0,BOX0_ACTIVATED > 0)
	IF(PLAYER0,FLAG7 == 0)
		NEXT_COMMAND_REUSABLE
		QUICK_INFORMATION(25,"Show the heroes of this land what you've done with the place.",ALL_PLAYERS,897)
		NEXT_COMMAND_REUSABLE
		SET_TIMER(PLAYER0,TIMER7)
		NEXT_COMMAND_REUSABLE
		SET_FLAG(PLAYER0,BOX0_ACTIVATED,0)
		NEXT_COMMAND_REUSABLE
		SET_FLAG(PLAYER0,FLAG7,1)
	ENDIF
ENDIF

IF(PLAYER0,TIMER7 >= 100)
	IF(PLAYER0,FLAG7 == 1)
		NEXT_COMMAND_REUSABLE
		CREATE_EFFECT(54,1)
		NEXT_COMMAND_REUSABLE
		ADD_OBJECT_TO_LEVEL(SPECBOX_CUSTOM, 1, 0)
		NEXT_COMMAND_REUSABLE
		SET_FLAG(PLAYER0,FLAG7,0)
	ENDIF
ENDIF





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