
REM ************************************
REM    SCRIPT FOR LEVEL208 JAGGEDKEEP
REM 	        BY K. BENNETT
REM ************************************

SET_GENERATE_SPEED(425)

COMPUTER_PLAYER(PLAYER1,0)
COMPUTER_PLAYER(PLAYER2,0)

MAX_CREATURES(PLAYER0,24)
MAX_CREATURES(PLAYER1,20)
MAX_CREATURES(PLAYER2,20)

START_MONEY(player0,60000)
START_MONEY(player1,60000)
START_MONEY(player2,60000)

ADD_CREATURE_TO_POOL(DARK_MISTRESS,20)
ADD_CREATURE_TO_POOL(ORC,20)
ADD_CREATURE_TO_POOL(TROLL,15)
ADD_CREATURE_TO_POOL(BILE_DEMON,15)
ADD_CREATURE_TO_POOL(VAMPIRE,2)
ADD_CREATURE_TO_POOL(DRAGON,20)
ADD_CREATURE_TO_POOL(SPIDER,8)
ADD_CREATURE_TO_POOL(BUG,4)

CREATURE_AVAILABLE(ALL_PLAYERS,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,ORC,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,TROLL,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,BILE_DEMON,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,SPIDER,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,DRAGON,1,1)
CREATURE_AVAILABLE(PLAYER0,BUG,1,1)
CREATURE_AVAILABLE(PLAYER0,VAMPIRE,1,1)

ROOM_AVAILABLE(ALL_PLAYERS,GUARD_POST,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,GARDEN,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,research,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TRAINING,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TEMPLE,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TORTURE,1,0)

ROOM_AVAILABLE(PLAYER0,TREASURE,1,1)
ROOM_AVAILABLE(player0,WORKSHOP,1,0)
ROOM_AVAILABLE(player0,BRIDGE,1,0)
ROOM_AVAILABLE(player0,PRISON,1,0)
ROOM_AVAILABLE(player0,GRAVEYARD,1,0)

MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_OBEY,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(player2,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_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_LIGHTNING,1,0)

MAGIC_AVAILABLE(player0,POWER_cave_in,1,0)
MAGIC_AVAILABLE(player0,POWER_destroy_walls,1,0)

DOOR_AVAILABLE(ALL_PLAYERS,STEEL,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,LIGHTNING,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,word_of_power,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,ALARM,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,MAGIC,1,0)

CREATE_PARTY(GOOD)
	ADD_TO_PARTY(GOOD,GIANT,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GOOD,WIZARD,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GOOD,WITCH,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GOOD,HORNY,7,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GOOD,WIZARD,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GOOD,GIANT,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GOOD,HORNY,6,0,ATTACK_ENEMIES,0)

CREATE_PARTY(GOODII)
	ADD_TO_PARTY(GOODII,GIANT,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GOODII,WIZARD,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GOODII,SAMURAI,9,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GOODII,SAMURAI,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GOODII,MONK,8,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GOODII,HORNY,7,0,ATTACK_ENEMIES,0)
	ADD_TO_PARTY(GOODII,HORNY,6,0,ATTACK_ENEMIES,0)

set_flag(player1,flag1,0)
set_flag(player2,flag1,0)


	set_timer(player1,timer1)
	set_timer(player1,timer4)
	set_timer(player1,timer6)

	set_timer(player2,timer2)
	set_timer(player2,timer5)
	set_timer(player2,timer7)



if(player1,imp <=7)
	if(player1,flag1 ==0)
		if(player1,timer1 >=2000)
		next_command_reusable
		add_creature_to_level(player1,imp,1,6,3,500)
		next_command_reusable
		set_timer(player1,timer1)
		endif
	endif
endif

if(player2,imp <=7)
	if(player2,flag1 ==0)
		if(player2,timer2 >=2000)
		next_command_reusable
		add_creature_to_level(player2,imp,2,6,3,500)
		next_command_reusable
		set_timer(player2,timer2)
		endif
	endif
endif


if(player1,total_creatures <=10)
	if(player1,flag1 ==0)
		if(player1,timer4 >=2000)
		next_command_reusable
		add_creature_to_level(player1,dragon,3,2,9,250)
		next_command_reusable
		add_creature_to_level(player1,BILE_DEMON,3,2,8,0)
		next_command_reusable
		set_timer(player1,timer4)
		endif
	endif
endif

if(player2,total_creatures <=10)
	if(player2,flag1 ==0)
		if(player2,timer5 >=2000)
		next_command_reusable
		add_creature_to_level(player2,dragon,4,2,9,250)
		next_command_reusable
		add_creature_to_level(player2,BILE_DEMON,4,2,8,0)
		next_command_reusable
		set_timer(player2,timer5)
		endif
	endif
endif

if(player1,total_creatures <=10)
	if(player1,flag1 ==0)
		if(player1,timer6 >=3000)
		next_command_reusable
		add_creature_to_level(player1,DARK_MISTRESS,5,2,8,0)
		next_command_reusable
		add_creature_to_level(player1,ORC,5,3,7,0)
		next_command_reusable
		set_timer(player1,timer6)
		endif
	endif
endif

if(player2,total_creatures <=10)
	if(player2,flag1 ==0)
		if(player2,timer7 >=3000)
		next_command_reusable
		add_creature_to_level(player2,DARK_MISTRESS,6,2,8,0)
		next_command_reusable
		add_creature_to_level(player2,ORC,6,3,7,0)
		next_command_reusable
		set_timer(player2,timer7)
		endif
	endif
endif


if(player1,vampire >0)
	set_flag(player1,flag2,0)
	set_timer(player1,timer0)
endif

if(player2,vampire >0)
	set_flag(player2,flag2,0)
	set_timer(player2,timer0)
endif

if(player1,flag2 ==0)
	if(player1,vampire <=1)
		if(player1,timer0 >=4200)
		next_command_reusable
		add_creature_to_level(player1,vampire,5,1,9,800)
		next_command_reusable
		set_timer(player1,timer0)
		endif
	endif
endif

if(player2,flag2 ==0)
	if(player2,vampire <=1)
		if(player2,timer0 >=4200)
		next_command_reusable
		add_creature_to_level(player2,vampire,6,1,9,800)
		next_command_reusable
		set_timer(player1,timer0)
		endif
	endif
endif

IF_ACTION_POINT(7,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,GOOD,7,1)
ENDIF

IF_ACTION_POINT(8,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,GOODII,8,1)
ENDIF


IF(PLAYER1, DUNGEON_DESTROYED == 1)
	set_flag(player1,flag1,1)
	set_flag(player1,flag2,1)
endif

IF(PLAYER2, DUNGEON_DESTROYED == 1)
	set_flag(player2,flag1,1)
	set_flag(player2,flag2,1)
endif


IF(PLAYER0, ALL_DUNGEONS_DESTROYED ==1)
	WIN_GAME
ENDIF


quick_objective(1,"Good news: Your rivals are at war. Bad news: both can regenerate creatures. There's powerful help to the North, but you'll have to enter the battle to acquire it...watch out for nosy heroes. ",player0)
