REM ****************************************************
REM Reapers' Yard
REM
REM Assmist Isle Campaign by Kix
REM
REM v2.0 for DAT file objectives (by dayokay)
REM 14-Nov-2020
REM ****************************************************

LEVEL_VERSION(1)

REM aps:
rem 1,2 libraries
rem 3 horny room

REM gates:
rem clockwise

REVEAL_MAP_LOCATION(PLAYER0,1,33)
REVEAL_MAP_LOCATION(PLAYER0,2,33)
REVEAL_MAP_LOCATION(PLAYER0,3,18)
REVEAL_MAP_LOCATION(PLAYER0,4,33)
REVEAL_MAP_LOCATION(PLAYER0,5,18)
MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
START_MONEY(PLAYER0,18000)

CREATE_PARTY(A1)
ADD_TO_PARTY(A1,DWARFA,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(A1,THIEF,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(A1,THIEF,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(A1,THIEF,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(A1,WITCH,1,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(A2)
ADD_TO_PARTY(A2,THIEF,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(A2,THIEF,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(A2,THIEF,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(A2,WIZARD,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(A2,THIEF,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(A2,SAMURAI,1,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(B1)
ADD_TO_PARTY(B1,ARCHER,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(B1,WIZARD,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(B1,DWARFA,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(B1,DWARFA,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(B1,THIEF,1,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(B1,MONK,2,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(B2)
ADD_TO_PARTY(B2,ARCHER,2,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(B2,ARCHER,2,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(B2,WIZARD,3,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(B2,DWARFA,3,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(B2,DWARFA,3,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(B2,THIEF,3,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(C1)
ADD_TO_PARTY(C1,WIZARD,2,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(C1,WIZARD,2,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(C1,THIEF,3,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(C1,THIEF,3,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(C1,DWARFA,4,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(C1,ARCHER,5,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(C2)
ADD_TO_PARTY(C2,WIZARD,3,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(C2,THIEF,4,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(C2,THIEF,3,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(C2,ARCHER,4,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(C2,DWARFA,4,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(C2,BARBARIAN,6,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(D1)
ADD_TO_PARTY(D1,WIZARD,4,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(D1,THIEF,5,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(D1,FAIRY,5,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(D1,ARCHER,5,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(D1,GIANT,4,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(D1,BARBARIAN,6,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(FINA)
ADD_TO_PARTY(FINA,AVATAR,10,0,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(FIN)
ADD_TO_PARTY(FIN,WITCH,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN,BARBARIAN,10,0,ATTACK_DUNGEON_HEART,0)
ADD_TO_PARTY(FIN,KNIGHT,10,0,ATTACK_DUNGEON_HEART,0)

REM	QUICK_OBJECTIVE(1,"The platform's got four entries. Expect human parties attacking from all around. Protect the dungeon heart at all cost!",ALL_PLAYERS)
DISPLAY_OBJECTIVE(144,PLAYER0)

IF(PLAYER0,BATTLES_WON>0)
	REM	QUICK_OBJECTIVE(2,"The eastern lava-flooded area is where the toughest troops guard your imprisoned units. Your dragons used to carry quite some treasures, now the knights possess them. For every defeated knight some amount of gold is returned to you.",ALL_PLAYERS)
	DISPLAY_OBJECTIVE(145,ALL_PLAYERS)
ENDIF


IF(PLAYER0,IMP>0)
	SET_TIMER(PLAYER0,TIMER0)
	SET_FLAG(PLAYER0,FLAG1,0)
	SET_FLAG(PLAYER0,FLAG0,0)
ENDIF

IF(PLAYER0,FLAG6<1)
IF(PLAYER0,TIMER0>600)
	IF(PLAYER0,FLAG1<8)
		REM FIRST TYPE OF WAVES
		NEXT_COMMAND_REUSABLE
		SET_FLAG(PLAYER0,FLAG7,1)
	ENDIF
	IF(PLAYER0,FLAG1>=8)
		REM SECOND TYPE OF WAVES
		REM	QUICK_OBJECTIVE(8,"The end of the resistance is near, Keeper. I can smell the desperation in their greedy faces.",ALL_PLAYERS)
		DISPLAY_OBJECTIVE(146,ALL_PLAYERS)
		SET_FLAG(PLAYER0,FLAG0,0)
		NEXT_COMMAND_REUSABLE
		SET_FLAG(PLAYER0,FLAG7,2)
	ENDIF
	NEXT_COMMAND_REUSABLE
	SET_TIMER(PLAYER0,TIMER0)
ENDIF
ENDIF

IF(PLAYER0,FLAG7==1)
	IF(PLAYER0,FLAG0<5)
		IF(PLAYER0,FLAG1==0)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,A1,DRAWFROM(-3,-4),2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,A1,-1,2)
		ENDIF
		IF(PLAYER0,FLAG1==1)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,A1,DRAWFROM(-3,-4),2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,A2,-1,2)
		ENDIF
		IF(PLAYER0,FLAG1==2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,A2,DRAWFROM(-3,-4),2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,B1,DRAWFROM(-1,-2),2)
		ENDIF
		IF(PLAYER0,FLAG1==3)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,B1,DRAWFROM(-3,-4),2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,B2,DRAWFROM(-1,-2),2)
		ENDIF
		IF(PLAYER0,FLAG1==4)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,B2,DRAWFROM(-3,-4),3)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,B2,DRAWFROM(-1,-2),3)
		ENDIF
		IF(PLAYER0,FLAG1==5)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,B2,DRAWFROM(-3,-4),3)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,A2,DRAWFROM(-3,-4),2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,B2,DRAWFROM(-1,-2),3)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,A2,DRAWFROM(-3,-4),2)
		ENDIF
		IF(PLAYER0,FLAG1==6)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,C1,DRAWFROM(-3,-4),2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,B2,DRAWFROM(-1,-2),3)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,A2,DRAWFROM(-1,-2,-3,-4),2)
		ENDIF
		IF(PLAYER0,FLAG1==7)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,C1,-1,2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,C2,-2,2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,C1,-3,2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,C2,-4,2)
		ENDIF
	ENDIF
	NEXT_COMMAND_REUSABLE
	ADD_TO_FLAG(PLAYER0,FLAG0,1)
	IF(PLAYER0,FLAG0>18)
		NEXT_COMMAND_REUSABLE
		ADD_TO_FLAG(PLAYER0,FLAG1,1)
		NEXT_COMMAND_REUSABLE
		SET_FLAG(PLAYER0,FLAG0,0)
	ENDIF
	NEXT_COMMAND_REUSABLE
	SET_FLAG(PLAYER0,FLAG7,0)
ENDIF

IF(PLAYER0,FLAG7==2)
	IF(PLAYER0,FLAG0<20)
		IF(PLAYER0,FLAG2==0)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,C2,-1,2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,C1,-2,2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,C2,-3,2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,C1,-4,2)
		ENDIF
		IF(PLAYER0,FLAG2==1)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,C2,-1,2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,D1,-2,2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,C2,-3,2)
			NEXT_COMMAND_REUSABLE
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,D1,-4,2)
		ENDIF
		IF(PLAYER0,FLAG2>1)
			REM	QUICK_OBJECTIVE(4,"This is it. The final pathetic attempt to bring you down. Withstand the attack, defeat every knight in this land and the land is yours.",ALL_PLAYERS)
			DISPLAY_OBJECTIVE(147,ALL_PLAYERS)
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FINA,DRAWFROM(-1,-2),2)
			ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIN,DRAWFROM(-3,-4),4)
			SET_FLAG(PLAYER0,FLAG6,1)
		ENDIF
	ENDIF
	NEXT_COMMAND_REUSABLE
	ADD_TO_FLAG(PLAYER0,FLAG0,1)
	IF(PLAYER0,FLAG0>24)
		NEXT_COMMAND_REUSABLE
		ADD_TO_FLAG(PLAYER0,FLAG2,1)
		NEXT_COMMAND_REUSABLE
		SET_FLAG(PLAYER0,FLAG0,0)
	ENDIF
	NEXT_COMMAND_REUSABLE
	SET_FLAG(PLAYER0,FLAG7,0)
ENDIF

IF(PLAYER_GOOD,KNIGHT<7)
	REM	QUICK_INFORMATION(3,"Gold falls from knight's pockets as he mumbles something in Polish. Then he shuts up and dies. Kill some more of them. Not just for the fun but also for the gold they owe you.",ALL_PLAYERS)
	DISPLAY_INFORMATION(148,ALL_PLAYERS)
	ADD_GOLD_TO_PLAYER(PLAYER0,35000)
ENDIF

IF(PLAYER_GOOD,KNIGHT<6)
	ADD_GOLD_TO_PLAYER(PLAYER0,50000)
ENDIF

IF(PLAYER_GOOD,KNIGHT<5)
	ADD_GOLD_TO_PLAYER(PLAYER0,65000)
ENDIF

IF(PLAYER_GOOD,KNIGHT<4)
	ADD_GOLD_TO_PLAYER(PLAYER0,80000)
ENDIF

IF(PLAYER_GOOD,KNIGHT<2)
	ADD_GOLD_TO_PLAYER(PLAYER0,100000)
ENDIF

IF(PLAYER_GOOD,KNIGHT<1)
	ADD_GOLD_TO_PLAYER(PLAYER0,135000)
ENDIF

IF(PLAYER_GOOD,RESEARCH==0)
	ROOM_AVAILABLE(PLAYER0,BRIDGE,1,0)
	TUTORIAL_FLASH_BUTTON(18,100)
	REM	QUICK_OBJECTIVE(7,"The library you just claimed contained plans to build bridges. Useful stuff.",ALL_PLAYERS)
	DISPLAY_OBJECTIVE(149,ALL_PLAYERS)
ENDIF

IF(PLAYER0,FLAG6>0)
	IF(PLAYER_GOOD,KNIGHT==0)
	IF(PLAYER_GOOD,AVATAR==0)
		REM	QUICK_OBJECTIVE(5,"Fantastic work, Keeper. Just one more land and the isle is free from the Polish empire.",ALL_PLAYERS)
		DISPLAY_OBJECTIVE(150,ALL_PLAYERS)
		WIN_GAME
	ENDIF
	ENDIF
ENDIF
