Пример #1
0
        private Dictionary <Element, int> GenerateDamage(Player player, IWeaponItem weapon)
        {
            var weaponDamage = weapon.GenerateDamage();

            foreach (var pair in weaponDamage.ToArray())
            {
                weaponDamage[pair.Key] = AttackHelper.CalculateDamage(pair.Value, pair.Key, player);
            }

            return(weaponDamage);
        }
Пример #2
0
        private StyledLine[] GetWeaponDetails(IWeaponItem weapon)
        {
            var result = new List <StyledLine>
            {
                new StyledLine
                {
                    $"Accuracy: {weapon.Accuracy + Player.AccuracyBonus}%"
                },
                StyledLine.Empty
            };

            foreach (Element element in Enum.GetValues(typeof(Element)))
            {
                var maxDamage = WeaponItem.GetMaxDamage(weapon, element);
                var minDamage = WeaponItem.GetMinDamage(weapon, element);

                maxDamage = AttackHelper.CalculateDamage(maxDamage, element, Player);
                minDamage = AttackHelper.CalculateDamage(minDamage, element, Player);

                if (maxDamage == 0 && minDamage == 0)
                {
                    continue;
                }

                var damageLine = new StyledLine
                {
                    new StyledString($"{TextHelper.GetElementName(element)}",
                                     TextHelper.GetElementColor(element)),
                    " Damage: ",
                    $"{minDamage} - {maxDamage}"
                };

                result.Add(damageLine);
            }

            return(result.ToArray());
        }