{
  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             10
    SET INT_ATTR_PREF_SPY_TRAINS               0
    SET INT_ATTR_PREF_RELIGIOUS_TRAINS         0
    SET INT_ATTR_PREF_WARRIOR_TRAINS           0
    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 STATE_DEFEND                            ON
    DO STATE_FIREWARRIOR_DEFEND                ON
    DO STATE_DEFEND_BASE                       ON
    SET INT_ATTR_DEFENSE_RAD_INCR              0
    SET INT_ATTR_MAX_DEFENSIVE_ACTIONS         0
    SET INT_ATTR_USE_PREACHER_FOR_DEFENCE      1
    DO STATE_PREACH                            ON
    SET INT_ATTR_SHAMEN_BLAST                  128
    DO STATE_SPELL_DEFENCE                     64 54 ON
    DO SET_SPELL_ENTRY 0 INT_LIGHTNING 150000 128 2 0
    DO SET_SPELL_ENTRY 1 INT_HYPNOTISM 200000 128 4 0
    SET INT_ATTR_SPY_CHECK_FREQUENCY           128
    SET INT_ATTR_SPY_DISCOVER_CHANCE           30
    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_BOAT               8
    SET INT_ATTR_PREF_BOAT_DRIVERS             5
    DO STATE_TRAIN_PEOPLE                      ON
    SET INT_ATTR_PREF_SPY_PEOPLE               0
    SET INT_ATTR_PREF_RELIGIOUS_PEOPLE         15
    SET INT_ATTR_PREF_WARRIOR_PEOPLE           10
    SET INT_ATTR_PREF_FIREWARRIOR_PEOPLE       20
    DO SET_MARKER_ENTRY                        1 15 16 0 1 1 1
    DO SET_MARKER_ENTRY                        2 17 18 0 0 2 0
    DO SET_MARKER_ENTRY                        3 19 20 0 2 2 1
    DO SET_MARKER_ENTRY                        4 23 -1 0 0 0 1
    DO SET_MARKER_ENTRY                        5 24 -1 0 0 0 1
    DO SET_MARKER_ENTRY                        6 25 -1 0 0 0 1
    SET INT_ATTR_MAX_TRAIN_AT_ONCE             3
    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                  50
    SET INT_ATTR_AWAY_RELIGIOUS                25
    SET INT_ATTR_AWAY_SPY                      0
    SET INT_ATTR_AWAY_FIREWARRIOR              25
    SET INT_ATTR_AWAY_SHAMAN                   0
    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
    DO CREATE_MSG_NARRATIVE                    6
    DO SET_MSG_AUTO_OPEN_DLG
  }
  ELSE
  {
    EVERY 128
    {
      IF ( INT_M_BUILDING_SMALL_HUT < 1 )
      {
        IF ( INT_M_BUILDING_MEDIUM_HUT < 1 && INT_M_BUILDING_LARGE_HUT < 1 )
        {
          IF ( INT_M_PERSON_SHAMAN > 0 )
          {
            DO DEFEND_SHAMEN                       INT_MY_NUM_PEOPLE
          }
          ELSE
          {
            DO SEND_SHAMEN_DEFENDERS_HOME
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 16
    {
      IF ( INT_RED_PEOPLE < 1 && $5 == 0 )
      {
        DO TRIGGER_LEVEL_WON
        SET $5                                   1
      }
      ENDIF
      IF ( $7 == 0 )
      {
        DO GET_NUM_ONE_OFF_SPELLS 0 INT_TELEPORT $6
        IF ( $6 > 0 )
        {
          DO CREATE_MSG_INFORMATION               12
          DO SET_MSG_DELETE_ON_OK
          DO SET_MSG_TIMEOUT                      256
          SET $7                                  1
        }
        ENDIF
      }
      ENDIF
    }
    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 256
    {
      IF ( INT_GAME_TURN > 16384 && INT_ATTR_MAX_DEFENSIVE_ACTIONS == 0 )
      {
        SET INT_ATTR_MAX_DEFENSIVE_ACTIONS       1
      }
      ENDIF
    }
    EVERY 256 128
    {
      IF ( INT_M_PERSON_FIREWARRIOR > 1 )
      {
        DO PUT_PERSON_IN_DT INT_RELIGIOUS 86 2
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 86 48
      }
      ENDIF
      IF ( INT_M_PERSON_FIREWARRIOR > 3 )
      {
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 64 10
        DO PUT_PERSON_IN_DT INT_FIREWARRIOR 72 242
        DO PUT_PERSON_IN_DT INT_RELIGIOUS 90 250
        DO PUT_PERSON_IN_DT INT_RELIGIOUS 92 8
      }
      ENDIF
      IF ( INT_M_PERSON_WARRIOR > 3 )
      {
        DO MARKER_ENTRIES                        1 3 -1 -1
      }
      ENDIF
      IF ( INT_M_PERSON_RELIGIOUS > 2 )
      {
        DO MARKER_ENTRIES                        4 5 6 -1
      }
      ENDIF
      DO COUNT_PEOPLE_IN_MARKER BLUE 13 8 $2
      IF ( $2 > 8 && INT_MY_NUM_PEOPLE < 25 )
      {
        DO TRAIN_PEOPLE_NOW 2 INT_WARRIOR
        DO TRAIN_PEOPLE_NOW 2 INT_RELIGIOUS
        DO TRAIN_PEOPLE_NOW 2 INT_FIREWARRIOR
        DO DEFEND_SHAMEN                         6
      }
      ELSE
      {
        IF ( $2 > 8 )
        {
          DO DEFEND_SHAMEN                        10
        }
        ELSE
        {
          IF ( $2 == 0 )
          {
            DO SEND_SHAMEN_DEFENDERS_HOME
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 2048 64
    {
      IF ( INT_MY_NUM_PEOPLE > 50 && INT_RED_PEOPLE < 20 )
      {
        IF ( INT_M_PERSON_WARRIOR > 5 && $4 == 0 )
        {
          DO NAV_CHECK RED ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 1 $3
          IF ( $3 == 1 )
          {
            DO ATTACK RED 16 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 100 INT_INVISIBILITY INT_INVISIBILITY INT_INVISIBILITY ATTACK_NORMAL 0 -1 -1 -1
            SET $4                                 1
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
      IF ( $4 > 0 )
      {
        INCREMENT $4 1
        IF ( $4 == 3 )
        {
          SET $4                                  0
        }
        ENDIF
      }
      ENDIF
    }
  }
  ENDIF
}
SCRIPT_END
