REM ****************************************************
REM Martyr Halls
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 action points:
REM 1,2 tunnels
REM 3,4,5 east rooms
REM 6 monk room
REM 7,8 treasure rooms
REM 9 heart
REM 10 increase level secret passage
REM 11 ne
REM 12 nw post
REM 13 final hall entry
REM 14 horny room
REM 15 big treasure

REM hero gates:
REM 1 intro
REM 2 NE water point

REM flags:
REM p0.0 total types counter
REM p0.1 1=avatar to be spawned,2=spawned
REM p0.2 fortress entered

REM timers:
REM p0.0 starts when prison taken
REM p0.1 starts when white has less than 3 flies
REM p0.2 white heart destroyed

ROOM_AVAILABLE(ALL_PLAYERS,GARDEN,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_OBEY,1,0)

TRAP_AVAILABLE(PLAYER0,POISON_GAS,1,0)
SET_GAME_RULE(TrapSellValuePercent,0)

ADD_CREATURE_TO_POOL(FLY,2)
ADD_CREATURE_TO_POOL(SPIDER,2)
ADD_CREATURE_TO_POOL(BUG,2)
ADD_CREATURE_TO_POOL(TROLL,3)
ADD_CREATURE_TO_POOL(ORC,4)
ADD_CREATURE_TO_POOL(SORCEROR,4)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,3)
ADD_CREATURE_TO_POOL(BILE_DEMON,3)
CREATURE_AVAILABLE(PLAYER0,FLY,1,0)
CREATURE_AVAILABLE(PLAYER0,SPIDER,1,0)
CREATURE_AVAILABLE(PLAYER0,BUG,1,0)
CREATURE_AVAILABLE(PLAYER0,TROLL,1,0)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,0)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,0)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,0)
MAX_CREATURES(PLAYER1,30)

ADD_GOLD_TO_PLAYER(PLAYER0,IMPORT(PLAYER0,CAMPAIGN_FLAG0))

REM ##############################################################################
REM parties
REM ##############################################################################

CREATE_PARTY(WEAK_NABS)
ADD_TO_PARTY(WEAK_NABS,SAMURAI,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_NABS,SAMURAI,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_NABS,BARBARIAN,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_NABS,BARBARIAN,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_NABS,BARBARIAN,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_NABS,GIANT,2,0,ATTACK_ENEMIES,0)

CREATE_PARTY(WEAK_ARCHERS)
ADD_TO_PARTY(WEAK_ARCHERS,ARCHER,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_ARCHERS,ARCHER,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_ARCHERS,ARCHER,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_ARCHERS,ARCHER,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_ARCHERS,ARCHER,1,0,ATTACK_ENEMIES,0)

CREATE_PARTY(WEAK_DWARVES)
ADD_TO_PARTY(WEAK_DWARVES,DWARFA,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_DWARVES,DWARFA,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_DWARVES,DWARFA,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_DWARVES,DWARFA,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_DWARVES,DWARFA,1,0,ATTACK_ENEMIES,0)

CREATE_PARTY(WEAK_MIX)
ADD_TO_PARTY(WEAK_MIX,ARCHER,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_MIX,ARCHER,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_MIX,DRAWFROM(BARBARIAN,GIANT),1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_MIX,DWARFA,1,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WEAK_MIX,DWARFA,1,0,ATTACK_ENEMIES,0)

CREATE_PARTY(MIX)
ADD_TO_PARTY(MIX,ARCHER,4,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MIX,ARCHER,4,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MIX,SAMURAI,6,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MIX,BARBARIAN,4,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MIX,BARBARIAN,4,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MIX,MONK,4,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MIX,MONK,4,0,ATTACK_ENEMIES,0)

CREATE_PARTY(MIX2)
ADD_TO_PARTY(MIX2,SAMURAI,8,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MIX2,SAMURAI,6,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MIX2,GIANT,5,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MIX2,BARBARIAN,5,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MIX2,THIEF,6,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MIX2,THIEF,6,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MIX2,THIEF,6,0,ATTACK_ENEMIES,0)

