<commit_before>class @Pokemon extends Backbone.Model
  defaults: =>
    name: 'Bulbasaur'
    moves: []
    pixels: 48
    ivs:
      hp: 31
      attack: 31
      defense: 31
      specialAttack: 31
      specialDefense: 31
      speed: 31
    evs:
      hp: 0
      attack: 0
      defense: 0
      specialAttack: 0
      specialDefense: 0
      speed: 0

  initialize: (attributes={}) ->
    @set('forme', 'default')  unless attributes.forme
    @normalizeStats(@get('ivs'), 31)
    @normalizeStats(@get('evs'), 0)
    @resetBoosts()
    @isNull = false

    # Skip teambuilder-specific properties.
    return  if @get('teambuilder') != true

    # Set to default forme and ability when the species changes
    @on 'change:name', =>
      @set('forme', 'default')
      @set('ability', @getAbilities()[0], silent: true)
      @set('item', null, silent: true)
      @set('level', 100, silent: true)
      @set('happiness', 100, silent: true)
      @set('gender', @getGenders()[0], silent: true)
      @get('ivs')[stat] = 31  for stat of @get('ivs')
      @get('evs')[stat] = 0   for stat of @get('evs')
      @set('moves', [], silent: true)

      hiddenPowerType = HiddenPower.BW.type(@get('ivs')).toLowerCase()
      @set('hiddenPowerType', hiddenPowerType, silent: true)

    @on 'change:ivs', (model, ivs)=>
      type = HiddenPower.BW.type(ivs).toLowerCase()
      @set("hiddenPowerType", type, silent: true)

    @on 'change:hiddenPowerType', (model, type) =>
      hpIVs = HiddenPower.BW.ivs[type.toLowerCase()]
      ivs = @get('ivs')
      for stat, iv of ivs
        ivs[stat] = hpIVs[stat] || 31
      @set('ivs', ivs, silent: true)

    @set('ability', @getAbilities()[0])  unless attributes.ability
    @set('level', 100)  unless attributes.level
    @set('happiness', 100)  unless attributes.happiness
    hiddenPowerType = HiddenPower.BW.type(@get('ivs')).toLowerCase()
    @set('hiddenPowerType', hiddenPowerType, silent: true)
<commit_msg>Teambuilder: Hardy is now neutral nature<commit_after>class @Pokemon extends Backbone.Model
  defaults: =>
    name: 'Bulbasaur'
    moves: []
    pixels: 48
    ivs:
      hp: 31
      attack: 31
      defense: 31
      specialAttack: 31
      specialDefense: 31
      speed: 31
    evs:
      hp: 0
      attack: 0
      defense: 0
      specialAttack: 0
      specialDefense: 0
      speed: 0

  initialize: (attributes={}) ->
    @set('forme', 'default')  unless attributes.forme
    @normalizeStats(@get('ivs'), 31)
    @normalizeStats(@get('evs'), 0)
    @resetBoosts()
    @isNull = false

    # Skip teambuilder-specific properties.
    return  if @get('teambuilder') != true

    # Set to default forme and ability when the species changes
    @on 'change:name', =>
      @set('forme', 'default')
      @set('ability', @getAbilities()[0], silent: true)
      @set('item', null, silent: true)
      @set('level', 100, silent: true)
      @set('happiness', 100, silent: true)
      @set('gender', @getGenders()[0], silent: true)
      @get('ivs')[stat] = 31  for stat of @get('ivs')
      @get('evs')[stat] = 0   for stat of @get('evs')
      @set('moves', [], silent: true)

      hiddenPowerType = HiddenPower.BW.type(@get('ivs')).toLowerCase()
      @set('hiddenPowerType', hiddenPowerType, silent: true)

    @on 'change:ivs', (model, ivs)=>
      type = HiddenPower.BW.type(ivs).toLowerCase()
      @set("hiddenPowerType", type, silent: true)

    @on 'change:hiddenPowerType', (model, type) =>
      hpIVs = HiddenPower.BW.ivs[type.toLowerCase()]
      ivs = @get('ivs')
      for stat, iv of ivs
        ivs[stat] = hpIVs[stat] || 31
      @set('ivs', ivs, silent: true)

    @set('ability', @getAbilities()[0])  unless attributes.ability
    @set('level', 100)  unless attributes.level
    @set('happiness', 100)  unless attributes.happiness
    @set('nature', 'Hardy')  unless attributes.nature
    hiddenPowerType = HiddenPower.BW.type(@get('ivs')).toLowerCase()
    @set('hiddenPowerType', hiddenPowerType, silent: true)

{'fraction_non_alphanumeric': 0.16012009006755065, 'fraction_numerical': 0.02151613710282712, 'mean_word_length': 3.071283095723014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2252268', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1341, 'n_words': 327}