Skip to content

Commit

Permalink
[Warlock] Fix multi-dot logic
Browse files Browse the repository at this point in the history
* Only remove curses that are active on the current target
* Fixes #955
  • Loading branch information
Marcel Ellermann committed Aug 3, 2024
1 parent ba8b255 commit 7e8cdfb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions sim/warlock/apl_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func (value *APLValueWarlockShouldRecastDrainSoul) GetBool(sim *core.Simulation)
}

curseRefresh := time.Duration(0)
if warlock.ActiveCurseAura != nil {
curseRefresh = warlock.ActiveCurseAura.RemainingDuration(sim)
if warlock.ActiveCurseAura.Get(value.warlock.CurrentTarget) != nil {
curseRefresh = warlock.ActiveCurseAura.Get(value.warlock.CurrentTarget).RemainingDuration(sim)
}

hauntRefresh := 1000 * time.Second
Expand Down
36 changes: 18 additions & 18 deletions sim/warlock/curses.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ func (warlock *Warlock) getCurseOfAgonyBaseConfig(rank int) core.SpellConfig {
warlock.InvocationRefresh(sim, spell.Dot(target))
}
} else {
if warlock.ActiveCurseAura != nil {
warlock.ActiveCurseAura.Deactivate(sim)
if warlock.ActiveCurseAura.Get(target) != nil {
warlock.ActiveCurseAura.Get(target).Deactivate(sim)
}
dot := spell.Dot(target)
dot.Apply(sim)
warlock.ActiveCurseAura = dot.Aura
warlock.ActiveCurseAura[target.UnitIndex] = dot.Aura

if hasMarkOfChaosRune {
warlock.applyMarkOfChaosDebuff(sim, target, dot.Duration)
Expand Down Expand Up @@ -182,11 +182,11 @@ func (warlock *Warlock) registerCurseOfRecklessnessSpell() {
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
result := spell.CalcOutcome(sim, target, spell.OutcomeMagicHit)
if result.Landed() {
if warlock.ActiveCurseAura != nil {
warlock.ActiveCurseAura.Deactivate(sim)
if warlock.ActiveCurseAura.Get(target) != nil {
warlock.ActiveCurseAura.Get(target).Deactivate(sim)
}
warlock.ActiveCurseAura = warlock.CurseOfRecklessnessAuras.Get(target)
warlock.ActiveCurseAura.Activate(sim)
warlock.ActiveCurseAura[target.UnitIndex] = warlock.CurseOfRecklessnessAuras.Get(target)
warlock.ActiveCurseAura.Get(target).Activate(sim)

if hasMarkOfChaosRune {
warlock.applyMarkOfChaosDebuff(sim, target, time.Minute*2)
Expand Down Expand Up @@ -246,11 +246,11 @@ func (warlock *Warlock) registerCurseOfElementsSpell() {
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
result := spell.CalcOutcome(sim, target, spell.OutcomeMagicHit)
if result.Landed() {
if warlock.ActiveCurseAura != nil {
warlock.ActiveCurseAura.Deactivate(sim)
if warlock.ActiveCurseAura.Get(target) != nil {
warlock.ActiveCurseAura.Get(target).Deactivate(sim)
}
warlock.ActiveCurseAura = warlock.CurseOfElementsAuras.Get(target)
warlock.ActiveCurseAura.Activate(sim)
warlock.ActiveCurseAura[target.UnitIndex] = warlock.CurseOfElementsAuras.Get(target)
warlock.ActiveCurseAura.Get(target).Activate(sim)
}
},

Expand Down Expand Up @@ -303,11 +303,11 @@ func (warlock *Warlock) registerCurseOfShadowSpell() {
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
result := spell.CalcOutcome(sim, target, spell.OutcomeMagicHit)
if result.Landed() {
if warlock.ActiveCurseAura != nil {
warlock.ActiveCurseAura.Deactivate(sim)
if warlock.ActiveCurseAura.Get(target) != nil {
warlock.ActiveCurseAura.Get(target).Deactivate(sim)
}
warlock.ActiveCurseAura = warlock.CurseOfShadowAuras.Get(target)
warlock.ActiveCurseAura.Activate(sim)
warlock.ActiveCurseAura[target.UnitIndex] = warlock.CurseOfShadowAuras.Get(target)
warlock.ActiveCurseAura.Get(target).Activate(sim)
}
},

Expand Down Expand Up @@ -404,12 +404,12 @@ func (warlock *Warlock) registerCurseOfDoomSpell() {
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
result := spell.CalcOutcome(sim, target, spell.OutcomeMagicHit)
if result.Landed() {
if warlock.ActiveCurseAura != nil {
warlock.ActiveCurseAura.Deactivate(sim)
if warlock.ActiveCurseAura.Get(target) != nil {
warlock.ActiveCurseAura.Get(target).Deactivate(sim)
}
dot := spell.Dot(target)
dot.Apply(sim)
warlock.ActiveCurseAura = dot.Aura
warlock.ActiveCurseAura[target.UnitIndex] = dot.Aura

if hasMarkOfChaosRune {
warlock.applyMarkOfChaosDebuff(sim, target, dot.Duration)
Expand Down
8 changes: 4 additions & 4 deletions sim/warlock/tank/TestAffliction.results
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ dps_results: {
dps_results: {
key: "TestAffliction-Lvl25-Settings-Orc-p1.affi.tank-Affliction Warlock-p1.affi.tank-FullBuffs-Phase 1 Consumes-LongMultiTarget"
value: {
dps: 191.35704
tps: 831.42796
dps: 369.01708
tps: 1259.7812
}
}
dps_results: {
Expand All @@ -232,8 +232,8 @@ dps_results: {
dps_results: {
key: "TestAffliction-Lvl25-Settings-Orc-p1.affi.tank-Affliction Warlock-p1.affi.tank-NoBuffs-Phase 1 Consumes-LongMultiTarget"
value: {
dps: 146.62443
tps: 761.81619
dps: 277.79569
tps: 1078.12222
}
}
dps_results: {
Expand Down
4 changes: 2 additions & 2 deletions sim/warlock/warlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type Warlock struct {
Shadowflame *core.Spell
UnstableAffliction *core.Spell

ActiveCurseAura *core.Aura
ActiveCurseAura core.AuraArray
CurseOfElements *core.Spell
CurseOfElementsAuras core.AuraArray
CurseOfShadow *core.Spell
Expand Down Expand Up @@ -164,7 +164,7 @@ func (warlock *Warlock) AddRaidBuffs(raidBuffs *proto.RaidBuffs) {

func (warlock *Warlock) Reset(sim *core.Simulation) {
warlock.setDefaultActivePet()
warlock.ActiveCurseAura = nil
warlock.ActiveCurseAura = make([]*core.Aura, len(sim.Environment.AllUnits))

// warlock.ItemSwap.SwapItems(sim, []proto.ItemSlot{proto.ItemSlot_ItemSlotMainHand,
// proto.ItemSlot_ItemSlotOffHand, proto.ItemSlot_ItemSlotRanged}, false)
Expand Down

0 comments on commit 7e8cdfb

Please sign in to comment.