CREATE_PARTY(INSECTS)
ADD_TO_PARTY(INSECTS,BUG,4,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(INSECTS,BUG,4,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(INSECTS,BUG,5,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(INSECTS,FLY,7,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(INSECTS,FLY,7,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(INSECTS,SPIDER,5,0,ATTACK_ENEMIES,0)

CREATE_PARTY(WIZS)
ADD_TO_PARTY(WIZS,WIZARD,8,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WIZS,WIZARD,8,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WIZS,WIZARD,8,0,ATTACK_ENEMIES,0)

CREATE_PARTY(WARLOCKS)
ADD_TO_PARTY(WARLOCKS,SORCEROR,10,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WARLOCKS,SORCEROR,10,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WARLOCKS,SORCEROR,10,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WARLOCKS,SORCEROR,7,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WARLOCKS,SORCEROR,7,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WARLOCKS,SORCEROR,6,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(WARLOCKS,SORCEROR,6,0,ATTACK_ENEMIES,0)

CREATE_PARTY(FAIRIES)
ADD_TO_PARTY(FAIRIES,FAIRY,9,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(FAIRIES,FAIRY,9,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(FAIRIES,FAIRY,9,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(FAIRIES,FAIRY,10,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(FAIRIES,FAIRY,10,0,ATTACK_ENEMIES,0)

CREATE_PARTY(TRK)
ADD_TO_PARTY(TRK,MONK,9,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(TRK,MONK,9,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(TRK,WITCH,9,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(TRK,WITCH,9,0,ATTACK_ENEMIES,0)

CREATE_PARTY(REVENGE)
ADD_TO_PARTY(REVENGE,FAIRY,7,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(REVENGE,FAIRY,7,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(REVENGE,DRAWFROM(MONK,GIANT,DWARFA),7,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(REVENGE,SAMURAI,9,0,ATTACK_ENEMIES,0)

CREATE_PARTY(FIN)
ADD_TO_PARTY(FIN,WITCH,10,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(FIN,WITCH,10,0,ATTACK_ENEMIES,0)
ADD_TO_PARTY(FIN,AVATAR,10,0,ATTACK_ENEMIES,0)

REM ##############################################################################
REM creature captures
REM ##############################################################################

REM	QUICK_OBJECTIVE(1,"A novice Keeper with barely any knowledge of spells and room plans has a slim chance for victory. That would mean getting all the way northwards to face Avatar. No rooms or spells but highly alluring talent for tormenting heroes - use the talent manage around somehow. Start by reclaiming the poorly guarded prison and then exploring the room west to the portal.",ALL_PLAYERS)
DISPLAY_OBJECTIVE(30,ALL_PLAYERS)

IF(PLAYER0,FLAG0>1)
    REM	QUICK_OBJECTIVE(2,"Great, you're able to get some information from the converts. Surely useful, however heroes despise betrayal. The more hero type converts, the stronger resistance you can expect later.",ALL_PLAYERS)
    DISPLAY_OBJECTIVE(31,ALL_PLAYERS)
ENDIF

IF(PLAYER0,BILE_DEMON>0)
    REM	QUICK_INFORMATION(19,"Bile demon is a fantastic help, do you have a room for him in your lair though?",ALL_PLAYERS)
    DISPLAY_OBJECTIVE(32,ALL_PLAYERS)
ENDIF

IF(PLAYER0,THIEF>0)
    REM	QUICK_INFORMATION(0,"These thieves have seen many treasure rooms in their pathetic lives. Plans to build your own are now available!",ALL_PLAYERS)
    DISPLAY_INFORMATION(33,ALL_PLAYERS)
    ROOM_AVAILABLE(PLAYER0,TREASURE,1,1)
    TUTORIAL_FLASH_BUTTON(6,100)
    ADD_TO_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER0,BARBARIAN>0)
    REM	QUICK_INFORMATION(18,"With barbarians on your side, you also learn some of their fighting tactics. Call to arms now available.",ALL_PLAYERS)
    DISPLAY_INFORMATION(34,ALL_PLAYERS)
    MAGIC_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS,1,1)
    TUTORIAL_FLASH_BUTTON(23,100)
    ADD_TO_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER0,SAMURAI>0)
    REM	QUICK_INFORMATION(9,"The converted samurai enables you to hasten your creatures.",ALL_PLAYERS)
    DISPLAY_INFORMATION(35,ALL_PLAYERS)
    MAGIC_AVAILABLE(PLAYER0,POWER_SPEED,1,1)
    TUTORIAL_FLASH_BUTTON(27,100)
    ADD_TO_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER0,MONK>0)
    REM	QUICK_INFORMATION(10,"The converted monk shares a spell enabling you to heal your creatures.",ALL_PLAYERS)
    DISPLAY_INFORMATION(36,ALL_PLAYERS)
    MAGIC_AVAILABLE(PLAYER0,POWER_HEAL_CREATURE,1,1)
    TUTORIAL_FLASH_BUTTON(26,100)
    ADD_TO_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER0,ARCHER>0)
    REM	QUICK_INFORMATION(11,"Archers sure spent some time in workshops. Having one on your side provides you with plans to build one.",ALL_PLAYERS)
    DISPLAY_INFORMATION(37,ALL_PLAYERS)
    ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,1)
    TUTORIAL_FLASH_BUTTON(13,100)
    ADD_TO_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER0,FAIRY>0)
    REM	QUICK_INFORMATION(12,"This converted fairy knows the secrets to build a special room! Scavenger room now available!",ALL_PLAYERS)
    DISPLAY_INFORMATION(38,ALL_PLAYERS)
    ROOM_AVAILABLE(PLAYER0,SCAVENGER,1,1)
    rem TUTORIAL_FLASH_BUTTON(13,100)
    ADD_TO_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER0,WITCH>0)
    REM	QUICK_INFORMATION(13,"The converted witch carried a scroll with a spell inscribed on it!",ALL_PLAYERS)
    DISPLAY_INFORMATION(39,ALL_PLAYERS)
    MAGIC_AVAILABLE(PLAYER0,POWER_LIGHTNING,1,1)
    TUTORIAL_FLASH_BUTTON(25,100)
    ADD_TO_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER0,WIZARD>0)
    REM	QUICK_INFORMATION(14,"Wizards of this land possess the knowledge required to construct a library.",ALL_PLAYERS)
    DISPLAY_INFORMATION(42,ALL_PLAYERS)
    ROOM_AVAILABLE(PLAYER0,RESEARCH,1,1)
    TUTORIAL_FLASH_BUTTON(9,100)
    ADD_TO_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER0,VAMPIRE>0)
    REM	QUICK_OBJECTIVE(15,"Probably a group of his undead mates he sips his blood drinks with every Sunday came to take this vampire you just converted back. Look out. Convert them too so they can continue their exciting sessions.",12)
    DISPLAY_INFORMATION(41,12)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,VAMPIRE,12,4,10,1500)
ENDIF

IF(PLAYER0,DWARFA>0)
    REM	QUICK_INFORMATION(16,"The dwarf you just converted babbled out a secret passage!.",10)
    DISPLAY_INFORMATION(43,10)
    REVEAL_MAP_LOCATION(PLAYER0,10,9)
    PLAY_MESSAGE(PLAYER0,SPEECH,53)
    ADD_TO_FLAG(PLAYER0,FLAG0,1)
ENDIF

IF(PLAYER0,KNIGHT>0)
    REM	QUICK_INFORMATION(17,"The word about deserting knight spread quickly and heroes are on their way to get their revenge.",15)
    DISPLAY_INFORMATION(44,15)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,TRK,15,DUNGEON,0,10,1000)
    ADD_TO_FLAG(PLAYER0,FLAG0,1)
ENDIF

REM ##############################################################################
REM ambushes
REM ##############################################################################

IF_CONTROLS(PLAYER_GOOD,WIZARD<3)
    REM	QUICK_OBJECTIVE(7,"Don't think you're not the only one with torture chamber. The warlocks didn't last for too long before they deserted.",ALL_PLAYERS)
    DISPLAY_OBJECTIVE(40,ALL_PLAYERS)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WARLOCKS,DRAWFROM(-1,-2,12,3),1)
ENDIF

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

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

IF_ACTION_POINT(6,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_MIX,6,2)
ENDIF

IF_ACTION_POINT(11,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,INSECTS,-2,6)
    REM	QUICK_OBJECTIVE(5,"Think I hear some buzzing north-east.",-2)
    DISPLAY_OBJECTIVE(89,-2)
ENDIF

IF(PLAYER0,TIMER1>12000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_NABS,12,5)
    REM	QUICK_OBJECTIVE(6,"Some of the resistance has arrived.",12)
    DISPLAY_OBJECTIVE(99,12)
ENDIF

IF_ACTION_POINT(12,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,INSECTS,-2,3)
ENDIF

IF_ACTION_POINT(6,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_MIX,6,2)
ENDIF

IF(PLAYER0,TIMER0>15000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_MIX,-1,1)
ENDIF

IF(PLAYER0,TIMER0>32000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_MIX,-1,3)
ENDIF

IF(PLAYER0,TIMER0>40000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_MIX,-1,3)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_ARCHERS,-1,2)
ENDIF

IF(PLAYER0,TIMER0>61000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MIX,-1,2)
ENDIF

IF(PLAYER0,TIMER0>73555)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MIX,-1,3)
ENDIF

IF(PLAYER0,TIMER0>93222)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FAIRIES,-1,1)
ENDIF

IF(PLAYER0,TIMER0>115000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MIX2,-1,1)
ENDIF

IF_ACTION_POINT(9,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WIZS,9,1)
ENDIF

IF_ACTION_POINT(3,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_ARCHERS,3,4)
ENDIF

IF_ACTION_POINT(4,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_DWARVES,4,5)
ENDIF

IF_ACTION_POINT(5,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MIX,5,3)
ENDIF

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

IF(PLAYER_GOOD,DUNGEON_DESTROYED>0)
    SET_FLAG(PLAYER0,FLAG1,1)
    SET_TIMER(PLAYER0,TIMER2)
    BONUS_LEVEL_TIME(1200,1)
    REM	QUICK_OBJECTIVE(3,"The battle is not over yet. The monks are reviving Avatar and the sentinel groups are getting ready. Defeat Avatar, withstand all waves and the land is yours.",ALL_PLAYERS)
    DISPLAY_OBJECTIVE(45,ALL_PLAYERS)
ENDIF

IF(PLAYER0,TIMER2>1200)
    BONUS_LEVEL_TIME(0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIN,9,1)
    SET_FLAG(PLAYER0,FLAG1,2)
    NEXT_COMMAND_REUSABLE
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,REVENGE,-1,1)
    NEXT_COMMAND_REUSABLE
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,REVENGE,-2,1)
    NEXT_COMMAND_REUSABLE
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,REVENGE,12,1)
    NEXT_COMMAND_REUSABLE
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,REVENGE,3,1)
    IF(PLAYER0,FLAG0>0)
        NEXT_COMMAND_REUSABLE
        ADD_TO_FLAG(PLAYER0,FLAG0,-1)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER0,TIMER2)
    ENDIF
