REM ********************************************
REM  Hero campaign by Alexsa
REM  Map 1241, Wickedrige
REM  Script for the map
REM  Version 0.00
REM ********************************************
REM Final level in campaign.
REM ********************************************
REM Update 1.00, august 2018: adjusted difficulty. 
REM Lowered maximal amounts of troops to 7 each, some thiefs are often claimed by AI which is an issue alright
REM Added much more gold to mob groups which can be disabled.
REM v2.0 by dayokay to use pot file (Dec2020)
REM ********************************************
LEVEL_VERSION(1)

SET_PLAYER_COLOR(PLAYER0,WHITE)
SET_PLAYER_COLOR(PLAYER_GOOD,RED)

SET_GENERATE_SPEED(400)

MAX_CREATURES(PLAYER0,24)
MAX_CREATURES(PLAYER1,26)

COMPUTER_PLAYER(PLAYER1,0)
ALLY_PLAYERS(PLAYER1,PLAYER_GOOD,1)

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

REM All hero pools are limited by hand.
REM The creature count tops at 40, here.
REM My personal opinion after playtesting through this campaign at least twice (some levele, multiple times):
REM Dwarfs are worthless at manufacture 3 compared to archers who support. They don't even have anything going for them beyond late armor+rebound combo, and no offensive abilities. 
REM Granted, they are plenty strong for their tiny wage, but that's not relevant with Samurai, or even Barbarians available.
REM Those selfsame barbarians are very useful for early game, when you need something strong thrown at enemy (that's they way I use them - instead of dumping, target something which doesn't heal).
REM Giants are OK, but Samurai are better because freeze+lightning+speed.
REM Knights are mandatory by the end of campaign, to tank for samurai and the remaining fairy swarm (btw, Lightning is a menace, use Wizards instead).
REM Samurai are mandatory, because few other things can kill lv 10 Dark Mistress - frail spellcasters can't stand electrocution.
REM Witches (Priestesses) are disrupting with wind when used in melee because gas, but if Fairies accompany them? they ignore the gas. Used on Hellspring, for removing scavenger rooms (half the hell hound attacks).
REM Monks are good support when massed, thanks to WOP and Slow and Hailstorm/Deain, but are fragile as Demonspawns.
REM Archers are the best workshop workers along with Samurai; their support spells are nice and they don't demand samurai upkeep. Use when stringy on money or need more workshop
REM Wizards are the go-to spellcasters, obviously because freeze/rebound.
ADD_CREATURE_TO_POOL(THIEF,7)
ADD_CREATURE_TO_POOL(DWARFA,7)
ADD_CREATURE_TO_POOL(MONK,7)
ADD_CREATURE_TO_POOL(FAIRY,7)
ADD_CREATURE_TO_POOL(BARBARIAN,7)
ADD_CREATURE_TO_POOL(GIANT,7)
ADD_CREATURE_TO_POOL(ARCHER,7)
ADD_CREATURE_TO_POOL(WITCH,7)
ADD_CREATURE_TO_POOL(SAMURAI,7)
ADD_CREATURE_TO_POOL(WIZARD,7)
ADD_CREATURE_TO_POOL(KNIGHT,1)
ADD_CREATURE_TO_POOL(BILE_DEMON,10)
ADD_CREATURE_TO_POOL(DRAGON,10)
ADD_CREATURE_TO_POOL(ORC,20)
ADD_CREATURE_TO_POOL(HELL_HOUND,20)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,10)
CREATURE_AVAILABLE(ALL_PLAYERS,THIEF,1,0)
CREATURE_AVAILABLE(PLAYER0,DWARFA,1,0)
CREATURE_AVAILABLE(PLAYER0,ARCHER,1,0)
CREATURE_AVAILABLE(PLAYER0,FAIRY,1,0)
CREATURE_AVAILABLE(PLAYER0,BARBARIAN,1,0)
CREATURE_AVAILABLE(PLAYER0,GIANT,1,0)
CREATURE_AVAILABLE(PLAYER0,MONK,1,0)
CREATURE_AVAILABLE(PLAYER0,SAMURAI,1,0)
CREATURE_AVAILABLE(PLAYER0,WITCH,1,0)
CREATURE_AVAILABLE(PLAYER1,BILE_DEMON,1,0)
CREATURE_AVAILABLE(PLAYER1,DRAGON,1,0)
CREATURE_AVAILABLE(PLAYER1,ORC,1,0)
CREATURE_AVAILABLE(PLAYER1,HELL_HOUND,1,0)
CREATURE_AVAILABLE(PLAYER1,DARK_MISTRESS,1,0)
REM Wizard unavailable from start, needs second portal.
REM Three portals allow attracting some knights directly.
    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,0)
    ROOM_AVAILABLE(ALL_PLAYERS,GUARD_POST,1,0)
    ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,0)
    ROOM_AVAILABLE(PLAYER1,PRISON,1,0)
    ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,0)
    ROOM_AVAILABLE(ALL_PLAYERS,TEMPLE,1,0)
    ROOM_AVAILABLE(ALL_PLAYERS,SCAVENGER,1,0)

