Exemplo n.º 1
0
        public ICalculatedDamageInfo[] CalculateCharacterMDamage(IAttackInfo info)
        {
            var random = new Rotational <uint>(new uint[RND_SIZE]);

            RndGenForCharacter.Next(random.Array);

            return(Array.Empty <ICalculatedDamageInfo>());
        }
Exemplo n.º 2
0
        public ICalculatedDamageInfo[] CalculateCharacterPDamage(IAttackInfo info)
        {
            var random             = new Rotational <uint>(new uint[RND_SIZE]);
            var skillTemplate      = info.SkillID > 0 ? _skillTemplates.Retrieve(info.SkillID).Result : null;
            var skillLevelTemplate = info.SkillID > 0 ? skillTemplate.LevelData[info.SkillLevel] : null;
            var attackCount        = skillLevelTemplate != null ? skillLevelTemplate.AttackCount : 1;
            var result             = new ICalculatedDamageInfo[attackCount];

            RndGenForCharacter.Next(random.Array);

            var userStats = info.User.Stats;
            var mobStats  = info.Mob.Stats;
            var userLevel = info.User.Character.Level;
            var mobLevel  = info.Mob.Info.Level;
            var sqrtACC   = Math.Sqrt(userStats.PACC);
            var sqrtEVA   = Math.Sqrt(mobStats.EVA);
            var hitRate   = sqrtACC - sqrtEVA + 100 + userStats.Ar * (sqrtACC - sqrtEVA + 100) / 100;

            hitRate = Math.Min(hitRate, 100);

            if (mobLevel > userLevel)
            {
                hitRate -= 5 * (mobLevel - userLevel);
            }

            for (var i = 0; i < attackCount; i++)
            {
                random.Skip();

                if (hitRate < GetRandomInRange(random.Next(), 0, 100))
                {
                    result[i] = new CalculatedDamageInfo(0);
                    continue;
                }

                var damage   = GetRandomInRange(random.Next(), userStats.DamageMin, userStats.DamageMax);
                var critical = false;

                if (mobLevel > userLevel)
                {
                    damage *= (100d - (mobLevel - userLevel)) / 100d;
                }
                ;

                damage *= (100d - (mobStats.PDR * userStats.IMDr / -100 + mobStats.PDR)) / 100d;

                if (skillLevelTemplate != null)
                {
                    damage *= skillLevelTemplate.Damage / 100d;
                }

                if (userStats.Cr > 0 && GetRandomInRange(random.Next(), 0, 100) <= userStats.Cr)
                {
                    var cd = (int)GetRandomInRange(random.Next(), userStats.CDMin, userStats.CDMax) / 100d;

                    critical = true;
                    damage  += (int)damage * cd;
                }

                damage    = Math.Min(Math.Max(damage, 1), 999999);
                result[i] = new CalculatedDamageInfo((int)damage, critical);
            }

            return(result);
        }
Exemplo n.º 3
0
 public void SkipCalculationForCharacterDamage() => RndGenForCharacter.Next(new uint[RND_SIZE]);