REM ********************************************
REM
REM Script for Kzelbatu 1.0.0
REM Author: Stanza, Created on 18 Jan 2008
REM   English version, by Mefistotelis
REM   modified for pot file by dayokay Dec2020
REM   converted to keeperfx format sep 2024
REM
REM ********************************************

LEVEL_VERSION(1)
SET_GENERATE_SPEED(500)
MAX_CREATURES(PLAYER0,18)
START_MONEY(PLAYER0,7000)
SET_GAME_RULE(MapCreatureLimit,500)

ADD_CREATURE_TO_POOL(DRAGON,12)
ADD_CREATURE_TO_POOL(FLY,5)
ADD_CREATURE_TO_POOL(TROLL,5)
ADD_CREATURE_TO_POOL(TENTACLE,5)
ADD_CREATURE_TO_POOL(DEMONSPAWN,5)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,1)
ADD_CREATURE_TO_POOL(SORCEROR,5)
ADD_CREATURE_TO_POOL(BILE_DEMON,12)
ADD_CREATURE_TO_POOL(SPIDER,12)
ADD_CREATURE_TO_POOL(HELL_HOUND,10)
ADD_CREATURE_TO_POOL(BUG,5)
ADD_CREATURE_TO_POOL(ORC,12)

CREATURE_AVAILABLE(PLAYER0,DRAGON,1,0)
CREATURE_AVAILABLE(PLAYER0,FLY,1,0)
CREATURE_AVAILABLE(PLAYER0,TROLL,1,0)
CREATURE_AVAILABLE(PLAYER0,TENTACLE,1,0)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,0)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,0)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,0)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,0)
CREATURE_AVAILABLE(PLAYER0,SPIDER,1,0)
CREATURE_AVAILABLE(PLAYER0,HELL_HOUND,1,0)
CREATURE_AVAILABLE(PLAYER0,BUG,1,0)
CREATURE_AVAILABLE(PLAYER0,ORC,1,0)

ROOM_AVAILABLE(PLAYER0,TREASURE,1,1)
ROOM_AVAILABLE(PLAYER0,RESEARCH,1,1)
ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,0)
ROOM_AVAILABLE(PLAYER0,GARDEN,1,1)
ROOM_AVAILABLE(PLAYER0,LAIR,1,1)
ROOM_AVAILABLE(PLAYER0,GUARD_POST,1,0)
ROOM_AVAILABLE(PLAYER0,TORTURE,1,0)
ROOM_AVAILABLE(PLAYER0,TRAINING,1,0)
ROOM_AVAILABLE(PLAYER0,BARRACKS,1,0)
ROOM_AVAILABLE(PLAYER0,TEMPLE,1,0)
ROOM_AVAILABLE(PLAYER0,BRIDGE,1,0)
ROOM_AVAILABLE(PLAYER0,SCAVENGER,3,0)

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

TRAP_AVAILABLE(PLAYER0,WORD_OF_POWER,1,0)
TRAP_AVAILABLE(PLAYER0,ALARM,1,0)
TRAP_AVAILABLE(PLAYER0,POISON_GAS,1,0)

MAGIC_AVAILABLE(PLAYER0,POWER_OBEY,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_SLAP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_SPEED,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_PROTECT,1,0)

REM "Your powers have been sealed by magic, and the meager resources are fiercely guarded by smugglers. Have no pity and shorten them by their heads, keeper."
DISPLAY_OBJECTIVE(5)

