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

Heroic Lich King AI for tank sims + associated support #3615

Merged
merged 6 commits into from
Sep 5, 2023
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
Binary file modified assets/database/db.bin
Binary file not shown.
3 changes: 2 additions & 1 deletion assets/database/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -12987,7 +12987,8 @@
{"path":"Ulduar 25/Hodir","targets":[{"path":"Ulduar 25/Hodir","target":{"id":32845,"name":"Hodir","level":83,"mobType":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,805,0,0,0,0,0,0,0,0,10643,0,0,0,76,0,0,0,32477905,0,0,0,0,0,0,0,0,0,0,0],"minBaseDamage":46300,"damageSpread":0.3333,"swingSpeed":2.4,"targetInputs":[{"label":"Stormpower Prio","tooltip":"Should stormpower buff be applied when available","boolValue":true},{"inputType":1,"label":"Starlight Uptime %","tooltip":"Uptime on Starlight haste buff (Range 0-100%)","numberValue":80}]}}]},
{"path":"Ulduar 25/Algalon","targets":[{"path":"Ulduar 25/Algalon","target":{"id":32871,"name":"Algalon","level":83,"mobType":4,"stats":[0,0,0,0,0,0,0,0,0,0,0,805,0,0,0,0,0,0,0,0,10643,0,0,0,76,0,0,0,41834998,0,0,0,0,0,0,0,0,0,0,0],"minBaseDamage":63649,"damageSpread":0.1,"swingSpeed":1,"dualWield":true}}]},
{"path":"ToGC 25/Gormok","targets":[{"path":"ToGC 25/Gormok","target":{"id":34796,"name":"Gormok","level":83,"mobType":6,"stats":[0,0,0,0,0,0,0,0,0,0,0,805,0,0,0,0,0,0,0,0,10643,0,0,0,76,0,0,0,11853250,0,0,0,0,0,0,0,0,0,0,0],"minBaseDamage":39600,"damageSpread":0.3333,"swingSpeed":1.5}}]},
{"path":"ToGC 25/Anub'arak","targets":[{"path":"ToGC 25/Anub'arak","target":{"id":34564,"name":"Anub'arak","level":83,"mobType":8,"stats":[0,0,0,0,0,0,0,0,0,0,0,805,0,0,0,0,0,0,0,0,10643,0,0,0,76,0,0,0,27192750,0,0,0,0,0,0,0,0,0,0,0],"minBaseDamage":58411,"damageSpread":0.45,"swingSpeed":1.5}}]}
{"path":"ToGC 25/Anub'arak","targets":[{"path":"ToGC 25/Anub'arak","target":{"id":34564,"name":"Anub'arak","level":83,"mobType":8,"stats":[0,0,0,0,0,0,0,0,0,0,0,805,0,0,0,0,0,0,0,0,10643,0,0,0,76,0,0,0,27192750,0,0,0,0,0,0,0,0,0,0,0],"minBaseDamage":58411,"damageSpread":0.45,"swingSpeed":1.5}}]},
{"path":"ICC 25/Lich King (Heroic)","targets":[{"path":"ICC 25/Lich King (Heroic)","target":{"id":36597,"name":"Lich King (Heroic)","level":83,"mobType":8,"stats":[0,0,0,0,0,0,0,0,0,0,0,805,0,0,0,0,0,0,0,0,10643,0,0,0,76,0,0,0,103151165,0,0,0,0,0,0,0,0,0,0,0],"minBaseDamage":146497,"damageSpread":0.1557,"swingSpeed":1.5,"suppressDodge":true}}]}
],
"glyphIds":[
{"itemId":43361,"spellId":52648},
Expand Down
2 changes: 2 additions & 0 deletions proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ message IndividualBuffs {
int32 tricks_of_the_trades = 19;
int32 divine_guardians = 23;
int32 pain_suppressions = 24;
int32 hand_of_sacrifices = 25;
int32 guardian_spirits = 26;

// Technically a debuff, but only used by individual sims.
int32 shattering_throws = 20;
Expand Down
110 changes: 110 additions & 0 deletions sim/core/buffs.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ func applyBuffEffects(agent Agent, raidBuffs *proto.RaidBuffs, partyBuffs *proto
registerManaTideTotemCD(agent, partyBuffs.ManaTideTotems)
registerInnervateCD(agent, individualBuffs.Innervates)
registerDivineGuardianCD(agent, individualBuffs.DivineGuardians)
registerHandOfSacrificeCD(agent, individualBuffs.HandOfSacrifices)
registerPainSuppressionCD(agent, individualBuffs.PainSuppressions)
registerGuardianSpiritCD(agent, individualBuffs.GuardianSpirits)

character.AddStats(stats.Stats{
stats.SpellCrit: 28 * float64(partyBuffs.AtieshMage),
Expand Down Expand Up @@ -834,6 +836,55 @@ func DivineGuardianAura(character *Character, actionTag int32) *Aura {
})
}

var HandOfSacrificeAuraTag = "HandOfSacrifice"

const HandOfSacrificeDuration = time.Millisecond * 10500 // subtract Divine Shield GCD
const HandOfSacrificeCD = time.Minute * 5 // use Divine Shield CD here

func registerHandOfSacrificeCD(agent Agent, numSacs int32) {
if numSacs == 0 {
return
}

hosAura := HandOfSacrificeAura(agent.GetCharacter(), -1)

registerExternalConsecutiveCDApproximation(
agent,
externalConsecutiveCDApproximation{
ActionID: ActionID{SpellID: 6940, Tag: -1},
AuraTag: HandOfSacrificeAuraTag,
CooldownPriority: CooldownPriorityLow,
AuraDuration: HandOfSacrificeDuration,
AuraCD: HandOfSacrificeCD,
Type: CooldownTypeSurvival,

ShouldActivate: func(sim *Simulation, character *Character) bool {
return true
},
AddAura: func(sim *Simulation, character *Character) {
hosAura.Activate(sim)
},
},
numSacs)
}

func HandOfSacrificeAura(character *Character, actionTag int32) *Aura {
actionID := ActionID{SpellID: 6940, Tag: actionTag}

return character.GetOrRegisterAura(Aura{
Label: "HandOfSacrifice-" + actionID.String(),
Tag: HandOfSacrificeAuraTag,
ActionID: actionID,
Duration: HandOfSacrificeDuration,
OnGain: func(aura *Aura, sim *Simulation) {
character.PseudoStats.DamageTakenMultiplier *= 0.7
},
OnExpire: func(aura *Aura, sim *Simulation) {
character.PseudoStats.DamageTakenMultiplier /= 0.7
},
})
}

var PainSuppressionAuraTag = "PainSuppression"

const PainSuppressionDuration = time.Second * 8
Expand Down Expand Up @@ -881,6 +932,65 @@ func PainSuppressionAura(character *Character, actionTag int32) *Aura {
})
}

var GuardianSpiritAuraTag = "GuardianSpirit"

const GuardianSpiritDuration = time.Second * 10
const GuardianSpiritCD = time.Minute * 3

func registerGuardianSpiritCD(agent Agent, numGuardianSpirits int32) {
if numGuardianSpirits == 0 {
return
}

character := agent.GetCharacter()
gsAura := GuardianSpiritAura(character, -1)
healthMetrics := character.NewHealthMetrics(ActionID{SpellID: 47788})

character.AddDynamicDamageTakenModifier(func(sim *Simulation, _ *Spell, result *SpellResult) {
if (result.Damage >= character.CurrentHealth()) && gsAura.IsActive() {
result.Damage = character.CurrentHealth()
character.GainHealth(sim, 0.5*character.MaxHealth(), healthMetrics)
gsAura.Deactivate(sim)
}
})

registerExternalConsecutiveCDApproximation(
agent,
externalConsecutiveCDApproximation{
ActionID: ActionID{SpellID: 47788, Tag: -1},
AuraTag: GuardianSpiritAuraTag,
CooldownPriority: CooldownPriorityLow,
AuraDuration: GuardianSpiritDuration,
AuraCD: GuardianSpiritCD,
Type: CooldownTypeSurvival,

ShouldActivate: func(sim *Simulation, character *Character) bool {
return true
},
AddAura: func(sim *Simulation, character *Character) {
gsAura.Activate(sim)
},
},
numGuardianSpirits)
}

func GuardianSpiritAura(character *Character, actionTag int32) *Aura {
actionID := ActionID{SpellID: 47788, Tag: actionTag}

return character.GetOrRegisterAura(Aura{
Label: "GuardianSpirit-" + actionID.String(),
Tag: GuardianSpiritAuraTag,
ActionID: actionID,
Duration: GuardianSpiritDuration,
OnGain: func(aura *Aura, sim *Simulation) {
character.PseudoStats.HealingTakenMultiplier *= 1.4
},
OnExpire: func(aura *Aura, sim *Simulation) {
character.PseudoStats.HealingTakenMultiplier /= 1.4
},
})
}

func registerRevitalizeHotCD(agent Agent, label string, hotID ActionID, ticks int, tickPeriod time.Duration, uptimeCount int32) {
if uptimeCount == 0 {
return
Expand Down
16 changes: 8 additions & 8 deletions sim/core/major_cooldown.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,21 @@ func (mcd *MajorCooldown) tryActivateInternal(sim *Simulation, character *Charac
}

func (mcd *MajorCooldown) shouldActivateHelper(sim *Simulation, character *Character) bool {
if mcd.Type.Matches(CooldownTypeSurvival) && character.cooldownConfigs.HpPercentForDefensives != 0 {
if character.CurrentHealthPercent() > character.cooldownConfigs.HpPercentForDefensives {
return false
}
}

if !mcd.Spell.CanCast(sim, character.CurrentTarget) {
return false
}

if mcd.numUsages < len(mcd.timings) {
return sim.CurrentTime >= mcd.timings[mcd.numUsages]
} else {
return mcd.ShouldActivate(sim, character)
}

if mcd.Type.Matches(CooldownTypeSurvival) && character.cooldownConfigs.HpPercentForDefensives != 0 {
if character.CurrentHealthPercent() > character.cooldownConfigs.HpPercentForDefensives {
return false
}
}

return mcd.ShouldActivate(sim, character)
}

// Activates this MCD, if all the conditions pass.
Expand Down
8 changes: 0 additions & 8 deletions sim/druid/tank/rotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ func (bear *FeralTankDruid) doRotation(sim *core.Simulation) {
bear.DemoralizingRoar.Cast(sim, bear.CurrentTarget)
} else if bear.Berserk.IsReady(sim) {
bear.Berserk.Cast(sim, nil)

// Bundle Enrage + Barkskin with Berserk
if bear.Enrage.IsReady(sim) {
bear.Enrage.Cast(sim, nil)
}
if bear.Barkskin.IsReady(sim) {
bear.Barkskin.Cast(sim, nil)
}
} else if bear.MangleBear.CanCast(sim, bear.CurrentTarget) {
bear.MangleBear.Cast(sim, bear.CurrentTarget)
} else if bear.shouldFaerieFire(sim) {
Expand Down
5 changes: 5 additions & 0 deletions sim/encounters/icc/icc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package icc

func Register() {
addLichKing25H("ICC 25")
}
149 changes: 149 additions & 0 deletions sim/encounters/icc/lichking25h_ai.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
package icc

import (
"time"

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

func addLichKing25H(bossPrefix string) {
core.AddPresetTarget(&core.PresetTarget{
PathPrefix: bossPrefix,
Config: &proto.Target{
Id: 36597,
Name: "Lich King (Heroic)",
Level: 83,
MobType: proto.MobType_MobTypeUndead,
TankIndex: 0,

Stats: stats.Stats{
stats.Health: 103_151_165,
stats.Armor: 10643,
stats.AttackPower: 805,
stats.BlockValue: 76,
}.ToFloatArray(),

SpellSchool: proto.SpellSchool_SpellSchoolPhysical,
SwingSpeed: 1.50,
MinBaseDamage: 146497, // Est 160154 minimum debuffed Unmit
SuppressDodge: true,
ParryHaste: false,
DualWield: false,
DualWieldPenalty: false,
DamageSpread: 0.1557,
TargetInputs: make([]*proto.TargetInput, 0),
},
AI: NewLichKing25HAI(),
})
core.AddPresetEncounter("Lich King (Heroic)", []string{
bossPrefix + "/Lich King (Heroic)",
})
}

type LichKing25HAI struct {
Target *core.Target

SoulReaper *core.Spell
SoulReaperAura *core.Aura
}

func NewLichKing25HAI() core.AIFactory {
return func() core.TargetAI {
return &LichKing25HAI{}
}
}

func (ai *LichKing25HAI) Initialize(target *core.Target, config *proto.Target) {
ai.Target = target
ai.registerSoulReaperSpell(target)
}

func (ai *LichKing25HAI) Reset(*core.Simulation) {
}

func (ai *LichKing25HAI) registerSoulReaperSpell(target *core.Target) {
ai.SoulReaperAura = target.GetOrRegisterAura(core.Aura{
Label: "Soul Reaper",
ActionID: core.ActionID{SpellID: 69410},
Duration: time.Second * 5,
OnGain: func(aura *core.Aura, sim *core.Simulation) {
aura.Unit.MultiplyAttackSpeed(sim, 2.0)
},
OnExpire: func(aura *core.Aura, sim *core.Simulation) {
aura.Unit.MultiplyAttackSpeed(sim, 0.5)
},
})

ai.SoulReaper = target.RegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 69409},
SpellSchool: core.SpellSchoolShadow,
ProcMask: core.ProcMaskMeleeMHSpecial,
Flags: core.SpellFlagNone,

Cast: core.CastConfig{
CD: core.Cooldown{
Timer: target.NewTimer(),
Duration: time.Second * 30,
},
DefaultCast: core.Cast{
GCD: time.Millisecond * 1620,
},
},

DamageMultiplier: 1,
CritMultiplier: 1,

Dot: core.DotConfig{
Aura: core.Aura{
Label: "Soul Reaper",
Duration: time.Second * 5,
},
NumberOfTicks: 1,
TickLength: time.Second * 5,

OnTick: func(sim *core.Simulation, target *core.Unit, dot *core.Dot) {
// Soul Reaper ticks cannot be partially resisted even though the initial hit can, so temporarily change the spell flag accordingly.
dot.Spell.Flags = core.SpellFlagIgnoreResists

// Perform damage calculation
dot.Spell.CalcAndDealPeriodicDamage(sim, target, 70000., dot.Spell.OutcomeAlwaysHit)

// Activate Haste aura on boss
ai.SoulReaperAura.Activate(sim)

// Reset spell flag for next application
dot.Spell.Flags = core.SpellFlagNone
},
},

ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
// 50% weapon damage
baseDamage := 0.5 * spell.Unit.AutoAttacks.MH.EnemyWeaponDamage(sim, spell.MeleeAttackPower(), 0.1557)
spell.CalcAndDealDamage(sim, target, baseDamage, spell.OutcomeAlwaysHit)

dot := spell.Dot(target)
dot.Apply(sim)
},
})
}

func (ai *LichKing25HAI) DoAction(sim *core.Simulation) {
if ai.Target.GCD.IsReady(sim) {
if ai.Target.CurrentTarget != nil {
if ai.SoulReaper.IsReady(sim) && sim.CurrentTime >= ai.SoulReaper.CD.Duration {
// Based on log analysis, Soul Reaper appears to have a ~40% chance to "proc" on every 1.62 second server tick once it is off cooldown.
procRoll := sim.RandomFloat("Soul Reaper AI")

if procRoll < 0.4 {
ai.SoulReaper.Cast(sim, ai.Target.CurrentTarget)
return
}
}
}

// Lich King follows the standard Classic WoW boss AI behavior of evaluating actions on a 1.62 second server tick.
ai.Target.WaitUntil(sim, sim.CurrentTime+time.Millisecond*1620)
}
}
2 changes: 2 additions & 0 deletions sim/encounters/register_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package encounters

import (
"github.com/wowsims/wotlk/sim/core"
"github.com/wowsims/wotlk/sim/encounters/icc"
"github.com/wowsims/wotlk/sim/encounters/naxxramas"
"github.com/wowsims/wotlk/sim/encounters/toc"
"github.com/wowsims/wotlk/sim/encounters/ulduar"
Expand All @@ -11,6 +12,7 @@ func init() {
naxxramas.Register()
ulduar.Register()
toc.Register()
icc.Register()
}

func AddSingleTargetBossEncounter(presetTarget *core.PresetTarget) {
Expand Down
2 changes: 2 additions & 0 deletions ui/core/components/icon_inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ export const SpellPowerBuff = InputHelpers.makeMultiIconInput([
export const Bloodlust = withLabel(makeBooleanRaidBuffInput(ActionId.fromSpellId(2825), 'bloodlust'), 'Lust');

export const DefensiveCooldownBuff = InputHelpers.makeMultiIconInput([
makeMultistateIndividualBuffInput(ActionId.fromSpellId(6940), 11, 'handOfSacrifices'),
makeMultistateIndividualBuffInput(ActionId.fromSpellId(53530), 11, 'divineGuardians'),
makeMultistateIndividualBuffInput(ActionId.fromSpellId(33206), 11, 'painSuppressions'),
makeMultistateIndividualBuffInput(ActionId.fromSpellId(47788), 11, 'guardianSpirits'),
], 'Defensive CDs');

// Misc Buffs
Expand Down
Loading