Skip to content

Commit

Permalink
Infinite moonfire settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Hugues Guinot committed Jul 3, 2023
1 parent c1fe848 commit 3c0f0cb
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 39 deletions.
6 changes: 6 additions & 0 deletions proto/druid.proto
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ message BalanceDruid {
BeforeLunar = 1;
MaximizeMf = 2;
MultidotMf = 3;
ExtendFishingForLunar = 4;
ExtendFishingForSolar = 5;
ExtendDuringLunar = 6;
ExtendDuringSolar = 7;
ExtendAlways = 8;
ExtendOutsideSolar = 9;
}
MfUsage mf_usage = 2;

Expand Down
48 changes: 24 additions & 24 deletions sim/druid/balance/TestBalance.results
Original file line number Diff line number Diff line change
Expand Up @@ -1461,43 +1461,43 @@ dps_results: {
dps_results: {
key: "TestBalance-Settings-Tauren-P3-MultidotBoth-FullBuffs-LongMultiTarget"
value: {
dps: 16256.40839
tps: 16951.98236
dps: 16479.04305
tps: 17422.54397
}
}
dps_results: {
key: "TestBalance-Settings-Tauren-P3-MultidotBoth-FullBuffs-LongSingleTarget"
value: {
dps: 11528.8527
tps: 11328.72745
dps: 11561.20256
tps: 11350.54693
}
}
dps_results: {
key: "TestBalance-Settings-Tauren-P3-MultidotBoth-FullBuffs-ShortSingleTarget"
value: {
dps: 12614.26593
tps: 11926.93122
dps: 12654.58396
tps: 11941.75566
}
}
dps_results: {
key: "TestBalance-Settings-Tauren-P3-MultidotBoth-NoBuffs-LongMultiTarget"
value: {
dps: 6794.14228
tps: 6638.80545
dps: 6180.54015
tps: 6155.95692
}
}
dps_results: {
key: "TestBalance-Settings-Tauren-P3-MultidotBoth-NoBuffs-LongSingleTarget"
value: {
dps: 6125.59481
tps: 6035.28061
dps: 5762.64388
tps: 5668.21022
}
}
dps_results: {
key: "TestBalance-Settings-Tauren-P3-MultidotBoth-NoBuffs-ShortSingleTarget"
value: {
dps: 8053.41926
tps: 7754.87068
dps: 8014.50027
tps: 7708.51871
}
}
dps_results: {
Expand Down Expand Up @@ -1545,43 +1545,43 @@ dps_results: {
dps_results: {
key: "TestBalance-Settings-Tauren-P3-MultidotMf-FullBuffs-LongMultiTarget"
value: {
dps: 15129.31368
tps: 18203.89754
dps: 15141.36697
tps: 18241.12396
}
}
dps_results: {
key: "TestBalance-Settings-Tauren-P3-MultidotMf-FullBuffs-LongSingleTarget"
value: {
dps: 11557.53996
tps: 11358.05688
dps: 11562.26174
tps: 11357.11536
}
}
dps_results: {
key: "TestBalance-Settings-Tauren-P3-MultidotMf-FullBuffs-ShortSingleTarget"
value: {
dps: 12480.80823
tps: 11793.51103
dps: 12543.04422
tps: 11831.93853
}
}
dps_results: {
key: "TestBalance-Settings-Tauren-P3-MultidotMf-NoBuffs-LongMultiTarget"
value: {
dps: 5661.69929
tps: 5990.8852
dps: 5149.36248
tps: 5524.59243
}
}
dps_results: {
key: "TestBalance-Settings-Tauren-P3-MultidotMf-NoBuffs-LongSingleTarget"
value: {
dps: 6124.46162
tps: 6036.38606
dps: 5914.25999
tps: 5821.51506
}
}
dps_results: {
key: "TestBalance-Settings-Tauren-P3-MultidotMf-NoBuffs-ShortSingleTarget"
value: {
dps: 8032.00837
tps: 7735.81108
dps: 8054.47292
tps: 7751.69765
}
}
dps_results: {
Expand Down
46 changes: 43 additions & 3 deletions sim/druid/balance/rotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func (moonkin *BalanceDruid) rotation(sim *core.Simulation) (*core.Spell, *core.

var lunarUptime time.Duration
shouldRefreshMf := moonkin.Moonfire.CurDot().RemainingDuration(sim) <= 0
maximizeMf := !(rotation.MfUsage == proto.BalanceDruid_Rotation_NoMf) && !(rotation.MfUsage == proto.BalanceDruid_Rotation_BeforeLunar)
hasLunarFury := core.Ternary(moonkin.Equip[core.ItemSlotRanged].ID == 47670, true, false)
lunarIsActive := moonkin.LunarEclipseProcAura.IsActive()

Expand All @@ -50,7 +51,7 @@ func (moonkin *BalanceDruid) rotation(sim *core.Simulation) (*core.Spell, *core.
return moonkin.Starfire, target
} else if rotation.UseBattleRes && sim.GetRemainingDuration().Seconds() < moonkin.RebirthTiming && moonkin.Rebirth.IsReady(sim) {
return moonkin.Rebirth, target
} else if rotation.MfUsage == proto.BalanceDruid_Rotation_MaximizeMf && shouldRefreshMf && hasLunarFury {
} else if maximizeMf && shouldRefreshMf && hasLunarFury {
return moonkin.Moonfire, target
} else if moonkin.Talents.ForceOfNature && moonkin.ForceOfNature.IsReady(sim) && !lunarIsActive {
moonkin.useTrinkets(stats.SpellPower, sim, target)
Expand Down Expand Up @@ -122,6 +123,12 @@ func (moonkin *BalanceDruid) rotation(sim *core.Simulation) (*core.Spell, *core.
// Eclipse
if solarIsActive || lunarIsActive {
if lunarIsActive {
canExtendMf := rotation.MfUsage == proto.BalanceDruid_Rotation_ExtendAlways || rotation.MfUsage == proto.BalanceDruid_Rotation_ExtendOutsideSolar || rotation.MfUsage == proto.BalanceDruid_Rotation_ExtendDuringLunar
if canExtendMf && moonkin.ExtendingMoonfireStacks == 0 {
if extendTarget := moonkin.tryExtendMoonfire(sim); extendTarget != nil {
return moonkin.Moonfire, extendTarget
}
}
if (rotation.UseSmartCooldowns && lunarUptime > 10*time.Second) || sim.GetRemainingDuration() < 15*time.Second {
moonkin.castMajorCooldown(moonkin.hyperSpeedMCD, sim, target)
moonkin.castMajorCooldown(moonkin.potionSpeedMCD, sim, target)
Expand All @@ -131,17 +138,25 @@ func (moonkin *BalanceDruid) rotation(sim *core.Simulation) (*core.Spell, *core.
}
}
return moonkin.Starfire, target
} else if solarIsActive && rotation.WrathUsage == proto.BalanceDruid_Rotation_RegularWrath {
} else if solarIsActive {
if moonkin.MoonkinT84PCAura.IsActive() {
if moonkin.MoonkinT84PCAura.RemainingDuration(sim) < solarUptime {
return moonkin.Starfire, target
}
}
canExtendMf := rotation.MfUsage == proto.BalanceDruid_Rotation_ExtendAlways || rotation.MfUsage == proto.BalanceDruid_Rotation_ExtendDuringSolar
if canExtendMf && moonkin.ExtendingMoonfireStacks == 0 {
if extendTarget := moonkin.tryExtendMoonfire(sim); extendTarget != nil {
return moonkin.Moonfire, extendTarget
}
}
if (rotation.UseSmartCooldowns && solarUptime > 10*time.Second) || sim.GetRemainingDuration() < 15*time.Second {
moonkin.castMajorCooldown(moonkin.potionWildMagicMCD, sim, target)
moonkin.useTrinkets(stats.SpellCrit, sim, target)
}
return moonkin.Wrath, target
if rotation.WrathUsage == proto.BalanceDruid_Rotation_RegularWrath {
return moonkin.Wrath, target
}
}
}
if rotation.MfUsage == proto.BalanceDruid_Rotation_BeforeLunar && lunarICD < 2*time.Second && shouldRefreshMf {
Expand All @@ -153,10 +168,25 @@ func (moonkin *BalanceDruid) rotation(sim *core.Simulation) (*core.Spell, *core.
}
}

canExtendMf := rotation.MfUsage == proto.BalanceDruid_Rotation_ExtendAlways || rotation.MfUsage == proto.BalanceDruid_Rotation_ExtendOutsideSolar

fishingForLunar := lunarICD <= solarICD
if rotation.EclipsePrio == proto.BalanceDruid_Rotation_Solar {
fishingForLunar = lunarICD < solarICD
}

if fishingForLunar && (canExtendMf || rotation.MfUsage == proto.BalanceDruid_Rotation_ExtendFishingForLunar) && moonkin.ExtendingMoonfireStacks == 0 {
if extendTarget := moonkin.tryExtendMoonfire(sim); extendTarget != nil {
return moonkin.Moonfire, extendTarget
}
}

if !fishingForLunar && (canExtendMf || rotation.MfUsage == proto.BalanceDruid_Rotation_ExtendFishingForSolar) && moonkin.ExtendingMoonfireStacks == 0 {
if extendTarget := moonkin.tryExtendMoonfire(sim); extendTarget != nil {
return moonkin.Moonfire, extendTarget
}
}

// Non-Eclipse
eclipseShuffle := rotation.EclipseShuffling && lunarICD == 0 && solarICD == 0
if eclipseShuffle && moonkin.LastCast == moonkin.Wrath && rotation.UseStarfire {
Expand Down Expand Up @@ -195,3 +225,13 @@ func (moonkin *BalanceDruid) useTrinkets(stat stats.Stat, sim *core.Simulation,
moonkin.castMajorCooldown(moonkin.onUseTrinket2.Cooldown, sim, target)
}
}

func (moonkin *BalanceDruid) tryExtendMoonfire(sim *core.Simulation) *core.Unit {
for range sim.Encounter.Targets {
if moonkin.Moonfire.CurDot().RemainingDuration(sim) <= 0 {
return moonkin.CurrentTarget
}
moonkin.CurrentTarget = sim.Environment.NextTargetUnit(moonkin.CurrentTarget)
}
return nil
}
19 changes: 10 additions & 9 deletions sim/druid/druid.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,16 @@ type Druid struct {

ProcOoc func(sim *core.Simulation)

LunarICD core.Cooldown
SolarICD core.Cooldown
Treant1 *TreantPet
Treant2 *TreantPet
Treant3 *TreantPet

form DruidForm
disabledMCDs []*core.MajorCooldown
OwlkinFrenzyTimings []float64
ExtendingMoonfireStacks int
LunarICD core.Cooldown
SolarICD core.Cooldown
Treant1 *TreantPet
Treant2 *TreantPet
Treant3 *TreantPet
OwlkinFrenzyTimings []float64

form DruidForm
disabledMCDs []*core.MajorCooldown
}

type SelfBuffs struct {
Expand Down
1 change: 1 addition & 0 deletions sim/druid/moonfire.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func (druid *Druid) registerMoonfireSpell() {
baseDamage := sim.Roll(406, 476) + 0.15*spell.SpellPower()
result := spell.CalcDamage(sim, target, baseDamage, spell.OutcomeMagicHitAndCrit)
if result.Landed() {
druid.ExtendingMoonfireStacks = 3
dot := spell.Dot(target)
dot.NumberOfTicks = numTicks
dot.Apply(sim)
Expand Down
5 changes: 2 additions & 3 deletions sim/druid/starfire.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func (druid *Druid) registerStarfireSpell() {
core.TernaryFloat64(druid.Equip[core.ItemSlotRanged].ID == 40321, 165, 0) // Shooting Star

hasGlyph := druid.HasMajorGlyph(proto.DruidMajorGlyph_GlyphOfStarfire)
maxMoonfireTicks := druid.moonfireTicks() + core.TernaryInt32(hasGlyph, 3, 0)

druid.Starfire = druid.RegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 48465},
Expand Down Expand Up @@ -52,8 +51,8 @@ func (druid *Druid) registerStarfireSpell() {
druid.EarthAndMoonAura.Activate(sim)
}
moonfireDot := druid.Moonfire.Dot(target)
if hasGlyph && moonfireDot.IsActive() && moonfireDot.NumberOfTicks < maxMoonfireTicks {
moonfireDot.NumberOfTicks += 1
if hasGlyph && moonfireDot.IsActive() && druid.ExtendingMoonfireStacks > 0 {
druid.ExtendingMoonfireStacks -= 1
moonfireDot.UpdateExpires(moonfireDot.ExpiresAt() + time.Second*3)
}
}
Expand Down
7 changes: 7 additions & 0 deletions ui/balance_druid/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ export const BalanceDruidRotationConfig = {
{ name: 'Before lunar', value: MfUsage.BeforeLunar },
{ name: 'Maximize', value: MfUsage.MaximizeMf },
{ name: 'Multidot', value: MfUsage.MultidotMf },
{ name: 'Extend fishing for lunar', value: MfUsage.ExtendFishingForLunar },
{ name: 'Extend fishing for solar', value: MfUsage.ExtendFishingForSolar },
{ name: 'Extend during lunar', value: MfUsage.ExtendDuringLunar },
{ name: 'Extend during solar', value: MfUsage.ExtendDuringSolar },
{ name: 'Extend always', value: MfUsage.ExtendAlways },
{ name: 'Extend outside solar', value: MfUsage.ExtendOutsideSolar },

],
showWhen: (player: Player<Spec.SpecBalanceDruid>) => player.getRotation().type == RotationType.Manual,
}),
Expand Down

0 comments on commit 3c0f0cb

Please sign in to comment.