REM AI has extra Lightning, but no Call to Arms.
    MAGIC_AVAILABLE(PLAYER0,POWER_SLAP,0,0)
    MAGIC_AVAILABLE(PLAYER1,POWER_SLAP,1,1)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_POSSESS,1,1)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,1,0)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
    MAGIC_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS,1,0)
    MAGIC_AVAILABLE(PLAYER0,POWER_SIGHT,1,0)
    MAGIC_AVAILABLE(PLAYER1,POWER_LIGHTNING,1,0)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,1,0)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,1,0)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DESTROY_WALLS,1,0)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_ARMAGEDDON,1,0)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CHICKEN,1,0)
REM Alarm, gas, and steel door; AI uses lightning and braced.
TRAP_AVAILABLE(PLAYER0,ALARM,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,LIGHTNING,1,0)
DOOR_AVAILABLE(PLAYER0,STEEL,1,0)
DOOR_AVAILABLE(PLAYER1,MAGIC,1,0)


REM No Skeletons, Warlocks, Tentacles or Spiders here. The rest creatures are present.

CREATE_PARTY(WAVE_DRAGON_LOW)
CREATE_PARTY(WAVE_DRAGON_MED)
CREATE_PARTY(WAVE_DRAGON_HIG)
CREATE_PARTY(WAVE_ORC_LOW)
CREATE_PARTY(WAVE_ORC_MED)
CREATE_PARTY(WAVE_ORC_HIG)
CREATE_PARTY(WAVE_DARK_LOW)
CREATE_PARTY(WAVE_DARK_MED)
CREATE_PARTY(WAVE_DARK_HIG)
CREATE_PARTY(WAVE_UNDEAD_LOW)
CREATE_PARTY(WAVE_UNDEAD_MED)
CREATE_PARTY(WAVE_UNDEAD_HIG)
CREATE_PARTY(WAVE_BILE_LOW)
CREATE_PARTY(WAVE_BILE_MED)
CREATE_PARTY(WAVE_BILE_HIG)
CREATE_PARTY(WAVE_HORNIES)

ADD_TO_PARTY(WAVE_DRAGON_LOW,DEMONSPAWN,4,0,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_DRAGON_LOW,DRAGON,4,500,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_DRAGON_LOW,DEMONSPAWN,4,0,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_DRAGON_LOW,DEMONSPAWN,4,0,ATTACK_ENEMIES,200)

ADD_TO_PARTY(WAVE_DRAGON_MED,DEMONSPAWN,7,0,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_DRAGON_MED,DRAGON,7,1000,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_DRAGON_MED,DEMONSPAWN,7,0,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_DRAGON_MED,DEMONSPAWN,7,0,ATTACK_ENEMIES,200)

ADD_TO_PARTY(WAVE_DRAGON_HIG,DEMONSPAWN,10,0,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_DRAGON_HIG,DRAGON,10,1500,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_DRAGON_HIG,DEMONSPAWN,10,0,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_DRAGON_HIG,DEMONSPAWN,10,0,ATTACK_ENEMIES,200)

