{
  IF ( INT_GAME_TURN == 0 )
  {
    SET $0                                     0
    DO SET_ATTACK_VARIABLE                     $0
    DO SET_DRUM_TOWER_POS                      216 56
    DO STATE_CONSTRUCT_BUILDING                ON
    DO STATE_FETCH_WOOD                        ON
    SET INT_ATTR_ATTACK_PERCENTAGE             100
    SET INT_ATTR_PREF_SPY_TRAINS               0
    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           1
    SET INT_ATTR_HOUSE_PERCENTAGE              0
    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 SET_MARKER_ENTRY                        1 33 -1 0 2 0 0
    DO SET_MARKER_ENTRY                        2 33 -1 1 0 0 0
    DO STATE_DEFEND                            ON
    DO STATE_DEFEND_BASE                       ON
    SET INT_ATTR_DEFENSE_RAD_INCR              2
    SET INT_ATTR_MAX_DEFENSIVE_ACTIONS         1
    SET INT_ATTR_USE_PREACHER_FOR_DEFENCE      1
    DO STATE_PREACH                            ON
    SET INT_ATTR_SHAMEN_BLAST                  128
    DO STATE_SPELL_DEFENCE                     190 56 ON
    DO SET_SPELL_ENTRY 0 INT_LIGHTNING 500000 128 3 1
    SET INT_ATTR_SPY_CHECK_FREQUENCY           128
    SET INT_ATTR_RETREAT_VALUE                 20
    SET INT_ATTR_RANDOM_BUILD_SIDE             0
    DO STATE_TRAIN_PEOPLE                      ON
    SET INT_ATTR_PREF_SPY_PEOPLE               0
    SET INT_ATTR_PREF_RELIGIOUS_PEOPLE         10
    SET INT_ATTR_PREF_WARRIOR_PEOPLE           25
    SET INT_ATTR_PREF_FIREWARRIOR_PEOPLE       0
    SET INT_ATTR_MAX_TRAIN_AT_ONCE             1
    SET INT_ATTR_GROUP_OPTION                  0
    DO STATE_AUTO_ATTACK                       ON
    SET INT_ATTR_COUNT_PREACH_DAMAGE           1
    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_BASE_UNDER_ATTACK_RETREAT     1
    SET INT_ATTR_DONT_AUTO_TRAIN_PREACHERS     1
    SET $1                                     0
    SET $2                                     1
    SET $3                                     1
    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                                    3
    SET $31                                    0
    SET $32                                    3
    SET $33                                    0
    SET $34                                    0
    SET $35                                    1
    SET $36                                    1
    SET $37                                    3
    SET $38                                    0
    DO CREATE_MSG_NARRATIVE                    110
    DO SET_MSG_AUTO_OPEN_DLG
  }
  ELSE
  {
    EVERY 256 133
    {
      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 128
    {
      IF ( INT_MY_NUM_PEOPLE > 8 && INT_M_PERSON_WARRIOR < 3 )
      {
        DO GET_HEAD_TRIGGER_COUNT 244 52 $36
        IF ( $36 == 1 )
        {
          DO MARKER_ENTRIES                       2 -1 -1 -1
        }
        ENDIF
      }
      ELSE
      {
        IF ( INT_M_PERSON_WARRIOR > 2 && INT_MY_NUM_PEOPLE > 8 )
        {
          DO GET_HEAD_TRIGGER_COUNT 244 52 $36
          IF ( $36 == 1 )
          {
            DO MARKER_ENTRIES                      1 -1 -1 -1
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 512
    {
      IF ( INT_GAME_TURN > 50 && $26 == 0 )
      {
        SET $26                                  1
        DO SET_BUILDING_DIRECTION                4
      }
      ENDIF
      IF ( $13 == 1 && $12 == 0 )
      {
        DO GUARD_BETWEEN_MARKERS                 3 4 0 5 0 0 GUARD_NORMAL
        SET $12                                  1
      }
      ELSE
      {
        IF ( $13 == 1 && $12 == 1 )
        {
          DO GUARD_BETWEEN_MARKERS                5 6 0 5 0 0 GUARD_NORMAL
          SET $12                                 0
        }
        ENDIF
      }
      ENDIF
      IF ( $11 == 0 )
      {
        IF ( INT_M_PERSON_WARRIOR > 5 )
        {
          DO GUARD_BETWEEN_MARKERS                1 2 0 5 0 0 GUARD_NORMAL
          SET $11                                 1
        }
        ENDIF
      }
      ELSE
      {
        IF ( $11 == 1 )
        {
          DO COUNT_PEOPLE_IN_MARKER RED 1 5 $8
          DO COUNT_PEOPLE_IN_MARKER BLUE 1 5 $9
          IF ( $8 == 0 && $9 == 0 )
          {
            SET $11                                0
          }
          ELSE
          {
            SET $11                                2
          }
          ENDIF
        }
        ELSE
        {
          DO COUNT_PEOPLE_IN_MARKER RED 1 6 $14
          IF ( $14 < 2 )
          {
            SET $13                                1
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      DO COUNT_PEOPLE_IN_MARKER BLUE 15 12 $16
      DO COUNT_PEOPLE_IN_MARKER BLUE 16 12 $15
      SET $10                                   -1
      IF ( $15 > $16 )
      {
        SET $10                                  10
      }
      ELSE
      {
        IF ( $15 != 0 )
        {
          SET $10                                 14
        }
        ENDIF
      }
      ENDIF
      IF ( INT_M_PERSON_RELIGIOUS > 0 && $6 == 0 )
      {
        IF ( $13 == 0 )
        {
          DO PREACH_AT_MARKER                     7
        }
        ENDIF
        INCREMENT $6 1
      }
      ELSE
      {
        IF ( INT_M_PERSON_RELIGIOUS > 1 && $6 == 1 )
        {
          DO PREACH_AT_MARKER                     8
          INCREMENT $6 1
        }
        ELSE
        {
          IF ( INT_M_PERSON_RELIGIOUS > 2 && $6 == 2 )
          {
            DO PREACH_AT_MARKER                    9
            DO PREACH_AT_MARKER                    20
            SET $6                                 0
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      DO COUNT_PEOPLE_IN_MARKER BLUE 12 8 $7
      IF ( $7 > 4 && INT_MY_NUM_PEOPLE < 10 )
      {
        DO SEND_ALL_PEOPLE_TO_MARKER             12
      }
      ENDIF
      IF ( INT_M_BUILDING_WARRIOR_TRAIN > 0 )
      {
        SET INT_ATTR_HOUSE_PERCENTAGE            14
        SET INT_ATTR_PREF_RELIGIOUS_TRAINS       1
        SET INT_ATTR_MAX_BUILDINGS_ON_GO         2
      }
      ELSE
      {
      }
      ENDIF
      IF ( INT_ATTR_EXPANSION < 40 )
      {
        INCREMENT INT_ATTR_EXPANSION 1
      }
      ELSE
      {
      }
      ENDIF
    }
    EVERY 1024
    {
      IF ( INT_M_PERSON_WARRIOR > 2 && $33 == 0 )
      {
        SET $28                                  INT_B_BUILDING_SMALL_HUT
        INCREMENT $28 INT_B_BUILDING_MEDIUM_HUT
        INCREMENT $28 INT_B_BUILDING_LARGE_HUT
        INCREMENT $28 INT_B_BUILDING_WARRIOR_TRAIN
        INCREMENT $28 INT_B_BUILDING_TEMPLE
        IF ( $28 > 3 && INT_CP_FREE_ENTRIES > 1 )
        {
          IF ( INT_MY_MANA > INT_M_SPELL_LIGHTNING_COST )
          {
            DO ATTACK BLUE 3 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 12 INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 -1 -1
            SET $38                                1
            SET $33                                1
          }
          ENDIF
        }
        ELSE
        {
          IF ( INT_CP_FREE_ENTRIES > 1 && INT_GAME_TURN > 5000 )
          {
            IF ( INT_MY_MANA > INT_M_SPELL_LIGHTNING_COST )
            {
              SET INT_ATTR_AWAY_BRAVE               100
              SET INT_ATTR_AWAY_WARRIOR             0
              SET INT_ATTR_AWAY_RELIGIOUS           0
              DO ATTACK BLUE 3 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 12 INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 -1 -1
              SET INT_ATTR_AWAY_BRAVE               0
              SET INT_ATTR_AWAY_WARRIOR             100
              SET INT_ATTR_AWAY_RELIGIOUS           0
              SET $38                               1
              SET $33                               1
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ELSE
      {
        IF ( $33 == 1 && INT_MY_MANA > 100000 )
        {
          IF ( INT_BLUE_PEOPLE > 20 && INT_M_PERSON_RELIGIOUS > 0 )
          {
            IF ( INT_CP_FREE_ENTRIES > 1 && INT_M_PERSON_WARRIOR > 2 )
            {
              SET INT_ATTR_AWAY_RELIGIOUS           34
              DO ATTACK BLUE 3 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 20 INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 -1 -1
              SET $33                               2
            }
            ENDIF
          }
          ENDIF
        }
        ELSE
        {
          IF ( $33 == 2 && INT_M_PERSON_RELIGIOUS > 2 )
          {
            IF ( INT_BLUE_PEOPLE > 28 && INT_MY_MANA > INT_M_SPELL_LIGHTNING_COST )
            {
              IF ( INT_CP_FREE_ENTRIES > 1 )
              {
                SET INT_ATTR_AWAY_RELIGIOUS          100
                DO ATTACK BLUE 3 ATTACK_BUILDING INT_WARRIOR_TRAIN 20 INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 -1 -1
                SET INT_ATTR_AWAY_WARRIOR            0
                SET INT_ATTR_AWAY_RELIGIOUS          0
                SET INT_ATTR_AWAY_SHAMAN             100
                DO ATTACK BLUE 0 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 6 INT_LIGHTNING INT_LIGHTNING INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 $10 -1 -1
                SET $33                              3
                SET $3                               2
              }
              ENDIF
            }
            ENDIF
          }
          ELSE
          {
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 128
    {
      IF ( INT_MY_NUM_PEOPLE > 25 )
      {
        DO STATE_SHAMAN_GET_WILDS                OFF
      }
      ENDIF
    }
    EVERY 256
    {
      DO PARTIAL_BUILDING_COUNT
      IF ( INT_B_BUILDING_WARRIOR_TRAIN < 1 && INT_BLUE_PEOPLE > 25 )
      {
        IF ( INT_B_PERSON_WARRIOR < 1 && $20 == 0 )
        {
          IF ( $25 == 0 )
          {
            SET $20                                1
            SET $25                                1
            DO CREATE_MSG_INFORMATION              71
            DO SET_MSG_DELETE_ON_OK
            DO SET_MSG_TIMEOUT                     256
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      DO PARTIAL_BUILDING_COUNT
      IF ( INT_B_BUILDING_TEMPLE < 1 && INT_BLUE_PEOPLE > 35 )
      {
        IF ( INT_B_PERSON_RELIGIOUS < 1 && $21 == 0 )
        {
          IF ( $25 == 0 )
          {
            SET $21                                1
            SET $25                                1
            DO CREATE_MSG_INFORMATION              72
            DO SET_MSG_DELETE_ON_OK
            DO SET_MSG_TIMEOUT                     256
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      IF ( INT_B_PERSON_WARRIOR > 9 && INT_B_PERSON_RELIGIOUS > 9 )
      {
        IF ( $24 == 0 && $25 == 0 )
        {
          SET $24                                 1
          SET $25                                 1
          DO CREATE_MSG_INFORMATION               73
          DO SET_MSG_DELETE_ON_OK
          DO SET_MSG_TIMEOUT                      256
        }
        ENDIF
      }
      ENDIF
      SET $25                                   0
    }
    EVERY 2048
    {
      IF ( $3 == 2 && INT_BLUE_PEOPLE > 30 )
      {
        IF ( INT_MY_NUM_PEOPLE > 38 && INT_MY_MANA > 100000 )
        {
          SET INT_ATTR_AWAY_WARRIOR               100
          SET INT_ATTR_AWAY_RELIGIOUS             34
          SET INT_ATTR_AWAY_SHAMAN                100
          DO ATTACK BLUE 6 ATTACK_BUILDING INT_DRUM_TOWER 20 INT_LIGHTNING INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 -1 -1
        }
        ELSE
        {
          IF ( INT_MY_NUM_PEOPLE > 20 && INT_MY_MANA > INT_M_SPELL_LIGHTNING_COST )
          {
            SET INT_ATTR_AWAY_WARRIOR              100
            SET INT_ATTR_AWAY_RELIGIOUS            34
            SET INT_ATTR_AWAY_SHAMAN               100
            DO ATTACK BLUE 6 ATTACK_BUILDING INT_TEMPLE 20 INT_LIGHTNING INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 -1 -1
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      IF ( INT_GAME_TURN > 35000 )
      {
        DO ATTACK BLUE INT_MY_NUM_PEOPLE ATTACK_BUILDING INT_DRUM_TOWER 999 INT_LIGHTNING INT_LIGHTNING INT_LIGHTNING ATTACK_NORMAL 0 -1 -1 -1
      }
      ENDIF
      IF ( INT_GAME_TURN > 8000 && $38 == 0 )
      {
        INCREMENT $37 1
        IF ( $37 > 7 )
        {
          SET INT_ATTR_AWAY_BRAVE                 100
          SET INT_ATTR_AWAY_WARRIOR               0
          SET INT_ATTR_AWAY_RELIGIOUS             0
          SET INT_ATTR_AWAY_SHAMAN                0
          DO ATTACK BLUE 3 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 20 INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 -1 -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 $37                                 0
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 16 32
    {
      IF ( $34 == 0 )
      {
        DO FLYBY_CREATE_NEW
        DO FLYBY_ALLOW_INTERRUPT                 ON
        DO FLYBY_SET_END_TARGET                  42 248 221 0
        DO FLYBY_SET_EVENT_POS                   76 20 1 29
        DO FLYBY_SET_EVENT_TOOLTIP               76 20 1 1 50
        DO FLYBY_SET_EVENT_ANGLE                 714 1 29
        DO FLYBY_SET_EVENT_ZOOM                  -50 1 19
        DO FLYBY_SET_EVENT_ANGLE                 327 30 30
        DO FLYBY_SET_EVENT_ZOOM                  30 30 40
        DO FLYBY_SET_EVENT_POS                   60 70 60 30
        DO FLYBY_SET_EVENT_TOOLTIP               60 70 0 55 60
        DO FLYBY_SET_EVENT_ZOOM                  -60 75 20
        DO FLYBY_SET_EVENT_ANGLE                 700 60 35
        DO FLYBY_SET_EVENT_ANGLE                 253 95 30
        DO FLYBY_SET_EVENT_ZOOM                  20 95 50
        DO FLYBY_SET_EVENT_POS                   244 52 125 45
        DO FLYBY_SET_EVENT_TOOLTIP               244 52 1 120 100
        DO FLYBY_SET_EVENT_ANGLE                 763 125 38
        DO FLYBY_SET_EVENT_ANGLE                 1291 163 30
        DO FLYBY_SET_EVENT_ZOOM                  -40 145 60
        DO FLYBY_SET_EVENT_POS                   182 54 200 25
        DO FLYBY_SET_EVENT_ANGLE                 459 193 50
        DO FLYBY_SET_EVENT_ZOOM                  0 210 30
        DO FLYBY_SET_EVENT_POS                   42 248 238 35
        DO FLYBY_SET_EVENT_ANGLE                 221 243 30
        DO FLYBY_SET_EVENT_ZOOM                  0 245 28
        DO FLYBY_START
        SET $34                                  1
      }
      ENDIF
    }
    EVERY 64
    {
      IF ( INT_MY_NUM_PEOPLE < 8 && INT_MY_NUM_KILLED_BY_HUMAN > 10 )
      {
        DO GIVE_UP_AND_SULK                      ON
      }
      ENDIF
      IF ( $29 == 0 )
      {
        DO GET_HEAD_TRIGGER_COUNT 60 70 $30
        IF ( $30 < 4 )
        {
          DO CREATE_MSG_INFORMATION_ZOOM          111 60 70 350
          DO SET_MSG_DELETE_ON_OK
          SET $29                                 1
        }
        ENDIF
      }
      ENDIF
      IF ( $35 == 1 )
      {
        DO GET_HEAD_TRIGGER_COUNT 76 20 $35
        IF ( $35 == 0 )
        {
          DO CREATE_MSG_INFORMATION_ZOOM          65 76 20 350
          DO SET_MSG_DELETE_ON_OK
        }
        ENDIF
      }
      ENDIF
    }
  }
  ENDIF
}
SCRIPT_END