CREATE_PARTY(PAMPA)
    ADD_TO_PARTY(PAMPA,WITCH,10,300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(PAMPA,BILE_DEMON,9,300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(PAMPA,BILE_DEMON,9,700,ATTACK_ENEMIES,0)

CREATE_PARTY(WARNING)
    ADD_TO_PARTY(WARNING,ARCHER,6,300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(WARNING,ARCHER,6,300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(WARNING,ARCHER,6,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(WARNING,MONK,7,800,ATTACK_ENEMIES,0)

CREATE_PARTY(BANDIT1)
    ADD_TO_PARTY(BANDIT1,THIEF,5,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BANDIT1,THIEF,5,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BANDIT1,SAMURAI,5,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BANDIT1,SAMURAI,4,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BANDIT1,SAMURAI,4,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BANDIT1,SAMURAI,4,1000,ATTACK_ENEMIES,0)

CREATE_PARTY(BANDIT2)
    ADD_TO_PARTY(BANDIT2,THIEF,7,1100,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BANDIT2,BARBARIAN,8,1300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BANDIT2,WIZARD,7,1700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BANDIT2,SAMURAI,6,1800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BANDIT2,SAMURAI,6,1800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BANDIT2,SAMURAI,6,1800,ATTACK_ENEMIES,0)

CREATE_PARTY(OPERATIVE)
    ADD_TO_PARTY(OPERATIVE,THIEF,9,300,STEAL_GOLD,0)
    ADD_TO_PARTY(OPERATIVE,THIEF,9,300,STEAL_GOLD,0)
    ADD_TO_PARTY(OPERATIVE,THIEF,9,700,STEAL_GOLD,0)
    ADD_TO_PARTY(OPERATIVE,DWARFA,9,700,STEAL_GOLD,0)
    ADD_TO_PARTY(OPERATIVE,DWARFA,9,700,STEAL_GOLD,0)


CREATE_PARTY(HOLY1)
    ADD_TO_PARTY(HOLY1,GIANT,7,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY1,BARBARIAN,7,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY1,GIANT,8,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY1,SAMURAI,7,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY1,WIZARD,7,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY1,ARCHER,8,800,ATTACK_ENEMIES,0)

CREATE_PARTY(HOLY2)
    ADD_TO_PARTY(HOLY2,GIANT,10,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY2,BARBARIAN,9,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY2,GIANT,10,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY2,SAMURAI,9,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY2,WIZARD,10,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY2,SAMURAI,9,1000,ATTACK_ENEMIES,0)

CREATE_PARTY(HOLY3)
    ADD_TO_PARTY(HOLY3,KNIGHT,10,2000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY3,BARBARIAN,10,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY3,GIANT,10,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY3,SAMURAI,10,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY3,WIZARD,10,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY3,SAMURAI,10,1000,ATTACK_ENEMIES,0)

CREATE_PARTY(STRIKE)
    ADD_TO_PARTY(STRIKE,FAIRY,10,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(STRIKE,FAIRY,10,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(STRIKE,GIANT,10,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(STRIKE,SAMURAI,10,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(STRIKE,WIZARD,10,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(STRIKE,ARCHER,10,1000,ATTACK_ENEMIES,0)

IF_ACTION_POINT(1,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WARNING,1,1)
ENDIF

IF_ACTION_POINT(2,PLAYER0)
    SET_TIMER(PLAYER_GOOD,TIMER0)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 5500)
    REM "Smugglers send an assemblage of harmful shock to you, put them into pieces!")
    DISPLAY_OBJECTIVE(6,-1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BANDIT1,-1,1)
ENDIF

IF(PLAYER_GOOD,KNIGHT == 4)
    SET_FLAG(PLAYER_GOOD,FLAG0,1)
ENDIF

IF(PLAYER_GOOD,FLAG0 == 1)
    SET_TIMER(PLAYER_GOOD,TIMER1)
ENDIF

IF(PLAYER_GOOD,TIMER1 >= 1000)
    REM "The master troupe was resurrected. Destroy it again, and this time let it be once and for all."
    DISPLAY_OBJECTIVE(7,-2)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,HOLY1,-2,DUNGEON,0,6,600)
ENDIF

IF(PLAYER_GOOD,TIMER1 >= 7000)
    REM "Heroic reinforcements arrive on your land in order to steal your belongings. Find a way to make their suffering special."
    DISPLAY_OBJECTIVE(9,-2)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BANDIT2,-2,1)
ENDIF

IF(PLAYER_GOOD,KNIGHT == 2)
    SET_FLAG(PLAYER_GOOD,FLAG1,1)
ENDIF

IF(PLAYER_GOOD,FLAG1 == 1)
    SET_TIMER(PLAYER_GOOD,TIMER2)
ENDIF

IF(PLAYER_GOOD,TIMER2 >= 500)
    REM "The second bandit king has also been raised in his secret altar. When counting survivors, teach him the meaning of word: none."
    DISPLAY_OBJECTIVE(8,-4)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,HOLY2,-4,DUNGEON,0,8,800)
ENDIF

IF(PLAYER_GOOD,TIMER2 >= 3000)
    REM "Agents have infiltrated your dungeon to steal gold. They obviously do not yet know they will die."
    DISPLAY_OBJECTIVE(10,-1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,OPERATIVE,-1,1)
ENDIF

IF(PLAYER_GOOD,KNIGHT == 1)
    SET_TIMER(PLAYER_GOOD,TIMER3)
ENDIF

IF(PLAYER_GOOD,TIMER3 >= 3000)
    REM "Hell have a pact with the smugglers, the demons come for you aneantir!"
    DISPLAY_OBJECTIVE(11,-2)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PAMPA,-2,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PAMPA,-3,1)
ENDIF

IF(PLAYER_GOOD,KNIGHT == 0)
    IF(PLAYER_GOOD,DUNGEON_DESTROYED == 1)
        REM  "The last of the bandit masters is getting ready for his return, be prepared to even his county to underground level."
        DISPLAY_OBJECTIVE(12)
        SET_TIMER(PLAYER_GOOD,TIMER4)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER4 >= 4000)
    REM "The Lord is back with a bunch of optimistic puppets. Make them pay for their insurance with a slow death!",PLAYER0)
    DISPLAY_OBJECTIVE(13,-3)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HOLY3,-3,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,STRIKE,-2,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HOLY1,-2,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,OPERATIVE,-3,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PAMPA,-1,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BANDIT2,-1,1)
    SET_FLAG(PLAYER_GOOD,FLAG3,1)
ENDIF

IF_CONTROLS(PLAYER_GOOD,TOTAL_CREATURES == 0)
    IF(PLAYER_GOOD,FLAG3 == 1)
        DISPLAY_OBJECTIVE(14,PLAYER0)
        WIN_GAME
    ENDIF
ENDIF

IF(PLAYER0,DUNGEON_DESTROYED == 1)
    LOSE_GAME
ENDIF
