コード例 #1
0
        protected override void Calculate()
        {
            float tableSize      = 0.0f;
            float bonusHit       = Lookup.BonusHitPercentage(Character, Stats);
            float bonusExpertise = Lookup.BonusExpertisePercentage(Character, Stats);

            // Miss
            Miss       = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Miss) - bonusHit));
            tableSize += Miss;
            // Avoidance
            if (Lookup.IsAvoidable(Ability))
            {
                // Dodge
                Dodge      = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Dodge) - bonusExpertise));
                tableSize += Dodge;
                // Parry
                Parry      = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Parry) - bonusExpertise));
                tableSize += Parry;
            }
            // Glancing Blow
            if (Ability == Ability.None)
            {
                Glance     = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Glance)));
                tableSize += Glance;
            }
            // Critical Hit
            Critical   = Math.Min(1.0f - tableSize, Lookup.BonusCritPercentage(Character, Stats, Ability));
            tableSize += Critical;
            // Normal Hit
            Hit = Math.Max(0.0f, 1.0f - tableSize);
        }
コード例 #2
0
        protected override void Calculate()
        {
            float tableSize      = 0.0f;
            float bonusHit       = Lookup.BonusHitPercentage(Player);
            float bonusExpertise = Lookup.BonusExpertisePercentage(Player);

            // Miss
            Miss       = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Player, HitResult.Miss) - bonusHit));
            tableSize += Miss;
            // Avoidance
            if (Lookup.IsAvoidable(Ability))
            {
                // Dodge
                Dodge      = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Player, HitResult.Dodge) - bonusExpertise));
                tableSize += Dodge;
                // Parry
                Parry      = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Player, HitResult.Parry) - bonusExpertise));
                tableSize += Parry;
            }
            if (Ability == Ability.None)
            {
                // White Glancing Blow
                Glance     = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Player, HitResult.Glance)));
                tableSize += Glance;

                // White Critical Hits
                Critical = Math.Max(0.0f, Math.Min(1.0f - tableSize, Lookup.BonusCritPercentage(Player, Ability))
                                    - Lookup.TargetAvoidanceChance(Player, HitResult.Crit));
                tableSize += Critical;
            }
            else
            {
                // Yellow Critical Hits, Two-Roll
                Critical = Math.Min(1.0f - tableSize, this.AnyHit * (Math.Max(0.0f, Lookup.BonusCritPercentage(Player, Ability)
                                                                              - Lookup.TargetAvoidanceChance(Player, HitResult.Crit))));
                tableSize += Critical;
            }
            // Normal Hit
            Hit = Math.Max(0.0f, 1.0f - tableSize);
        }
コード例 #3
0
ファイル: CombatTable.cs プロジェクト: tsebalj1/rawr
        protected override void Calculate()
        {
            float tableSize      = 0.0f;
            float bonusHit       = Lookup.BonusHitPercentage(Character, Stats);
            float bonusExpertise = Lookup.BonusExpertisePercentage(Character, Stats);

            // Miss
            Miss       = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Miss, Options.TargetLevel) - bonusHit));
            tableSize += Miss;
            // Avoidance
            if (Lookup.IsAvoidable(Ability))
            {
                // Dodge
                Dodge      = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Dodge, Options.TargetLevel) - bonusExpertise));
                tableSize += Dodge;
                // Parry
                Parry      = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Parry, Options.TargetLevel) - bonusExpertise));
                tableSize += Parry;
            }
            if (Ability == Ability.None)
            {
                // White Glancing Blow
                Glance     = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Glance, Options.TargetLevel)));
                tableSize += Glance;

                // White Critical Hits
                Critical = Math.Max(0.0f, Math.Min(1.0f - tableSize, Lookup.BonusCritPercentage(Character, Stats, Ability, Options.TargetLevel))
                                    - Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Crit, Options.TargetLevel));
                tableSize += Critical;
            }
            else
            {
                // Yellow Critical Hits
                Critical = Math.Min(1.0f - tableSize, Math.Max(0.0f, Lookup.BonusCritPercentage(Character, Stats, Ability, Options.TargetLevel)
                                                               - Lookup.TargetAvoidanceChance(Character, Stats, HitResult.Crit, Options.TargetLevel)));
                tableSize += Critical;
            }
            // Normal Hit
            Hit = Math.Max(0.0f, 1.0f - tableSize);
        }