REM ****************************************************************************
REM  Campaigns Consolidation Project for KeeperFX strategy game.
REM ****************************************************************************
REM  Script for Level Invisible (インビジブル)
REM  Campaign: Twin Keepers
REM  Authors:  Original author unknown
REM            KeeperFX CCP Team
REM            Switched to translatable objectives by dayokay Nov 2014
REM  Date:     05 Aug 2005 - 20 Jan 2011
REM  Copying and copyrights:
REM    This program is free software; you can redistribute it and/or modify
REM    it under the terms of the GNU General Public License as published by
REM    the Free Software Foundation; either version 2 of the License, or
REM    (at your option) any later version.
REM ****************************************************************************

LEVEL_VERSION(1)

START_MONEY(PLAYER0,0)

SET_GENERATE_SPEED(500)

MAX_CREATURES(PLAYER0,20)

REM Timers and flags:
REM PLAYER_GOOD,TIMER0 - trigger hero parties when player claims the entrance
REM PLAYER_GOOD,TIMER1 - trigger hero parties when player starts attack on top center area
REM PLAYER0,FLAG2 - continuously trigger thieves; 0 - wait, 1 - trigger, 2 - stop

SET_FLAG(PLAYER0,FLAG2,0)

ADD_CREATURE_TO_POOL(DRAGON,4)
ADD_CREATURE_TO_POOL(TROLL,10)
ADD_CREATURE_TO_POOL(BUG,20)
ADD_CREATURE_TO_POOL(DEMONSPAWN,10)
ADD_CREATURE_TO_POOL(BILE_DEMON,10)
ADD_CREATURE_TO_POOL(SPIDER,15)
ADD_CREATURE_TO_POOL(ORC,10)
ADD_CREATURE_TO_POOL(TENTACLE,4)
ADD_CREATURE_TO_POOL(HELL_HOUND,10)
ADD_CREATURE_TO_POOL(VAMPIRE,4)

CREATURE_AVAILABLE(ALL_PLAYERS,DRAGON,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,TROLL,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,BUG,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,DEMONSPAWN,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,BILE_DEMON,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,SPIDER,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,ORC,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,TENTACLE,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,HELL_HOUND,1,0)
CREATURE_AVAILABLE(ALL_PLAYERS,VAMPIRE,1,0)

ROOM_AVAILABLE(PLAYER0,LAIR,1,1)
ROOM_AVAILABLE(PLAYER0,GARDEN,1,1)
ROOM_AVAILABLE(PLAYER0,TRAINING,1,1)
ROOM_AVAILABLE(PLAYER0,RESEARCH,1,1)
ROOM_AVAILABLE(PLAYER0,BARRACKS,1,0)
ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,0)
ROOM_AVAILABLE(PLAYER0,TEMPLE,1,0)
ROOM_AVAILABLE(PLAYER0,SCAVENGER,1,0)

MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_OBEY,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_SPEED,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS,1,0)

TRAP_AVAILABLE(ALL_PLAYERS,ALARM,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,POISON_GAS,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,LIGHTNING,1,0)
SET_CREATURE_CONFIGURATION(IMP,FearWounded,30)
SET_CREATURE_CONFIGURATION(THIEF,FearWounded,255)

CREATE_PARTY(INVISIBLE)
    ADD_TO_PARTY(INVISIBLE,THIEF,9,0,STEAL_GOLD,0)

CREATE_PARTY(FAIR_KNIGHT)
    ADD_TO_PARTY(FAIR_KNIGHT,FAIRY,6,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FAIR_KNIGHT,KNIGHT,9,10000,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FAIR_KNIGHT,FAIRY,6,500,ATTACK_ENEMIES,0)

