{
  IF ( INT_GAME_TURN == 0 )
  {
    SET $0                                     0
    DO SET_ATTACK_VARIABLE                     $0
    DO STATE_STATE_BRING_NEW_PEOPLE_BACK       ON
    DO STATE_SHAMAN_GET_WILDS                  ON
    DO STATE_CONSTRUCT_BUILDING                ON
    DO SET_DRUM_TOWER_POS                      140 222
    SET INT_ATTR_PREF_SPY_TRAINS               1
    SET INT_ATTR_PREF_WARRIOR_TRAINS           1
    SET INT_ATTR_PREF_FIREWARRIOR_TRAINS       1
    SET INT_ATTR_PREF_RELIGIOUS_TRAINS         1
    SET INT_ATTR_PREF_BOAT_HUTS                1
    SET INT_ATTR_PREF_BALLOON_HUTS             0
    SET INT_ATTR_MAX_BUILDINGS_ON_GO           2
    SET INT_ATTR_HOUSE_PERCENTAGE              45
    SET INT_ATTR_EXPANSION                     10
    DO STATE_POPULATE_DRUM_TOWER               ON
    DO STATE_DEFEND                            ON
    DO STATE_DEFEND_BASE                       ON
    DO SET_DEFENCE_RADIUS                      7
    SET INT_ATTR_MAX_DEFENSIVE_ACTIONS         3
    SET INT_ATTR_ATTACK_PERCENTAGE             255
    SET INT_ATTR_USE_PREACHER_FOR_DEFENCE      1
    DO STATE_PREACH                            ON
    DO STATE_FIREWARRIOR_DEFEND                ON
    SET INT_ATTR_SPY_CHECK_FREQUENCY           128
    SET INT_ATTR_SPY_DISCOVER_CHANCE           35
    SET INT_ATTR_ENEMY_SPY_MAX_STAND           128
    SET INT_ATTR_MAX_TRAIN_AT_ONCE             4
    SET INT_ATTR_GROUP_OPTION                  0
    SET INT_ATTR_FIGHT_STOP_DISTANCE           0
    SET INT_ATTR_RETREAT_VALUE                 0
    SET INT_ATTR_BASE_UNDER_ATTACK_RETREAT     1
    SET INT_ATTR_RANDOM_BUILD_SIDE             0
    SET INT_ATTR_SHAMEN_BLAST                  128
    DO STATE_SPELL_DEFENCE                     140 222 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_LIGHTNING_COST 64 2 0
    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 STATE_TRAIN_PEOPLE                      ON
    SET INT_ATTR_PREF_WARRIOR_PEOPLE           20
    SET INT_ATTR_PREF_FIREWARRIOR_PEOPLE       20
    SET INT_ATTR_PREF_RELIGIOUS_PEOPLE         15
    SET INT_ATTR_PREF_SPY_PEOPLE               5
    DO STATE_HOUSE_A_PERSON                    ON
    DO STATE_AUTO_ATTACK                       ON
    SET INT_ATTR_MAX_ATTACKS                   2
    SET INT_ATTR_AWAY_BRAVE                    0
    SET INT_ATTR_AWAY_WARRIOR                  50
    SET INT_ATTR_AWAY_RELIGIOUS                25
    SET INT_ATTR_AWAY_SPY                      5
    SET INT_ATTR_AWAY_FIREWARRIOR              50
    SET INT_ATTR_AWAY_SHAMAN                   1
    DO STATE_FETCH_LOST_PEOPLE                 ON
    DO STATE_FETCH_LOST_VEHICLE                OFF
    DO STATE_FETCH_FAR_VEHICLE                 ON
    DO STATE_BUILD_VEHICLE                     ON
    SET INT_ATTR_PEOPLE_PER_BOAT               6
    SET INT_ATTR_PREF_BOAT_DRIVERS             15
    DO TARGET_FIREWARRIORS
    DO TARGET_BLUE_SHAMAN
    DO TARGET_BLUE_DRUM_TOWERS
    DO CREATE_MSG_NARRATIVE                    7
    DO SET_MSG_AUTO_OPEN_DLG
    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
    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
    SET $27                                    0
    SET $28                                    0
    SET $29                                    0
    SET $30                                    0
    SET $22                                    INT_EARTHQUAKE
  }
  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 512
    {
      IF ( INT_CP_FREE_ENTRIES > 2 )
      {
        IF ( INT_M_PERSON_FIREWARRIOR > 19 && INT_M_VEHICLE_BOAT > 0 )
        {
          IF ( INT_M_VEHICLE_BOAT < 3 )
          {
            DO VEHICLE_PATROL 5 8 9 10 11 BOAT_TYPE
          }
          ELSE
          {
            DO VEHICLE_PATROL 5 0 1 2 3 BOAT_TYPE
            DO VEHICLE_PATROL 5 4 5 6 7 BOAT_TYPE
            DO VEHICLE_PATROL 5 8 9 10 11 BOAT_TYPE
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 128 57
    {
      DO GET_HEAD_TRIGGER_COUNT 234 168 $1
      IF ( $1 > 0 )
      {
        DO COUNT_PEOPLE_IN_MARKER BLUE 12 2 $5
        IF ( $5 > 0 && INT_M_VEHICLE_BOAT > 3 )
        {
          DO PRAY_AT_HEAD                         5 12
        }
        ENDIF
      }
      ELSE
      {
        DO GET_HEAD_TRIGGER_COUNT 60 60 $2
        IF ( $2 > 0 )
        {
          DO COUNT_PEOPLE_IN_MARKER BLUE 13 2 $6
          IF ( $6 > 0 && INT_M_VEHICLE_BOAT > 4 )
          {
            DO PRAY_AT_HEAD                        6 13
          }
          ENDIF
        }
        ELSE
        {
          DO GET_HEAD_TRIGGER_COUNT 218 60 $3
          IF ( $3 > 0 )
          {
            DO COUNT_PEOPLE_IN_MARKER BLUE 14 2 $7
            IF ( $7 > 0 && INT_M_VEHICLE_BOAT > 5 )
            {
              DO PRAY_AT_HEAD                       7 14
              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 4 ATTACK_MARKER 14 20 INT_LIGHTNING INT_BLAST INT_NO_SPECIFIC_SPELL ATTACK_BY_BOAT 1 21 -1 -1
              SET INT_ATTR_AWAY_BRAVE               0
              SET INT_ATTR_AWAY_WARRIOR             50
              SET INT_ATTR_AWAY_RELIGIOUS           25
              SET INT_ATTR_AWAY_SPY                 5
              SET INT_ATTR_AWAY_FIREWARRIOR         50
              SET INT_ATTR_AWAY_SHAMAN              1
            }
            ENDIF
          }
          ELSE
          {
            DO GET_HEAD_TRIGGER_COUNT 6 100 $4
            IF ( $4 > 0 )
            {
              DO COUNT_PEOPLE_IN_MARKER BLUE 15 2 $8
              IF ( $8 > 0 && INT_M_VEHICLE_BOAT > 6 )
              {
                DO PRAY_AT_HEAD                      8 15
                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 15 20 INT_LIGHTNING INT_LIGHTNING INT_NO_SPECIFIC_SPELL ATTACK_BY_BOAT 1 21 -1 -1
                SET INT_ATTR_AWAY_BRAVE              0
                SET INT_ATTR_AWAY_WARRIOR            50
                SET INT_ATTR_AWAY_RELIGIOUS          25
                SET INT_ATTR_AWAY_SPY                5
                SET INT_ATTR_AWAY_FIREWARRIOR        50
                SET INT_ATTR_AWAY_SHAMAN             1
              }
              ENDIF
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 256 113
    {
      IF ( INT_MY_MANA > INT_M_SPELL_EROSION_COST )
      {
        DO GET_SPELLS_CAST BLUE INT_LAND_BRIDGE $9
        DO GET_SPELLS_CAST BLUE INT_FLATTEN $10
        SET $11                                  $9
        INCREMENT $11 $10
        IF ( $11 > 0 )
        {
          DO GET_HEIGHT_AT_POS                    4 $12
          IF ( $12 > 0 )
          {
            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
            SET INT_ATTR_AWAY_SHAMAN               1
            DO ATTACK BLUE 1 ATTACK_MARKER 4 10 INT_EROSION INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 4 -1
            SET INT_ATTR_AWAY_BRAVE                0
            SET INT_ATTR_AWAY_WARRIOR              50
            SET INT_ATTR_AWAY_RELIGIOUS            25
            SET INT_ATTR_AWAY_SPY                  5
            SET INT_ATTR_AWAY_FIREWARRIOR          50
            SET INT_ATTR_AWAY_SHAMAN               1
          }
          ELSE
          {
            DO GET_HEIGHT_AT_POS                   16 $13
            IF ( $13 > 0 )
            {
              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
              SET INT_ATTR_AWAY_SHAMAN              1
              DO ATTACK BLUE 1 ATTACK_MARKER 16 10 INT_EROSION INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 16 -1
              SET INT_ATTR_AWAY_BRAVE               0
              SET INT_ATTR_AWAY_WARRIOR             50
              SET INT_ATTR_AWAY_RELIGIOUS           25
              SET INT_ATTR_AWAY_SPY                 5
              SET INT_ATTR_AWAY_FIREWARRIOR         50
              SET INT_ATTR_AWAY_SHAMAN              1
            }
            ELSE
            {
              DO GET_HEIGHT_AT_POS                  17 $14
              IF ( $14 > 0 )
              {
                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
                SET INT_ATTR_AWAY_SHAMAN             1
                DO ATTACK BLUE 1 ATTACK_MARKER 17 10 INT_EROSION INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 17 -1
                SET INT_ATTR_AWAY_BRAVE              0
                SET INT_ATTR_AWAY_WARRIOR            50
                SET INT_ATTR_AWAY_RELIGIOUS          25
                SET INT_ATTR_AWAY_SPY                5
                SET INT_ATTR_AWAY_FIREWARRIOR        50
                SET INT_ATTR_AWAY_SHAMAN             1
              }
              ELSE
              {
                DO GET_HEIGHT_AT_POS                 18 $15
                IF ( $15 > 0 )
                {
                  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
                  SET INT_ATTR_AWAY_SHAMAN            1
                  DO ATTACK BLUE 1 ATTACK_MARKER 18 10 INT_EROSION INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 18 -1
                  SET INT_ATTR_AWAY_BRAVE             0
                  SET INT_ATTR_AWAY_WARRIOR           50
                  SET INT_ATTR_AWAY_RELIGIOUS         25
                  SET INT_ATTR_AWAY_SPY               5
                  SET INT_ATTR_AWAY_FIREWARRIOR       50
                  SET INT_ATTR_AWAY_SHAMAN            1
                }
                ELSE
                {
                  DO GET_HEIGHT_AT_POS                19 $16
                  IF ( $16 > 0 )
                  {
                    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
                    SET INT_ATTR_AWAY_SHAMAN           1
                    DO ATTACK BLUE 1 ATTACK_MARKER 19 10 INT_EROSION INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 19 -1
                    SET INT_ATTR_AWAY_BRAVE            0
                    SET INT_ATTR_AWAY_WARRIOR          50
                    SET INT_ATTR_AWAY_RELIGIOUS        25
                    SET INT_ATTR_AWAY_SPY              5
                    SET INT_ATTR_AWAY_FIREWARRIOR      50
                    SET INT_ATTR_AWAY_SHAMAN           1
                  }
                  ELSE
                  {
                    DO GET_HEIGHT_AT_POS               20 $17
                    IF ( $17 > 0 )
                    {
                      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
                      SET INT_ATTR_AWAY_SHAMAN          1
                      DO ATTACK BLUE 1 ATTACK_MARKER 20 10 INT_EROSION INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 20 -1
                      SET INT_ATTR_AWAY_BRAVE           0
                      SET INT_ATTR_AWAY_WARRIOR         50
                      SET INT_ATTR_AWAY_RELIGIOUS       25
                      SET INT_ATTR_AWAY_SPY             5
                      SET INT_ATTR_AWAY_FIREWARRIOR     50
                      SET INT_ATTR_AWAY_SHAMAN          1
                    }
                    ENDIF
                  }
                  ENDIF
                }
                ENDIF
              }
              ENDIF
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 512 300
    {
      SET $20                                   INT_M_VEHICLE_BOAT
      DECREMENT $20 2
      MULTIPLY $21 $20 5
      IF ( INT_MY_MANA > INT_M_SPELL_ANGEL_OF_DEATH_COST )
      {
        SET $31                                  INT_ANGEL_OF_DEATH
      }
      ELSE
      {
        IF ( INT_MY_MANA > INT_M_SPELL_EROSION_COST )
        {
          SET $31                                 INT_EROSION
        }
        ELSE
        {
          IF ( INT_MY_MANA > INT_M_SPELL_EARTHQUAKE_COST )
          {
            SET $31                                INT_EARTHQUAKE
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 512 333
    {
      IF ( $18 == 0 )
      {
        IF ( INT_BLUE_PEOPLE > 15 && INT_M_VEHICLE_BOAT > 2 )
        {
          DO ATTACK BLUE 10 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 50 INT_TORNADO INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_BY_BOAT 1 21 -1 -1
          DO TRAIN_PEOPLE_NOW 5 INT_SPY
          SET $18                                 1
        }
        ENDIF
      }
      ELSE
      {
        IF ( $18 == 1 )
        {
          IF ( $0 != 0 )
          {
            IF ( $0 > 50 )
            {
              SET $18                               2
            }
            ELSE
            {
              SET $18                               0
            }
            ENDIF
            SET $0                                 0
          }
          ENDIF
        }
        ELSE
        {
          IF ( $18 == 2 )
          {
            IF ( INT_M_VEHICLE_BOAT > 3 && INT_M_PERSON_SPY > 3 )
            {
              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              1
              DO ATTACK BLUE 4 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 50 INT_INVISIBILITY INT_SWARM INT_SWARM ATTACK_BY_BOAT 0 21 -1 -1
              SET INT_ATTR_AWAY_BRAVE               0
              SET INT_ATTR_AWAY_WARRIOR             50
              SET INT_ATTR_AWAY_RELIGIOUS           25
              SET INT_ATTR_AWAY_SPY                 5
              SET INT_ATTR_AWAY_FIREWARRIOR         50
              SET INT_ATTR_AWAY_SHAMAN              1
              SET $18                               3
            }
            ENDIF
          }
          ELSE
          {
            IF ( $18 == 3 )
            {
              IF ( $0 != 0 )
              {
                IF ( $0 > 50 )
                {
                  SET $18                             4
                }
                ELSE
                {
                  SET $18                             2
                }
                ENDIF
                SET $0                               0
              }
              ENDIF
            }
            ELSE
            {
              IF ( $18 == 4 )
              {
                IF ( INT_M_VEHICLE_BOAT > 4 && INT_MY_MANA > INT_M_SPELL_SHIELD_COST )
                {
                  SET INT_ATTR_AWAY_BRAVE             0
                  SET INT_ATTR_AWAY_WARRIOR           60
                  SET INT_ATTR_AWAY_RELIGIOUS         35
                  SET INT_ATTR_AWAY_SPY               5
                  SET INT_ATTR_AWAY_FIREWARRIOR       0
                  SET INT_ATTR_AWAY_SHAMAN            0
                  DO ATTACK BLUE 8 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 50 INT_SHIELD INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_BY_BOAT 1 21 -1 -1
                  SET INT_ATTR_AWAY_BRAVE             0
                  SET INT_ATTR_AWAY_WARRIOR           50
                  SET INT_ATTR_AWAY_RELIGIOUS         25
                  SET INT_ATTR_AWAY_SPY               5
                  SET INT_ATTR_AWAY_FIREWARRIOR       50
                  SET INT_ATTR_AWAY_SHAMAN            1
                  SET $18                             5
                }
                ENDIF
              }
              ELSE
              {
                IF ( $18 == 5 )
                {
                  IF ( $0 != 0 )
                  {
                    IF ( $0 > 50 )
                    {
                      SET $18                           6
                    }
                    ELSE
                    {
                      SET $18                           4
                    }
                    ENDIF
                    SET $0                             0
                  }
                  ENDIF
                }
                ELSE
                {
                  IF ( $18 == 6 )
                  {
                    IF ( INT_M_VEHICLE_BOAT > 3 && INT_MY_MANA > INT_M_SPELL_EROSION_COST )
                    {
                      SET INT_ATTR_AWAY_BRAVE           0
                      SET INT_ATTR_AWAY_WARRIOR         50
                      SET INT_ATTR_AWAY_RELIGIOUS       30
                      SET INT_ATTR_AWAY_SPY             0
                      SET INT_ATTR_AWAY_FIREWARRIOR     20
                      SET INT_ATTR_AWAY_SHAMAN          1
                      DO ATTACK BLUE 8 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 50 $31 INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_BY_BOAT 1 21 -1 -1
                      SET INT_ATTR_AWAY_BRAVE           0
                      SET INT_ATTR_AWAY_WARRIOR         50
                      SET INT_ATTR_AWAY_RELIGIOUS       25
                      SET INT_ATTR_AWAY_SPY             5
                      SET INT_ATTR_AWAY_FIREWARRIOR     50
                      SET INT_ATTR_AWAY_SHAMAN          1
                      SET $18                           7
                    }
                    ENDIF
                  }
                  ELSE
                  {
                    IF ( $18 == 7 )
                    {
                      IF ( $0 != 0 )
                      {
                        IF ( $0 > 50 )
                        {
                          SET $18                         8
                        }
                        ELSE
                        {
                          SET $18                         6
                        }
                        ENDIF
                        SET $0                           0
                      }
                      ENDIF
                    }
                    ELSE
                    {
                      IF ( $18 > 8 )
                      {
                        IF ( INT_MY_MANA > $22 )
                        {
                          SET INT_ATTR_AWAY_SHAMAN        1
                          DO ATTACK BLUE $21 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 45 $22 INT_TORNADO INT_LIGHTNING ATTACK_BY_BOAT 0 21 -1 -1
                          INCREMENT $18 1
                        }
                        ENDIF
                      }
                      ENDIF
                    }
                    ENDIF
                  }
                  ENDIF
                }
                ENDIF
              }
              ENDIF
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 1024 3
    {
      DO COUNT_PEOPLE_IN_MARKER BLUE 24 8 $23
      IF ( $23 > 6 )
      {
        SET $27                                  INT_M_VEHICLE_BOAT
        IF ( $27 > 4 )
        {
          IF ( $29 < 16 )
          {
            DECREMENT $27 4
            MULTIPLY $28 $27 4
            SET INT_ATTR_AWAY_SHAMAN               1
            DO ATTACK BLUE $28 ATTACK_MARKER 24 45 $22 INT_TORNADO INT_LIGHTNING ATTACK_BY_BOAT 0 21 -1 -1
            INCREMENT $29 1
          }
          ENDIF
        }
        ENDIF
      }
      ELSE
      {
        DO COUNT_PEOPLE_IN_MARKER BLUE 25 8 $24
        IF ( $24 > 6 )
        {
          SET $27                                 INT_M_VEHICLE_BOAT
          IF ( $27 > 4 )
          {
            IF ( $29 < 16 )
            {
              DECREMENT $27 4
              MULTIPLY $28 $27 4
              SET INT_ATTR_AWAY_SHAMAN              1
              DO ATTACK BLUE $28 ATTACK_MARKER 25 45 $22 INT_TORNADO INT_LIGHTNING ATTACK_BY_BOAT 0 21 -1 -1
              INCREMENT $29 1
            }
            ENDIF
          }
          ENDIF
        }
        ELSE
        {
          DO COUNT_PEOPLE_IN_MARKER BLUE 26 8 $25
          IF ( $25 > 6 )
          {
            SET $27                                INT_M_VEHICLE_BOAT
            IF ( $27 > 4 )
            {
              IF ( $29 < 16 )
              {
                DECREMENT $27 4
                MULTIPLY $28 $27 4
                SET INT_ATTR_AWAY_SHAMAN             1
                DO ATTACK BLUE $28 ATTACK_MARKER 26 45 $22 INT_TORNADO INT_LIGHTNING ATTACK_BY_BOAT 0 21 -1 -1
                INCREMENT $29 1
              }
              ENDIF
            }
            ENDIF
          }
          ELSE
          {
            DO COUNT_PEOPLE_IN_MARKER BLUE 27 8 $26
            IF ( $26 > 6 )
            {
              SET $27                               INT_M_VEHICLE_BOAT
              IF ( $27 > 4 )
              {
                IF ( $29 < 16 )
                {
                  DECREMENT $27 4
                  MULTIPLY $28 $27 4
                  SET INT_ATTR_AWAY_SHAMAN            1
                  DO ATTACK BLUE $28 ATTACK_MARKER 27 45 $22 INT_TORNADO INT_LIGHTNING ATTACK_BY_BOAT 0 21 -1 -1
                  INCREMENT $29 1
                }
                ENDIF
              }
              ENDIF
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 1024 3
    {
      IF ( $18 > 3 )
      {
        IF ( INT_MY_MANA > INT_M_SPELL_ANGEL_OF_DEATH_COST )
        {
          DO SPELL_ATTACK INT_ANGEL_OF_DEATH 40 0
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 64 55
    {
      SET $30                                   INT_M_BUILDING_MEDIUM_HUT
      INCREMENT $30 INT_M_BUILDING_SMALL_HUT
      INCREMENT $30 INT_M_BUILDING_LARGE_HUT
      IF ( INT_MY_NUM_PEOPLE < 8 && INT_MY_NUM_KILLED_BY_BLUE > 5 )
      {
        IF ( $30 == 0 )
        {
          DO GIVE_UP_AND_SULK                     ON
        }
        ENDIF
      }
      ENDIF
    }
  }
  ENDIF
}
SCRIPT_END
