{
  IF ( INT_GAME_TURN == 0 )
  {
    SET $0                                     0
    DO SET_ATTACK_VARIABLE                     $0
    DO STATE_CONSTRUCT_BUILDING                ON
    DO STATE_FETCH_WOOD                        ON
    DO DELAY_MAIN_DRUM_TOWER
    SET INT_ATTR_PREF_SPY_TRAINS               1
    SET INT_ATTR_PREF_RELIGIOUS_TRAINS         0
    SET INT_ATTR_PREF_WARRIOR_TRAINS           1
    SET INT_ATTR_PREF_FIREWARRIOR_TRAINS       0
    SET INT_ATTR_PREF_BOAT_HUTS                0
    SET INT_ATTR_PREF_BALLOON_HUTS             0
    SET INT_ATTR_MAX_BUILDINGS_ON_GO           3
    SET INT_ATTR_HOUSE_PERCENTAGE              10
    SET INT_ATTR_SHAMEN_BLAST                  64
    DO STATE_SHAMAN_GET_WILDS                  ON
    SET INT_ATTR_EXPANSION                     10
    DO CONVERT_AT_MARKER                       44
    DO SET_DEFENCE_RADIUS                      7
    DO STATE_HOUSE_A_PERSON                    ON
    DO STATE_STATE_BRING_NEW_PEOPLE_BACK       ON
    DO STATE_POPULATE_DRUM_TOWER               ON
    DO STATE_DEFEND                            ON
    DO STATE_DEFEND_BASE                       ON
    SET INT_ATTR_DEFENSE_RAD_INCR              15
    SET INT_ATTR_MAX_DEFENSIVE_ACTIONS         3
    SET INT_ATTR_ATTACK_PERCENTAGE             180
    SET INT_ATTR_USE_PREACHER_FOR_DEFENCE      1
    DO STATE_PREACH                            ON
    DO STATE_FIREWARRIOR_DEFEND                ON
    SET INT_ATTR_RETREAT_VALUE                 35
    SET INT_ATTR_BASE_UNDER_ATTACK_RETREAT     1
    SET INT_ATTR_RANDOM_BUILD_SIDE             1
    SET INT_ATTR_SPY_CHECK_FREQUENCY           128
    SET INT_ATTR_SPY_DISCOVER_CHANCE           5
    SET INT_ATTR_ENEMY_SPY_MAX_STAND           128
    DO STATE_FETCH_LOST_PEOPLE                 ON
    DO STATE_FETCH_LOST_VEHICLE                ON
    DO STATE_FETCH_FAR_VEHICLE                 ON
    DO STATE_BUILD_VEHICLE                     ON
    SET INT_ATTR_PEOPLE_PER_BALLOON            10
    SET INT_ATTR_PREF_BALLOON_DRIVERS          4
    DO STATE_TRAIN_PEOPLE                      ON
    SET INT_ATTR_PREF_SPY_PEOPLE               40
    SET INT_ATTR_PREF_RELIGIOUS_PEOPLE         0
    SET INT_ATTR_PREF_WARRIOR_PEOPLE           15
    SET INT_ATTR_PREF_FIREWARRIOR_PEOPLE       0
    DO STATE_AUTO_ATTACK                       ON
    SET INT_ATTR_MAX_ATTACKS                   1
    SET INT_ATTR_AWAY_BRAVE                    10
    SET INT_ATTR_AWAY_WARRIOR                  25
    SET INT_ATTR_AWAY_RELIGIOUS                15
    SET INT_ATTR_AWAY_SPY                      25
    SET INT_ATTR_AWAY_FIREWARRIOR              25
    SET INT_ATTR_AWAY_SHAMAN                   1
    SET INT_ATTR_MAX_TRAIN_AT_ONCE             1
    SET INT_ATTR_GROUP_OPTION                  0
    DO CREATE_MSG_NARRATIVE                    14
    DO SET_MSG_AUTO_OPEN_DLG
    DO TARGET_FIREWARRIORS
    DO TARGET_BLUE_SHAMAN
    DO TARGET_BLUE_DRUM_TOWERS
    SET $1                                     0
    SET $2                                     21
    SET $3                                     1
    SET $4                                     1
    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
    SET $17                                    0
    SET $18                                    0
    SET $19                                    0
    SET $20                                    0
    SET $21                                    0
    SET $22                                    0
    SET $23                                    0
    SET $24                                    0
    SET $25                                    0
    SET $26                                    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 8
    {
      IF ( INT_GAME_TURN > 5 )
      {
        IF ( $23 == 0 )
        {
          SET $23                                 1
          DO FLYBY_CREATE_NEW
          DO FLYBY_ALLOW_INTERRUPT                ON
          DO FLYBY_SET_EVENT_POS                  8 72 9 45
          DO FLYBY_SET_EVENT_POS                  218 92 54 20
          DO FLYBY_SET_EVENT_POS                  73 164 75 45
          DO FLYBY_SET_EVENT_POS                  154 50 121 48
          DO FLYBY_SET_EVENT_POS                  98 24 170 35
          DO FLYBY_SET_EVENT_ANGLE                1688 1 20
          DO FLYBY_SET_EVENT_ANGLE                1992 30 40
          DO FLYBY_SET_EVENT_ANGLE                505 72 38
          DO FLYBY_SET_EVENT_ANGLE                818 115 30
          DO FLYBY_SET_EVENT_ANGLE                130 150 20
          DO FLYBY_SET_EVENT_ANGLE                1021 171 19
          DO FLYBY_SET_EVENT_ANGLE                141 191 14
          DO FLYBY_SET_EVENT_ZOOM                 -50 2 25
          DO FLYBY_SET_EVENT_ZOOM                 20 55 20
          DO FLYBY_SET_EVENT_ZOOM                 -20 80 30
          DO FLYBY_SET_EVENT_ZOOM                 -80 122 26
          DO FLYBY_SET_EVENT_ZOOM                 -20 150 20
          DO FLYBY_SET_EVENT_ZOOM                 0 171 29
          DO FLYBY_SET_END_TARGET                 98 24 141 0
          DO FLYBY_START
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 256
    {
      DO COUNT_PEOPLE_IN_MARKER COUNT_WILD 45 5 $22
      IF ( $22 > 4 )
      {
        DO CONVERT_AT_MARKER                     45
      }
      ENDIF
    }
    EVERY 512 120
    {
      SET $24                                   INT_M_BUILDING_SMALL_HUT
      INCREMENT $24 INT_M_BUILDING_MEDIUM_HUT
      INCREMENT $24 INT_M_BUILDING_LARGE_HUT
      IF ( INT_MY_NUM_PEOPLE > 10 && $24 > 1 )
      {
        SET INT_ATTR_MAX_BUILDINGS_ON_GO         3
        SET INT_ATTR_HOUSE_PERCENTAGE            20
      }
      ENDIF
    }
    EVERY 512 130
    {
      IF ( INT_M_PERSON_SPY > 0 )
      {
        SET INT_ATTR_PREF_SPY_TRAINS             1
        SET INT_ATTR_PREF_RELIGIOUS_TRAINS       1
        SET INT_ATTR_PREF_WARRIOR_TRAINS         1
        SET INT_ATTR_PREF_FIREWARRIOR_TRAINS     0
        SET INT_ATTR_PREF_BOAT_HUTS              0
        SET INT_ATTR_PREF_BALLOON_HUTS           0
        SET INT_ATTR_MAX_BUILDINGS_ON_GO         3
        SET INT_ATTR_PREF_SPY_PEOPLE             20
        SET INT_ATTR_PREF_RELIGIOUS_PEOPLE       10
        SET INT_ATTR_PREF_WARRIOR_PEOPLE         20
        SET INT_ATTR_PREF_FIREWARRIOR_PEOPLE     15
      }
      ENDIF
    }
    EVERY 1024 160
    {
      IF ( INT_M_PERSON_SPY >= $3 && $3 < 6 )
      {
        SET INT_ATTR_AWAY_BRAVE                  0
        SET INT_ATTR_AWAY_WARRIOR                0
        SET INT_ATTR_AWAY_RELIGIOUS              0
        SET INT_ATTR_AWAY_SPY                    100
        SET INT_ATTR_AWAY_FIREWARRIOR            0
        SET INT_ATTR_AWAY_SHAMAN                 0
        DO SET_ATTACK_VARIABLE                   $0
        DO ATTACK BLUE $3 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 5 INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 $2 -1 -1
        INCREMENT $2 1
        INCREMENT $4 1
        INCREMENT $3 1
        IF ( $2 > 23 )
        {
          DECREMENT $2 2
        }
        ENDIF
      }
      ELSE
      {
        SET INT_ATTR_MAX_ATTACKS                 1
        SET INT_ATTR_AWAY_BRAVE                  10
        SET INT_ATTR_AWAY_WARRIOR                25
        SET INT_ATTR_AWAY_RELIGIOUS              15
        SET INT_ATTR_AWAY_SPY                    15
        SET INT_ATTR_AWAY_FIREWARRIOR            25
        SET INT_ATTR_AWAY_SHAMAN                 1
      }
      ENDIF
    }
    EVERY 1024 240
    {
      IF ( $4 > 5 )
      {
        SET INT_ATTR_PREF_SPY_PEOPLE             5
        SET INT_ATTR_PREF_RELIGIOUS_PEOPLE       10
        SET INT_ATTR_PREF_WARRIOR_PEOPLE         25
        SET INT_ATTR_PREF_FIREWARRIOR_PEOPLE     20
      }
      ENDIF
    }
    EVERY 512 140
    {
      IF ( INT_M_PERSON_WARRIOR > 5 && INT_MY_NUM_PEOPLE > 20 )
      {
        SET INT_ATTR_PREF_SPY_TRAINS             1
        SET INT_ATTR_PREF_RELIGIOUS_TRAINS       1
        SET INT_ATTR_PREF_WARRIOR_TRAINS         1
        SET INT_ATTR_PREF_FIREWARRIOR_TRAINS     1
        SET INT_ATTR_PREF_BOAT_HUTS              0
        SET INT_ATTR_PREF_BALLOON_HUTS           0
        SET INT_ATTR_HOUSE_PERCENTAGE            30
        DO BUILD_MAIN_DRUM_TOWER
        SET INT_ATTR_MAX_SPY_ATTACKS             2
      }
      ENDIF
    }
    EVERY 512 150
    {
      IF ( INT_M_BUILDING_WARRIOR_TRAIN > 0 && INT_M_BUILDING_SPY_TRAIN > 0 )
      {
        IF ( INT_M_BUILDING_TEMPLE > 0 && INT_M_BUILDING_FIREWARRIOR_TRAIN > 0 )
        {
          IF ( INT_M_BUILDING_LARGE_HUT > 4 )
          {
            SET INT_ATTR_HOUSE_PERCENTAGE          45
            SET INT_ATTR_MAX_BUILDINGS_ON_GO       4
            IF ( INT_CP_FREE_ENTRIES > 2 )
            {
              IF ( $13 == 0 )
              {
                DO BUILD_DRUM_TOWER                  254 82
                INCREMENT $13 1
              }
              ELSE
              {
                DO PREACH_AT_MARKER                  28
              }
              ENDIF
            }
            ENDIF
            IF ( INT_CP_FREE_ENTRIES > 2 )
            {
              IF ( $14 == 0 )
              {
                DO BUILD_DRUM_TOWER                  244 68
                INCREMENT $14 1
              }
              ELSE
              {
                DO PREACH_AT_MARKER                  29
                DO STATE_SPELL_DEFENCE               244 68 ON
                DO SET_SPELL_ENTRY 0 INT_LIGHTNING INT_M_SPELL_TORNADO_COST 64 6 0
                DO SET_SPELL_ENTRY 1 INT_SWARM INT_M_SPELL_SWARM_COST 64 2 1
                DO SET_SPELL_ENTRY 2 INT_SWAMP INT_M_SPELL_LAND_BRIDGE_COST 64 5 0
                DO SET_SPELL_ENTRY 3 INT_HYPNOTISM INT_M_SPELL_INVISIBILITY_COST 64 4 0
                DO SET_SPELL_ENTRY 4 INT_TORNADO INT_M_SPELL_INVISIBILITY_COST 128 4 0
              }
              ENDIF
            }
            ENDIF
            IF ( $14 != 0 && $13 != 0 )
            {
              DO GUARD_BETWEEN_MARKERS              28 29 0 7 0 0 GUARD_NORMAL
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 4096 400
    {
      IF ( INT_M_PERSON_FIREWARRIOR > 4 && INT_M_PERSON_WARRIOR > 4 )
      {
        IF ( $26 < 3 )
        {
          DO STATE_SHAMAN_GET_WILDS               OFF
          SET INT_ATTR_AWAY_BRAVE                 0
          SET INT_ATTR_AWAY_WARRIOR               40
          SET INT_ATTR_AWAY_RELIGIOUS             20
          SET INT_ATTR_AWAY_SPY                   0
          SET INT_ATTR_AWAY_FIREWARRIOR           40
          SET INT_ATTR_AWAY_SHAMAN                1
          DO ATTACK BLUE 7 ATTACK_PERSON INT_TARGET_SHAMAN 999 INT_INVISIBILITY INT_LIGHTNING INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 -1 -1
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 512 160
    {
      DO COUNT_PEOPLE_IN_MARKER BLUE 5 7 $1
      IF ( $1 > 4 )
      {
        INCREMENT $17 1
      }
      ENDIF
      IF ( $17 > 3 )
      {
        MULTIPLY $27 $1 2
        SET INT_ATTR_AWAY_SHAMAN                 1
        DO ATTACK BLUE $27 ATTACK_MARKER 5 999 INT_BLAST INT_BLAST INT_BLAST ATTACK_NORMAL 0 -1 -1 -1
      }
      ENDIF
    }
    EVERY 512 170
    {
      DO COUNT_PEOPLE_IN_MARKER BLUE 8 7 $16
      IF ( $16 > 4 )
      {
        INCREMENT $18 1
      }
      ENDIF
      IF ( $18 > 3 )
      {
        MULTIPLY $28 $16 2
        SET INT_ATTR_AWAY_SHAMAN                 1
        DO ATTACK BLUE $28 ATTACK_MARKER 8 999 INT_BLAST INT_BLAST INT_BLAST ATTACK_NORMAL 0 -1 -1 -1
      }
      ENDIF
    }
    EVERY 2048 480
    {
      IF ( INT_ATTR_EXPANSION < 182 )
      {
        INCREMENT INT_ATTR_EXPANSION 2
      }
      ENDIF
    }
    EVERY 2048 560
    {
      IF ( $25 < 5 )
      {
        IF ( INT_MY_MANA > INT_M_SPELL_LIGHTNING_COST )
        {
          SET INT_ATTR_AWAY_SHAMAN                1
          DO STATE_SHAMAN_GET_WILDS               OFF
          SET INT_ATTR_AWAY_BRAVE                 0
          SET INT_ATTR_AWAY_WARRIOR               0
          SET INT_ATTR_AWAY_RELIGIOUS             0
          SET INT_ATTR_AWAY_SPY                   0
          SET INT_ATTR_AWAY_FIREWARRIOR           0
          DO ATTACK BLUE 7 ATTACK_PERSON INT_TARGET_SHAMAN 10 INT_LIGHTNING INT_FIRESTORM INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 -1 -1
          INCREMENT $25 1
          SET INT_ATTR_AWAY_BRAVE                 10
          SET INT_ATTR_AWAY_WARRIOR               25
          SET INT_ATTR_AWAY_RELIGIOUS             15
          SET INT_ATTR_AWAY_SPY                   25
          SET INT_ATTR_AWAY_FIREWARRIOR           25
          SET INT_ATTR_AWAY_SHAMAN                1
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 1024 640
    {
      DO COUNT_PEOPLE_IN_MARKER BLUE 19 7 $6
      IF ( $6 > 4 )
      {
        SET INT_ATTR_PREF_BALLOON_HUTS           1
        SET INT_ATTR_AWAY_BRAVE                  0
        SET INT_ATTR_AWAY_WARRIOR                0
        SET INT_ATTR_AWAY_RELIGIOUS              0
        SET INT_ATTR_AWAY_SPY                    0
        SET INT_ATTR_AWAY_FIREWARRIOR            100
        SET INT_ATTR_AWAY_SHAMAN                 1
        MULTIPLY $5 INT_M_VEHICLE_AIRSHIP 2
        DO ATTACK BLUE $5 ATTACK_MARKER 19 99 INT_FIRESTORM INT_LIGHTNING INT_LIGHTNING ATTACK_BY_BALLOON 1 -1 -1 -1
      }
      ENDIF
    }
    EVERY 1024 720
    {
      DO COUNT_PEOPLE_IN_MARKER BLUE 27 7 $10
      IF ( $10 > 4 )
      {
        SET INT_ATTR_PREF_BALLOON_HUTS           1
        SET INT_ATTR_AWAY_BRAVE                  0
        SET INT_ATTR_AWAY_WARRIOR                0
        SET INT_ATTR_AWAY_RELIGIOUS              0
        SET INT_ATTR_AWAY_SPY                    0
        SET INT_ATTR_AWAY_FIREWARRIOR            100
        SET INT_ATTR_AWAY_SHAMAN                 1
        MULTIPLY $9 INT_M_VEHICLE_AIRSHIP 2
        DO ATTACK BLUE $9 ATTACK_MARKER 27 99 INT_FIRESTORM INT_LIGHTNING INT_LIGHTNING ATTACK_BY_BALLOON 1 -1 -1 -1
      }
      ENDIF
    }
    EVERY 1024 800
    {
      DO COUNT_PEOPLE_IN_MARKER BLUE 20 7 $7
      IF ( $7 > 4 )
      {
        SET INT_ATTR_PREF_BALLOON_HUTS           1
        SET INT_ATTR_AWAY_BRAVE                  0
        SET INT_ATTR_AWAY_WARRIOR                0
        SET INT_ATTR_AWAY_RELIGIOUS              0
        SET INT_ATTR_AWAY_SPY                    0
        SET INT_ATTR_AWAY_FIREWARRIOR            100
        SET INT_ATTR_AWAY_SHAMAN                 1
        DO ATTACK BLUE $8 ATTACK_MARKER 20 99 INT_FIRESTORM INT_LIGHTNING INT_LIGHTNING ATTACK_BY_BALLOON 1 -1 -1 -1
      }
      ENDIF
    }
    EVERY 1024 880
    {
      DO COUNT_PEOPLE_IN_MARKER BLUE 26 7 $11
      IF ( $11 > 4 )
      {
        SET INT_ATTR_PREF_BALLOON_HUTS           1
        SET INT_ATTR_AWAY_BRAVE                  0
        SET INT_ATTR_AWAY_WARRIOR                0
        SET INT_ATTR_AWAY_RELIGIOUS              0
        SET INT_ATTR_AWAY_SPY                    0
        SET INT_ATTR_AWAY_FIREWARRIOR            100
        SET INT_ATTR_AWAY_SHAMAN                 1
        DO ATTACK BLUE $12 ATTACK_MARKER 26 99 INT_FIRESTORM INT_LIGHTNING INT_LIGHTNING ATTACK_BY_BALLOON 1 -1 -1 -1
      }
      ENDIF
    }
    EVERY 128 120
    {
      IF ( INT_B_BUILDING_TEMPLE > 0 )
      {
        SET INT_ATTR_PREF_RELIGIOUS_TRAINS       1
      }
      ENDIF
    }
    EVERY 64 55
    {
      IF ( INT_MY_NUM_PEOPLE < 8 && INT_MY_NUM_KILLED_BY_BLUE > 5 )
      {
        DO GIVE_UP_AND_SULK                      ON
      }
      ENDIF
    }
  }
  ENDIF
}
SCRIPT_END