CREATE_PARTY(FAIR_SAMURAI)
    ADD_TO_PARTY(FAIR_SAMURAI,FAIRY,8,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FAIR_SAMURAI,SAMURAI,10,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(FAIR_SAMURAI,FAIRY,8,500,ATTACK_ENEMIES,0)

CREATE_PARTY(WEAK_WITBAR)
    ADD_TO_PARTY(WEAK_WITBAR,DWARFA,1,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(WEAK_WITBAR,WITCH,1,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(WEAK_WITBAR,ARCHER,1,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(WEAK_WITBAR,BARBARIAN,1,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(MED_WIGISA)
    ADD_TO_PARTY(MED_WIGISA,SAMURAI,5,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(MED_WIGISA,GIANT,5,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(MED_WIGISA,WIZARD,6,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(HARD_WISA)
    ADD_TO_PARTY(HARD_WISA,SAMURAI,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(HARD_WISA,DWARFA,10,500,DEFEND_PARTY,0)
    ADD_TO_PARTY(HARD_WISA,WITCH,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(HARD_WISA,WITCH,10,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(HARD_MOWIAR)
    ADD_TO_PARTY(HARD_MOWIAR,WIZARD,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(HARD_MOWIAR,MONK,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(HARD_MOWIAR,ARCHER,10,500,DEFEND_PARTY,0)

CREATE_PARTY(MED_BAGI)
    ADD_TO_PARTY(MED_BAGI,DWARFA,4,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(MED_BAGI,BARBARIAN,5,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(MED_BAGI,GIANT,4,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(MED_WIMO)
    ADD_TO_PARTY(MED_WIMO,WIZARD,8,500,STEAL_SPELLS,0)
    ADD_TO_PARTY(MED_WIMO,MONK,8,500,STEAL_SPELLS,0)
    ADD_TO_PARTY(MED_WIMO,ARCHER,6,500,STEAL_SPELLS,0)
    ADD_TO_PARTY(MED_WIMO,ARCHER,6,500,STEAL_SPELLS,0)

CREATE_PARTY(HARD_WIMOGIGI)
    ADD_TO_PARTY(HARD_WIMOGIGI,GIANT,9,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HARD_WIMOGIGI,GIANT,9,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HARD_WIMOGIGI,MONK,9,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HARD_WIMOGIGI,DWARFA,9,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HARD_WIMOGIGI,DWARFA,9,500,ATTACK_ENEMIES,0)
    ADD_TO_PARTY(HARD_WIMOGIGI,WITCH,9,500,ATTACK_ENEMIES,0)

CREATE_PARTY(HARD_BAWIMOSA)
    ADD_TO_PARTY(HARD_BAWIMOSA,SAMURAI,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(HARD_BAWIMOSA,MONK,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(HARD_BAWIMOSA,DWARFA,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(HARD_BAWIMOSA,WITCH,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(HARD_BAWIMOSA,BARBARIAN,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(HARD_BAWIMOSA,WIZARD,10,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(WEAK_WITWIZ)
    ADD_TO_PARTY(WEAK_WITWIZ,ARCHER,3,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(WEAK_WITWIZ,DWARFA,3,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(WEAK_WITWIZ,WITCH,3,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(WEAK_WITWIZ,WIZARD,3,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(WEAK_BAWIMOGI)
    ADD_TO_PARTY(WEAK_BAWIMOGI,GIANT,2,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(WEAK_BAWIMOGI,MONK,2,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(WEAK_BAWIMOGI,ARCHER,2,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(WEAK_BAWIMOGI,WITCH,2,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(WEAK_BAWIMOGI,BARBARIAN,2,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(MED_BAWISA)
    ADD_TO_PARTY(MED_BAWISA,SAMURAI,4,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(MED_BAWISA,WIZARD,4,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(MED_BAWISA,BARBARIAN,4,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(MED_BAWISA,ARCHER,3,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(MED_BAWISA,ARCHER,3,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(FAIR_GIANTS)
    ADD_TO_PARTY(FAIR_GIANTS,GIANT,8,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(FAIR_GIANTS,GIANT,8,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(FAIR_GIANTS,GIANT,8,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(FAIR_GIANTS,FAIRY,8,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(FAIR_GIANTS,FAIRY,8,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(FAIR_GIANTS,FAIRY,8,500,ATTACK_DUNGEON_HEART,0)

REM Cannot transfer creature from previous realm
IF(PLAYER0,TOTAL_CREATURES > 0)
    IF(PLAYER0,GAME_TURN <= 20)
        LOSE_GAME
    ENDIF
ENDIF

REM QUICK_OBJECTIVE(1,"While traveling to this land, we've lost our Treasure Room plans. While this issue isn't deadly, it influenced our strategy. We will use existing one, left by keeper long dead now.",PLAYER0)
DISPLAY_OBJECTIVE(10)

REM ****************************************************************************
REM Handle mechanics related to the bottom right entry to hero dungeon.
REM This entry is a way to getting gems, so it's players first priority.

REM AP01 is the first one behind locked wooden door at bottom right
IF_ACTION_POINT(1,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_WITWIZ,-1,1)
ENDIF

REM AP02 is behind locked wooden door at bottom, after AP01
IF_ACTION_POINT(2,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DWARFA,-1,4,3,500)
ENDIF

REM AP03 is behind locked wooden door at bottom, after AP02
REM The player can get increase level box before triggering it
IF_ACTION_POINT(3,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BARBARIAN,-1,4,3,500)
ENDIF

REM AP04 is behind locked wooden door at bottom, after AP03
IF_ACTION_POINT(4,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GIANT,-1,4,4,500)
ENDIF

REM AP05 is behind wooden door at bottom, after AP04
IF_ACTION_POINT(5,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,SAMURAI,5,4,4,500)
ENDIF

REM AP06 is behind wooden door at bottom, after AP05
IF_ACTION_POINT(6,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MED_BAGI,6,2)
ENDIF

REM AP28 is behind unlocked iron door at bottom, after AP06
REM Before are lava traps, so player can trigger them to separate from that block
IF_ACTION_POINT(28,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MED_WIGISA,28,2)
ENDIF

REM Somewhere around area of AP28 is a graveyard
IF(PLAYER0,GRAVEYARD >= 1)
    ROOM_AVAILABLE(PLAYER0,GRAVEYARD,1,1)
ENDIF

REM AP07 is behind iron door at bottom, after AP28
IF_ACTION_POINT(7,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,WITCH,28,6,7,500)
ENDIF

REM AP08 is behind locked iron door at bottom, after AP07

REM AP09 is after AP08, at the same room
IF_ACTION_POINT(9,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FAIR_GIANTS,8,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FAIR_GIANTS,10,1)
ENDIF

REM AP10 is after AP09, at the same room

REM AP11 is behind locked iron door at left, after AP10
IF_ACTION_POINT(11,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MED_WIMO,12,2)
ENDIF

REM AP12 is behind lava, in the same room as AP11

REM AP13,AP14,AP15,AP16 are in neutral rooms near gems block

IF_ACTION_POINT(13,PLAYER0)
    REM QUICK_OBJECTIVE(7,"The hero forces will continue to attack, but they're getting weaker. When you're ready, focus on corridor near your entrance and commence an attack on their main force!",PLAYER0)
    DISPLAY_OBJECTIVE(11)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HARD_WIMOGIGI,14,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HARD_WIMOGIGI,15,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HARD_WIMOGIGI,16,1)
ENDIF

REM ****************************************************************************
REM Handle mechanics related to the top center entry to hero dungeon, near entrance.

IF_ACTION_POINT(17,PLAYER0)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,SAMURAI,17,10,10,500)
ENDIF

IF_ACTION_POINT(18,PLAYER0)
    IF(PLAYER0,FLAG2 < 2)
        REM QUICK_INFORMATION(6,"You've chosen to attack the main enemy fore quite fast. I just hope it won't be your undoing, keeper.",PLAYER0)
    DISPLAY_INFORMATION(12)
    ENDIF
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HARD_MOWIAR,19,4)
ENDIF

IF_ACTION_POINT(24,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HARD_BAWIMOSA,25,2)
    SET_TIMER(PLAYER_GOOD,TIMER1)
ENDIF

REM The timer is started when entering the area

IF(PLAYER_GOOD,TIMER1 > 1000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FAIR_KNIGHT,17,1)
ENDIF

IF(PLAYER_GOOD,TIMER1 > 1200)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FAIR_SAMURAI,17,4)
ENDIF

REM ****************************************************************************
REM Handle mechanics related to the top right hero dungeon, the last area.

IF_ACTION_POINT(20,PLAYER0)
    REM QUICK_OBJECTIVE(8,"The good are beginning to understand their unavoidable fate. But stay alert, there's still a bunch to slay, and they're definitely not the weaker ones!",PLAYER0)
    DISPLAY_OBJECTIVE(13)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HARD_WISA,21,2)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HARD_WISA,22,2)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HARD_WISA,23,2)
ENDIF

IF_ACTION_POINT(26,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HARD_BAWIMOSA,26,4)
ENDIF

IF_ACTION_POINT(29,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HARD_WISA,29,3)
ENDIF

IF_ACTION_POINT(30,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FAIR_SAMURAI,30,5)
ENDIF

REM ****************************************************************************
REM Handle general mechanics.

IF(PLAYER0,ENTRANCE >= 1)
    REM QUICK_INFORMATION(2,"If I were in your skin.. I mean, in your flask - I would avoid attacking the door near the Entrance. Heroes who live there might prove to be a problem if your army does not consists of hardened veterans.",PLAYER0)
    DISPLAY_INFORMATION(14)
    SET_TIMER(PLAYER_GOOD,TIMER0)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 3000)
    REM QUICK_INFORMATION(3,"The people of this land know well where to find the old Treasure Room. Expect visits of various heroes, looking either for fame and glory, or just for some easy gold.",PLAYER0)
    DISPLAY_INFORMATION(15)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_WITBAR,27,1)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 6000)
    REM QUICK_INFORMATION(4,"Do not allow your creatures to attack the door near Entrance! Instead, turn your eyes towards the door at bottom. Heroes there are somewhat weaker, and I smell a seductive wealth inside.",PLAYER0)
    DISPLAY_INFORMATION(16)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_BAWIMOGI,27,1)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 8000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,DWARFA,-1,4,2,500)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 10000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,WEAK_WITWIZ,27,1)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 15000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MED_BAWISA,27,2)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 20000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,INVISIBLE,-1,2)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 24000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MED_BAGI,27,3)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 30000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BARBARIAN,-1,4,4,500)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 35000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MED_WIGISA,27,3)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 39000)
    ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,GIANT,-1,4,5,500)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 42000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,MED_WIMO,27,3)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 50000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,INVISIBLE,-1,3)
    SET_FLAG(PLAYER0,FLAG2,1)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 51000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,FAIR_GIANTS,27,2)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 62000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HARD_WIMOGIGI,27,2)
ENDIF

IF(PLAYER_GOOD,TIMER0 > 75000)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,HARD_WISA,27,3)
ENDIF

REM We've got samurai when we reach the neutral rooms at top
IF(PLAYER0,SAMURAI >= 1)
    REM QUICK_INFORMATION(5,"Having gems will allow your Samurai to do proper training, and Thieves should no longer target you with such strength. That's a progress!",PLAYER0)
    DISPLAY_INFORMATION(17)
    SET_FLAG(PLAYER0,FLAG2,2)
ENDIF

REM Special feature - continuously spawn scared thieves
IF(PLAYER0,FLAG2 == 1)
    IF(PLAYER_GOOD,THIEF < 5)
        NEXT_COMMAND_REUSABLE
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,INVISIBLE,-1,1)
    ENDIF
ENDIF

REM If enemy heart destroyed, trigger everything
IF(PLAYER0,ALL_DUNGEONS_DESTROYED == 1)
    REM QUICK_OBJECTIVE(9,"Almost victory! Just make sure all heroes are rotting instead of standing, and we'll be done here.",PLAYER0)
    DISPLAY_OBJECTIVE(18)
    IF(PLAYER_GOOD,TIMER1 == 0)
        SET_TIMER(PLAYER_GOOD,TIMER1)
    ENDIF
    IF(PLAYER_GOOD,TIMER1 > 1300)
        REM Make sure spawning thieves is disabled
        SET_FLAG(PLAYER0,FLAG2,2)
        IF(PLAYER_GOOD,TOTAL_CREATURES < 1)
            WIN_GAME
        ENDIF
    ENDIF
ENDIF
