REM ****************************************************************************
REM  Campaigns Consolidation Project for KeeperFX strategy game.
REM ****************************************************************************
REM  Script for Level Tub vulnerabilities (桶狭間)
REM  Campaign: Twin Keepers
REM  Authors:  Original author unknown
REM            KeeperFX CCP Team
REM            Switched to translatable objectives by dayokay Nov 2014
REM  Date:     17 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 ****************************************************************************

START_MONEY(PLAYER0,10000)
START_MONEY(PLAYER1,10000)
START_MONEY(PLAYER2,10000)
START_MONEY(PLAYER3,10000)

COMPUTER_PLAYER(PLAYER1,10)
COMPUTER_PLAYER(PLAYER2,10)
COMPUTER_PLAYER(PLAYER3,10)

SET_FLAG(PLAYER0,FLAG0,0)

ALLY_PLAYERS(PLAYER1,PLAYER2)
ALLY_PLAYERS(PLAYER2,PLAYER3)
ALLY_PLAYERS(PLAYER1,PLAYER3)

SET_GENERATE_SPEED(500)

MAX_CREATURES(PLAYER0,20)
MAX_CREATURES(PLAYER1,10)
MAX_CREATURES(PLAYER2,15)
MAX_CREATURES(PLAYER3,20)

ADD_CREATURE_TO_POOL(BUG,20)
ADD_CREATURE_TO_POOL(TROLL,20)
ADD_CREATURE_TO_POOL(DEMONSPAWN,20)
ADD_CREATURE_TO_POOL(SORCEROR,20)
ADD_CREATURE_TO_POOL(BILE_DEMON,20)
ADD_CREATURE_TO_POOL(SPIDER,20)
ADD_CREATURE_TO_POOL(ORC,20)
ADD_CREATURE_TO_POOL(TENTACLE,20)
ADD_CREATURE_TO_POOL(FLY,20)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,20)
ADD_CREATURE_TO_POOL(DRAGON,20)

CREATURE_AVAILABLE(PLAYER1,BUG,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,TROLL,1,1)
CREATURE_AVAILABLE(PLAYER2,DEMONSPAWN,1,1)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,1)
CREATURE_AVAILABLE(PLAYER1,SORCEROR,1,1)
CREATURE_AVAILABLE(PLAYER2,SORCEROR,1,1)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER2,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER1,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER2,SPIDER,1,1)
CREATURE_AVAILABLE(PLAYER0,ORC,1,1)
CREATURE_AVAILABLE(PLAYER2,ORC,1,1)
CREATURE_AVAILABLE(PLAYER3,ORC,1,1)
CREATURE_AVAILABLE(ALL_PLAYERS,TENTACLE,1,1)
CREATURE_AVAILABLE(PLAYER1,FLY,1,1)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER3,DARK_MISTRESS,1,1)
CREATURE_AVAILABLE(PLAYER0,DRAGON,1,1)
CREATURE_AVAILABLE(PLAYER3,DRAGON,1,1)

ROOM_AVAILABLE(PLAYER0,TREASURE,1,0)
ROOM_AVAILABLE(PLAYER0,LAIR,1,0)
ROOM_AVAILABLE(PLAYER0,GARDEN,1,0)
ROOM_AVAILABLE(PLAYER0,TRAINING,1,0)
ROOM_AVAILABLE(PLAYER0,RESEARCH,1,0)
ROOM_AVAILABLE(PLAYER1,TREASURE,1,1)
ROOM_AVAILABLE(PLAYER1,LAIR,1,1)
ROOM_AVAILABLE(PLAYER1,GARDEN,1,1)
ROOM_AVAILABLE(PLAYER1,TRAINING,1,1)
ROOM_AVAILABLE(PLAYER1,RESEARCH,1,1)
ROOM_AVAILABLE(PLAYER2,TREASURE,1,1)
ROOM_AVAILABLE(PLAYER2,LAIR,1,1)
ROOM_AVAILABLE(PLAYER2,GARDEN,1,1)
ROOM_AVAILABLE(PLAYER2,TRAINING,1,1)
ROOM_AVAILABLE(PLAYER2,RESEARCH,1,1)
ROOM_AVAILABLE(PLAYER3,TREASURE,1,1)
ROOM_AVAILABLE(PLAYER3,LAIR,1,1)
ROOM_AVAILABLE(PLAYER3,GARDEN,1,1)
ROOM_AVAILABLE(PLAYER3,TRAINING,1,1)
ROOM_AVAILABLE(PLAYER3,RESEARCH,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,WORKSHOP,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TORTURE,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TEMPLE,1,0)

MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_OBEY,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,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)
TRAP_AVAILABLE(ALL_PLAYERS,WORD_OF_POWER,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,STEEL,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,MAGIC,1,0)

CREATE_PARTY(PARTY1)
    ADD_TO_PARTY(PARTY1,SAMURAI,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY1,KNIGHT,10,10000,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY1,SAMURAI,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY1,WIZARD,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY1,WIZARD,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY1,GIANT,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY1,GIANT,10,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(PARTY2)
    ADD_TO_PARTY(PARTY2,BARBARIAN,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY2,ARCHER,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY2,ARCHER,10,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(PARTY3)
    ADD_TO_PARTY(PARTY3,DWARFA,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY3,DWARFA,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY3,MONK,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY3,MONK,10,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(PARTY4)
    ADD_TO_PARTY(PARTY4,WITCH,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY4,WITCH,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY4,WIZARD,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY4,WIZARD,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY4,FAIRY,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY4,FAIRY,10,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(PARTY5)
    ADD_TO_PARTY(PARTY5,SAMURAI,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY5,BARBARIAN,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY5,DWARFA,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY5,GIANT,10,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(PARTY6)
    ADD_TO_PARTY(PARTY6,THIEF,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY6,THIEF,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY6,THIEF,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY6,ARCHER,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY6,ARCHER,10,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(PARTY7)
    ADD_TO_PARTY(PARTY7,MONK,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY7,ARCHER,9,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY7,ARCHER,9,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY7,FAIRY,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY7,FAIRY,10,500,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(PARTY8)
    ADD_TO_PARTY(PARTY8,SAMURAI,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY8,GIANT,9,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY8,GIANT,9,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY8,DWARFA,10,500,ATTACK_DUNGEON_HEART,0)
    ADD_TO_PARTY(PARTY8,DWARFA,10,500,ATTACK_DUNGEON_HEART,0)

DISPLAY_OBJECTIVE(27,PLAYER0)

IF(PLAYER0,FLAG0 == 0)
	IF(PLAYER0,GAME_TURN > 49500)
		SET_TIMER(PLAYER0,TIMER0)
		SET_FLAG(PLAYER0,FLAG0,1)
	ENDIF
	IF_ACTION_POINT(5,PLAYER0)
		SET_TIMER(PLAYER0,TIMER0)
		SET_FLAG(PLAYER0,FLAG0,1)
	ENDIF
ENDIF
	
IF_ACTION_POINT(1,PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY8,2,1)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY7,3,1)
ENDIF

IF(PLAYER0,FLAG0 == 1)
    IF(PLAYER0,TIMER0 > 500)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY6,-1,1)
        DISPLAY_OBJECTIVE(30,PLAYER0)
    ENDIF
    IF(PLAYER0,TIMER0 > 600)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY5,-1,2)
    ENDIF
    IF(PLAYER0,TIMER0 > 700)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY4,4,1)
    ENDIF
    IF(PLAYER0,TIMER0 > 800)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY3,-1,2)
    ENDIF
    IF(PLAYER0,TIMER0 > 900)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY2,-1,2)
    ENDIF
    IF(PLAYER0,TIMER0 > 1000)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,PARTY1,-1,1)
    ENDIF
    IF(PLAYER0,TIMER0 > 1100)
        SET_FLAG(PLAYER0,FLAG0,2)
    ENDIF
ENDIF

IF(PLAYER0,FLAG0 == 2)
    IF(PLAYER_GOOD,KNIGHT == 0)
        DISPLAY_OBJECTIVE(29,PLAYER0)
        SET_CREATURE_FEAR(ARCHER,255)
        SET_CREATURE_FEAR(BARBARIAN,255)
        SET_CREATURE_FEAR(DWARFA,255)
        SET_CREATURE_FEAR(FAIRY,255)
        SET_CREATURE_FEAR(GIANT,255)
        SET_CREATURE_FEAR(MONK,255)
        SET_CREATURE_FEAR(SAMURAI,255)
        SET_CREATURE_FEAR(THIEF,255)
        SET_CREATURE_FEAR(WITCH,255)
        SET_CREATURE_FEAR(WIZARD,255)
    ENDIF
    IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
        DISPLAY_OBJECTIVE(28,PLAYER0)
        WIN_GAME
    ENDIF
ENDIF