ADD_TO_PARTY(WAVE_ORC_LOW,ORC,4,250,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_ORC_LOW,BUG,4,0,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_ORC_LOW,ORC,4,250,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_ORC_LOW,ORC,4,0,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_ORC_LOW,TROLL,4,0,ATTACK_ROOMS,200)

ADD_TO_PARTY(WAVE_ORC_MED,ORC,7,250,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_ORC_MED,BUG,7,0,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_ORC_MED,ORC,7,250,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_ORC_MED,ORC,7,250,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_ORC_MED,TROLL,7,250,ATTACK_ROOMS,200)

ADD_TO_PARTY(WAVE_ORC_HIG,ORC,10,500,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_ORC_HIG,BUG,10,0,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_ORC_HIG,ORC,10,500,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_ORC_HIG,ORC,10,500,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_ORC_HIG,TROLL,10,500,ATTACK_ROOMS,200)

ADD_TO_PARTY(WAVE_DARK_LOW,DARK_MISTRESS,6,200,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_DARK_LOW,SPIDER,6,0,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_DARK_LOW,DARK_MISTRESS,6,200,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_DARK_LOW,FLY,6,0,ATTACK_DUNGEON_HEART,200)

ADD_TO_PARTY(WAVE_DARK_MED,DARK_MISTRESS,7,200,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_DARK_MED,SPIDER,8,0,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_DARK_MED,DARK_MISTRESS,7,200,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_DARK_MED,DARK_MISTRESS,7,0,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_DARK_MED,FLY,7,0,ATTACK_DUNGEON_HEART,200)

ADD_TO_PARTY(WAVE_DARK_HIG,DARK_MISTRESS,10,200,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_DARK_HIG,SPIDER,10,0,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_DARK_HIG,DARK_MISTRESS,10,200,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_DARK_HIG,FLY,10,0,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_DARK_HIG,HORNY,10,0,ATTACK_DUNGEON_HEART,200)

ADD_TO_PARTY(WAVE_UNDEAD_LOW,GHOST,4,0,STEAL_GOLD,200)
ADD_TO_PARTY(WAVE_UNDEAD_LOW,GHOST,4,0,STEAL_GOLD,200)
ADD_TO_PARTY(WAVE_UNDEAD_LOW,GHOST,4,0,STEAL_SPELLS,200)
ADD_TO_PARTY(WAVE_UNDEAD_LOW,GHOST,4,0,STEAL_SPELLS,200)

ADD_TO_PARTY(WAVE_UNDEAD_MED,GHOST,8,0,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_UNDEAD_MED,GHOST,8,0,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_UNDEAD_MED,GHOST,8,0,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_UNDEAD_MED,VAMPIRE,7,500,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_UNDEAD_MED,VAMPIRE,7,500,ATTACK_ENEMIES,200)

ADD_TO_PARTY(WAVE_UNDEAD_HIG,GHOST,10,0,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_UNDEAD_HIG,GHOST,10,0,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_UNDEAD_HIG,GHOST,10,0,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_UNDEAD_HIG,VAMPIRE,10,1000,ATTACK_ENEMIES,200)
ADD_TO_PARTY(WAVE_UNDEAD_HIG,VAMPIRE,10,500,ATTACK_ENEMIES,200)

ADD_TO_PARTY(WAVE_BILE_LOW,BILE_DEMON,4,250,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_BILE_LOW,BILE_DEMON,4,250,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_BILE_LOW,BILE_DEMON,4,250,ATTACK_ROOMS,200)

ADD_TO_PARTY(WAVE_BILE_MED,BILE_DEMON,7,500,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_BILE_MED,BILE_DEMON,7,500,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_BILE_MED,BILE_DEMON,7,500,ATTACK_ROOMS,200)

ADD_TO_PARTY(WAVE_BILE_HIG,BILE_DEMON,10,750,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_BILE_HIG,BILE_DEMON,10,750,ATTACK_ROOMS,200)
ADD_TO_PARTY(WAVE_BILE_HIG,BILE_DEMON,10,750,ATTACK_ROOMS,200)

