REM ********************************************
REM *                                          *
REM *                   midway                 *
REM *                                          *
REM ********************************************
REM *************************************************
REM Script for Level 213 (now 336)
REM By Darren Rees, created on 06 Jun 1998
REM Map created		 4 hrs
REM Script learnt & written	 4 hrs
REM Playtested & amendments	16 hrs
REM Comments mrjolly@dadadada.demon.co.uk
REM Enjoy
REM v2 to use pot file by dayokay Dec2020
REM *************************************************

SET_GENERATE_SPEED(2500)

COMPUTER_PLAYER(PLAYER1,0)

MAX_CREATURES(PLAYER0,30)
MAX_CREATURES(PLAYER1,25)

START_MONEY(PLAYER0,10000)
START_MONEY(PLAYER1,1000)

ADD_CREATURE_TO_POOL(SPIDER,4)
ADD_CREATURE_TO_POOL(SORCEROR,4)
ADD_CREATURE_TO_POOL(DEMONSPAWN,6)
ADD_CREATURE_TO_POOL(TROLL,4)
ADD_CREATURE_TO_POOL(ORC,5)
ADD_CREATURE_TO_POOL(HELL_HOUND,4)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,4)
ADD_CREATURE_TO_POOL(BILE_DEMON,5)

CREATURE_AVAILABLE(ALL_PLAYERS,SPIDER,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,SORCEROR,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,DEMONSPAWN,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,DRAGON,0,0)
CREATURE_AVAILABLE(ALL_PLAYERS,TROLL,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,ORC,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,HELL_HOUND,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,BILE_DEMON,1,1)

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,GUARD_POST,1,0)
ROOM_AVAILABLE(PLAYER1,WORKSHOP,1,0)
ROOM_AVAILABLE(PLAYER1,BARRACKS,1,0)
ROOM_AVAILABLE(PLAYER1,PRISON,1,0)
ROOM_AVAILABLE(PLAYER1,TORTURE,1,0)
ROOM_AVAILABLE(PLAYER1,TEMPLE,1,0)

DOOR_AVAILABLE(ALL_PLAYERS,WOOD,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,BRACED,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,STEEL,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,MAGIC,1,0)

