REM -------------------------------------------------------------------------------------------------------------------------------------------
REM Undead Keeper
REM Dawnterror
REM Made by Duke Ragereaver
REM -------------------------------------------------------------------------------------------------------------------------------------------

REM -------------------------------------------------------------------------------------------------------------------------------------------

START_MONEY(PLAYER0,100000)
START_MONEY(PLAYER1,3000000)

REM Avatar boost

SET_CREATURE_HEALTH(AVATAR,3150)
SET_CREATURE_STRENGTH(AVATAR,175)
SET_CREATURE_ARMOUR(AVATAR,140)

REM Computer stuff

COMPUTER_PLAYER(PLAYER1,0)

SET_COMPUTER_CHECKS(PLAYER1,"CHECK FOR NEUTRAL PLACES",15000,0,0,0,195000)

REM CHECKEVERY	ATTACKPERCENT	CTADURATION		MINFORATTACK	LASTCHECK

SET_COMPUTER_CHECKS(PLAYER1,"CHECK FOR QUICK ATTACK",14250,45,4000,5,10000)
SET_COMPUTER_PROCESS(PLAYER1,"ATTACK SAFE ATTACK",-1,100,335,100,0)
SET_COMPUTER_PROCESS(PLAYER1,"ATTACK PLAN 1",-1,100,335,100,0)


REM -------------------------------------------------------------------------------------------------------------------------------------------

MAX_CREATURES(PLAYER0,25)
MAX_CREATURES(PLAYER1,40)

REM -------------------------------------------------------------------------------------------------------------------------------------------

SET_GENERATE_SPEED(525)
ADD_CREATURE_TO_POOL(TROLL,15)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,25)
ADD_CREATURE_TO_POOL(SKELETON,25)
ADD_CREATURE_TO_POOL(BILE_DEMON,25)
ADD_CREATURE_TO_POOL(DRAGON,25)
ADD_CREATURE_TO_POOL(VAMPIRE,3)

ADD_CREATURE_TO_POOL(GHOST,15)
ADD_CREATURE_TO_POOL(SORCEROR,15)
ADD_CREATURE_TO_POOL(HORNY,3)
ADD_CREATURE_TO_POOL(TENTACLE,10)
ADD_CREATURE_TO_POOL(ORC,5)

REM -------------------------------------------------------------------------------------------------------------------------------------------

CREATURE_AVAILABLE(PLAYER0,SKELETON,1,1)
CREATURE_AVAILABLE(PLAYER0,GHOST,1,1)

CREATURE_AVAILABLE(PLAYER1,TROLL,1,1)
CREATURE_AVAILABLE(PLAYER1,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER1,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER1,DRAGON,1,1)
CREATURE_AVAILABLE(PLAYER1,SORCEROR,1,1)
CREATURE_AVAILABLE(PLAYER1,HORNY,1,1)
CREATURE_AVAILABLE(PLAYER1,TENTACLE,1,1)
CREATURE_AVAILABLE(PLAYER1,VAMPIRE,1,1)

REM -------------------------------------------------------------------------------------------------------------------------------------------

ROOM_AVAILABLE(ALL_PLAYERS,TREASURE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
ROOM_AVAILABLE(PLAYER1,GARDEN,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TRAINING,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,RESEARCH,1,1)
ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,0)
ROOM_AVAILABLE(PLAYER1,BARRACKS,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,GUARD_POST,1,0)
ROOM_AVAILABLE(PLAYER0,BRIDGE,1,0)
ROOM_AVAILABLE(PLAYER1,TORTURE,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,GRAVEYARD,1,0)
ROOM_AVAILABLE(PLAYER1,PRISON,1,0)


REM -------------------------------------------------------------------------------------------------------------------------------------------

MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,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(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(PLAYER1,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(PLAYER1,POWER_DISEASE,1,0)
MAGIC_AVAILABLE(PLAYER1,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(PLAYER1,POWER_DESTROY_WALLS,1,0)

REM -------------------------------------------------------------------------------------------------------------------------------------------

TRAP_AVAILABLE(PLAYER0,ALARM,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,STEEL,1,0)
TRAP_AVAILABLE(PLAYER1,BOULDER,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,MAGIC,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,LIGHTNING,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,WORD_OF_POWER,1,0)

REM -------------------------------------------------------------------------------------------------------------------------------------------

CREATE_PARTY(FIRST_STRIKE)
    ADD_TO_PARTY(FIRST_STRIKE,DWARFA,4,350,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FIRST_STRIKE,BARBARIAN,5,400,STEAL_SPELLS,0)
    ADD_TO_PARTY(FIRST_STRIKE,DWARFA,4,350,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FIRST_STRIKE,THIEF,4,350,STEAL_GOLD,0)
    ADD_TO_PARTY(FIRST_STRIKE,ARCHER,5,350,DEFEND_PARTY,0)

CREATE_PARTY(SECOND_STRIKE)
    ADD_TO_PARTY(SECOND_STRIKE,MONK,5,400,DEFEND_PARTY,0)
    ADD_TO_PARTY(SECOND_STRIKE,WIZARD,5,450,STEAL_SPELLS,0)
    ADD_TO_PARTY(SECOND_STRIKE,MONK,4,400,DEFEND_PARTY,0)
    ADD_TO_PARTY(SECOND_STRIKE,ARCHER,5,350,DEFEND_PARTY,0)

CREATE_PARTY(THIRD_STRIKE)
    ADD_TO_PARTY(THIRD_STRIKE,SAMURAI,5,450,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THIRD_STRIKE,SAMURAI,6,550,STEAL_SPELLS,0)
    ADD_TO_PARTY(THIRD_STRIKE,SAMURAI,4,450,DEFEND_PARTY,0)
    ADD_TO_PARTY(THIRD_STRIKE,SAMURAI,4,450,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THIRD_STRIKE,SAMURAI,5,450,DEFEND_PARTY,0)

CREATE_PARTY(FOURTH_STRIKE)
    ADD_TO_PARTY(FOURTH_STRIKE,SAMURAI,6,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOURTH_STRIKE,WIZARD,6,550,STEAL_SPELLS,0)
    ADD_TO_PARTY(FOURTH_STRIKE,MONK,6,500,DEFEND_PARTY,0)
    ADD_TO_PARTY(FOURTH_STRIKE,ARCHER,6,400,DEFEND_PARTY,0)
    ADD_TO_PARTY(FOURTH_STRIKE,GIANT,6,500,ATTACK_ROOMS,0)

REM Avatar Bodyguards

CREATE_PARTY(HEART1)
    ADD_TO_PARTY(HEART1,DWARFA,8,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HEART1,ARCHER,8,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HEART1,DWARFA,8,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HEART1,THIEF,8,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HEART1,THIEF,8,1000,DEFEND_PARTY,0)
    ADD_TO_PARTY(HEART1,ARCHER,8,1000,DEFEND_PARTY,0)

CREATE_PARTY(HEART2)
    ADD_TO_PARTY(HEART2,BARBARIAN,9,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HEART2,GIANT,9,1500,STEAL_SPELLS,0)
    ADD_TO_PARTY(HEART2,BARBARIAN,9,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HEART2,GIANT,9,1500,DEFEND_PARTY,0)

CREATE_PARTY(HEART3)
    ADD_TO_PARTY(HEART3,SAMURAI,9,2500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HEART3,KNIGHT,10,2500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HEART3,WIZARD,10,2500,STEAL_SPELLS,0)
    ADD_TO_PARTY(HEART3,SAMURAI,9,2500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HEART3,GIANT,10,2500,DEFEND_PARTY,0)
    ADD_TO_PARTY(HEART3,BARBARIAN,9,2500,DEFEND_PARTY,0)
    ADD_TO_PARTY(HEART3,SAMURAI,9,2500,ATTACK_ENEMIES,0)

REM Search & Destroy

CREATE_PARTY(ELITE)
    ADD_TO_PARTY(ELITE,SAMURAI,9,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ELITE,WIZARD,9,1500,STEAL_SPELLS,0)
    ADD_TO_PARTY(ELITE,BARBARIAN,9,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ELITE,BARBARIAN,9,1500,DEFEND_PARTY,0)
    ADD_TO_PARTY(ELITE,GIANT,9,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ELITE,SAMURAI,9,1500,DEFEND_PARTY,0)

REM -------------------------------------------------------------------------------------------------------------------------------------------

SET_TIMER(PLAYER_GOOD,TIMER0)
QUICK_OBJECTIVE(0,"Keeper Bane has barricaded himself in, the pathetic wretch. But the more suprising news is that most of the Elite Heroes along with their leader, the Avatar, have survived and are preparing to attack you!",PLAYER0)

IF(PLAYER_GOOD,TIMER0 >= 9000)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,FIRST_STRIKE,-3,ACTION_POINT,3,4,350)
QUICK_OBJECTIVE(1,"Keeper Bane is very powerful because all creatures in this realm are supporting him. The Dark Gods, however, are willing to help you, but they demand a tribute in the form of 100 Souls, preferably dead, of course!",PLAYER0)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 11000)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,SECOND_STRIKE,-1,ACTION_POINT,3,5,350)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIRST_STRIKE,-3,1)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 15500)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,THIRD_STRIKE,-2,DUNGEON_HEART,0,5,350)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FIRST_STRIKE,-1,1)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 18750)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THIRD_STRIKE,-2,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SECOND_STRIKE,-3,1)
ENDIF

