REM ****************************************************************************
REM  Campaigns Consolidation Project for KeeperFX strategy game.
REM ****************************************************************************
REM  Script for Level Moonbrush Wood
REM  Campaign: New game plus
REM  Authors:  based on Bullfrog script
REM            KeeperFX CCP Team
REM            Loobinex
REM  Date:     17 Dec 1996 - 25 Jul 2020
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)

REM New rooms for the player:
REM   GRAVEYARD
REM New creatures for the player:
REM   HORNY
REM   VAMPIRE
REM   DRAGON
REM New powers for the player:
REM   POWER_HOLD_AUDIENCE
REM   POWER_DISEASE

REM Flags used:
REM   PLAYER0,FLAG0 - Transferred DRAGON state; 0-not transferred to this level; 1-had transferred DRAGON from level start. 
REM Timers used:
REM   PLAYER_GOOD,TIMER0 - Delay after Lord of Land arrival

SET_GENERATE_SPEED(350)

START_MONEY(PLAYER0,5000)

MAX_CREATURES(PLAYER0,20)

ADD_CREATURE_TO_POOL(FLY,20)
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(SPIDER,20)
ADD_CREATURE_TO_POOL(BILE_DEMON,8)
ADD_CREATURE_TO_POOL(ORC,20)

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,DARK_MISTRESS,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,SORCEROR,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,SPIDER,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,BILE_DEMON,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,ORC,1,0)

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,0)
ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,GUARD_POST,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,PRISON,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TORTURE,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,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_LIGHTNING,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,1,0)

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

CREATE_PARTY(LANDLORD)
	ADD_TO_PARTY(LANDLORD,KNIGHT,7,3000,ATTACK_DUNGEON_HEART,400)
	ADD_TO_PARTY(LANDLORD,THIEF,5,3000,ATTACK_DUNGEON_HEART,400)
	ADD_TO_PARTY(LANDLORD,THIEF,5,3000,ATTACK_DUNGEON_HEART,400)
	ADD_TO_PARTY(LANDLORD,THIEF,5,3000,ATTACK_DUNGEON_HEART,400)
	ADD_TO_PARTY(LANDLORD,ARCHER,5,3000,ATTACK_DUNGEON_HEART,400)
	ADD_TO_PARTY(LANDLORD,ARCHER,5,3000,ATTACK_DUNGEON_HEART,400)
	ADD_TO_PARTY(LANDLORD,ARCHER,5,3000,ATTACK_DUNGEON_HEART,400)

CREATE_PARTY(READERS)
	ADD_TO_PARTY(READERS,GIANT,7,200,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(READERS,MONK,5,200,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(READERS,ARCHER,5,200,ATTACK_DUNGEON_HEART,0)


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

REM "This realm is ruled by four arrogant Wizards who think they've got everything under control, because their feeble magical power impresses the locals. But you're not from these parts..."
DISPLAY_OBJECTIVE(81,ALL_PLAYERS)

REM If we had dragon at start (from Transfer Creature special), disable the evolution notice
IF(PLAYER0,GAME_TURN < 200)
	IF(PLAYER0,DRAGON >= 1)
		SET_FLAG(PLAYER0,FLAG0,1)
	ENDIF
ENDIF

REM Show the evolution notice; note that adding DRAGON to level would destroy the logic below
IF(PLAYER0,DRAGON >= 1)
	IF(PLAYER0,GAME_TURN >= 1000)
		IF(PLAYER0,FLAG0 == 0)
			DISPLAY_INFORMATION(174,ALL_PLAYERS)
		ENDIF
	ENDIF
ENDIF

IF_CONTROLS(PLAYER_GOOD,WIZARD <= 0)
	SET_TIMER(PLAYER_GOOD,TIMER1)
	IF(PLAYER_GOOD,TIMER1 >= 3600)
		SET_FLAG(PLAYER0,FLAG1,2)
	ENDIF
	IF(PLAYER_GOOD,WIZARD <= 0)
		SET_FLAG(PLAYER0,FLAG1,2)
	ENDIF
ENDIF

IF(PLAYER0,FLAG1 >= 2)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,LANDLORD,-1,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,READERS,-2,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,READERS,-3,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,READERS,-4,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,READERS,-5,1)
	SET_TIMER(PLAYER_GOOD,TIMER0)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 100)
	IF_CONTROLS(PLAYER_GOOD,TOTAL_CREATURES <= 0)
		REM "Well, you're done down here. Time to introduce yourself to the locals and re-organise their nice little lives."
		DISPLAY_OBJECTIVE(82,ALL_PLAYERS)
		WIN_GAME
	ENDIF
ENDIF


REM REM Convert all heroes impressed by the wizards to your cause before the lord spawns to get the transfer special
IF(PLAYER0,FLAG1 < 2)
	IF_CONTROLS(PLAYER0,ARCHER >= 1)
		CHANGE_SLAB_TYPE(4,37,PATH)
	ENDIF
	IF_CONTROLS(PLAYER0,GIANT >= 1)
		CHANGE_SLAB_TYPE(8,26,PATH)
	ENDIF
	IF_CONTROLS(PLAYER0,MONK >= 1)
		CHANGE_SLAB_TYPE(3,25,PATH)
	ENDIF
	IF_CONTROLS(PLAYER0,GIANT >= 6)
		CHANGE_SLAB_TYPE(3,34,PATH)
	ENDIF
	IF_CONTROLS(PLAYER0,MONK >= 4)
		CHANGE_SLAB_TYPE(3,27,PATH)
	ENDIF
	IF_CONTROLS(PLAYER0,ARCHER >= 9)
		CHANGE_SLAB_TYPE(8,31,PATH)
	ENDIF
	IF_CONTROLS(PLAYER0,THIEF >= 1)
		CHANGE_SLAB_TYPE(3,36,PATH)
	ENDIF
	IF_CONTROLS(PLAYER0,SAMURAI >= 1)
		CHANGE_SLAB_TYPE(4,33,PATH)
	ENDIF
	IF_CONTROLS(PLAYER0,WITCH >= 1)
		CHANGE_SLAB_TYPE(6,29,PATH)
	ENDIF
	IF_CONTROLS(PLAYER0,WITCH >= 4)
		CHANGE_SLAB_TYPE(8,28,PATH)
	ENDIF
	IF_CONTROLS(PLAYER0,SAMURAI >= 4)
		CHANGE_SLAB_TYPE(8,24,PATH)
	ENDIF
	IF_CONTROLS(PLAYER0,THIEF >= 8)
		CHANGE_SLAB_TYPE(6,24,PATH)
	ENDIF
ENDIF

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