Skip to content

Commit bc0ad33

Browse files
committed
pets/guardian dynamic inheritance
1 parent 2a190b5 commit bc0ad33

7 files changed

Lines changed: 32 additions & 25 deletions

File tree

sim/shaman/earth_elemental_pet.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"time"
55

66
"github.com/wowsims/mop/sim/core"
7+
"github.com/wowsims/mop/sim/core/proto"
78
"github.com/wowsims/mop/sim/core/stats"
89
)
910

@@ -44,15 +45,18 @@ func (shaman *Shaman) NewEarthElemental(isGuardian bool) *EarthElemental {
4445
AutoSwingMelee: true,
4546
})
4647

47-
earthElemental.OnPetEnable = earthElemental.enable
48+
earthElemental.OnPetEnable = earthElemental.enable(isGuardian)
4849
earthElemental.OnPetDisable = earthElemental.disable
4950

5051
shaman.AddPet(earthElemental)
5152

5253
return earthElemental
5354
}
5455

55-
func (earthElemental *EarthElemental) enable(sim *core.Simulation) {
56+
func (earthElemental *EarthElemental) enable(isGuardian bool) func(*core.Simulation) {
57+
return func(sim *core.Simulation) {
58+
earthElemental.EnableDynamicStats(earthElemental.shamanOwner.earthElementalStatInheritance(isGuardian))
59+
}
5660
}
5761

5862
func (earthElemental *EarthElemental) disable(sim *core.Simulation) {
@@ -104,20 +108,20 @@ func (shaman *Shaman) earthElementalBaseStats(isGuardian bool) stats.Stats {
104108

105109
func (shaman *Shaman) earthElementalStatInheritance(isGuardian bool) core.PetStatInheritance {
106110
return func(ownerStats stats.Stats) stats.Stats {
107-
ownerSpellHitPercent := ownerStats[stats.SpellHitPercent]
108-
ownerPhysicalHitPercent := ownerStats[stats.PhysicalHitPercent]
111+
ownerHitRating := ownerStats[stats.HitRating]
109112
ownerExpertiseRating := ownerStats[stats.ExpertiseRating]
110113
ownerSpellCritPercent := ownerStats[stats.SpellCritPercent]
111114
ownerPhysicalCritPercent := ownerStats[stats.PhysicalCritPercent]
112115
ownerHasteRating := ownerStats[stats.HasteRating]
113116

117+
power := core.TernaryFloat64(shaman.Spec == proto.Spec_SpecEnhancementShaman, ownerStats[stats.AttackPower]*0.65, ownerStats[stats.SpellPower])
118+
114119
return stats.Stats{
115120
stats.Stamina: ownerStats[stats.Stamina] * core.TernaryFloat64(isGuardian, 1, 1.5),
116-
stats.AttackPower: shaman.GetSpellPowerValue(shaman.EarthElementalTotem) * core.TernaryFloat64(isGuardian, EarthElementalSpellPowerScaling, EarthElementalSpellPowerScaling*1.8),
121+
stats.AttackPower: power * core.TernaryFloat64(isGuardian, EarthElementalSpellPowerScaling, EarthElementalSpellPowerScaling*1.8),
117122

118-
stats.PhysicalHitPercent: max(ownerSpellHitPercent/2, ownerPhysicalHitPercent),
119-
stats.SpellHitPercent: max(ownerSpellHitPercent, ownerExpertiseRating/core.ExpertisePerQuarterPercentReduction/4+ownerPhysicalHitPercent),
120-
stats.ExpertiseRating: max(ownerSpellHitPercent*core.ExpertisePerQuarterPercentReduction*2, ownerExpertiseRating),
123+
stats.HitRating: ownerHitRating,
124+
stats.ExpertiseRating: ownerExpertiseRating,
121125
stats.SpellCritPercent: ownerSpellCritPercent,
122126
stats.PhysicalCritPercent: ownerPhysicalCritPercent,
123127
stats.HasteRating: ownerHasteRating,

sim/shaman/earth_elemental_totem.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ func (shaman *Shaman) registerEarthElementalTotem(isGuardian bool) {
1717
Label: "Earth Elemental Totem",
1818
ActionID: actionID,
1919
Duration: totalDuration,
20-
OnReset: func(aura *core.Aura, sim *core.Simulation) {
21-
shaman.EarthElemental.ChangeStatInheritance(shaman.EarthElemental.shamanOwner.earthElementalStatInheritance(isGuardian))
22-
},
2320
})
2421

2522
shaman.EarthElementalTotem = shaman.RegisterSpell(core.SpellConfig{

sim/shaman/enhancement/spirit_wolves.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ func (enh *EnhancementShaman) NewSpiritWolf(index int) *SpiritWolf {
5858
AutoSwingMelee: true,
5959
})
6060

61+
spiritWolf.OnPetEnable = func(sim *core.Simulation) {
62+
spiritWolf.EnableDynamicStats(spiritWolf.shamanOwner.makeStatInheritance())
63+
}
64+
6165
enh.AddPet(spiritWolf)
6266

6367
return spiritWolf
@@ -68,8 +72,7 @@ func (enh *EnhancementShaman) makeStatInheritance() core.PetStatInheritance {
6872
return stats.Stats{
6973
stats.Stamina: ownerStats[stats.Stamina] * 0.3,
7074
stats.AttackPower: ownerStats[stats.AttackPower] * 0.5,
71-
stats.PhysicalHitPercent: ownerStats[stats.PhysicalHitPercent],
72-
stats.SpellHitPercent: ownerStats[stats.SpellHitPercent],
75+
stats.HitRating: ownerStats[stats.HitRating],
7376
stats.ExpertiseRating: ownerStats[stats.ExpertiseRating],
7477
stats.PhysicalCritPercent: ownerStats[stats.PhysicalCritPercent],
7578
stats.SpellCritPercent: ownerStats[stats.SpellCritPercent],

sim/shaman/fire_elemental_pet.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"time"
55

66
"github.com/wowsims/mop/sim/core"
7+
"github.com/wowsims/mop/sim/core/proto"
78
"github.com/wowsims/mop/sim/core/stats"
89
)
910

@@ -48,15 +49,18 @@ func (shaman *Shaman) NewFireElemental(isGuardian bool) *FireElemental {
4849
})
4950
fireElemental.AutoAttacks.MHConfig().ProcMask |= core.ProcMaskSpellDamage
5051

51-
fireElemental.OnPetEnable = fireElemental.enable
52+
fireElemental.OnPetEnable = fireElemental.enable(isGuardian)
5253
fireElemental.OnPetDisable = fireElemental.disable
5354

5455
shaman.AddPet(fireElemental)
5556

5657
return fireElemental
5758
}
5859

59-
func (fireElemental *FireElemental) enable(sim *core.Simulation) {
60+
func (fireElemental *FireElemental) enable(isGuardian bool) func(*core.Simulation) {
61+
return func(sim *core.Simulation) {
62+
fireElemental.EnableDynamicStats(fireElemental.shamanOwner.fireElementalStatInheritance(isGuardian))
63+
}
6064
}
6165

6266
func (fireElemental *FireElemental) disable(sim *core.Simulation) {
@@ -124,20 +128,20 @@ func (shaman *Shaman) fireElementalBaseStats(isGuardian bool) stats.Stats {
124128

125129
func (shaman *Shaman) fireElementalStatInheritance(isGuardian bool) core.PetStatInheritance {
126130
return func(ownerStats stats.Stats) stats.Stats {
127-
ownerSpellHitPercent := ownerStats[stats.SpellHitPercent]
128-
ownerPhysicalHitPercent := ownerStats[stats.PhysicalHitPercent]
131+
ownerHitRating := ownerStats[stats.HitRating]
129132
ownerExpertiseRating := ownerStats[stats.ExpertiseRating]
130133
ownerSpellCritPercent := ownerStats[stats.SpellCritPercent]
131134
ownerPhysicalCritPercent := ownerStats[stats.PhysicalCritPercent]
132135
ownerHasteRating := ownerStats[stats.HasteRating]
133136

137+
power := core.TernaryFloat64(shaman.Spec == proto.Spec_SpecEnhancementShaman, ownerStats[stats.AttackPower]*0.65, ownerStats[stats.SpellPower])
138+
134139
return stats.Stats{
135140
stats.Stamina: ownerStats[stats.Stamina] * core.TernaryFloat64(isGuardian, 0.75, 0.75*1.2),
136-
stats.SpellPower: shaman.GetSpellPowerValue(shaman.FireElementalTotem) * core.TernaryFloat64(isGuardian, FireElementalSpellPowerScaling, FireElementalSpellPowerScaling*1.8),
141+
stats.SpellPower: power * core.TernaryFloat64(isGuardian, FireElementalSpellPowerScaling, FireElementalSpellPowerScaling*1.8),
137142

138-
stats.PhysicalHitPercent: max(ownerSpellHitPercent/2, ownerPhysicalHitPercent),
139-
stats.SpellHitPercent: max(ownerSpellHitPercent, ownerExpertiseRating/core.ExpertisePerQuarterPercentReduction/4+ownerPhysicalHitPercent),
140-
stats.ExpertiseRating: max(ownerSpellHitPercent*core.ExpertisePerQuarterPercentReduction*2, ownerExpertiseRating),
143+
stats.HitRating: ownerHitRating,
144+
stats.ExpertiseRating: ownerExpertiseRating,
141145
stats.SpellCritPercent: ownerSpellCritPercent,
142146
stats.PhysicalCritPercent: ownerPhysicalCritPercent,
143147
stats.HasteRating: ownerHasteRating,

sim/shaman/fire_elemental_totem.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ func (shaman *Shaman) registerFireElementalTotem(isGuardian bool) {
1717
Label: "Fire Elemental Totem",
1818
ActionID: actionID,
1919
Duration: totalDuration,
20-
OnReset: func(aura *core.Aura, sim *core.Simulation) {
21-
shaman.FireElemental.ChangeStatInheritance(shaman.FireElemental.shamanOwner.fireElementalStatInheritance(isGuardian))
22-
},
2320
})
2421

2522
shaman.FireElementalTotem = shaman.RegisterSpell(core.SpellConfig{

ui/core/components/detailed_results/timeline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ export class Timeline extends ResultComponent {
411411
});
412412

413413
return {
414-
maxDps: dpsLogs[maxIndex(dpsLogs.map(l => l.dps))!].dps,
414+
maxDps: dpsLogs[maxIndex(dpsLogs.map(l => l.dps))!]?.dps,
415415
tooltipHandler: (dataPointIndex: number) => {
416416
const log = dpsLogs[dataPointIndex];
417417
return this.dpsTooltip(log, true, unit, colorOverride);

ui/core/proto_utils/action_id.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,8 @@ const petNameToActionId: Record<string, ActionId> = {
10821082
'Gnomish Flame Turret': ActionId.fromItemId(23841),
10831083
'Greater Earth Elemental': ActionId.fromSpellId(2062),
10841084
'Greater Fire Elemental': ActionId.fromSpellId(2894),
1085+
'Primal Earth Elemental': ActionId.fromSpellId(2062),
1086+
'Primal Fire Elemental': ActionId.fromSpellId(2894),
10851087
'Mirror Image': ActionId.fromSpellId(55342),
10861088
'Mirror Image T12 2pc': ActionId.fromSpellId(55342),
10871089
'Rune Weapon': ActionId.fromSpellId(49028),

0 commit comments

Comments
 (0)