REM ****************************************************************************
REM  Campaigns Consolidation Project for KeeperFX strategy game.
REM ****************************************************************************
REM  Script for Level TulipScent
REM  Campaign: New game plus
REM  Authors:  based on Bullfrog script
REM            KeeperFX CCP Team
REM            Loobinex
REM  Date:     17 Dec 1996 - 15 Aug 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 creatures for the player:
REM   TENTACLE - this is a rare case where it can be attracted
REM New powers for the player:
REM   POWER_OBEY - castable from the beginning

REM Flags used:
REM   PLAYER0,FLAG1 - When creature annoyed, no transfer special
REM Timers used:
REM   PLAYER_GOOD,TIMER0 - Makes delay between parties after AP4 activation

SET_GENERATE_SPEED(750)

REM Computer Player stuff
COMPUTER_PLAYER(PLAYER1,0)

SET_COMPUTER_CHECKS(PLAYER1,"CHECK FOR NEUTRAL PLACES",15000,0,0,0,65000)
REM "CHECK FOR QUICK ATTACK" CheckEvery AttackPercent CTADuration MinForAttack LastCheck
SET_COMPUTER_CHECKS(PLAYER1,"CHECK FOR QUICK ATTACK",700,70,3000,8,12500)
SET_COMPUTER_PROCESS(PLAYER1,"ATTACK SAFE ATTACK",-1,100,17,100,0)
SET_COMPUTER_PROCESS(PLAYER1,"ATTACK PLAN 1",-1,100,17,100,0)

START_MONEY(PLAYER0,27500)
START_MONEY(PLAYER1,40000)

MAX_CREATURES(PLAYER0,16)
MAX_CREATURES(PLAYER1,17)

ADD_CREATURE_TO_POOL(TROLL,8)
ADD_CREATURE_TO_POOL(ORC,20)
ADD_CREATURE_TO_POOL(BILE_DEMON,2)
ADD_CREATURE_TO_POOL(TENTACLE,30)
ADD_CREATURE_TO_POOL(SKELETON,30)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,30)
ADD_CREATURE_TO_POOL(SORCEROR,21)
ADD_CREATURE_TO_POOL(DRAGON,35)
ADD_CREATURE_TO_POOL(HELL_HOUND,40)

