<commit_before>#<< main
lol.champions = {}

class LoLChampion
  constructor: (name, params) ->
    @name = name

    @baseStats = params.baseStats
    @statsPerLevel = params.statsPerLevel

    @skills = params.skills

  ##
  # Gets the stats of the champion at a given level
  # without items, masteries, runes, etc.
  #
  getVanillaStats: (level) ->
    stats = {}

    for stat in lol.stats.names
      stats[stat] = ((@baseStats[stat] || 0) unless stat is "as") + (level - 1) * (@statsPerLevel[stat] || 0)

    return stats

  ##
  # Gets the stats of the champion at a given level
  # with the given items, masteries, and runes.
  # 
  getStats: (level, items, masteries, runes) ->
    return lol.stats.combine [@getVanillaStats(level), lol.stats.combine(items), lol.stats.combine(masteries), lol.stats.combine(runes)]

lol.champions.list = {}
lol.champions._def = (name, params) ->
  lol.champions.list[name] = new LoLChampion name, params
<commit_msg>Fix stats functions<commit_after>#<< main
lol.champions = {}

class LoLChampion
  constructor: (name, params) ->
    @name = name

    @baseStats = params.baseStats
    @statsPerLevel = params.statsPerLevel

    @skills = params.skills

  ##
  # Applies stats to the base stats of this champion.
  #
  applyStats: (stats) ->
    stats = {}
    for stat in lol.stats.names
      unless stat is "as"
        stats[stat] = (@baseStats[stat] || 0) + (stats[stat] || 0)
      else
        stats[stat] = (@baseStats[stat] || 0) * (stats[stat] || 0)
    return stats

  ##
  # Gets the stats of the champion at a given level
  # without items, masteries, runes, etc.
  #
  getVanillaStats: (level) ->
    return applyStats getAdditionalStats level

  ##
  # Gets the additional stats to add to the champion for the given level.
  #
  getAdditionalStats: (level) ->
    added = {}

    for stat in lol.stats.names
      added[stat] = (level - 1) * (@statsPerLevel[stat] || 0)

    return added

  ##
  # Gets the stats of the champion at a given level
  # with the given items, masteries, and runes.
  # 
  getStats: (level, items, masteries, runes) ->
    return applyStats lol.stats.combine [@getAdditionalStats(level), lol.stats.combine(items), lol.stats.combine(masteries), lol.stats.combine(runes)]

lol.champions.list = {}
lol.champions._def = (name, params) ->
  lol.champions.list[name] = new LoLChampion name, params

{'fraction_non_alphanumeric': 0.12920875420875422, 'fraction_numerical': 0.003787878787878788, 'mean_word_length': 3.1996466431095407, 'pattern_counts': {'":': 0, '<': 7, '<?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': '618487', 'n_tokens_mistral': 813, 'n_tokens_neox': 785, 'n_words': 225}