TRAP_AVAILABLE(ALL_PLAYERS,BOULDER,0,0)
TRAP_AVAILABLE(ALL_PLAYERS,ALARM,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
TRAP_AVAILABLE(PLAYER1,LIGHTNING,1,0)
TRAP_AVAILABLE(PLAYER1,WORD_OF_POWER,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,LAVA,0,0)

MAGIC_AVAILABLE(PLAYER1,POWER_IMP,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_OBEY,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_SIGHT,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_CALL_TO_ARMS,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_CAVE_IN,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_HEAL_CREATURE,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_HOLD_AUDIENCE,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_LIGHTNING,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_SPEED,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_PROTECT,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_CONCEAL,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_DISEASE,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_CHICKEN,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_DESTROY_WALLS,1,1)
MAGIC_AVAILABLE(PLAYER1,POWER_ARMAGEDDON,1,1)

REM SET_FLAG(	PLAYER0,	FLAG0,		0)
REM SET_TIMER(	PLAYER0,	TIMER0)

CREATE_PARTY(ARCHERS)
CREATE_PARTY(PARTY1)
CREATE_PARTY(PARTY2)
CREATE_PARTY(PARTY3)
CREATE_PARTY(PARTY4)
CREATE_PARTY(PARTY5)

    ADD_TO_PARTY(ARCHERS,ARCHER,7,5000,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ARCHERS,ARCHER,5,3000,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(ARCHERS,ARCHER,5,3000,ATTACK_DUNGEON_HEART,0)

    ADD_TO_PARTY(PARTY1,ARCHER,6,200,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY1,ARCHER,7,200,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY1,DWARFA,7,1400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY1,DWARFA,7,1400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY1,KNIGHT,8,1700,ATTACK_DUNGEON_HEART,0)

    ADD_TO_PARTY(PARTY2,ARCHER,6,200,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY2,ARCHER,7,200,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY2,KNIGHT,7,1400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY2,KNIGHT,7,1400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY2,WITCH,8,1700,ATTACK_DUNGEON_HEART,0)

    ADD_TO_PARTY(PARTY3,ARCHER,8,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY3,ARCHER,8,400,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY3,KNIGHT,8,1600,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY3,MONK,7,1200,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY3,MONK,7,1200,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY3,SAMURAI,8,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY3,SAMURAI,8,500,ATTACK_DUNGEON_HEART,0)


    ADD_TO_PARTY(PARTY4,ARCHER,10,600,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY4,ARCHER,10,600,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY4,GIANT,8,200,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY4,GIANT,8,200,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY4,WIZARD,8,600,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY4,WIZARD,8,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY4,KNIGHT,10,500,ATTACK_DUNGEON_HEART,0)

    ADD_TO_PARTY(PARTY5,SAMURAI,10,1600,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY5,SAMURAI,10,1600,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY5,BARBARIAN,10,1200,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY5,BARBARIAN,10,1200,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY5,WIZARD,10,1500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY5,WIZARD,10,1500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY5,AVATAR,10,2500,ATTACK_DUNGEON_HEART,0)




REM **********      MAIN SCRIPT       **********
REM **********      IF COMMANDS       **********

IF(PLAYER0,WORKSHOP > 0)
    ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,0)
ENDIF

IF(PLAYER0,BARRACKS > 0)
    ROOM_AVAILABLE(PLAYER0,BARRACKS,1,0)
ENDIF

IF(PLAYER0,PRISON > 0)
    ROOM_AVAILABLE(PLAYER0,PRISON,1,0)
ENDIF

IF(PLAYER0,TORTURE > 0)
    ROOM_AVAILABLE(PLAYER0,TORTURE,1,0)
ENDIF

IF(PLAYER0,TEMPLE > 0)
    ROOM_AVAILABLE(PLAYER0,TEMPLE,1,0)
ENDIF

IF(PLAYER0,BRIDGE > 0)
    ROOM_AVAILABLE(PLAYER0,BRIDGE,1,0)
ENDIF

IF_ACTION_POINT(1,PLAYER0)
    REM	QUICK_OBJECTIVE(1,"Souls of ancient keepers lurk to the south-west. They watch you intently with what is left of their magical powers",PLAYER0)
	DISPLAY_OBJECTIVE(24,1)
ENDIF

IF_ACTION_POINT(2,PLAYER0)
    REM	QUICK_OBJECTIVE(2,"Welcome to the Avatar's castle. His domain lies to the North-East, while his followers lurk to the North-West.",PLAYER0)
	DISPLAY_OBJECTIVE(25,2)
ENDIF

IF_ACTION_POINT(3,PLAYER0)
    REM	QUICK_OBJECTIVE(3,"Beware, the Avatar is escaping even now....",PLAYER0)
	DISPLAY_OBJECTIVE(26,3)
ENDIF

IF_ACTION_POINT(4,PLAYER0)
    REM	QUICK_OBJECTIVE(4,"The door to the east bears a simple plaque which reads, Emergency Exit - Keep Clear at all Times - Offenders will be shot.",PLAYER0)
	DISPLAY_OBJECTIVE(27,4)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ARCHERS,4,2)
ENDIF

IF_ACTION_POINT(5,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY1,5,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY3,5,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY5,5,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY1,-4,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY2,-1,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY3,-2,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY4,1,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY5,-3,1)
ENDIF

REM **********     OBJECTIVES AND     **********
REM **********      INFORMATION       **********


REM ***** Starting objective               *****

REM	QUICK_OBJECTIVE(0,"The Battle of Midway is afoot. Beware Evil one, the enemy is strong and well defended. Turn their misled minions against each other, sit back and let the butchery begin.",PLAYER0)
DISPLAY_OBJECTIVE(28,PLAYER0)



REM **********      WIN AND LOSE      **********

REM Player		Variable		Comparison	Value

IF(PLAYER1,DUNGEON_DESTROYED == 1)
    IF(PLAYER_GOOD,DUNGEON_DESTROYED == 1)
        IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
			DISPLAY_OBJECTIVE(29,PLAYER0)
            WIN_GAME
        ENDIF
    ENDIF
ENDIF