ADD_TO_PARTY(WAVE_HORNIES,HELL_HOUND,10,0,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_HORNIES,HORNY,7,500,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_HORNIES,HORNY,5,500,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_HORNIES,HORNY,5,500,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_HORNIES,HELL_HOUND,10,0,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_HORNIES,HELL_HOUND,10,0,ATTACK_DUNGEON_HEART,200)
ADD_TO_PARTY(WAVE_HORNIES,HELL_HOUND,10,0,ATTACK_DUNGEON_HEART,200)

REM Action points:
REM 1 - hero heart vicinity
REM 2 - blue heart vicinity
REM 3 - eastern wing south
REM 4 - eastern wing north
REM 5 - central rooms
REM 6 - western wing
REM 24 - eastern wing timer start

REM 7 - west train
REM 8 - west barrs
REM 9 - west tetor
REM 10 - central lair
REM 11 - central barrs
REM 12 - central temple

REM 13 - eastern south training
REM 14 - lair
REM 15 - barracks
REM 16 - temple
REM 17 - training
REM 18 - lair
REM 19 - barracks

REM 20 - Eastern north lair
REM 21 - training
REM 22 - temple
REM 23 - temple
REM 24 - approaching eastern south
REM 25 - gems

REM Hero Gates:
REM 1 - torture chamber (mistresses)
REM 2 - blue dungeon heart
REM 3 - near scavenger room (dragons/demonspawn)
REM 4 - white dungeon heart
REM 5 - northern imps
REM 6 - central gold
REM 7 - eastern gold

REM Startup
    SET_TIMER(PLAYER0,TIMER0)
    SET_TIMER(PLAYER1,TIMER0)
REM	QUICK_OBJECTIVE(1,"You have arrived to the source of all evil in Dominus. Gather your heroes, and strike into the heart of darkness.", PLAYER0)
	DISPLAY_OBJECTIVE(80)


REM Add imps for AI if some are dead.
IF(PLAYER1,TIMER0 >= 200)
REM Kill off too many vampires, since...too hard!!! I mean seriously, they get out of any control.
	IF(PLAYER1,VAMPIRE >= 10)
		NEXT_COMMAND_REUSABLE
		KILL_CREATURE(PLAYER1,VAMPIRE,LEAST_EXPERIENCED,1)
	ENDIF
	IF(PLAYER1,IMP <= 20)
		IF(PLAYER1,IMP >= 5)
  			NEXT_COMMAND_REUSABLE
  			SET_TIMER(PLAYER1,TIMER0)
			NEXT_COMMAND_REUSABLE
			ADD_CREATURE_TO_LEVEL(PLAYER1,IMP,-2,1,3,0)
		ENDIF
	ENDIF
ENDIF

REM First timer and first wave.
IF(PLAYER0,TIMER1 >=9000)
REM	QUICK_INFORMATION(5,"The monstrous beings in this land are many, and they are mostly self-sufficient and set apart from the supreme keeper who seems care little for your invasion. The orcs live in their barracks, demonspawns and dragons reside at the training rooms, undead rises from the temples and the bile demons lazily fart within their filthy lairs. Capture these rooms, and their attacks will weaken and finally cease.", PLAYER0)
	DISPLAY_INFORMATION(81)
    IF(PLAYER_GOOD,TRAINING >= 9)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_DRAGON_LOW,-3,1)
    ENDIF
    IF(PLAYER_GOOD,BARRACKS >= 9)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_ORC_LOW,DRAWFROM(-5,-6,-7),1)
    ENDIF
    IF(PLAYER_GOOD,TEMPLE >= 9)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_UNDEAD_LOW,-2,1)
    ENDIF
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER0,TIMER1)
    SET_TIMER(PLAYER0,TIMER2)
ENDIF

REM Second timer and second wave; Mistresses, Biles and Vampires added
IF(PLAYER0,TIMER2 >= 11000)
    IF(PLAYER1,DUNGEON_DESTROYED == 0)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_DARK_LOW,-1,1)
    ENDIF
    IF(PLAYER_GOOD,TRAINING >= 50)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_DRAGON_MED,-3,1)
    ENDIF
    IF(PLAYER_GOOD,TEMPLE >= 50)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_UNDEAD_MED,-2,1)
    ENDIF
    IF(PLAYER_GOOD,LAIR >= 9)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_BILE_LOW,DRAWFROM(-5,-6,-7),1)
    ENDIF
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER0,TIMER2)
    SET_TIMER(PLAYER0,TIMER3)
