{
  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             125
    DO SET_DRUM_TOWER_POS                      86 220
    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             0
    SET INT_ATTR_MAX_BUILDINGS_ON_GO           4
    SET INT_ATTR_HOUSE_PERCENTAGE              21
    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
    SET INT_ATTR_DEFENSE_RAD_INCR              3
    SET INT_ATTR_MAX_DEFENSIVE_ACTIONS         3
    SET INT_ATTR_USE_PREACHER_FOR_DEFENCE      1
    DO STATE_PREACH                            ON
    SET INT_ATTR_SHAMEN_BLAST                  64
    DO STATE_SPELL_DEFENCE                     86 220 ON
    DO SET_SPELL_ENTRY 0 INT_LIGHTNING 100000 128 2 0
    SET INT_ATTR_SPY_CHECK_FREQUENCY           128
    SET INT_ATTR_SPY_DISCOVER_CHANCE           20
    SET INT_ATTR_ENEMY_SPY_MAX_STAND           128
    SET INT_ATTR_RETREAT_VALUE                 10
    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                      OFF
    SET INT_ATTR_PREF_SPY_PEOPLE               0
    SET INT_ATTR_PREF_RELIGIOUS_PEOPLE         20
    SET INT_ATTR_PREF_WARRIOR_PEOPLE           20
    SET INT_ATTR_PREF_FIREWARRIOR_PEOPLE       20
    DO SET_MARKER_ENTRY                        1 21 22 0 4 3 2
    DO SET_MARKER_ENTRY                        2 23 24 0 2 3 2
    DO SET_MARKER_ENTRY                        3 25 26 0 2 2 1
    DO SET_MARKER_ENTRY                        4 27 -1 0 0 0 1
    DO SET_MARKER_ENTRY                        5 28 -1 0 0 0 1
    DO SET_MARKER_ENTRY                        6 29 -1 0 0 0 1
    DO SET_MARKER_ENTRY                        7 89 90 0 3 2 1
    DO SET_MARKER_ENTRY                        8 91 -1 0 1 2 0
    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                25
    SET INT_ATTR_AWAY_SPY                      0
    SET INT_ATTR_AWAY_FIREWARRIOR              35
    SET INT_ATTR_AWAY_SHAMAN                   100
    SET INT_ATTR_BASE_UNDER_ATTACK_RETREAT     1
    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
    DO GIVE_MANA_TO_PLAYER GREEN 100000
    SET INT_ATTR_FIGHT_STOP_DISTANCE           24
  }
  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 ( INT_MY_MANA < 500000 )
      {
        DO GIVE_MANA_TO_PLAYER GREEN 7500
      }
      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 128
    {
      IF ( INT_GAME_TURN > 8000 )
      {
        DO STATE_TRAIN_PEOPLE                    ON
      }
      ENDIF
      IF ( INT_M_BUILDING_LARGE_HUT > 2 )
      {
        SET INT_ATTR_HOUSE_PERCENTAGE            90
        SET INT_ATTR_PREF_BALLOON_HUTS           1
      }
      ENDIF
    }
    EVERY 256
    {
      IF ( INT_M_BUILDING_LARGE_HUT > 0 && $13 < 6 )
      {
        IF ( $13 == 0 && INT_CP_FREE_ENTRIES > 1 )
        {
          DO BUILD_DRUM_TOWER                     108 224
          SET $13                                 1
        }
        ELSE
        {
          IF ( $13 == 1 && INT_CP_FREE_ENTRIES > 1 )
          {
            DO BUILD_DRUM_TOWER                    108 234
            SET $13                                2
          }
          ELSE
          {
            IF ( $13 == 2 && INT_MY_NUM_PEOPLE > 40 )
            {
              IF ( INT_CP_FREE_ENTRIES > 1 )
              {
                DO BUILD_DRUM_TOWER                  80 200
                SET $13                              3
              }
              ENDIF
            }
            ELSE
            {
              IF ( $13 == 3 && INT_MY_NUM_PEOPLE > 45 )
              {
                IF ( INT_CP_FREE_ENTRIES > 1 )
                {
                  DO BUILD_DRUM_TOWER                 64 240
                  SET $13                             4
                }
                ENDIF
              }
              ELSE
              {
                IF ( $13 == 4 && INT_MY_NUM_PEOPLE > 50 )
                {
                  IF ( INT_CP_FREE_ENTRIES > 1 )
                  {
                    DO BUILD_DRUM_TOWER                76 10
                    SET $13                            5
                  }
                  ELSE
                  {
                    IF ( $13 == 5 && INT_MY_NUM_PEOPLE > 55 )
                    {
                      IF ( INT_CP_FREE_ENTRIES > 1 )
                      {
                        DO BUILD_DRUM_TOWER              92 10
                        SET $13                          6
                      }
                      ENDIF
                    }
                    ENDIF
                  }
                  ENDIF
                }
                ENDIF
              }
              ENDIF
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      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
    }
    EVERY 256 128
    {
      IF ( INT_M_PERSON_FIREWARRIOR > 1 )
      {
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 108 224
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 108 234
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 80 200
      }
      ENDIF
      IF ( INT_M_PERSON_FIREWARRIOR > 3 )
      {
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 64 240
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 76 10
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 92 10
      }
      ENDIF
      IF ( INT_M_PERSON_WARRIOR > 3 )
      {
        DO MARKER_ENTRIES                        1 2 3 -1
      }
      ENDIF
      IF ( INT_M_PERSON_RELIGIOUS > 2 )
      {
        DO MARKER_ENTRIES                        4 5 6 -1
      }
      ENDIF
      DO COUNT_PEOPLE_IN_MARKER BLUE 30 8 $2
      IF ( $2 > 8 && INT_MY_NUM_PEOPLE < 25 )
      {
        DO STATE_TRAIN_PEOPLE                    ON
        DO TRAIN_PEOPLE_NOW 2 INT_WARRIOR
        DO DEFEND_SHAMEN                         4
      }
      ELSE
      {
        IF ( $2 > 8 )
        {
          DO DEFEND_SHAMEN                        5
        }
        ELSE
        {
          IF ( $2 == 0 && INT_MY_NUM_PEOPLE > 7 )
          {
            DO SEND_SHAMEN_DEFENDERS_HOME
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      IF ( INT_MY_NUM_PEOPLE > 20 && $22 == 0 )
      {
        SET $22                                  1
      }
      ENDIF
      IF ( INT_MY_NUM_PEOPLE < 8 && $22 == 1 )
      {
        DO DEFEND_SHAMEN                         INT_MY_NUM_PEOPLE
      }
      ELSE
      {
        IF ( $2 == 0 )
        {
          DO SEND_SHAMEN_DEFENDERS_HOME
        }
        ENDIF
      }
      ENDIF
      IF ( $21 == 1 )
      {
        DO MARKER_ENTRIES                        7 8 -1 -1
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 98 56
      }
      ENDIF
    }
    EVERY 2048
    {
      DO COUNT_PEOPLE_IN_MARKER BLUE 88 8 $17
      DO COUNT_PEOPLE_IN_MARKER RED 88 8 $18
      DO COUNT_PEOPLE_IN_MARKER YELLOW 88 8 $19
      DO COUNT_PEOPLE_IN_MARKER GREEN 88 8 $20
      IF ( $17 > $18 )
      {
        IF ( $17 > $19 )
        {
          SET $14                                 0
        }
        ELSE
        {
          SET $14                                 2
        }
        ENDIF
      }
      ELSE
      {
        IF ( $18 > $19 )
        {
          SET $14                                 1
        }
        ELSE
        {
          SET $14                                 2
        }
        ENDIF
      }
      ENDIF
      SET $16                                   $17
      INCREMENT $16 $18
      INCREMENT $16 $19
      IF ( $16 > 0 && INT_CP_FREE_ENTRIES > 2 )
      {
        IF ( INT_MY_NUM_PEOPLE > 45 && INT_M_PERSON_RELIGIOUS > 2 )
        {
          IF ( INT_M_PERSON_WARRIOR > 2 && INT_MY_MANA > 100000 )
          {
            DO ATTACK $14 $16 ATTACK_MARKER 88 $16 INT_LIGHTNING INT_LIGHTNING INT_LIGHTNING ATTACK_NORMAL 0 -1 -1 -1
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      IF ( $16 <= $20 && INT_MY_NUM_PEOPLE > 50 )
      {
        DO PRAY_AT_HEAD                          6 88
        IF ( INT_M_PERSON_WARRIOR > 3 && INT_M_PERSON_RELIGIOUS > 3 )
        {
          IF ( INT_M_PERSON_FIREWARRIOR > 3 && INT_CP_FREE_ENTRIES > 0 )
          {
            SET $21                                1
            DO MARKER_ENTRIES                      7 8 -1 -1
            DO PUT_PERSON_IN_DT INT_FIREWARRIOR 98 56
            DO IS_BUILDING_NEAR INT_DRUM_TOWER 98 56 GREEN 6 $15
            IF ( $15 == 0 )
            {
              DO BUILD_DRUM_TOWER                   98 56
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ELSE
      {
        SET $21                                  0
      }
      ENDIF
    }
    EVERY 1024 64
    {
      IF ( INT_BLUE_PEOPLE > INT_RED_PEOPLE )
      {
        IF ( INT_BLUE_PEOPLE > INT_YELLOW_PEOPLE )
        {
          SET $12                                 0
        }
        ELSE
        {
          SET $12                                 2
        }
        ENDIF
      }
      ELSE
      {
        IF ( INT_RED_PEOPLE > INT_YELLOW_PEOPLE )
        {
          SET $12                                 1
        }
        ELSE
        {
          SET $12                                 2
        }
        ENDIF
      }
      ENDIF
      IF ( $1 == 4 && INT_CP_FREE_ENTRIES > 1 )
      {
        IF ( $11 == 0 && INT_M_PERSON_WARRIOR > 4 )
        {
          SET $10                                 INT_M_SPELL_SHIELD_COST
          INCREMENT $10 INT_M_SPELL_SWARM_COST
          INCREMENT $10 INT_M_SPELL_LIGHTNING_COST
          IF ( INT_MY_MANA > $10 && INT_M_PERSON_RELIGIOUS > 4 )
          {
            IF ( INT_M_PERSON_FIREWARRIOR > 4 )
            {
              DO ATTACK $12 24 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 989 INT_LIGHTNING INT_SHIELD INT_SWARM ATTACK_NORMAL 0 -1 -1 -1
              SET $11                               1
            }
            ENDIF
          }
          ENDIF
        }
        ELSE
        {
          IF ( $11 == 1 && INT_M_PERSON_WARRIOR > 4 )
          {
            SET $8                                 INT_M_SPELL_EARTHQUAKE_COST
            INCREMENT $8 INT_M_SPELL_LIGHTNING_COST
            INCREMENT $8 INT_M_SPELL_TORNADO_COST
            IF ( INT_MY_MANA > $8 && INT_M_PERSON_RELIGIOUS > 4 )
            {
              IF ( INT_M_PERSON_FIREWARRIOR > 4 )
              {
                DO ATTACK $12 15 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 999 INT_EARTHQUAKE INT_TORNADO INT_LIGHTNING ATTACK_NORMAL 0 -1 -1 -1
                SET $11                              0
              }
              ENDIF
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      IF ( $1 == 3 && INT_CP_FREE_ENTRIES > 1 )
      {
        IF ( INT_M_PERSON_WARRIOR > 5 && INT_M_PERSON_RELIGIOUS > 4 )
        {
          SET $8                                  INT_M_SPELL_EROSION_COST
          INCREMENT $8 INT_M_SPELL_LIGHTNING_COST
          INCREMENT $8 INT_M_SPELL_TORNADO_COST
          IF ( INT_M_PERSON_FIREWARRIOR > 4 && INT_MY_MANA > $8 )
          {
            DO ATTACK BLUE 24 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 999 INT_EROSION INT_LIGHTNING INT_TORNADO ATTACK_NORMAL 0 76 77 0
            SET $1                                 4
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      IF ( $1 == 2 && INT_CP_FREE_ENTRIES > 1 )
      {
        SET $9                                   INT_M_SPELL_SWARM_COST
        INCREMENT $9 INT_M_SPELL_TORNADO_COST
        INCREMENT $9 INT_M_SPELL_TORNADO_COST
        IF ( INT_MY_MANA > $9 && INT_MY_NUM_PEOPLE > 30 )
        {
          IF ( INT_M_PERSON_WARRIOR > 5 && INT_M_PERSON_RELIGIOUS > 4 )
          {
            IF ( INT_M_PERSON_FIREWARRIOR > 4 )
            {
              DO ATTACK $12 24 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 999 INT_SWARM INT_TORNADO INT_TORNADO ATTACK_NORMAL 0 -1 -1 -1
              SET $1                                3
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      IF ( $1 == 1 && INT_CP_FREE_ENTRIES > 1 )
      {
        SET $4                                   INT_M_SPELL_EARTHQUAKE_COST
        INCREMENT $4 INT_M_SPELL_LIGHTNING_COST
        INCREMENT $4 INT_M_SPELL_LIGHTNING_COST
        IF ( INT_MY_MANA > $4 && INT_M_PERSON_WARRIOR > 5 )
        {
          IF ( INT_M_PERSON_RELIGIOUS > 4 && INT_M_PERSON_FIREWARRIOR > 5 )
          {
            DO ATTACK $12 20 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 999 INT_EARTHQUAKE INT_LIGHTNING INT_LIGHTNING ATTACK_NORMAL 0 -1 -1 -1
            SET $1                                 2
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      IF ( $1 == 0 && INT_CP_FREE_ENTRIES > 1 )
      {
        SET $3                                   INT_M_SPELL_LIGHTNING_COST
        INCREMENT $3 INT_M_SPELL_EROSION_COST
        IF ( INT_MY_MANA > $3 && INT_M_PERSON_WARRIOR > 6 )
        {
          IF ( INT_M_PERSON_RELIGIOUS > 4 && INT_M_PERSON_FIREWARRIOR > 5 )
          {
            DO ATTACK BLUE 20 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 999 INT_EROSION INT_LIGHTNING INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 27 31 0
            SET $1                                 1
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
  }
  ENDIF
}
SCRIPT_END
