REM	Level 405 Yami 2.137.0
REM	Author: Duke Ragereaver, Created on 12 Mar 2017
REM	updated to use pot file for messages by dayokay Dec2020

START_MONEY(PLAYER0,40000)
START_MONEY(PLAYER1,400000)

COMPUTER_PLAYER(PLAYER1,0)

MAX_CREATURES(PLAYER0,17)
MAX_CREATURES(PLAYER1,32)

REM Shogun
SET_CREATURE_STRENGTH(SAMURAI,150)
SET_CREATURE_HEALTH(SAMURAI,3000)
SET_CREATURE_ARMOUR(SAMURAI,120)

SET_GENERATE_SPEED(700)
ADD_CREATURE_TO_POOL(TROLL,10)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,5)
ADD_CREATURE_TO_POOL(BILE_DEMON,15)
ADD_CREATURE_TO_POOL(SORCEROR,5)
ADD_CREATURE_TO_POOL(ORC,10)
ADD_CREATURE_TO_POOL(HELL_HOUND,10)
ADD_CREATURE_TO_POOL(SPIDER,5)
ADD_CREATURE_TO_POOL(BUG,5)
ADD_CREATURE_TO_POOL(FLY,5)
ADD_CREATURE_TO_POOL(DEMONSPAWN,10)
ADD_CREATURE_TO_POOL(SKELETON,25)
ADD_CREATURE_TO_POOL(GHOST,6)
ADD_CREATURE_TO_POOL(VAMPIRE,3)
ADD_CREATURE_TO_POOL(DRAGON,3)

CREATURE_AVAILABLE(PLAYER0,FLY,1,1)
CREATURE_AVAILABLE(PLAYER0,TROLL,1,1)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,1)
CREATURE_AVAILABLE(PLAYER1,SKELETON,1,1)
CREATURE_AVAILABLE(PLAYER1,GHOST,1,1)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER0,ORC,1,1)
CREATURE_AVAILABLE(PLAYER0,DRAGON,1,1)
CREATURE_AVAILABLE(PLAYER1,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER0,BUG,1,1)
CREATURE_AVAILABLE(PLAYER0,HELL_HOUND,1,1)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,VAMPIRE,1,1)

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

SET_COMPUTER_PROCESS(PLAYER1,"BUILD A TORTURE ROOM",-5,5,6,5,0)
SET_COMPUTER_PROCESS(PLAYER1,"BUILD A GRAVEYARD ROOM",0,5,6,11,0)

SET_COMPUTER_GLOBALS(PLAYER1,50,1,1,1,10000,1)

IF(PLAYER1,WORKSHOP >= 72)
    NEXT_COMMAND_REUSABLE
    ROOM_AVAILABLE(PLAYER1,WORKSHOP,0,0)
ENDIF

IF(PLAYER1,WORKSHOP < 72)
    NEXT_COMMAND_REUSABLE
    ROOM_AVAILABLE(PLAYER1,WORKSHOP,1,1)
ENDIF

IF(PLAYER0,TEMPLE > 0)
    ROOM_AVAILABLE(ALL_PLAYERS,TEMPLE,1,1)
    TUTORIAL_FLASH_BUTTON(12,100)
ENDIF

IF(PLAYER0,SCAVENGER > 0)
    ROOM_AVAILABLE(ALL_PLAYERS,SCAVENGER,1,1)
    TUTORIAL_FLASH_BUTTON(14,100)
ENDIF

IF(PLAYER0,BRIDGE > 0)
    ROOM_AVAILABLE(ALL_PLAYERS,BRIDGE,1,1)
    TUTORIAL_FLASH_BUTTON(18,100)
ENDIF

IF(PLAYER0,GUARD_POST > 0)
    ROOM_AVAILABLE(ALL_PLAYERS,GUARD_POST,1,1)
    TUTORIAL_FLASH_BUTTON(19,100)
ENDIF

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(PLAYER1,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CAVE_IN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)

TRAP_AVAILABLE(PLAYER0,ALARM,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,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,LIGHTNING,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,WORD_OF_POWER,1,0)

CREATE_PARTY(ONE)
    ADD_TO_PARTY(ONE,THIEF,5,300,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,THIEF,4,250,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,THIEF,4,400,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ONE,ARCHER,4,350,DEFEND_PARTY,0)
    ADD_TO_PARTY(ONE,DWARFA,3,300,STEAL_GOLD,0)