ENDIF


REM Third wave; more strong creatures. Big dragons, medium orcs, medium biles.
IF(PLAYER0,TIMER3 >= 13000)
    IF(PLAYER1,DUNGEON_DESTROYED == 0)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_DARK_MED,-1,1)
    ENDIF
    IF(PLAYER_GOOD,TRAINING >= 25)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_DRAGON_HIG,-3,1)
    ENDIF
    IF(PLAYER_GOOD,BARRACKS >= 50)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_ORC_MED,DRAWFROM(-5,-6,-7),1)
    ENDIF
    IF(PLAYER_GOOD,LAIR >= 50)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_BILE_MED,DRAWFROM(-5,-6,-7),1)
    ENDIF
    NEXT_COMMAND_REUSABLE
    SET_TIMER(PLAYER0,TIMER3)
    SET_TIMER(PLAYER0,TIMER4)
ENDIF

REM Fourth wave; even more strong creatures. Big orcs, big vampires, big biles.
IF(PLAYER0,TIMER4 >= 15000)
    IF(PLAYER1,DUNGEON_DESTROYED == 0)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_DARK_HIG,-1,1)
    ENDIF
    IF(PLAYER_GOOD,BARRACKS >= 25)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_ORC_HIG,DRAWFROM(-5,-6,-7),1)
    ENDIF
    IF(PLAYER_GOOD,TEMPLE >= 25)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_UNDEAD_HIG,-2,1)
    ENDIF
    IF(PLAYER_GOOD,LAIR >= 25)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_BILE_HIG,DRAWFROM(-5,-6,-7),1)
    ENDIF
    IF(PLAYER0,FLAG4 == 1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_HORNIES,-4,1)
    ENDIF
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER0,TIMER4)
ENDIF


REM Start first timer so the attacks launch on 3rd payday.
IF(PLAYER0,TIMER0 >= 15000)
	SET_FLAG(PLAYER0,FLAG1,1)
ENDIF

REM Approaching white Dungeon Heart triggers weak hornies; turn on endless horny/hound attacks
IF_ACTION_POINT(1,PLAYER0)
	SET_FLAG(PLAYER0,FLAG5,1)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,HORNY,-4,3,4,0)
ENDIF
REM Attacking blue heart
IF_ACTION_POINT(2,PLAYER0)
	SET_FLAG(PLAYER0,FLAG5,1)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,HORNY,-2,3,4,0)
ENDIF
IF(PLAYER_GOOD,FLAG5 >= 1)
REM	QUICK_OBJECTIVE(4,"Your troops have breached the final bastion of evil; beware, for the last vile creatures are pouring forth!.", PLAYER0)
	DISPLAY_OBJECTIVE(82)
	SET_TIMER(PLAYER_GOOD,TIMER5)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,HORNY,-4,3,4,0)
ENDIF

IF(PLAYER_GOOD,TIMER5 >= 10000)
	NEXT_COMMAND_REUSABLE
	SET_TIMER(PLAYER_GOOD,TIMER5)
	NEXT_COMMAND_REUSABLE
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WAVE_HORNIES,-4,1)
ENDIF

REM Eastern wing approached: start first timer
IF_ACTION_POINT(3,PLAYER0)
	SET_FLAG(PLAYER0,FLAG1,1)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DRAGON,17,3,10,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BILE_DEMON,18,4,7,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,TROLL,19,5,7,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,IMP,-7,2,1,0)
ENDIF

REM Northern east approached
IF_ACTION_POINT(4,PLAYER0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BILE_DEMON,20,3,9,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DRAGON,21,3,9,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,VAMPIRE,22,3,6,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GHOST,23,4,6,0)
ENDIF

REM Eastern wing approached: start first timer
IF_ACTION_POINT(24,PLAYER0)
	SET_FLAG(PLAYER0,FLAG1,1)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DEMONSPAWN,13,8,6,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BILE_DEMON,14,4,6,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,ORC,15,4,6,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GHOST,16,5,6,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,IMP,-7,2,1,0)
