From 22a2eb9d0191118e4732bd4ba4f9298131469019 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Sun, 20 Aug 2023 04:55:22 -0700 Subject: [PATCH] Add call of the elements shaman spell, and default preset for enhance --- sim/shaman/shaman.go | 3 + sim/shaman/totems.go | 128 +++++++++++++++++++++++-------- ui/enhancement_shaman/presets.ts | 31 +++++++- ui/enhancement_shaman/sim.ts | 4 + 4 files changed, 130 insertions(+), 36 deletions(-) diff --git a/sim/shaman/shaman.go b/sim/shaman/shaman.go index 28fbff7e0a..67960d558b 100644 --- a/sim/shaman/shaman.go +++ b/sim/shaman/shaman.go @@ -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 { diff --git a/sim/shaman/totems.go b/sim/shaman/totems.go index 118b051244..9b591c44df 100644 --- a/sim/shaman/totems.go +++ b/sim/shaman/totems.go @@ -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]), @@ -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 { @@ -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 +} diff --git a/ui/enhancement_shaman/presets.ts b/ui/enhancement_shaman/presets.ts index 372d774512..838d010add 100644 --- a/ui/enhancement_shaman/presets.ts +++ b/ui/enhancement_shaman/presets.ts @@ -10,10 +10,9 @@ import { Debuffs, CustomRotation, CustomSpell, - ItemSwap, - ItemSpec, } 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 { @@ -86,6 +85,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, diff --git a/ui/enhancement_shaman/sim.ts b/ui/enhancement_shaman/sim.ts index e976b8ec05..aaeaa261f8 100644 --- a/ui/enhancement_shaman/sim.ts +++ b/ui/enhancement_shaman/sim.ts @@ -150,6 +150,10 @@ export class EnhancementShamanSimUI extends IndividualSimUI