{
  IF ( INT_GAME_TURN == 0 )
  {
    SET $0                                     0
    DO SET_ATTACK_VARIABLE                     $0
    DO STATE_CONSTRUCT_BUILDING                ON
    DO STATE_FETCH_WOOD                        ON
    SET INT_ATTR_ATTACK_PERCENTAGE             150
    DO SET_DRUM_TOWER_POS                      208 130
    SET INT_ATTR_PREF_SPY_TRAINS               0
    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             1
    SET INT_ATTR_MAX_BUILDINGS_ON_GO           3
    SET INT_ATTR_HOUSE_PERCENTAGE              100
    DO STATE_SHAMAN_GET_WILDS                  ON
    SET INT_ATTR_EXPANSION                     20
    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_FIREWARRIOR_DEFEND                ON
    DO STATE_DEFEND_BASE                       ON
    DO SET_DEFENCE_RADIUS                      9
    SET INT_ATTR_DEFENSE_RAD_INCR              0
    SET INT_ATTR_MAX_DEFENSIVE_ACTIONS         2
    SET INT_ATTR_USE_PREACHER_FOR_DEFENCE      1
    DO STATE_PREACH                            ON
    SET INT_ATTR_SHAMEN_BLAST                  64
    DO STATE_SPELL_DEFENCE                     208 130 ON
    DO SET_SPELL_ENTRY 0 INT_LIGHTNING 500000 128 3 0
    DO SET_SPELL_ENTRY 1 INT_TORNADO 100000 256 6 0
    SET INT_ATTR_SPY_CHECK_FREQUENCY           128
    SET INT_ATTR_SPY_DISCOVER_CHANCE           15
    SET INT_ATTR_ENEMY_SPY_MAX_STAND           128
    SET INT_ATTR_RETREAT_VALUE                 5
    SET INT_ATTR_RANDOM_BUILD_SIDE             0
    DO STATE_BUILD_VEHICLE                     ON
    DO STATE_FETCH_LOST_PEOPLE                 ON
    DO STATE_FETCH_LOST_VEHICLE                OFF
    DO STATE_FETCH_FAR_VEHICLE                 ON
    SET INT_ATTR_PEOPLE_PER_BALLOON            8
    SET INT_ATTR_PREF_BALLOON_DRIVERS          5
    DO STATE_TRAIN_PEOPLE                      ON
    SET INT_ATTR_PREF_SPY_PEOPLE               0
    SET INT_ATTR_PREF_RELIGIOUS_PEOPLE         20
    SET INT_ATTR_PREF_WARRIOR_PEOPLE           25
    SET INT_ATTR_PREF_FIREWARRIOR_PEOPLE       30
    DO SET_MARKER_ENTRY                        1 1 2 0 2 2 1
    DO SET_MARKER_ENTRY                        2 2 3 0 2 2 1
    DO SET_MARKER_ENTRY                        3 4 5 0 2 0 1
    DO SET_MARKER_ENTRY                        4 6 7 0 3 1 2
    DO SET_MARKER_ENTRY                        5 7 8 0 2 1 1
    DO SET_MARKER_ENTRY                        6 9 10 0 2 1 2
    DO SET_MARKER_ENTRY                        7 11 12 0 2 0 1
    DO SET_MARKER_ENTRY                        8 33 34 0 2 1 1
    SET INT_ATTR_MAX_TRAIN_AT_ONCE             5
    SET INT_ATTR_GROUP_OPTION                  0
    DO STATE_AUTO_ATTACK                       ON
    SET INT_ATTR_COUNT_PREACH_DAMAGE           1
    SET INT_ATTR_MAX_ATTACKS                   3
    SET INT_ATTR_AWAY_BRAVE                    0
    SET INT_ATTR_AWAY_WARRIOR                  40
    SET INT_ATTR_AWAY_RELIGIOUS                30
    SET INT_ATTR_AWAY_SPY                      0
    SET INT_ATTR_AWAY_FIREWARRIOR              30
    SET INT_ATTR_AWAY_SHAMAN                   100
    SET INT_ATTR_BASE_UNDER_ATTACK_RETREAT     0
    SET $1                                     0
    SET $2                                     0
    SET $3                                     0
    SET $4                                     0
    SET $5                                     20
    SET $6                                     0
    SET $7                                     0
    SET $8                                     0
    SET $9                                     1
    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                                    1
    SET $26                                    0
    SET $27                                    0
    SET $28                                    0
    DO GIVE_MANA_TO_PLAYER RED 300000
    SET INT_ATTR_FIGHT_STOP_DISTANCE           24
    DO GET_HEIGHT_AT_POS                       17 $13
    DO GET_HEIGHT_AT_POS                       45 $15
    DO GET_HEIGHT_AT_POS                       94 $17
    DO CREATE_MSG_NARRATIVE                    8
    DO SET_MSG_AUTO_OPEN_DLG
  }
  ELSE
  {
    EVERY 64
    {
      IF ( INT_MY_NUM_PEOPLE < 8 && INT_MY_NUM_KILLED_BY_HUMAN > 10 )
      {
        IF ( INT_M_BUILDING_MEDIUM_HUT < 1 && INT_M_BUILDING_LARGE_HUT < 1 )
        {
          IF ( INT_M_BUILDING_SMALL_HUT < 1 )
          {
            DO GIVE_UP_AND_SULK                    ON
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 256 133
    {
      IF ( $1 > 0 && INT_MY_NUM_PEOPLE > 55 )
      {
        DO GIVE_MANA_TO_PLAYER RED 16500
      }
      ENDIF
      IF ( INT_MY_NUM_PEOPLE < 73 )
      {
        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 256
    {
      IF ( INT_MY_NUM_PEOPLE > 29 )
      {
        DO STATE_SHAMAN_GET_WILDS                OFF
      }
      ELSE
      {
        IF ( INT_MY_NUM_PEOPLE < 20 )
        {
          DO STATE_SHAMAN_GET_WILDS               ON
        }
        ENDIF
      }
      ENDIF
      IF ( INT_ATTR_EXPANSION < 40 )
      {
        INCREMENT INT_ATTR_EXPANSION 1
      }
      ENDIF
      IF ( INT_M_PERSON_WARRIOR > 5 && $9 == 1 )
      {
        DO GET_HEAD_TRIGGER_COUNT 98 76 $9
        IF ( $9 == 1 )
        {
          DO MARKER_ENTRIES                       8 -1 -1 -1
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 256 128
    {
      IF ( INT_M_PERSON_FIREWARRIOR > 1 )
      {
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 162 156
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 178 166
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 200 160
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 218 158
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 226 136
      }
      ENDIF
      IF ( INT_M_PERSON_FIREWARRIOR > 3 )
      {
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 236 116
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 206 110
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 184 110
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 174 124
        DO PUT_PERSON_IN_DT INT_RELIGIOUS 98 104
      }
      ENDIF
      IF ( INT_M_PERSON_WARRIOR > 3 )
      {
        DO MARKER_ENTRIES                        1 2 3 4
      }
      ENDIF
      IF ( INT_M_PERSON_RELIGIOUS > 2 )
      {
        DO MARKER_ENTRIES                        5 6 7 -1
      }
      ENDIF
      IF ( INT_MY_NUM_PEOPLE < 15 && INT_GAME_TURN > 3000 )
      {
        DO DEFEND_SHAMEN                         INT_MY_NUM_PEOPLE
        SET $4                                   1
      }
      ELSE
      {
        IF ( $4 == 1 )
        {
          DO SEND_SHAMEN_DEFENDERS_HOME
          SET $4                                  0
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 128 32
    {
      IF ( $8 < 14 )
      {
        INCREMENT $8 1
      }
      ELSE
      {
        SET $8                                   0
        DO TRIGGER_THING                         18
      }
      ENDIF
    }
    EVERY 32
    {
      IF ( $22 == 0 && INT_GAME_TURN > 100 )
      {
        DO GET_HEIGHT_AT_POS                     17 $14
        DO GET_HEAD_TRIGGER_COUNT 40 130 $25
        IF ( $25 == 0 && $28 == 0 )
        {
          DO CREATE_MSG_INFORMATION_ZOOM          10 34 126 15448
          DO SET_MSG_DELETE_ON_OK
          DO SET_MSG_TIMEOUT                      256
          SET $28                                 1
        }
        ENDIF
        IF ( $14 != $13 && $25 == 1 )
        {
          IF ( $28 == 0 )
          {
            DO REMOVE_HEAD_AT_POS                  40 130
            SET $28                                1
          }
          ENDIF
        }
        ENDIF
        IF ( $14 == $13 && $25 == 1 )
        {
          IF ( $19 == 0 )
          {
            DO TRIGGER_THING                       91
            DO TRIGGER_THING                       92
            DO TRIGGER_THING                       93
            SET $19                                1
          }
          ENDIF
          IF ( INT_GAME_TURN > 1950 )
          {
            DO TRIGGER_THING                       17
            SET $22                                1
            DO REMOVE_HEAD_AT_POS                  40 130
            DO CREATE_MSG_INFORMATION_ZOOM         126 34 126 16018
            DO SET_MSG_DELETE_ON_OK
            DO SET_MSG_TIMEOUT                     256
          }
          ENDIF
        }
        ELSE
        {
          SET $22                                 2
          DO DELETE_SMOKE_STUFF                   36 126 5
        }
        ENDIF
      }
      ELSE
      {
        IF ( $22 == 1 )
        {
          SET $22                                 2
          DO DELETE_SMOKE_STUFF                   36 126 5
        }
        ENDIF
      }
      ENDIF
      IF ( $23 == 0 && INT_GAME_TURN > 2250 )
      {
        DO GET_HEIGHT_AT_POS                     45 $16
        IF ( $16 == $15 )
        {
          IF ( $20 == 0 )
          {
            DO TRIGGER_THING                       46
            DO TRIGGER_THING                       47
            DO TRIGGER_THING                       48
            SET $20                                1
          }
          ENDIF
          IF ( INT_GAME_TURN > 3700 )
          {
            DO TRIGGER_THING                       45
            SET $23                                1
            DO CREATE_MSG_INFORMATION_ZOOM         126 58 192 16668
            DO SET_MSG_DELETE_ON_OK
            DO SET_MSG_TIMEOUT                     256
          }
          ENDIF
        }
        ELSE
        {
          SET $23                                 2
          DO DELETE_SMOKE_STUFF                   58 190 5
        }
        ENDIF
      }
      ELSE
      {
        IF ( $23 == 1 )
        {
          SET $23                                 2
          DO DELETE_SMOKE_STUFF                   58 190 5
        }
        ENDIF
      }
      ENDIF
      IF ( $24 == 0 && INT_GAME_TURN > 7500 )
      {
        DO GET_HEIGHT_AT_POS                     94 $18
        IF ( $18 == $17 )
        {
          IF ( $21 == 0 )
          {
            DO TRIGGER_THING                       95
            SET $21                                1
          }
          ENDIF
          IF ( INT_GAME_TURN > 8100 )
          {
            DO TRIGGER_THING                       94
            SET $24                                1
            DO CREATE_MSG_INFORMATION_ZOOM         126 90 194 16668
            DO SET_MSG_DELETE_ON_OK
            DO SET_MSG_TIMEOUT                     256
          }
          ENDIF
        }
        ELSE
        {
          SET $24                                 2
          DO DELETE_SMOKE_STUFF                   92 194 5
        }
        ENDIF
      }
      ELSE
      {
        IF ( $24 == 1 )
        {
          SET $24                                 2
          DO DELETE_SMOKE_STUFF                   92 194 5
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 64
    {
      IF ( $9 == 0 && $12 == 0 )
      {
        DO TRIGGER_THING                         35
        SET $12                                  1
        DO CREATE_MSG_INFORMATION_ZOOM           126 92 64 15298
        DO SET_MSG_DELETE_ON_OK
        DO SET_MSG_TIMEOUT                       256
      }
      ENDIF
    }
    EVERY 128
    {
      IF ( $5 < 32 )
      {
        INCREMENT $5 1
      }
      ELSE
      {
        SET $5                                   20
      }
      ENDIF
      DO TRIGGER_THING                          $5
      IF ( INT_GAME_TURN > 4096 && $6 == 0 )
      {
        SET $6                                   1
        DO TRIGGER_THING                         16
        DO CREATE_MSG_INFORMATION_ZOOM           126 144 64 10628
        DO SET_MSG_DELETE_ON_OK
        DO SET_MSG_TIMEOUT                       256
      }
      ENDIF
    }
    EVERY 2048 64
    {
      IF ( $1 == 3 && INT_CP_FREE_ENTRIES > 1 )
      {
        IF ( INT_M_PERSON_FIREWARRIOR > 5 && INT_MY_MANA > INT_M_SPELL_VOLCANO_COST )
        {
          IF ( INT_M_VEHICLE_AIRSHIP > 0 )
          {
            DO GIVE_ONE_SHOT INT_LIGHTNING RED
            DO GIVE_ONE_SHOT INT_TORNADO RED
            SET INT_ATTR_AWAY_WARRIOR              0
            SET INT_ATTR_AWAY_RELIGIOUS            0
            SET INT_ATTR_AWAY_SPY                  0
            SET INT_ATTR_AWAY_FIREWARRIOR          100
            DO ATTACK BLUE 1 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 993 INT_TORNADO INT_LIGHTNING INT_VOLCANO ATTACK_BY_BALLOON 0 -1 -1 -1
            SET INT_ATTR_AWAY_WARRIOR              40
            SET INT_ATTR_AWAY_RELIGIOUS            30
            SET INT_ATTR_AWAY_SPY                  0
            SET INT_ATTR_AWAY_FIREWARRIOR          30
          }
          ENDIF
        }
        ENDIF
        IF ( INT_M_PERSON_RELIGIOUS > 5 && INT_M_PERSON_WARRIOR > 5 )
        {
          IF ( INT_M_PERSON_FIREWARRIOR > 6 )
          {
            DO COUNT_PEOPLE_IN_MARKER BLUE 13 2 $11
            IF ( $11 > 0 )
            {
              SET $10                               13
            }
            ELSE
            {
              SET $10                               14
            }
            ENDIF
            SET INT_ATTR_AWAY_SHAMAN               0
            SET INT_ATTR_DONT_USE_BOATS            1
            DO ATTACK BLUE 10 ATTACK_PERSON INT_SHAMAN 993 INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 $10 -1 -1
            SET INT_ATTR_AWAY_SHAMAN               100
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      IF ( $1 == 2 && INT_CP_FREE_ENTRIES > 1 )
      {
        SET $3                                   INT_M_SPELL_VOLCANO_COST
        INCREMENT $3 INT_M_SPELL_SHIELD_COST
        INCREMENT $3 INT_M_SPELL_SHIELD_COST
        IF ( INT_MY_MANA > INT_M_SPELL_VOLCANO_COST && INT_MY_NUM_PEOPLE > 30 )
        {
          IF ( INT_M_PERSON_FIREWARRIOR > 5 && INT_M_VEHICLE_AIRSHIP > 4 )
          {
            SET INT_ATTR_AWAY_WARRIOR              0
            SET INT_ATTR_AWAY_RELIGIOUS            0
            SET INT_ATTR_AWAY_SPY                  0
            SET INT_ATTR_AWAY_FIREWARRIOR          100
            DO ATTACK BLUE 9 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 992 INT_SHIELD INT_SHIELD INT_VOLCANO ATTACK_BY_BALLOON 0 -1 -1 -1
            SET INT_ATTR_AWAY_WARRIOR              40
            SET INT_ATTR_AWAY_RELIGIOUS            30
            SET INT_ATTR_AWAY_SPY                  0
            SET INT_ATTR_AWAY_FIREWARRIOR          30
            SET $1                                 3
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      IF ( $1 == 1 && INT_CP_FREE_ENTRIES > 1 )
      {
        SET $2                                   INT_M_SPELL_VOLCANO_COST
        INCREMENT $2 INT_M_SPELL_SWARM_COST
        INCREMENT $2 INT_M_SPELL_SWARM_COST
        IF ( INT_MY_MANA > $2 && INT_M_PERSON_WARRIOR > 5 )
        {
          IF ( INT_M_PERSON_RELIGIOUS > 4 && INT_M_PERSON_FIREWARRIOR > 5 )
          {
            SET INT_ATTR_DONT_USE_BOATS            1
            DO ATTACK BLUE 10 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 991 INT_SWARM INT_SWARM INT_VOLCANO ATTACK_NORMAL 0 14 -1 -1
            SET $1                                 2
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      IF ( $1 == 0 && INT_CP_FREE_ENTRIES > 1 )
      {
        IF ( INT_MY_MANA > 500000 && INT_M_PERSON_RELIGIOUS > 5 )
        {
          IF ( INT_M_PERSON_WARRIOR > 6 && INT_GAME_TURN > 4000 )
          {
            SET INT_ATTR_AWAY_WARRIOR              50
            SET INT_ATTR_AWAY_RELIGIOUS            50
            SET INT_ATTR_AWAY_SPY                  0
            SET INT_ATTR_AWAY_FIREWARRIOR          0
            SET INT_ATTR_DONT_USE_BOATS            1
            DO ATTACK BLUE 12 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 990 INT_SHIELD INT_SHIELD INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 14 -1 -1
            SET INT_ATTR_AWAY_WARRIOR              40
            SET INT_ATTR_AWAY_RELIGIOUS            30
            SET INT_ATTR_AWAY_SPY                  0
            SET INT_ATTR_AWAY_FIREWARRIOR          30
            SET $1                                 1
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
  }
  ENDIF
}
SCRIPT_END
