Ejemplo n.º 1
0
        /// <summary>
        /// Get the actual melee damage effect after glance, crit, hit and stuff are accounted for.
        /// </summary>
        /// <param name="baseDamage">The raw damage</param>
        /// <param name="chances">The chances for other things to modify it</param>
        /// <param name="randomizer">A randomizer</param>
        /// <returns></returns>
        public static WeaponHit GetFinalizedPhysicalDamage(int baseDamage, SkillChances chances, IRandomizer randomizer)
        {
            // MISS :<
            if (!RandomUtils.DidEventHappen(chances.HitChance, randomizer))
            {
                return(new Miss(MissReason.Miss));
            }

            // CRIT :)
            if (RandomUtils.DidEventHappen(chances.CritChance, randomizer))
            {
                return(new WeaponCrit(baseDamage));
            }


            // GLANCE :(
            if (RandomUtils.DidEventHappen(chances.GlanceChance, randomizer))
            {
                return(new WeaponGlance(baseDamage));
            }


            // BASE :|
            return(new WeaponHit(baseDamage));
        }
Ejemplo n.º 2
0
        public override SkillEffects ComputeEffects(SkillForecast forecast, IRandomizer randomizer)
        {
            var defender    = forecast.Defender;
            var parryChance = defender.GetStat(StatType.ProjectileParryChance);
            var didParry    = RandomUtils.DidEventHappen(parryChance.Value, randomizer);

            if (didParry)
            {
                return(new SkillEffects(
                           new List <IEffect> {
                    new Miss(MissReason.Parry)
                }
                           ));
            }

            var baseDamage = forecast.Hit.BaseDamage;
            var hit        = DamageUtils.GetFinalizedPhysicalDamage(baseDamage, forecast.Chances, randomizer);

            return(new SkillEffects(new List <IEffect>()
            {
                hit
            }));
        }