Skip to content

Commit

Permalink
Clean up now that no more spells use old mana cost
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyt857 committed Jan 12, 2023
1 parent 73aee51 commit 32eeb16
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 39 deletions.
24 changes: 0 additions & 24 deletions sim/core/cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,6 @@ func (spell *Spell) wrapCastFuncResources(config CastConfig, onCastComplete Cast
}

switch spell.ResourceType {
case stats.Mana:
return func(sim *Simulation, target *Unit) bool {
spell.CurCast.Cost = spell.ApplyCostModifiers(spell.CurCast.Cost)
if spell.Unit.CurrentMana() < spell.CurCast.Cost {
if sim.Log != nil && !spell.Flags.Matches(SpellFlagNoLogs) {
spell.Unit.Log(sim, "Failed casting %s, not enough mana. (Current Mana = %0.03f, Mana Cost = %0.03f)",
spell.ActionID, spell.Unit.CurrentMana(), spell.CurCast.Cost)
}
return false
}

// Mana is subtracted at the end of the cast.
onCastComplete(sim, target)
return true
}
case stats.Rage:
return func(sim *Simulation, target *Unit) bool {
spell.CurCast.Cost = spell.ApplyCostModifiers(spell.CurCast.Cost)
Expand Down Expand Up @@ -306,15 +291,6 @@ func (spell *Spell) makeCastFuncWait(config CastConfig, onCastComplete CastFunc)
spell.Cost.SpendCost(sim, spell)
oldOnCastComplete2(sim, target)
}
} else if spell.ResourceType == stats.Mana && spell.DefaultCast.Cost != 0 {
oldOnCastComplete2 := onCastComplete
onCastComplete = func(sim *Simulation, target *Unit) {
if spell.CurCast.Cost > 0 {
spell.Unit.SpendMana(sim, spell.CurCast.Cost, spell.ResourceMetrics)
spell.Unit.PseudoStats.FiveSecondRuleRefreshTime = sim.CurrentTime + time.Second*5
}
oldOnCastComplete2(sim, target)
}
}

if spell.DefaultCast.ChannelTime > 0 {
Expand Down
2 changes: 0 additions & 2 deletions sim/core/spell.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ func (unit *Unit) RegisterSpell(config SpellConfig) *Spell {

if spell.Cost == nil {
switch spell.ResourceType {
case stats.Mana:
spell.ResourceMetrics = spell.Unit.NewManaMetrics(spell.ActionID)
case stats.Rage:
spell.ResourceMetrics = spell.Unit.NewRageMetrics(spell.ActionID)
case stats.Energy:
Expand Down
23 changes: 10 additions & 13 deletions sim/druid/faerie_fire.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"time"

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

func (druid *Druid) registerFaerieFireSpell() {
actionID := core.ActionID{SpellID: 770}
resourceType := stats.Mana
baseCost := 0.08 * druid.BaseMana
manaCostOptions := core.ManaCostOptions{
BaseCost: 0.08,
}
gcd := core.GCDDefault
ignoreHaste := false
cd := core.Cooldown{}
Expand All @@ -19,8 +19,7 @@ func (druid *Druid) registerFaerieFireSpell() {

if druid.InForm(Cat | Bear) {
actionID = core.ActionID{SpellID: 16857}
resourceType = 0
baseCost = 0
manaCostOptions = core.ManaCostOptions{}
gcd = time.Second
ignoreHaste = true
flags = core.SpellFlagNone
Expand All @@ -34,17 +33,15 @@ func (druid *Druid) registerFaerieFireSpell() {
druid.FaerieFireAura = core.FaerieFireAura(druid.CurrentTarget, druid.Talents.ImprovedFaerieFire)

druid.FaerieFire = druid.RegisterSpell(core.SpellConfig{
ActionID: actionID,
SpellSchool: core.SpellSchoolNature,
ProcMask: core.ProcMaskSpellDamage,
ResourceType: resourceType,
BaseCost: baseCost,
Flags: flags,
ActionID: actionID,
SpellSchool: core.SpellSchoolNature,
ProcMask: core.ProcMaskSpellDamage,
Flags: flags,

ManaCost: manaCostOptions,
Cast: core.CastConfig{
DefaultCast: core.Cast{
Cost: baseCost,
GCD: gcd,
GCD: gcd,
},
IgnoreHaste: ignoreHaste,
CD: cd,
Expand Down

0 comments on commit 32eeb16

Please sign in to comment.