CREATE_PARTY(TWO)
    ADD_TO_PARTY(TWO,BARBARIAN,4,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(TWO,BARBARIAN,5,450,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(TWO,ARCHER,4,350,DEFEND_PARTY,0)
    ADD_TO_PARTY(TWO,ARCHER,5,350,DEFEND_PARTY,0)

CREATE_PARTY(THREE)
    ADD_TO_PARTY(THREE,MONK,5,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(THREE,MONK,6,600,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(THREE,WITCH,4,400,DEFEND_PARTY,0)
    ADD_TO_PARTY(THREE,WITCH,5,400,DEFEND_PARTY,0)

CREATE_PARTY(FOUR)
    ADD_TO_PARTY(FOUR,KNIGHT,7,1000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FOUR,KNIGHT,7,1000,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(FOUR,WIZARD,7,750,DEFEND_PARTY,0)

CREATE_PARTY(BRUTES)
    ADD_TO_PARTY(BRUTES,GIANT,6,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRUTES,GIANT,6,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRUTES,GIANT,6,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRUTES,GIANT,6,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(BRUTES,GIANT,6,500,DEFEND_PARTY,0)
    ADD_TO_PARTY(BRUTES,GIANT,6,500,DEFEND_PARTY,0)

CREATE_PARTY(SCOUTS)
    ADD_TO_PARTY(SCOUTS,DWARFA,10,750,STEAL_GOLD,0)
    ADD_TO_PARTY(SCOUTS,THIEF,9,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(SCOUTS,THIEF,9,700,DEFEND_PARTY,0)
    ADD_TO_PARTY(SCOUTS,THIEF,8,700,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(SCOUTS,ARCHER,9,500,DEFEND_PARTY,0)
    ADD_TO_PARTY(SCOUTS,ARCHER,8,500,DEFEND_PARTY,0)
    ADD_TO_PARTY(SCOUTS,ARCHER,8,500,DEFEND_PARTY,0)

CREATE_PARTY(MYSTIC)
    ADD_TO_PARTY(MYSTIC,MONK,7,750,DEFEND_PARTY,0)
    ADD_TO_PARTY(MYSTIC,WIZARD,8,800,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(MYSTIC,FAIRY,8,1000,STEAL_SPELLS,0)
    ADD_TO_PARTY(MYSTIC,WITCH,8,500,STEAL_SPELLS,0)

CREATE_PARTY(HOLY)
    ADD_TO_PARTY(HOLY,MONK,7,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY,MONK,8,500,STEAL_SPELLS,0)
    ADD_TO_PARTY(HOLY,MONK,7,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HOLY,MONK,6,500,DEFEND_PARTY,0)

CREATE_PARTY(ELITES)
    ADD_TO_PARTY(ELITES,KNIGHT,9,1500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(ELITES,WIZARD,8,1250,STEAL_SPELLS,0)
    ADD_TO_PARTY(ELITES,BARBARIAN,8,1000,DEFEND_PARTY,0)
    ADD_TO_PARTY(ELITES,GIANT,7,1000,ATTACK_ENEMIES,0)

CREATE_PARTY(SHOGUN)
    ADD_TO_PARTY(SHOGUN,SAMURAI,10,5000,ATTACK_DUNGEON_HEART,1)
    ADD_TO_PARTY(SHOGUN,WIZARD,9,1000,STEAL_SPELLS,1)
    ADD_TO_PARTY(SHOGUN,ARCHER,8,1000,DEFEND_PARTY,1)
    ADD_TO_PARTY(SHOGUN,MONK,9,1000,DEFEND_PARTY,1)
    ADD_TO_PARTY(SHOGUN,KNIGHT,8,1000,ATTACK_ENEMIES,1)
    ADD_TO_PARTY(SHOGUN,BARBARIAN,8,1000,ATTACK_ENEMIES,1)

REM	QUICK_OBJECTIVE(0,"This realm is ruled by the Shogun, a legendary Samurai warrior with great swordfighting skills. I say it's time we put these so-called skills to the test! Be warned, the Shogun may decide to pre-emptively attack us if we become too powerful.",PLAYER0)
DISPLAY_OBJECTIVE(5,PLAYER0)

IF_ACTION_POINT(3,PLAYER0)
    IF(PLAYER_GOOD,FLAG1 == 0)
        SET_FLAG(PLAYER_GOOD,FLAG1,1)
        SET_TIMER(PLAYER_GOOD,TIMER1)
        SET_TIMER(PLAYER_GOOD,TIMER2)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SCOUTS,-6,1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ELITES,-8,1)
    ENDIF
ENDIF

IF(PLAYER1,DUNGEON_DESTROYED == 1)
    IF(PLAYER_GOOD,DUNGEON_DESTROYED == 0)
        IF(PLAYER_GOOD,FLAG1 == 0)
            SET_FLAG(PLAYER_GOOD,FLAG1,1)
            SET_FLAG(PLAYER_GOOD,FLAG2,1)
            SET_TIMER(PLAYER_GOOD,TIMER1)
            SET_TIMER(PLAYER_GOOD,TIMER2)
            SET_TIMER(PLAYER_GOOD,TIMER3)
        ENDIF
    ENDIF
ENDIF

IF(PLAYER_GOOD,TIMER3 >= 750)
    IF(PLAYER_GOOD,FLAG2 == 1)
        ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-7,ACTION_POINT,10,8,1000)
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DWARFA,-7,4,7,500)
        ADD_TUNNELLER_TO_LEVEL(PLAYER_GOOD,-9,ACTION_POINT,9,8,1000)
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DWARFA,-9,4,7,500)
    ENDIF
ENDIF

IF_ACTION_POINT(4,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ONE,2,1)
ENDIF

IF_ACTION_POINT(5,PLAYER0)
    SET_TIMER(PLAYER0,TIMER0)
ENDIF

IF(PLAYER0,TIMER0 >= 1400)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,TWO,-1,1)
ENDIF

IF(PLAYER0,TIMER0 >= 3000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,-2,1)
ENDIF

IF_ACTION_POINT(7,PLAYER0)
    SET_TIMER(PLAYER0,TIMER1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BRUTES,-6,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SCOUTS,-8,1)
ENDIF

IF(PLAYER0,TIMER1 >= 1400)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BRUTES,-4,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THREE,-3,1)
ENDIF

IF(PLAYER0,TIMER1 >= 4800)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HOLY,-4,1)
ENDIF

IF(PLAYER0,TIMER1 >= 5400)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,-3,1)
ENDIF

IF(PLAYER_GOOD,FLAG1 == 1)
    IF(PLAYER_GOOD,TIMER2 >= 1450)
        IF(PLAYER_GOOD,SAMURAI == 1)
            IF(PLAYER_GOOD,TOTAL_CREATURES <= 20)
                SET_FLAG(PLAYER_GOOD,FLAG2,1)
                NEXT_COMMAND_REUSABLE
                ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FOUR,-7,1)
                NEXT_COMMAND_REUSABLE
                SET_TIMER(PLAYER_GOOD,TIMER2)
            ENDIF
        ENDIF
    ENDIF
ENDIF

IF(PLAYER_GOOD,FLAG1 == 1)
    IF(PLAYER_GOOD,TIMER1 >= 940)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,BRUTES,-6,1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,FLAG1 == 1)
    IF(PLAYER_GOOD,TIMER1 >= 1033)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SCOUTS,-8,1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,FLAG1 == 1)
    IF(PLAYER_GOOD,TIMER1 >= 1276)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MYSTIC,-6,1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ELITES,-8,1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,FLAG1 == 1)
    IF(PLAYER_GOOD,TIMER1 >= 1426)
        REM	QUICK_OBJECTIVE(1,"The Shogun himself has arrived... string him up!",PLAYER_GOOD)
		DISPLAY_OBJECTIVE(6,PLAYER_GOOD)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,SHOGUN,-7,1)
    ENDIF
ENDIF

IF(PLAYER_GOOD,FLAG1 == 1)
    IF(PLAYER_GOOD,TIMER1 >= 1500)
        IF(PLAYER_GOOD,SAMURAI == 0)
            REM	QUICK_OBJECTIVE(2,"The Shogun has fallen, now eliminate any remaining opposition!",PLAYER1)
			DISPLAY_OBJECTIVE(7,PLAYER1)
        ENDIF
    ENDIF
ENDIF

IF(PLAYER_GOOD,FLAG1 == 1)
    IF(PLAYER_GOOD,TIMER1 >= 1620)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MYSTIC,-5,1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,ELITES,-9,1)
    ENDIF
ENDIF

IF(PLAYER0,ALL_DUNGEONS_DESTROYED == 1)
    IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
        IF(PLAYER_GOOD,FLAG1 == 1)
			DISPLAY_OBJECTIVE(8,PLAYER0)
            WIN_GAME
        ENDIF
    ENDIF
ENDIF
