{
  IF ( INT_GAME_TURN == 0 )
  {
    SET $0                                     0
    DO SET_ATTACK_VARIABLE                     $0
    DO STATE_STATE_BRING_NEW_PEOPLE_BACK       ON
    DO STATE_TRAIN_PEOPLE                      ON
    DO STATE_SHAMAN_GET_WILDS                  OFF
    DO STATE_CONSTRUCT_BUILDING                ON
    DO STATE_FETCH_WOOD                        ON
    DO STATE_SEND_GHOSTS                       OFF
    DO STATE_FETCH_LOST_PEOPLE                 ON
    DO STATE_FETCH_FAR_VEHICLE                 OFF
    DO STATE_FETCH_LOST_VEHICLE                OFF
    DO SET_DRUM_TOWER_POS                      50 130
    DO SET_REINCARNATION                       OFF
    DO DISABLE_USER_INPUTS
    SET INT_ATTR_PREF_BOAT_DRIVERS             0
    DO SET_DEFENCE_RADIUS                      7
    SET INT_ATTR_SHAMEN_BLAST                  0
    SET INT_ATTR_MAX_TRAIN_AT_ONCE             1
    SET INT_ATTR_GROUP_OPTION                  0
    SET INT_ATTR_BASE_UNDER_ATTACK_RETREAT     1
    SET INT_ATTR_PREF_SPY_TRAINS               0
    SET INT_ATTR_PREF_WARRIOR_TRAINS           0
    SET INT_ATTR_PREF_FIREWARRIOR_TRAINS       0
    SET INT_ATTR_PREF_RELIGIOUS_TRAINS         0
    SET INT_ATTR_PREF_BOAT_HUTS                0
    SET INT_ATTR_PREF_BALLOON_HUTS             0
    SET INT_ATTR_MAX_BUILDINGS_ON_GO           1
    SET INT_ATTR_HOUSE_PERCENTAGE              3
    SET INT_ATTR_EXPANSION                     4
    DO STATE_POPULATE_DRUM_TOWER               ON
    DO STATE_DEFEND                            OFF
    DO STATE_DEFEND_BASE                       ON
    SET INT_ATTR_DEFENSE_RAD_INCR              2
    SET INT_ATTR_MAX_DEFENSIVE_ACTIONS         1
    SET INT_ATTR_ATTACK_PERCENTAGE             45
    DO STATE_SPELL_DEFENCE                     50 130 ON
    DO SET_SPELL_ENTRY 0 INT_SWARM INT_M_SPELL_BLAST_COST 512 6 0
    DO SET_SPELL_ENTRY 1 INT_SWARM INT_M_SPELL_BLAST_COST 512 6 1
    DO SET_MARKER_ENTRY                        0 7 -1 0 2 0 0
    DO SET_MARKER_ENTRY                        2 5 6 0 3 0 0
    DO ONLY_STAND_AT_MARKERS
    DO MARKER_ENTRIES                          0 -1 -1 -1
    DO STATE_HOUSE_A_PERSON                    ON
    DO STATE_AUTO_ATTACK                       ON
    SET INT_ATTR_MAX_ATTACKS                   1
    SET INT_ATTR_AWAY_BRAVE                    0
    SET INT_ATTR_AWAY_WARRIOR                  100
    SET INT_ATTR_AWAY_RELIGIOUS                0
    SET INT_ATTR_AWAY_SPY                      0
    SET INT_ATTR_AWAY_FIREWARRIOR              0
    SET INT_ATTR_AWAY_SHAMAN                   0
    SET INT_ATTR_RETREAT_VALUE                 50
    SET INT_ATTR_SPY_DISCOVER_CHANCE           30
    SET INT_ATTR_ENEMY_SPY_MAX_STAND           255
    DO PUT_PERSON_IN_DT INT_WARRIOR 124 124
    SET $1                                     0
    SET $2                                     0
    SET $3                                     0
    SET $4                                     0
    SET $5                                     0
    SET $6                                     0
    SET $7                                     0
    SET $8                                     0
    SET $9                                     0
    SET $10                                    0
    SET $11                                    0
    SET $12                                    0
    SET $13                                    0
    SET $14                                    0
    SET $15                                    0
    SET $16                                    0
  }
  ELSE
  {
    EVERY 256 133
    {
      IF ( INT_MY_NUM_PEOPLE < 80 )
      {
        DO SET_BUCKET_USAGE                      ON
        DO SET_BUCKET_COUNT_FOR_SPELL INT_BLAST                 8
        DO SET_BUCKET_COUNT_FOR_SPELL INT_CONVERT               8
        DO SET_BUCKET_COUNT_FOR_SPELL INT_SWARM                 32
        DO SET_BUCKET_COUNT_FOR_SPELL INT_INVISIBILITY          40
        DO SET_BUCKET_COUNT_FOR_SPELL INT_SHIELD                48
        DO SET_BUCKET_COUNT_FOR_SPELL INT_LAND_BRIDGE           66
        DO SET_BUCKET_COUNT_FOR_SPELL INT_LIGHTNING             64
        DO SET_BUCKET_COUNT_FOR_SPELL INT_HYPNOTISM             70
        DO SET_BUCKET_COUNT_FOR_SPELL INT_TORNADO               72
        DO SET_BUCKET_COUNT_FOR_SPELL INT_SWAMP                 80
        DO SET_BUCKET_COUNT_FOR_SPELL INT_FLATTEN               100
        DO SET_BUCKET_COUNT_FOR_SPELL INT_EARTHQUAKE            140
        DO SET_BUCKET_COUNT_FOR_SPELL INT_EROSION               168
        DO SET_BUCKET_COUNT_FOR_SPELL INT_FIRESTORM             320
        DO SET_BUCKET_COUNT_FOR_SPELL INT_ANGEL_OF_DEATH        408
        DO SET_BUCKET_COUNT_FOR_SPELL INT_VOLCANO               640
      }
      ELSE
      {
        DO SET_BUCKET_USAGE                      ON
        DO SET_BUCKET_COUNT_FOR_SPELL INT_BLAST                 4
        DO SET_BUCKET_COUNT_FOR_SPELL INT_CONVERT               4
        DO SET_BUCKET_COUNT_FOR_SPELL INT_SWARM                 16
        DO SET_BUCKET_COUNT_FOR_SPELL INT_INVISIBILITY          20
        DO SET_BUCKET_COUNT_FOR_SPELL INT_SHIELD                24
        DO SET_BUCKET_COUNT_FOR_SPELL INT_LAND_BRIDGE           33
        DO SET_BUCKET_COUNT_FOR_SPELL INT_LIGHTNING             32
        DO SET_BUCKET_COUNT_FOR_SPELL INT_HYPNOTISM             35
        DO SET_BUCKET_COUNT_FOR_SPELL INT_TORNADO               36
        DO SET_BUCKET_COUNT_FOR_SPELL INT_SWAMP                 40
        DO SET_BUCKET_COUNT_FOR_SPELL INT_FLATTEN               50
        DO SET_BUCKET_COUNT_FOR_SPELL INT_EARTHQUAKE            70
        DO SET_BUCKET_COUNT_FOR_SPELL INT_EROSION               84
        DO SET_BUCKET_COUNT_FOR_SPELL INT_FIRESTORM             180
        DO SET_BUCKET_COUNT_FOR_SPELL INT_ANGEL_OF_DEATH        204
        DO SET_BUCKET_COUNT_FOR_SPELL INT_VOLCANO               320
      }
      ENDIF
    }
    EVERY 64 13
    {
      IF ( $9 == 0 && $11 == 0 )
      {
        DO GET_HEAD_TRIGGER_COUNT 204 96 $10
        IF ( $10 < 3 )
        {
          SET $9                                  1
          DO CREATE_MSG_INFORMATION               103
          DO SET_MSG_DELETE_ON_OK
          SET $11                                 1
          SET $9                                  0
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 32 15
    {
      IF ( $13 == 0 )
      {
        DO COUNT_PEOPLE_IN_MARKER BLUE 8 3 $12
        IF ( $12 == 1 )
        {
          SET $14                                 32
        }
        ENDIF
      }
      ENDIF
    }
    IF ( $14 > 0 )
    {
      DECREMENT $14 1
      IF ( $14 == 0 )
      {
        IF ( $9 == 0 )
        {
          SET $9                                  1
          DO CREATE_MSG_INFORMATION_ZOOM          68 204 96 308
          DO SET_MSG_DELETE_ON_OK
          SET $13                                 1
          SET $9                                  0
        }
        ENDIF
      }
      ENDIF
    }
    ENDIF
    EVERY 64 73
    {
      DO MARKER_ENTRIES                         2 -1 -1 -1
    }
    EVERY 64
    {
      IF ( $2 == 0 )
      {
        DO COUNT_PEOPLE_IN_MARKER BLUE 0 6 $1
        IF ( $1 > 0 )
        {
          DO CALL_TO_ARMS
          INCREMENT $2 1
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 64 55
    {
      IF ( INT_MY_NUM_PEOPLE > 10 && INT_M_PERSON_WARRIOR < 2 )
      {
        SET $6                                   2
        DECREMENT $6 INT_M_PERSON_WARRIOR
        DO TRAIN_PEOPLE_NOW $6 INT_WARRIOR
      }
      ENDIF
    }
    EVERY 8 23
    {
      IF ( $4 == 0 )
      {
        DO GET_HEAD_TRIGGER_COUNT 150 134 $3
        IF ( $3 == 0 )
        {
          SET $4                                  1
          DO FLYBY_CREATE_NEW
          DO FLYBY_ALLOW_INTERRUPT                OFF
          DO FLYBY_SET_EVENT_POS                  194 96 1 20
          DO FLYBY_SET_EVENT_ANGLE                357 5 19
          DO FLYBY_SET_END_TARGET                 194 96 357 0
          DO FLYBY_START
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 2 35
    {
      DO GET_SPELLS_CAST RED INT_SWARM $5
      IF ( $5 > 1 )
      {
        DO SET_SPELL_ENTRY 0 0 INT_M_SPELL_BLAST_COST 512 6 0
        DO SET_SPELL_ENTRY 1 0 INT_M_SPELL_BLAST_COST 512 6 1
      }
      ENDIF
    }
    EVERY 1024 585
    {
      IF ( INT_B_PERSON_WARRIOR > 3 && INT_MY_NUM_KILLED_BY_BLUE > 3 )
      {
        IF ( $7 == 0 )
        {
          DO ATTACK BLUE 2 ATTACK_BUILDING INT_WARRIOR_TRAIN 10 INT_SWARM INT_SWARM INT_BLAST ATTACK_NORMAL 0 -1 -1 -1
          SET $7                                  1
        }
        ELSE
        {
          IF ( $7 == 1 )
          {
            IF ( $0 != 0 )
            {
              IF ( $0 > 50 )
              {
                SET $7                               2
              }
              ELSE
              {
                SET $7                               0
              }
              ENDIF
              SET $0                                0
            }
            ENDIF
          }
          ELSE
          {
            IF ( $7 == 2 )
            {
              DO ATTACK BLUE 4 ATTACK_BUILDING INT_WARRIOR_TRAIN 10 INT_SWARM INT_SWARM INT_BLAST ATTACK_NORMAL 0 -1 -1 -1
              SET $7                                3
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 8
    {
      IF ( INT_GAME_TURN > 65 )
      {
        IF ( $15 == 0 )
        {
          DO CREATE_MSG_NARRATIVE                 102
          DO SET_MSG_AUTO_OPEN_DLG
          DO ENABLE_USER_INPUTS
          SET $15                                 1
          DO FLYBY_CREATE_NEW
          DO FLYBY_ALLOW_INTERRUPT                ON
          DO FLYBY_SET_EVENT_POS                  204 96 5 30
          DO FLYBY_SET_EVENT_ANGLE                1556 7 38
          DO FLYBY_SET_EVENT_ZOOM                 -40 15 35
          DO FLYBY_SET_EVENT_POS                  150 134 40 40
          DO FLYBY_SET_EVENT_ANGLE                132 60 25
          DO FLYBY_SET_EVENT_ZOOM                 20 65 18
          DO FLYBY_SET_EVENT_POS                  96 136 85 30
          DO FLYBY_SET_EVENT_ANGLE                676 95 30
          DO FLYBY_SET_EVENT_ZOOM                 -100 90 70
          DO FLYBY_SET_EVENT_POS                  78 146 125 25
          DO FLYBY_SET_EVENT_ANGLE                550 130 40
          DO FLYBY_SET_EVENT_POS                  168 98 155 60
          DO FLYBY_SET_EVENT_ANGLE                1544 195 25
          DO FLYBY_SET_EVENT_ZOOM                 0 202 18
          DO FLYBY_SET_EVENT_TOOLTIP              204 96 0 25 35
          DO FLYBY_SET_EVENT_TOOLTIP              150 134 0 65 30
          DO FLYBY_SET_EVENT_TOOLTIP              96 136 1 100 40
          DO FLYBY_SET_END_TARGET                 168 98 1544 0
          DO FLYBY_START
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 64 55
    {
      IF ( INT_MY_NUM_PEOPLE < 8 && INT_MY_NUM_KILLED_BY_BLUE > 5 )
      {
        SET $16                                  INT_M_BUILDING_SMALL_HUT
        INCREMENT $16 INT_M_BUILDING_MEDIUM_HUT
        INCREMENT $16 INT_M_BUILDING_LARGE_HUT
        IF ( $16 == 0 )
        {
          DO DEFEND_SHAMEN                        INT_MY_NUM_PEOPLE
        }
        ENDIF
      }
      ENDIF
    }
  }
  ENDIF
}
SCRIPT_END