ENDIF

REM Central wing approached; start first timer
IF_ACTION_POINT(5,PLAYER0)
	SET_FLAG(PLAYER0,FLAG1,1)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BILE_DEMON,10,3,5,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,ORC,11,3,5,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GHOST,12,5,5,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,IMP,-6,2,1,0)
ENDIF

REM Western wing approached: start first timer
IF_ACTION_POINT(6,PLAYER0)
	SET_FLAG(PLAYER0,FLAG1,1)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DRAGON,7,3,10,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,ORC,8,4,8,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GHOST,9,5,8,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,IMP,-5,2,1,0)
ENDIF

REM Gems approached: add 3 hounds and allow Horny/Hound attacks from timer 4.
IF_ACTION_POINT(25,PLAYER0)
	SET_FLAG(PLAYER0,FLAG4,1)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,HELL_HOUND,-2,3,10,0)
ENDIF
IF(PLAYER0,FLAG1 == 1)
REM	QUICK_INFORMATION(3,"A faint drumming of alarm is heard in the distance - the evil keeper will soon attempt to remove you from this land.", PLAYER0)
	DISPLAY_INFORMATION(83)
	SET_TIMER(PLAYER0,TIMER1)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,IMP,-5,2,1,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,IMP,-6,2,1,0)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,IMP,-7,2,1,0)
ENDIF
REM Destruction of both hearts ends the game.
IF(PLAYER1, DUNGEON_DESTROYED>=1)
	IF(PLAYER_GOOD, DUNGEON_DESTROYED>=1)
	REM	QUICK_OBJECTIVE(16,"Your crusade against forces of evil entrenched at Wickedridge ends. Dominus is safe, and so the Revenge of the Lord is over. Congratulations!", PLAYER0)
	DISPLAY_OBJECTIVE(84)
		WIN_GAME
	ENDIF
ENDIF

REM No skeletons or ghosts allowed for player, despite prison available.
REM By the time you can use it, blue's likely all but dead.
IF(PLAYER0, SKELETON>=1)
	NEXT_COMMAND_REUSABLE
	KILL_CREATURE(PLAYER0,SKELETON,MOST_EXPERIENCED,1)
ENDIF
IF(PLAYER0, GHOST>=1)
	NEXT_COMMAND_REUSABLE
	KILL_CREATURE(PLAYER0,GHOST,MOST_EXPERIENCED,1)
ENDIF

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

IF(PLAYER1,ENTRANCE <= 9)
    NEXT_COMMAND_REUSABLE
    MAX_CREATURES(PLAYER0,13)
ENDIF

IF(PLAYER1,ENTRANCE >= 10)
	NEXT_COMMAND_REUSABLE
	MAX_CREATURES(PLAYER1,26)
ENDIF
REM Capture of entrances increases the max creatures count.
REM AI has 40 creatures, plus whatever white player has for attack.

IF(PLAYER0,ENTRANCE <= 9)
    NEXT_COMMAND_REUSABLE
    MAX_CREATURES(PLAYER0,25)
ENDIF

IF(PLAYER0,ENTRANCE >= 10)
	NEXT_COMMAND_REUSABLE
	MAX_CREATURES(PLAYER0,32)
	CREATURE_AVAILABLE(PLAYER0,WIZARD,1,0)
	IF(PLAYER0,ENTRANCE >= 20)
		NEXT_COMMAND_REUSABLE
		MAX_CREATURES(PLAYER0,40)
		CREATURE_AVAILABLE(PLAYER0,KNIGHT,1,0)
	ENDIF
ENDIF

IF(PLAYER0,BRIDGE >= 1)
REM	QUICK_INFORMATION(15,"The inhabitants of Dominus do not approve of building too many bridges. Make do with shorter ones!", PLAYER0)
	DISPLAY_INFORMATION(27)
    NEXT_COMMAND_REUSABLE
    ROOM_AVAILABLE(PLAYER0,BRIDGE,0,0)
ENDIF

IF(PLAYER0,BRIDGE < 1)
	NEXT_COMMAND_REUSABLE
	ROOM_AVAILABLE(PLAYER0,BRIDGE,1,1)
ENDIF
