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

Add global potion timer to fix Tinker potions #1256

Merged
merged 1 commit into from
Dec 15, 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
4 changes: 4 additions & 0 deletions sim/core/character.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ type Character struct {
defensiveTrinketCD *Timer
offensiveTrinketCD *Timer
conjuredCD *Timer
potionCD *Timer

Pets []*Pet // cached in AddPet, for advance()
}
Expand Down Expand Up @@ -691,6 +692,9 @@ func (character *Character) GetOffensiveTrinketCD() *Timer {
func (character *Character) GetConjuredCD() *Timer {
return character.GetOrInitTimer(&character.conjuredCD)
}
func (character *Character) GetPotionCD() *Timer {
return character.GetOrInitTimer(&character.potionCD)
}
func (character *Character) GetMatchingTrinketProcAuras(statTypesToMatch []stats.Stat, minIcd time.Duration) []*StatBuffAura {
includeIcdFilter := (minIcd > 0)

Expand Down
32 changes: 24 additions & 8 deletions sim/core/consumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ func registerPotionCD(agent Agent, consumes *proto.Consumes) {
defaultPotion := consumes.DefaultPotion
startingPotion := consumes.PrepopPotion

potionCD := character.NewTimer()
potionCD := character.GetPotionCD()
// if character.Spec == proto.Spec_SpecBalanceDruid {
// // Create both pots spells so they will be selectable in APL UI regardless of settings.
// speedMCD := makePotionActivation(proto.Potions_PotionOfSpeed, character, potionCD)
Expand Down Expand Up @@ -477,6 +477,10 @@ func makePotionActivationInternal(potionType proto.Potions, character *Character
Timer: potionCD,
Duration: time.Minute * 60, // Infinite CD
},
SharedCD: Cooldown{
Timer: character.GetPotionCD(),
Duration: time.Minute * 60,
},
}

if potionType == proto.Potions_MythicalHealingPotion {
Expand Down Expand Up @@ -976,15 +980,16 @@ func registerTinkerHandsCD(agent Agent, consumes *proto.Consumes) {
})
case proto.TinkerHands_TinkerHandsQuickflipDeflectionPlates:
// Enchant: 4180, Spell: 82176 - Quickflip Deflection Plates
actionID := ActionID{SpellID: 82176}
statAura := character.NewTemporaryStatsAura(
"Quickflip Deflection Plates Buff",
ActionID{SpellID: 82176},
actionID,
stats.Stats{stats.Armor: 1500},
time.Second*12,
)

spell := character.GetOrRegisterSpell(SpellConfig{
ActionID: ActionID{SpellID: 82176},
ActionID: actionID,
SpellSchool: SpellSchoolPhysical,
Flags: SpellFlagNoOnCastComplete,

Expand All @@ -1007,8 +1012,9 @@ func registerTinkerHandsCD(agent Agent, consumes *proto.Consumes) {
})
case proto.TinkerHands_TinkerHandsTazikShocker:
// Enchant: 4181, Spell: 82180 - Tazik Shocker
actionID := ActionID{SpellID: 82179}
spell := character.GetOrRegisterSpell(SpellConfig{
ActionID: ActionID{SpellID: 82179},
ActionID: actionID,
SpellSchool: SpellSchoolNature,
Flags: SpellFlagNoOnCastComplete,

Expand Down Expand Up @@ -1038,9 +1044,10 @@ func registerTinkerHandsCD(agent Agent, consumes *proto.Consumes) {
})
case proto.TinkerHands_TinkerHandsSpinalHealingInjector:
// Enchant: 4182, Spell: 82184 - Spinal Healing Injector
healthMetric := character.NewHealthMetrics(ActionID{SpellID: 82184})
actionID := ActionID{SpellID: 82184}
healthMetric := character.NewHealthMetrics(actionID)
spell := character.GetOrRegisterSpell(SpellConfig{
ActionID: ActionID{SpellID: 82184},
ActionID: actionID,
SpellSchool: SpellSchoolPhysical,
Flags: SpellFlagNoOnCastComplete | SpellFlagCombatPotion,

Expand All @@ -1049,6 +1056,10 @@ func registerTinkerHandsCD(agent Agent, consumes *proto.Consumes) {
Timer: character.NewTimer(),
Duration: time.Second * 60,
},
SharedCD: Cooldown{
Timer: character.GetPotionCD(),
Duration: time.Minute * 60,
},
},

ApplyEffects: func(sim *Simulation, unit *Unit, spell *Spell) {
Expand All @@ -1068,9 +1079,10 @@ func registerTinkerHandsCD(agent Agent, consumes *proto.Consumes) {
})
case proto.TinkerHands_TinkerHandsZ50ManaGulper:
// Enchant: 4183, Spell: 82186 - Z50 Mana Gulper
manaMetric := character.NewManaMetrics(ActionID{SpellID: 82186})
actionId := ActionID{SpellID: 82186}
manaMetric := character.NewManaMetrics(actionId)
spell := character.GetOrRegisterSpell(SpellConfig{
ActionID: ActionID{SpellID: 82186},
ActionID: actionId,
SpellSchool: SpellSchoolPhysical,
Flags: SpellFlagNoOnCastComplete | SpellFlagPotion,

Expand All @@ -1081,6 +1093,10 @@ func registerTinkerHandsCD(agent Agent, consumes *proto.Consumes) {
Timer: character.NewTimer(),
Duration: time.Second * 60,
},
SharedCD: Cooldown{
Timer: character.GetPotionCD(),
Duration: time.Minute * 60,
},
},

ApplyEffects: func(sim *Simulation, unit *Unit, spell *Spell) {
Expand Down
Loading