Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow adding auras to finalized envs #420

Merged
merged 2 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sim/core/aura.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ func (at *auraTracker) HasActiveAura(label string) bool {
}

func (at *auraTracker) registerAura(unit *Unit, aura Aura) *Aura {
if unit.Env != nil && unit.Env.IsFinalized() {
panic("Tried to add new aura in a finalized environment!")
}
if unit == nil {
panic("Aura unit is required!")
}
Expand Down
8 changes: 7 additions & 1 deletion sim/core/buffs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,12 @@ func BloodlustAura(character *Character, actionTag int32) *Aura {
Duration: time.Minute * 10,
})

for _, pet := range character.Pets {
if !pet.IsGuardian() {
BloodlustAura(&pet.Character, actionTag)
}
}

aura := character.GetOrRegisterAura(Aura{
Label: "Bloodlust-" + actionID.String(),
Tag: BloodlustAuraTag,
Expand All @@ -1223,7 +1229,7 @@ func BloodlustAura(character *Character, actionTag int32) *Aura {
aura.Unit.MultiplyResourceRegenSpeed(sim, 1.3)
for _, pet := range character.Pets {
if pet.IsEnabled() && !pet.IsGuardian() {
BloodlustAura(&pet.Character, actionTag).Activate(sim)
pet.GetAura(aura.Label).Activate(sim)
}
}

Expand Down
20 changes: 10 additions & 10 deletions sim/druid/feral/rotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,18 +263,18 @@ func (cat *FeralDruid) preRotationCleanup(sim *core.Simulation) bool {

// Bundle a leave-weave with the Cat Form GCD if possible
if cat.InForm(druid.Cat) && cat.Rotation.MeleeWeave {
timeToMove := core.DurationFromSeconds((cat.CatCharge.MinRange + 1 - cat.DistanceFromTarget) / cat.GetMovementSpeed()) + cat.ReactionTime
timeToMove := core.DurationFromSeconds((cat.CatCharge.MinRange+1-cat.DistanceFromTarget)/cat.GetMovementSpeed()) + cat.ReactionTime

if cat.CatCharge.TimeToReady(sim) < timeToMove {
cat.MoveTo(cat.CatCharge.MinRange + 1, sim)
cat.NextRotationAction(sim, sim.CurrentTime + cat.ReactionTime)
cat.MoveTo(cat.CatCharge.MinRange+1, sim)
cat.NextRotationAction(sim, sim.CurrentTime+cat.ReactionTime)
}
}

// To prep for the above, pre-position to max melee range during Bear Form GCD
if cat.InForm(druid.Bear) {
cat.MoveTo(core.MaxMeleeRange - 1, sim)
cat.NextRotationAction(sim, sim.CurrentTime + cat.ReactionTime)
cat.MoveTo(core.MaxMeleeRange-1, sim)
cat.NextRotationAction(sim, sim.CurrentTime+cat.ReactionTime)
}

return false
Expand Down Expand Up @@ -427,7 +427,7 @@ func (cat *FeralDruid) terminateBearWeave(sim *core.Simulation, isClearcast bool
}

// Also terminate early if Feral Charge is off cooldown to avoid accumulating delays for Ravage opportunities
if cat.Rotation.MeleeWeave && cat.CatCharge.IsReady(sim) && (sim.CurrentTime - cat.lastShift > core.GCDDefault) {
if cat.Rotation.MeleeWeave && cat.CatCharge.IsReady(sim) && (sim.CurrentTime-cat.lastShift > core.GCDDefault) {
return true
}

Expand All @@ -450,8 +450,8 @@ func (cat *FeralDruid) terminateBearWeave(sim *core.Simulation, isClearcast bool

// Also add a condition to prevent extending a weave if we don't have enough time
// to spend the pooled Energy thus far.
energyToDump := finalEnergy + 1.5 * regenRate // need to include Cat Form GCD here
timeToDump := earliestWeaveEnd + core.DurationFromSeconds(math.Floor(energyToDump / cat.Shred.DefaultCast.Cost))
energyToDump := finalEnergy + 1.5*regenRate // need to include Cat Form GCD here
timeToDump := earliestWeaveEnd + core.DurationFromSeconds(math.Floor(energyToDump/cat.Shred.DefaultCast.Cost))
return (timeToDump >= sim.Duration) || cat.tfExpectedBefore(sim, timeToDump)
}

Expand Down Expand Up @@ -567,7 +567,7 @@ func (cat *FeralDruid) doRotation(sim *core.Simulation) (bool, time.Duration) {
roarNow := curCp >= 1 && (!cat.SavageRoarAura.IsActive() || cat.clipRoar(sim, isExecutePhase))

// Ravage calc
ravageNow := cat.Ravage.CanCast(sim, cat.CurrentTarget) && !isClearcast && (curEnergy + regenRate < cat.MaximumEnergy())
ravageNow := cat.Ravage.CanCast(sim, cat.CurrentTarget) && !isClearcast && (curEnergy+regenRate < cat.MaximumEnergy())

// Pooling calcs
ripRefreshPending := ripDot.IsActive() && (ripDot.RemainingDuration(sim) < simTimeRemain-baseEndThresh) && (curCp >= core.TernaryInt32(isExecutePhase, 1, rotation.MinCombosForRip))
Expand Down Expand Up @@ -680,7 +680,7 @@ func (cat *FeralDruid) doRotation(sim *core.Simulation) (bool, time.Duration) {
} else if bearWeaveNow {
cat.readyToShift = true
} else if meleeWeaveNow {
cat.MoveTo(cat.CatCharge.MinRange + 1, sim)
cat.MoveTo(cat.CatCharge.MinRange+1, sim)
} else if ravageNow {
cat.Ravage.Cast(sim, cat.CurrentTarget)
return false, 0
Expand Down
Loading