Пример #1
0
        public override string ToString()
        {
            string DataString = Data.RawValue.HasValue ? $": {Data}" : string.Empty;

            string DamageTypeString = string.Empty;

            if (DamageType != GameDamageType.Internal_None)
            {
                for (int i = 0; i + 1 < sizeof(int) * 8; i++)
                {
                    GameDamageType Value = (GameDamageType)(1 << i);

                    if (DamageType.HasFlag(Value))
                    {
                        if (DamageTypeString.Length > 0)
                        {
                            DamageTypeString += ", ";
                        }

                        DamageTypeString += Value.ToString();
                    }
                }

                DamageTypeString = $" ({DamageTypeString})";
            }

            string CombatSkillString = CombatSkill == GameCombatSkill.Internal_None ? string.Empty : $" ({CombatSkill})";

            return($"{Keyword}{DataString}{DamageTypeString}{CombatSkillString}");
        }
Пример #2
0
        public static float GetDamageReduction(this Ability ability, Unit target, DamageType damageType)
        {
            // TODO: modifiers

            if (damageType.HasFlag(DamageType.HealthRemoval))
            {
                return(0.0f);
            }

            var reduction = 0.0f;

            switch (damageType)
            {
            case DamageType.Magical:
                reduction = target.MagicDamageResist;
                break;

            case DamageType.Physical:
                reduction = target.DamageResist;
                break;
            }

            return(reduction);
        }
Пример #3
0
 protected virtual void OnDamageTypeChanged(DamageType oldValue, DamageType newValue)
 {
     ckbAcid.IsChecked        = newValue.HasFlag(DamageType.Acid);
     ckbBludgeoning.IsChecked = newValue.HasFlag(DamageType.Bludgeoning);
     ckbCold.IsChecked        = newValue.HasFlag(DamageType.Cold);
     ckbFire.IsChecked        = newValue.HasFlag(DamageType.Fire);
     ckbForce.IsChecked       = newValue.HasFlag(DamageType.Force);
     ckbLightning.IsChecked   = newValue.HasFlag(DamageType.Lightning);
     ckbNecrotic.IsChecked    = newValue.HasFlag(DamageType.Necrotic);
     ckbPiercing.IsChecked    = newValue.HasFlag(DamageType.Piercing);
     ckbPoison.IsChecked      = newValue.HasFlag(DamageType.Poison);
     ckbPsychic.IsChecked     = newValue.HasFlag(DamageType.Psychic);
     ckbRadiant.IsChecked     = newValue.HasFlag(DamageType.Radiant);
     ckbSlashing.IsChecked    = newValue.HasFlag(DamageType.Slashing);
     ckbThunder.IsChecked     = newValue.HasFlag(DamageType.Thunder);
 }