Skip to content

Commit

Permalink
Merge pull request #3841 from wowsims/apl
Browse files Browse the repository at this point in the history
Prevent mismatch between selected prepull pot in consumes vs rotation
  • Loading branch information
jimmyt857 authored Oct 7, 2023
2 parents 8092e66 + ae9b757 commit 949bd38
Show file tree
Hide file tree
Showing 28 changed files with 831 additions and 810 deletions.
1 change: 1 addition & 0 deletions proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ message SpellStats {
bool has_dot = 4; // Whether this spell applies a DoT effect.
bool has_shield = 6; // Whether this spell applies a shield effect.
bool prepull_only = 5; // Whether this spell may only be cast during prepull.
bool encounter_only = 8; // Whether this spell may only be cast during the encounter (not prepull).
}
message APLActionStats {
repeated string warnings = 1;
Expand Down
3 changes: 2 additions & 1 deletion sim/core/apl.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ func (unit *Unit) newAPLRotation(config *proto.APLRotation) *APLRotation {
if prepotSpell != nil {
found := false
for _, prepullAction := range rotation.allPrepullActions() {
if castSpellAction, ok := prepullAction.impl.(*APLActionCastSpell); ok && castSpellAction.spell == prepotSpell {
if castSpellAction, ok := prepullAction.impl.(*APLActionCastSpell); ok &&
(castSpellAction.spell == prepotSpell || castSpellAction.spell.Flags.Matches(SpellFlagPotion)) {
found = true
}
}
Expand Down
4 changes: 4 additions & 0 deletions sim/core/consumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,10 @@ func (character *Character) HasAlchStone() bool {
func makePotionActivation(potionType proto.Potions, character *Character, potionCD *Timer) MajorCooldown {
mcd := makePotionActivationInternal(potionType, character, potionCD)
if mcd.Spell != nil {
// Mark as 'Encounter Only' so that users are forced to select the generic Potion
// placeholder action instead of specific potion spells, in APL prepull. This
// prevents a mismatch between Consumes and Rotation settings.
mcd.Spell.Flags |= SpellFlagEncounterOnly | SpellFlagPotion
oldApplyEffects := mcd.Spell.ApplyEffects
mcd.Spell.ApplyEffects = func(sim *Simulation, target *Unit, spell *Spell) {
oldApplyEffects(sim, target, spell)
Expand Down
7 changes: 5 additions & 2 deletions sim/core/flags.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package core

import (
"github.com/wowsims/wotlk/sim/core/proto"
"github.com/wowsims/wotlk/sim/core/stats"
"math/bits"
"strconv"

"github.com/wowsims/wotlk/sim/core/proto"
"github.com/wowsims/wotlk/sim/core/stats"
)

type ProcMask uint32
Expand Down Expand Up @@ -192,6 +193,8 @@ const (
SpellFlagMCD // Indicates this spell is a MajorCooldown.
SpellFlagNoOnDamageDealt // Disables OnSpellHitDealt and OnPeriodicDamageDealt aura callbacks for this spell.
SpellFlagPrepullOnly // Indicates this spell should only be used during prepull. Not enforced, just a signal for the APL UI.
SpellFlagEncounterOnly // Indicates this spell should only be used during the encounter (not prepull). Not enforced, just a signal for the APL UI.
SpellFlagPotion // Indicates this spell is a potion spell.
SpellFlagPrepullPotion // Indicates this spell is the prepull potion.
SpellFlagCombatPotion // Indicates this spell is the combat potion.

Expand Down
1 change: 1 addition & 0 deletions sim/core/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ func (unit *Unit) GetMetadata() *proto.UnitMetadata {
HasDot: spell.dots != nil || spell.aoeDot != nil,
HasShield: spell.shields != nil || spell.selfShield != nil,
PrepullOnly: spell.Flags.Matches(SpellFlagPrepullOnly),
EncounterOnly: spell.Flags.Matches(SpellFlagEncounterOnly),
}
})

Expand Down
Loading

0 comments on commit 949bd38

Please sign in to comment.