コード例 #1
0
 public void ResetStats(StatTypeEnum ResetLevel)
 {
     foreach (Basestat stat in m_allStatObjects)
     {
         stat.Reset(ResetLevel);
     }
 }
コード例 #2
0
        public void BuildIvsEvs(PokemonStats[] stats)
        {
            foreach (var stat in stats)
            {
                StatTypeEnum type = StatTypeEnum.ATK;
                switch (stat.Stat.Name)
                {
                case "speed":
                    type = StatTypeEnum.SPEED;
                    break;

                case "special-defense":
                    type = StatTypeEnum.SP_DEF;
                    break;

                case "special-attack":
                    type = StatTypeEnum.SP_ATK;
                    break;

                case "defense":
                    type = StatTypeEnum.DEF;
                    break;

                case "attack":
                    type = StatTypeEnum.ATK;
                    break;

                case "hp":
                    type = StatTypeEnum.HP;
                    break;
                }
                BaseStats.Add(type, stat.BaseValue);
                EffortStats.Add(type, stat.Effort);
            }
        }
コード例 #3
0
        public bool LoadTableAndChart(StatSalesType[] modelData, StatTypeEnum statType, ChartTypeEnum chartType, ViewTypeEnum viewType, FilterTypeEnum filterType, bool isCount, bool isUseCodeInName)
        {
            try
            {
                var parameters = new List <ReportParameter>
                {
                    new ReportParameter("ChartType", chartType.ToString()),
                    new ReportParameter("Symbol", isCount?" ":"€")
                };

                var reportDataSource = new ReportDataSource
                {
                    Name  = "ChartDataSet",
                    Value = ModelToChartDataService.GetChartData(modelData, statType, viewType, chartType, filterType, isCount, isUseCodeInName)
                };

                _report.Reset();
                _report.ProcessingMode = ProcessingMode.Local;
                _report.LocalReport.ReportEmbeddedResource = "ChartStat.ChartUI.Reports.ReportWithTable.rdlc";
                _report.LocalReport.SetParameters(parameters);
                _report.LocalReport.DataSources.Add(reportDataSource);
                _report.RefreshReport();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #4
0
        public static ChartDataType[] GetChartData(StatSalesType[] modelData, StatTypeEnum statType, ViewTypeEnum viewType, ChartTypeEnum chartType, FilterTypeEnum filterType,
                                                   bool isCount, bool isUseCodeInName)
        {
            switch (statType)
            {
            case StatTypeEnum.StatSales:
                return(GetViewData(modelData.Select(row => new ChartDataType
                {
                    DateTime = row.Date,
                    DateName = row.Date.ToString(),
                    Name = isUseCodeInName ? string.Format("{0} ({1})", row.Name, row.Number) : row.FullName,
                    CodeBar = isCount ? row.Qty.ToString() : string.Format("{0} €", GetTotal(row)),
                    Price = GetTotal(row),
                    Count = isCount ? row.Qty : GetTotal(row)
                }), viewType, chartType, filterType));

            case StatTypeEnum.StatSalesWithReceipts:
                return(GetViewData(modelData.Select(row => new ChartDataType
                {
                    DateTime = row.Date,
                    DateName = row.Date.ToString(),
                    Name = isUseCodeInName ? string.Format("{0} ({1})", row.Name, row.Number) : row.FullName,
                    CodeBar = isCount ? row.Qty.ToString() : string.Format("{0} €", GetPrix(row)),
                    Price = GetPrix(row),
                    Count = isCount ? row.Qty : GetPrix(row)
                }), viewType, chartType, filterType));
            }

            return(null);
        }
コード例 #5
0
 public void Reset(StatTypeEnum resetLevel)
 {
     foreach (Basestat stat in stats)
     {
         stat.Reset(resetLevel);
     }
 }
コード例 #6
0
 private int GetStatValue(StatTypeEnum type, int _base, int iv, int ev)
 {
     return(type switch
     {
         StatTypeEnum.HP => (((2 * _base + iv + (ev / 4)) * Level) / 100) + Level + 10,
         StatTypeEnum.SPEED => (((2 * _base + iv + (ev / 4)) * Level) / 100) + 5,
         _ => (((2 * _base + iv + (ev / 4)) * Level) / 100) + 5
     });
コード例 #7
0
    public void TestDontResetTotal()
    {
        StatType testStat = new StatType();

        testStat.Type = StatTypeEnum.ST_Total;
        StatTypeEnum resetLevel = StatTypeEnum.ST_Turn;

        Assert.AreEqual(false, testStat.NeedsReset(resetLevel));
    }
コード例 #8
0
    public void TestResetTurn()
    {
        StatType testStat = new StatType();

        testStat.Type = StatTypeEnum.ST_Turn;
        StatTypeEnum ResetLevel = StatTypeEnum.ST_Total;

        Assert.AreEqual(true, testStat.NeedsReset(ResetLevel));
    }
コード例 #9
0
ファイル: CommonFunctions.cs プロジェクト: majeretft/Talented
        /// <summary>
        /// Apply specific stat value to calculation result
        /// </summary>
        /// <param name="type">Stat type</param>
        /// <param name="value">Stat value</param>
        /// <param name="calculationResult">Current calculation result</param>
        public void ApplyStatValue(StatTypeEnum type, double value, CalculationResult calculationResult)
        {
            if (calculationResult == null)
                throw new ArgumentNullException("calculationResult");

            switch (type)
            {
                case StatTypeEnum.Agility:
                    calculationResult.Agility += value;
                    break;

                // This case is included here to append attack power provided by "icy bow" talent
                case StatTypeEnum.Attack:
                    calculationResult.AttackPowerLow += value;
                    calculationResult.AttackPowerTop += value;
                    break;
                case StatTypeEnum.Cunning:
                    calculationResult.Cunning += value;
                    break;
                case StatTypeEnum.Durability:
                    calculationResult.Durability += value;
                    break;
                case StatTypeEnum.Health:
                    calculationResult.Health += value;
                    break;
                case StatTypeEnum.HealthSteal:
                    calculationResult.HealthSteal += value;
                    break;
                case StatTypeEnum.Intelligence:
                    calculationResult.Intelligence += value;
                    break;
                case StatTypeEnum.Mana:
                    calculationResult.Mana += value;
                    break;
                case StatTypeEnum.Moveement:
                    calculationResult.MovementSpeed += value;
                    break;
                case StatTypeEnum.RegenerationHP:
                    calculationResult.RegenerationHP += value;
                    break;
                case StatTypeEnum.RegenerationMP:
                    calculationResult.RegenerationMP += value;
                    break;
                case StatTypeEnum.Strength:
                    calculationResult.Strength += value;
                    break;
                case StatTypeEnum.Will:
                    calculationResult.Will += value;
                    break;
                default:
                    throw new CalculationException(string.Format("Found unsupported stat type: {0}", type));
            }
        }
コード例 #10
0
        /// <summary>
        /// Calculate and append dependent properties values to final result
        /// </summary>
        /// <param name="calculationResult">Current calculation result</param>
        /// <param name="mainStat">Main stat</param>
        /// <param name="attackModifier">Attack modifier value (percent)</param>
        public void Calculate(CalculationResult calculationResult, StatTypeEnum mainStat, double attackModifier)
        {
            if (calculationResult == null)
                throw new ArgumentNullException("calculationResult");

            var armorPenetration = CalculateArmorPenetration(calculationResult.Agility, calculationResult.Cunning);
            calculationResult.ArmorPenetration = armorPenetration;

            var mainStatValue = GetMainStatValue(calculationResult, mainStat);
            var attackPower = CalculateAttackPower(mainStatValue, attackModifier);
            calculationResult.AttackPowerLow += attackPower.LowBorderValue;
            calculationResult.AttackPowerTop += attackPower.TopBorderValue;

            var attackSpeed = CalculateAttackSpeed(calculationResult.Agility);
            calculationResult.AttackSpeed = attackSpeed;

            var critChance = CalculateCritChance(calculationResult.Cunning);
            calculationResult.CritChance = critChance;

            var armor = CalculateResistance(calculationResult.Will, calculationResult.Durability);
            calculationResult.MagicalResistance = armor.First(x => x.Key == StatTypeEnum.Will).Value;
            calculationResult.PhisycalResistance = armor.First(x => x.Key == StatTypeEnum.Durability).Value;
        }
コード例 #11
0
 public void Add(StatTypeEnum type, int value) => Values.AddOrUpdate(type, value, (key, v) => v = value);
コード例 #12
0
 public int this[StatTypeEnum type] => Values[type];
コード例 #13
0
        /// <summary>
        /// Get value of main stat from calculation result
        /// </summary>
        /// <param name="calculationResult">Current calculation result</param>
        /// <param name="mainStat">Main stat type</param>
        /// <returns>Main stat value</returns>
        private double GetMainStatValue(CalculationResult calculationResult, StatTypeEnum mainStat)
        {
            if (calculationResult == null)
                throw new ArgumentNullException("calculationResult");

            switch (mainStat)
            {
                case StatTypeEnum.Strength: return calculationResult.Strength;
                case StatTypeEnum.Intelligence: return calculationResult.Intelligence;
                default: throw new CalculationException(string.Format("Unsupported mainstat type found: {0}", mainStat.ToString()));
            }
        }