IF(PLAYER_GOOD,TIMER0 >= 20975)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOURTH_STRIKE,1,1)
ENDIF

REM -------------------------------------------------------------------------------------------------------------------------------------------

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

IF(PLAYER0,BATTLES_WON >= 100)
    QUICK_OBJECTIVE(2,"The Dark Gods are pleased with your sacrifice!",PLAYER0)
    ROOM_AVAILABLE(ALL_PLAYERS,PRISON,1,1)
    TUTORIAL_FLASH_BUTTON(11,PLAYER0)
ENDIF

IF_ACTION_POINT(6,PLAYER0)
    QUICK_OBJECTIVE(3,"Beware, the Avatar has returned and he's stronger than ever. Make this lunatic see the error of his ways because he just won't give up!",PLAYER0)
    SET_TIMER(PLAYER_GOOD,TIMER1)
ENDIF

IF(PLAYER_GOOD,TIMER1 >= 225)
    IF(PLAYER_GOOD,AVATAR == 1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HEART1,2,1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER1 >= 1000)
    IF(PLAYER_GOOD,AVATAR == 1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HEART2,2,1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER1 >= 2500)
    IF(PLAYER_GOOD,AVATAR == 1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HEART3,2,1)
        SET_TIMER(PLAYER_GOOD,TIMER1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,AVATAR == 0)
    QUICK_OBJECTIVE(4,"The Avatar is badly wounded, finish him off now so we can turn to the real prize of this realm, Bane. ",PLAYER0)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,-4,DUNGEON,1,9,1200)
    CREATURE_AVAILABLE(PLAYER1,ORC,1,1)
ENDIF

IF(PLAYER_GOOD,DUNGEON_DESTROYED == 1)
    ADD_TUNNELLER_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,-4,DUNGEON,0,9,1200)
ENDIF

IF_ACTION_POINT(5,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ELITE,1,1)
ENDIF

IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
    IF(PLAYER_GOOD,DUNGEON_DESTROYED == 1)
        IF(PLAYER1,TOTAL_CREATURES == 0)
            IF(PLAYER1,DUNGEON_DESTROYED == 1)
                IF(PLAYER_GOOD,AVATAR == 0)
QUICK_OBJECTIVE(5,"Finally, Keeper Bane is destroyed, all his minions dead, and so are the Heroes. There are no more living creatures on this continent, and there is nothing left to conquer; you have won.",PLAYER0)
                    WIN_GAME
                ENDIF
            ENDIF
        ENDIF
    ENDIF
ENDIF
