Пример #1
0
        private static Affix ConvertFomItemAffixJson(ItemAffixJson source)
        {
            if (source == null || source.Name == null)
            {
                return(null);
            }

            var name   = source.Name;
            var attack = new Attack("", 0);

            if (source.AttackData.ContainsKey("element"))
            {
                attack = attack.Brand((Element)Enum.Parse(typeof(Element), source.AttackData["element"].ToString()));
            }

            if (source.AttackData.ContainsKey("damageBonus"))
            {
                attack = attack.AddDamage((double)source.AttackData["damageBonus"]);
            }

            if (source.AttackData.ContainsKey("strikeBonus"))
            {
                attack = attack.AddStrike((double)source.AttackData["strikeBonus"]);
            }

            if (source.AttackData.ContainsKey("damageScale"))
            {
                attack = attack.MultiplyDamage((double)source.AttackData["damageScale"]);
            }


            var affix = new Affix(name, attack);

            return(affix);
        }
Пример #2
0
        public override Attack ModifyAttack(Attack attack, Actor defender)
        {
            var weapon = Hero.Equipment.Weapon;

            if (weapon != null)
            {
                // TODO: Should combat apply to ranged attacks?
                attack = attack.AddDamage(Combat.Level);

                if (Masteries.ContainsKey(weapon.type.category))
                {
                    var mastery = Masteries[weapon.type.category];
                    if (mastery != null)
                    {
                        attack = attack.MultiplyDamage(1.0 + mastery.Level * 0.1);
                    }
                }

                return(attack);
            }
            return(attack.AddDamage(Fighting.Level));
        }