Skip to content

Commit

Permalink
Merge pull request #3510 from wowsims/apl
Browse files Browse the repository at this point in the history
Add call of the elements shaman spell, and default preset for enhance
  • Loading branch information
jimmyt857 authored Aug 20, 2023
2 parents 9978faf + 6d53664 commit 1f37333
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 36 deletions.
3 changes: 3 additions & 0 deletions sim/shaman/shaman.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ func (shaman *Shaman) Initialize() {
shaman.registerWindfuryTotemSpell()
shaman.registerWrathOfAirTotemSpell()

// This registration must come after all the totems are registered
shaman.registerCallOfTheElements()

shaman.registerBloodlustCD()

if shaman.Totems.UseFireElemental && enableSnapshot && !shaman.IsUsingAPL {
Expand Down
128 changes: 95 additions & 33 deletions sim/shaman/totems.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,51 @@ func (shaman *Shaman) registerStoneskinTotemSpell() {
shaman.StoneskinTotem = shaman.RegisterSpell(config)
}

func (shaman *Shaman) registerCallOfTheElements() {
airTotem := shaman.getAirTotemSpell(shaman.Totems.Air)
earthTotem := shaman.getEarthTotemSpell(shaman.Totems.Earth)
fireTotem := shaman.getFireTotemSpell(shaman.Totems.Fire)
waterTotem := shaman.getWaterTotemSpell(shaman.Totems.Water)

totalManaCost := 0.0
if airTotem != nil {
totalManaCost += airTotem.DefaultCast.Cost
}
if earthTotem != nil {
totalManaCost += earthTotem.DefaultCast.Cost
}
if fireTotem != nil {
totalManaCost += fireTotem.DefaultCast.Cost
}
if waterTotem != nil {
totalManaCost += waterTotem.DefaultCast.Cost
}

shaman.RegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 66842},
Flags: core.SpellFlagAPL,

ExtraCastCondition: func(sim *core.Simulation, target *core.Unit) bool {
return shaman.CurrentMana() >= totalManaCost
},

ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
if airTotem != nil {
airTotem.Cast(sim, target)
}
if earthTotem != nil {
earthTotem.Cast(sim, target)
}
if fireTotem != nil {
fireTotem.Cast(sim, target)
}
if waterTotem != nil {
waterTotem.Cast(sim, target)
}
},
})
}

