<commit_before>﻿using PlayerModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PlayerModels.StatCalculations
{
    public class ClassStatCalculator : IStatCalculator
    {
        private List<Action<CharacterModel>> levelIncreases;
        private List<AbilityDescription> abilities;
        private List<string> statIncreases;
        private string className;

        public ClassStatCalculator(List<Action<CharacterModel>> levelIncreases, List<AbilityDescription> abilities, List<string> statIncreases, string className)
        {
            this.levelIncreases = levelIncreases;
            this.abilities = abilities;
            this.statIncreases = statIncreases;
            this.className = className;
        }

        public void getStats(CharacterModel cm)
        {
            foreach (CharacterClassModel ccm in cm.characterClasses)
            {
                if (ccm.className == className)
                {
                    for (int i = 0; i < ccm.lvl && i < levelIncreases.Count; i++)
                    {
                        levelIncreases[i](cm);
                    }
                }
            }
        }

        public IEnumerable<AbilityDescription> getAbilities(CharacterModel cm)
        {
            List<AbilityDescription> returnValue = new List<AbilityDescription>();

            foreach (CharacterClassModel ccm in cm.characterClasses)
            {
                if (ccm.className == className)
                {
                    for (int i = 0; i < ccm.lvl && i * 2 < abilities.Count; i += 2)
                    {
                        returnValue.Add(this.abilities[i / 2]);
                    }
                }
            }

            return returnValue;
        }

        public string getNewAbilityMessage(CharacterModel cm)
        {
            foreach (CharacterClassModel ccm in cm.characterClasses)
            {
                if (ccm.className == className)
                {
                    if (ccm.lvl % 2 == 1)
                    {
                        return cm.name + " has learned " + abilities[(ccm.lvl - 1) / 2].name + ".  " + abilities[(ccm.lvl - 1) / 2].description;
                    }
                    else
                    {
                        return statIncreases[(ccm.lvl / 2) - 1]; //Return new message for stat increases
                    }
                }<commit_msg>Fixed a bug with the number of displayed abilities<commit_after>﻿using PlayerModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PlayerModels.StatCalculations
{
    public class ClassStatCalculator : IStatCalculator
    {
        private List<Action<CharacterModel>> levelIncreases;
        private List<AbilityDescription> abilities;
        private List<string> statIncreases;
        private string className;

        public ClassStatCalculator(List<Action<CharacterModel>> levelIncreases, List<AbilityDescription> abilities, List<string> statIncreases, string className)
        {
            this.levelIncreases = levelIncreases;
            this.abilities = abilities;
            this.statIncreases = statIncreases;
            this.className = className;
        }

        public void getStats(CharacterModel cm)
        {
            foreach (CharacterClassModel ccm in cm.characterClasses)
            {
                if (ccm.className == className)
                {
                    for (int i = 0; i < ccm.lvl && i < levelIncreases.Count; i++)
                    {
                        levelIncreases[i](cm);
                    }
                }
            }
        }

        public IEnumerable<AbilityDescription> getAbilities(CharacterModel cm)
        {
            List<AbilityDescription> returnValue = new List<AbilityDescription>();

            foreach (CharacterClassModel ccm in cm.characterClasses)
            {
                if (ccm.className == className)
                {
                    for (int i = 0; i < ccm.lvl && i / 2 < abilities.Count; i += 2)
                    {
                        returnValue.Add(this.abilities[i / 2]);
                    }
                }
            }

            return returnValue;
        }

        public string getNewAbilityMessage(CharacterModel cm)
        {
            foreach (CharacterClassModel ccm in cm.characterClasses)
            {
                if (ccm.className == className)
                {
                    if (ccm.lvl % 2 == 1)
                    {
                        return cm.name + " has learned " + abilities[(ccm.lvl - 1) / 2].name + ".  " + abilities[(ccm.lvl - 1) / 2].description;
                    }
                    else
                    {
                        return statIncreases[(ccm.lvl / 2) - 1]; //Return new message for stat increases
                    }
                }
{'fraction_non_alphanumeric': 0.08311688311688312, 'fraction_numerical': 0.005194805194805195, 'mean_word_length': 1.4300970873786407, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 25, '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': '2762667', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1185, 'n_words': 282}