Skip to content

Commit

Permalink
fix sindragosa ai crash (wowsims#3944)
Browse files Browse the repository at this point in the history
  • Loading branch information
lime-green authored Oct 26, 2023
1 parent d944ccf commit e343f1d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion sim/encounters/icc/sindragosa25h_ai.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,12 @@ func (ai *Sindragosa25HAI) registerMysticBuffetAuras() {
}

ai.MysticBuffetAuras = make([]*core.Aura, 0)
pendingActions := make([]*core.PendingAction, 50)
i := 0

for _, party := range ai.Target.Env.Raid.Parties {
for _, player := range party.PlayersAndPets {
i += 1
character := player.GetCharacter()
aura := character.GetOrRegisterAura(core.Aura{
Label: "Mystic Buffet",
Expand All @@ -178,7 +181,12 @@ func (ai *Sindragosa25HAI) registerMysticBuffetAuras() {
OnGain: func(aura *core.Aura, sim *core.Simulation) {
period := time.Second * 6
numTicks := int(sim.GetRemainingDuration() / period)
core.StartPeriodicAction(sim, core.PeriodicActionOptions{

if pendingActions[i-1] != nil {
pendingActions[i-1].Cancel(sim)
}

pendingActions[i-1] = core.StartPeriodicAction(sim, core.PeriodicActionOptions{
NumTicks: numTicks,
Period: period,
OnAction: func(sim *core.Simulation) {
Expand All @@ -187,6 +195,14 @@ func (ai *Sindragosa25HAI) registerMysticBuffetAuras() {
},
})
},
OnExpire: func(aura *core.Aura, sim *core.Simulation) {
pendingActions[i-1].Cancel(sim)
},
OnReset: func(aura *core.Aura, sim *core.Simulation) {
if pendingActions[i-1] != nil {
pendingActions[i-1].Cancel(sim)
}
},
})
ai.MysticBuffetAuras = append(ai.MysticBuffetAuras, aura)
}
Expand Down

0 comments on commit e343f1d

Please sign in to comment.