ENDIF

IF(PLAYER0,FLAG1>1)
    IF(PLAYER0,FLAG0<1)
        IF_CONTROLS(PLAYER_GOOD,AVATAR<1)
            IF_CONTROLS(PLAYER_GOOD,SAMURAI<1)
                REM	QUICK_OBJECTIVE(4,"Great, the cathedral above is burning. No more Sunday schools. Let's move before it all falls down.",ALL_PLAYERS)
                DISPLAY_OBJECTIVE(46,ALL_PLAYERS)
                WIN_GAME
            ENDIF
        ENDIF
    ENDIF
ENDIF

IF_ACTION_POINT(14,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,HORNY,14,1,10,5000)
ENDIF

REM ##############################################################################
REM timerz and stuff
REM ##############################################################################
IF_ACTION_POINT(13,PLAYER0)
    PLAY_MESSAGE(PLAYER0,SOUND,84)
    REM	QUICK_OBJECTIVE(20,"Some kind of alarm sets off as you take a step into the hallway. Heroes are now also taking precautions to avoid imprisonment. Find Avatar.",13)
    DISPLAY_OBJECTIVE(47,13)
    SET_FLAG(PLAYER0,FLAG2,1)
ENDIF

IF(PLAYER0,FLAG2>0)
    NEXT_COMMAND_REUSABLE
    SET_CREATURE_TENDENCIES(PLAYER0,IMPRISON,0)
ENDIF

IF(PLAYER0,PRISON>0)
    SET_TIMER(PLAYER0,TIMER0)
ENDIF

IF(PLAYER_GOOD,FLY<3)
    SET_TIMER(PLAYER0,TIMER1)
ENDIF

IF(PLAYER0,SKELETON>15)
    NEXT_COMMAND_REUSABLE
    KILL_CREATURE(PLAYER0,SKELETON,LEAST_EXPERIENCED,1)
ENDIF