func (shaman *Shaman) NextTotemAt(_ *core.Simulation) time.Duration {
nextTotemAt := core.MinDuration(
core.MinDuration(shaman.NextTotemDrops[0], shaman.NextTotemDrops[1]),
Expand All @@ -149,42 +194,13 @@ func (shaman *Shaman) TryDropTotems(sim *core.Simulation) bool {
if sim.CurrentTime >= totemExpiration {
switch totemTypeIdx {
case AirTotem:
switch proto.AirTotem(nextDrop) {
case proto.AirTotem_WrathOfAirTotem:
spell = shaman.WrathOfAirTotem
case proto.AirTotem_WindfuryTotem:
spell = shaman.WindfuryTotem
}

spell = shaman.getAirTotemSpell(proto.AirTotem(nextDrop))
case EarthTotem:
switch proto.EarthTotem(nextDrop) {
case proto.EarthTotem_StrengthOfEarthTotem:
spell = shaman.StrengthOfEarthTotem
case proto.EarthTotem_TremorTotem:
spell = shaman.TremorTotem
case proto.EarthTotem_StoneskinTotem:
spell = shaman.StoneskinTotem
}

spell = shaman.getEarthTotemSpell(proto.EarthTotem(nextDrop))
case FireTotem:
switch proto.FireTotem(nextDrop) {
case proto.FireTotem_TotemOfWrath:
spell = shaman.TotemOfWrath
case proto.FireTotem_SearingTotem:
spell = shaman.SearingTotem
case proto.FireTotem_MagmaTotem:
spell = shaman.MagmaTotem
case proto.FireTotem_FlametongueTotem:
spell = shaman.FlametongueTotem
}

spell = shaman.getFireTotemSpell(proto.FireTotem(nextDrop))
case WaterTotem:
switch proto.WaterTotem(nextDrop) {
case proto.WaterTotem_ManaSpringTotem:
spell = shaman.ManaSpringTotem
case proto.WaterTotem_HealingStreamTotem:
spell = shaman.HealingStreamTotem
}
spell = shaman.getWaterTotemSpell(proto.WaterTotem(nextDrop))
}
}
if spell != nil {
Expand All @@ -201,3 +217,49 @@ func (shaman *Shaman) TryDropTotems(sim *core.Simulation) bool {
}
return casted
}

func (shaman *Shaman) getAirTotemSpell(totemType proto.AirTotem) *core.Spell {
switch totemType {
case proto.AirTotem_WrathOfAirTotem:
return shaman.WrathOfAirTotem
case proto.AirTotem_WindfuryTotem:
return shaman.WindfuryTotem
}
return nil
}

func (shaman *Shaman) getEarthTotemSpell(totemType proto.EarthTotem) *core.Spell {
switch totemType {
case proto.EarthTotem_StrengthOfEarthTotem:
return shaman.StrengthOfEarthTotem
case proto.EarthTotem_TremorTotem:
return shaman.TremorTotem
case proto.EarthTotem_StoneskinTotem:
return shaman.StoneskinTotem
}
return nil
}

func (shaman *Shaman) getFireTotemSpell(totemType proto.FireTotem) *core.Spell {
switch totemType {
case proto.FireTotem_TotemOfWrath:
return shaman.TotemOfWrath
case proto.FireTotem_SearingTotem:
return shaman.SearingTotem
case proto.FireTotem_MagmaTotem:
return shaman.MagmaTotem
case proto.FireTotem_FlametongueTotem:
return shaman.FlametongueTotem
}
return nil
}

func (shaman *Shaman) getWaterTotemSpell(totemType proto.WaterTotem) *core.Spell {
switch totemType {
case proto.WaterTotem_ManaSpringTotem:
return shaman.ManaSpringTotem
case proto.WaterTotem_HealingStreamTotem:
return shaman.HealingStreamTotem
}
return nil
}
31 changes: 28 additions & 3 deletions ui/enhancement_shaman/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import {
Debuffs,
CustomRotation,
CustomSpell,
ItemSwap,
ItemSpec,
Spec,
Faction,
} from '../core/proto/common.js';
import { SavedTalents } from '../core/proto/ui.js';
import { SavedRotation, SavedTalents } from '../core/proto/ui.js';
import { APLRotation } from '../core/proto/apl.js';

import { EnhancementShaman_Rotation as EnhancementShamanRotation, EnhancementShaman_Options as EnhancementShamanOptions, ShamanShield } from '../core/proto/shaman.js';
import {
Expand Down Expand Up @@ -89,6 +88,32 @@ export const DefaultRotation = EnhancementShamanRotation.create({
}),
});

export const ROTATION_DEFAULT = {
name: 'Default',
rotation: SavedRotation.create({
specRotationOptionsJson: EnhancementShamanRotation.toJsonString(EnhancementShamanRotation.create({
})),
rotation: APLRotation.fromJsonString(`{
"enabled": true,
"prepullActions": [
{"action":{"castSpell":{"spellId":{"otherId":"OtherActionPotion"}}},"doAtValue":{"const":{"val":"-1s"}}}
],
"priorityList": [
{"action":{"autocastOtherCooldowns":{}}},
{"action":{"condition":{"not":{"val":{"auraIsActive":{"sourceUnit":{"type":"CurrentTarget"},"auraId":{"spellId":17364}}}}},"castSpell":{"spellId":{"spellId":17364}}}},
{"action":{"condition":{"cmp":{"op":"OpGe","lhs":{"auraNumStacks":{"auraId":{"spellId":53817}}},"rhs":{"const":{"val":"3"}}}},"castSpell":{"spellId":{"spellId":49238}}}},
{"action":{"condition":{"and":{"vals":[{"cmp":{"op":"OpLe","lhs":{"dotRemainingTime":{"spellId":{"spellId":58734}}},"rhs":{"const":{"val":"100ms"}}}},{"not":{"val":{"auraIsActive":{"auraId":{"spellId":2894}}}}}]}},"castSpell":{"spellId":{"spellId":58734}}}},
{"action":{"castSpell":{"spellId":{"spellId":17364}}}},
{"action":{"condition":{"cmp":{"op":"OpLe","lhs":{"dotRemainingTime":{"spellId":{"spellId":49233}}},"rhs":{"const":{"val":"0s"}}}},"castSpell":{"spellId":{"spellId":49233}}}},
{"action":{"castSpell":{"spellId":{"spellId":49231}}}},
{"action":{"castSpell":{"spellId":{"spellId":61657}}}},
{"action":{"condition":{"not":{"val":{"auraIsActive":{"auraId":{"spellId":49281}}}}},"castSpell":{"spellId":{"spellId":49281}}}},
{"action":{"castSpell":{"spellId":{"spellId":60103}}}}
]
}`),
}),
};

export const DefaultOptions = EnhancementShamanOptions.create({
shield: ShamanShield.LightningShield,
bloodlust: true,
Expand Down
4 changes: 4 additions & 0 deletions ui/enhancement_shaman/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ export class EnhancementShamanSimUI extends IndividualSimUI<Spec.SpecEnhancement
talents: [
Presets.StandardTalents,
],
// Preset rotations that the user can quickly select.
rotations: [
Presets.ROTATION_DEFAULT,
],
// Preset gear configurations that the user can quickly select.
gear: [
Presets.PreRaid_PRESET,
Expand Down

0 comments on commit 1f37333

Please sign in to comment.