Skip to content

Commit ce9bf41

Browse files
authored
Merge pull request #100 from wowsims/guardian
Update avoidance DR for MoP
2 parents fe6f228 + e246a6b commit ce9bf41

3 files changed

Lines changed: 31 additions & 26 deletions

File tree

sim/core/avoid_dr.go

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
11
package core
22

33
import (
4+
"github.com/wowsims/mop/sim/core/proto"
45
"github.com/wowsims/mop/sim/core/stats"
56
)
67

7-
// Could be in constants.go, but they won't be used anywhere else
8-
// C values are divided by 100 so that we are working with 1% = 0.01
9-
// TODO: UPDATE FOR MOP
10-
// Reference for Cata values: https://web.archive.org/web/20130127084642/http://elitistjerks.com/f15/t29453-combat_ratings_level_85_cataclysm/
11-
const Diminish_k_Druid = 0.972
12-
const Diminish_k_Nondruid = 0.956
13-
const Diminish_Cd_Druid = 116.890707 / 100
14-
const Diminish_Cd_Nondruid = 65.631440 / 100
15-
const Diminish_Cp = 65.631440 / 100
16-
const Diminish_kCd_Druid = (Diminish_k_Druid * Diminish_Cd_Druid)
17-
const Diminish_kCd_Nondruid = (Diminish_k_Nondruid * Diminish_Cd_Nondruid)
18-
const Diminish_kCp = (Diminish_k_Nondruid * Diminish_Cp)
8+
type DiminishingReturnsConstants struct {
9+
k, c_p, c_d, c_b float64
10+
}
11+
12+
// https://github.com/raethkcj/MistsDiminishingReturns
13+
var AvoidanceDRByClass = map[proto.Class]DiminishingReturnsConstants{
14+
proto.Class_ClassWarrior: {0.956, 237.186, 90.6425, 150.376},
15+
proto.Class_ClassPaladin: {0.886, 237.186, 66.5675, 150.376},
16+
proto.Class_ClassHunter: {0.988, 0, 145.560, 0},
17+
proto.Class_ClassRogue: {0.988, 145.560, 145.560, 0},
18+
proto.Class_ClassPriest: {0.983, 0, 150.376, 0},
19+
proto.Class_ClassDeathKnight: {0.956, 237.186, 90.6425, 0},
20+
proto.Class_ClassShaman: {0.988, 145.560, 145.560, 0},
21+
proto.Class_ClassMonk: {1.422, 90.6425, 501.253, 0},
22+
proto.Class_ClassMage: {0.983, 0, 150.376, 0},
23+
proto.Class_ClassWarlock: {0.983, 0, 150.376, 0},
24+
proto.Class_ClassDruid: {1.222, 0, 150.376, 0},
25+
}
1926

2027
// Diminishing Returns for tank avoidance
2128
// Non-diminishing sources are added separately in spell outcome funcs
2229

2330
func (unit *Unit) GetDiminishedDodgeChance() float64 {
2431
// undiminished Dodge % = D
2532
// diminished Dodge % = (D * Cd)/((k*Cd) + D)
26-
dodgeChance := unit.stats[stats.DodgeRating] / DodgeRatingPerDodgePercent / 100
27-
28-
if unit.PseudoStats.CanParry {
29-
return (dodgeChance * Diminish_Cd_Nondruid) / (Diminish_kCd_Nondruid + dodgeChance)
30-
} else {
31-
return (dodgeChance * Diminish_Cd_Druid) / (Diminish_kCd_Druid + dodgeChance)
32-
}
33+
dodgePercent := unit.stats[stats.DodgeRating] / DodgeRatingPerDodgePercent
34+
return (dodgePercent * unit.avoidanceParams.c_d) / (unit.avoidanceParams.k * unit.avoidanceParams.c_d + dodgePercent) / 100
3335
}
3436

3537
func (unit *Unit) GetDiminishedParryChance() float64 {
3638
// undiminished Parry % = P
3739
// diminished Parry % = (P * Cp)/((k*Cp) + P)
38-
parryChance := unit.stats[stats.ParryRating] / ParryRatingPerParryPercent / 100
39-
return (parryChance * Diminish_Cp) / (Diminish_kCp + parryChance)
40+
parryPercent := unit.stats[stats.ParryRating] / ParryRatingPerParryPercent
41+
return (parryPercent * unit.avoidanceParams.c_p) / (unit.avoidanceParams.k * unit.avoidanceParams.c_p + parryPercent) / 100
4042
}
4143

42-
func (unit *Unit) GetDiminishedMissChance() float64 {
43-
// Defense Rating is gone in Cata, so there are no diminished sources of Miss
44-
return 0
44+
func (unit *Unit) GetDiminishedBlockChance() float64 {
45+
// undiminished Block % = B
46+
// diminished Block % = (B * Cb)/((k*Cb) + B)
47+
blockPercent := unit.stats[stats.BlockPercent]
48+
return (blockPercent * unit.avoidanceParams.c_b) / (unit.avoidanceParams.k * unit.avoidanceParams.c_b + blockPercent) / 100
4549
}

sim/core/character.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ func NewCharacter(party *Party, partyIndex int, player *proto.Player) Character
101101
Metrics: NewUnitMetrics(),
102102

103103
StatDependencyManager: stats.NewStatDependencyManager(),
104+
avoidanceParams: AvoidanceDRByClass[player.Class],
104105

105106
ReactionTime: time.Duration(max(player.ReactionTimeMs, 10)) * time.Millisecond,
106107
ChannelClipDelay: max(0, time.Duration(player.ChannelClipDelayMs)*time.Millisecond),

sim/core/unit.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ type Unit struct {
146146
AttackTables []*AttackTable
147147
DynamicDamageTakenModifiers []DynamicDamageTakenModifier
148148
Blockhandler func(sim *Simulation, spell *Spell, result *SpellResult)
149+
avoidanceParams DiminishingReturnsConstants
149150

150151
GCD *Timer
151152

@@ -715,14 +716,13 @@ func (unit *Unit) GetTotalParryChanceAsDefender(atkTable *AttackTable) float64 {
715716

716717
func (unit *Unit) GetTotalChanceToBeMissedAsDefender(atkTable *AttackTable) float64 {
717718
chance := atkTable.BaseMissChance +
718-
unit.GetDiminishedMissChance() +
719719
unit.PseudoStats.ReducedPhysicalHitTakenChance
720720
return math.Max(chance, 0.0)
721721
}
722722

723723
func (unit *Unit) GetTotalBlockChanceAsDefender(atkTable *AttackTable) float64 {
724724
chance := atkTable.BaseBlockChance +
725-
unit.GetStat(stats.BlockPercent)/100
725+
unit.GetDiminishedBlockChance()
726726
return math.Max(chance, 0.0)
727727
}
728728

0 commit comments

Comments
 (0)