REM	Creature availability
CREATURE_AVAILABLE(PLAYER0,TROLL,1,0)
CREATURE_AVAILABLE(PLAYER0,ORC,1,0)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,0)
CREATURE_AVAILABLE(PLAYER0,TENTACLE,1,0)
CREATURE_AVAILABLE(PLAYER0,SKELETON,1,0)
CREATURE_AVAILABLE(PLAYER1,DARK_MISTRESS,1,0)
CREATURE_AVAILABLE(PLAYER1,SORCEROR,1,0)
CREATURE_AVAILABLE(PLAYER1,BILE_DEMON,1,0)
CREATURE_AVAILABLE(PLAYER1,DRAGON,1,0)
CREATURE_AVAILABLE(PLAYER1,HELL_HOUND,1,0)
CREATURE_AVAILABLE(PLAYER1,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,BRIDGE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,WORKSHOP,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,GUARD_POST,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,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)
ROOM_AVAILABLE(ALL_PLAYERS,SCAVENGER,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,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_OBEY,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
REM Don't give POWER_CHICKEN to human player, he can find spellbook on a level
MAGIC_AVAILABLE(PLAYER1,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_ARMAGEDDON,1,0)

REM	Doors and traps availability
TRAP_AVAILABLE(ALL_PLAYERS,ALARM,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,WORD_OF_POWER,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,STEEL,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,MAGIC,1,0)
TRAP_AVAILABLE(PLAYER1,LAVA,1,0)

CREATE_PARTY(THIEFGUARD)
	ADD_TO_PARTY(THIEFGUARD,ARCHER,5,750,DEFEND_PARTY,0)
	ADD_TO_PARTY(THIEFGUARD,ARCHER,5,750,DEFEND_PARTY,0)
	ADD_TO_PARTY(THIEFGUARD,ARCHER,5,750,DEFEND_PARTY,0)
	ADD_TO_PARTY(THIEFGUARD,THIEF,7,1750,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(DWARVES)
	ADD_TO_PARTY(DWARVES,DWARFA,5,800,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DWARVES,DWARFA,5,800,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DWARVES,DWARFA,5,800,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DWARVES,DWARFA,5,800,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(DWARVES,ARCHER,5,800,ATTACK_ENEMIES,0)

CREATE_PARTY(BARBS)
	ADD_TO_PARTY(BARBS,BARBARIAN,6,1000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(BARBS,BARBARIAN,6,1000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(BARBS,BARBARIAN,6,1000,ATTACK_ENEMIES,0)

CREATE_PARTY(WIZARDS)
	ADD_TO_PARTY(WIZARDS,WIZARD,5,1200,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(WIZARDS,WIZARD,5,1200,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(WIZARDS,WIZARD,5,1200,ATTACK_ENEMIES,0)

CREATE_PARTY(GIANTGUARD)
	ADD_TO_PARTY(GIANTGUARD,GIANT,8,2000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GIANTGUARD,ARCHER,2,300,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GIANTGUARD,ARCHER,2,300,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GIANTGUARD,ARCHER,2,300,ATTACK_ENEMIES,0)

CREATE_PARTY(THIEVES)
	ADD_TO_PARTY(THIEVES,THIEF,7,2000,STEAL_GOLD,0)
	ADD_TO_PARTY(THIEVES,THIEF,6,2000,STEAL_GOLD,0)
	ADD_TO_PARTY(THIEVES,THIEF,6,2000,STEAL_GOLD,0)
	ADD_TO_PARTY(THIEVES,THIEF,6,2000,STEAL_GOLD,0)

CREATE_PARTY(WITCHES)
	ADD_TO_PARTY(WITCHES,WITCH,4,1200,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(WITCHES,WITCH,4,1200,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(WITCHES,WITCH,4,1200,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(WITCHES,WITCH,4,1200,ATTACK_ENEMIES,0)

CREATE_PARTY(ELITE)
	ADD_TO_PARTY(ELITE,SAMURAI,9,4000,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(ELITE,WIZARD,8,2000,STEAL_SPELLS,0)
	ADD_TO_PARTY(ELITE,BARBARIAN,8,2000,STEAL_GOLD,0)
	ADD_TO_PARTY(ELITE,GIANT,7,2000,STEAL_SPELLS,0)

CREATE_PARTY(TRANSFER)
	ADD_TO_PARTY(TRANSFER,GHOST,2,666,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TRANSFER,GHOST,2,666,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(TRANSFER,GHOST,2,666,ATTACK_ENEMIES,0)

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

REM "It appears you have a rival. Another Keeper believes he is more ruthless and evil than you. We shall soon see."
DISPLAY_OBJECTIVE(125,ALL_PLAYERS)

REM When the second portal is conquered, more creatures may join.
IF(PLAYER0,ENTRANCE >= 18)
	MAX_CREATURES(PLAYER0,18)
ENDIF

IF(PLAYER0,GAME_TURN >= 100)
	REM "You will not find any easy path through this region. You will have to fight hard to gain any advantage."
	DISPLAY_INFORMATION(120,ALL_PLAYERS)
ENDIF

IF(PLAYER0,GAME_TURN >= 5000)
	REM "This ancient realm is rich in magical artifacts. Go forth and plunder."
	DISPLAY_INFORMATION(126,ALL_PLAYERS)
ENDIF

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

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

IF_ACTION_POINT(4,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,DWARVES,-1,1)
	SET_TIMER(PLAYER_GOOD,TIMER0)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 1500)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BARBS,-1,1)
ENDIF

IF_ACTION_POINT(7,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WIZARDS,-4,1)
ENDIF

IF_ACTION_POINT(6,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,GIANTGUARD,-5,1)
ENDIF

IF_ACTION_POINT(5,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THIEVES,-3,1)
ENDIF

IF_ACTION_POINT(3,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WITCHES,-2,1)
ENDIF

IF_ACTION_POINT(8,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BARBS,9,1)
ENDIF

IF_AVAILABLE(PLAYER0,POWER_CONCEAL >= 1)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,DRAWFROM(10,11,12),DUNGEON,0,6,500)
ENDIF

IF(PLAYER0,TOTAL_CREATURES >= 16)
	SET_FLAG(PLAYER0,FLAG7,1)
ENDIF
IF(PLAYER0,FLAG7 <= 0)
	IF(PLAYER1,HEART_HEALTH <= 28000)
		SET_FLAG(PLAYER0,FLAG7,2)
	ENDIF
	IF(PLAYER1,BATTLES_LOST >= 4)
		SET_FLAG(PLAYER0,FLAG7,2)
	ENDIF
ENDIF
IF(PLAYER0,FLAG7 == 1)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,DRAWFROM(10,11,12),DUNGEON,0,6,500)
ENDIF
IF(PLAYER0,FLAG7 == 2)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,-4,DUNGEON,0,6,500)
	IF_SLAB_TYPE(60,58,DRAPE_WALL)
		CHANGE_SLAB_TYPE(60,58,PATH)
	ENDIF
	IF_SLAB_TYPE(61,58,DRAPE_WALL)
		CHANGE_SLAB_TYPE(61,58,PRETTY_PATH)
	ENDIF
	ALLY_PLAYERS(PLAYER1,PLAYER_GOOD,1)
ENDIF

IF(PLAYER1,TOTAL_CREATURES >= 17)
	IF_AVAILABLE(PLAYER1,POWER_CONCEAL >= 1)
		ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,DRAWFROM(10,11,12),DUNGEON,1,6,500)
	ENDIF
ENDIF

IF(PLAYER1,DUNGEON_DESTROYED == 1)
	SET_TIMER(PLAYER0,TIMER0)
ENDIF
IF(PLAYER0,TIMER0 >= 30)
	WIN_GAME
ENDIF

REM Transfer creature special becomes available when no creature gets annoyed all game long.
IF(PLAYER0,CREATURES_ANNOYED >= 1)
	SET_FLAG(PLAYER0,FLAG1,1)
	ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,TRANSFER,DRAWFROM(10,11,12),DUNGEON_HEART,0,2,666)
ENDIF
IF(PLAYER1,DUNGEON_DESTROYED == 1)
	IF(PLAYER0,FLAG1 == 0)
		ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,TRANSFER,-6,DUNGEON_HEART,0,2,666)
	ENDIF
ENDIF

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