Skip to content

Commit

Permalink
implement nibelung
Browse files Browse the repository at this point in the history
  • Loading branch information
lime-green committed Sep 5, 2023
1 parent 6145dd7 commit 0865c00
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 0 deletions.
140 changes: 140 additions & 0 deletions sim/common/wotlk/nibelung.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package wotlk

import (
"github.com/wowsims/wotlk/sim/core"
"github.com/wowsims/wotlk/sim/core/stats"
"time"
)

var valkyrStats = stats.Stats{
stats.Stamina: 1260,
}

type ValkyrPet struct {
core.Pet
smite *core.Spell
healthMetrics *core.ResourceMetrics
}

func newValkyr(character *core.Character) *ValkyrPet {
return &ValkyrPet{
Pet: core.NewPet(
"Valkyr",
character,
valkyrStats,
func(ownerStats stats.Stats) stats.Stats {
return stats.Stats{}
},
nil,
false,
true,
),
}
}

func getSmiteConfig(valkyr *ValkyrPet, spellId int32, damageMin float64, damageMax float64) core.SpellConfig {
return core.SpellConfig{
ActionID: core.ActionID{SpellID: spellId},
SpellSchool: core.SpellSchoolHoly,
ProcMask: core.ProcMaskEmpty,
Cast: core.CastConfig{
DefaultCast: core.Cast{
GCD: time.Second * 30 / 16, // 1.875s (16 casts per 30s)
CastTime: 0,
},
},
DamageMultiplier: 1,
ThreatMultiplier: 1,
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
baseDamage := sim.Roll(damageMin, damageMax)
result := spell.CalcDamage(sim, target, baseDamage, spell.OutcomeCritFixedChance(0.05))
spell.DealDamage(sim, result)
valkyr.GainHealth(sim, result.Damage*0.25, valkyr.healthMetrics)
},
CritMultiplier: valkyr.DefaultSpellCritMultiplier(),
}

}

func (valkyr *ValkyrPet) registerSmite(isHeroic bool) {
spellId := int32(71842)
if isHeroic {
spellId = 71841
}

if valkyr.healthMetrics == nil {
valkyr.healthMetrics = valkyr.NewHealthMetrics(core.ActionID{SpellID: spellId})
}

if isHeroic {
smite := getSmiteConfig(valkyr, spellId, 1804, 2022)
valkyr.smite = valkyr.GetOrRegisterSpell(smite)
} else {
smite := getSmiteConfig(valkyr, spellId, 1591, 1785)
valkyr.smite = valkyr.GetOrRegisterSpell(smite)
}
}

func (valkyr *ValkyrPet) Initialize() {}

func (valkyr *ValkyrPet) Reset(sim *core.Simulation) {}

func (valkyr *ValkyrPet) OnGCDReady(sim *core.Simulation) {
target := valkyr.CurrentTarget

if valkyr.smite.CanCast(sim, target) {
valkyr.smite.Cast(sim, target)
}
}

func (valkyr *ValkyrPet) GetPet() *core.Pet {
return &valkyr.Pet
}

func MakeNibelungTriggerAura(agent core.Agent, isHeroic bool) {
var auraSpellId, procSpellId int32

if isHeroic {
auraSpellId = 71844
procSpellId = 71846
} else {
auraSpellId = 71843
procSpellId = 71845
}

character := agent.GetCharacter()
valkyrAura := character.RegisterAura(core.Aura{
Label: "Summon Val'kyr",
ActionID: core.ActionID{SpellID: auraSpellId},
Duration: time.Second * 30,
})

core.MakeProcTriggerAura(&character.Unit, core.ProcTrigger{
Name: "Nibelung Proc",
Callback: core.CallbackOnCastComplete,
ProcMask: core.ProcMaskSpellOrProc,
Harmful: true,
ProcChance: 0.02,
ICD: time.Millisecond * 250,
ActionID: core.ActionID{SpellID: procSpellId},
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
for _, pet := range character.Pets {
valkyr, ok := pet.(*ValkyrPet)
if ok && !valkyr.IsEnabled() {
valkyr.registerSmite(isHeroic)
valkyr.EnableWithTimeout(sim, pet, valkyrAura.Duration)
break
}
}

valkyrAura.Activate(sim)
},
})
}

func ConstructValkyrPets(character *core.Character) {
for i := 0; i < 10; i++ {
valkyr := newValkyr(character)
character.AddPet(valkyr)
}
}
11 changes: 11 additions & 0 deletions sim/common/wotlk/other_effects.go
Original file line number Diff line number Diff line change
Expand Up @@ -1075,4 +1075,15 @@ func init() {
Type: core.CooldownTypeSurvival,
})
})

NewItemEffectWithHeroic(func(isHeroic bool) {
itemId := int32(49992)
if isHeroic {
itemId = 50648
}

core.NewItemEffect(itemId, func(agent core.Agent) {
MakeNibelungTriggerAura(agent, isHeroic)
})
})
}
2 changes: 2 additions & 0 deletions sim/druid/balance/balance.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package balance

import (
"github.com/wowsims/wotlk/sim/common/wotlk"
"github.com/wowsims/wotlk/sim/core"
"github.com/wowsims/wotlk/sim/core/proto"
"github.com/wowsims/wotlk/sim/core/stats"
Expand Down Expand Up @@ -39,6 +40,7 @@ func NewBalanceDruid(character core.Character, options *proto.Player) *BalanceDr
}

moonkin.EnableResumeAfterManaWait(moonkin.tryUseGCD)
wotlk.ConstructValkyrPets(&moonkin.Character)
return moonkin
}

Expand Down
2 changes: 2 additions & 0 deletions sim/mage/mage.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mage

import (
"github.com/wowsims/wotlk/sim/common/wotlk"
"time"

"github.com/wowsims/wotlk/sim/core"
Expand Down Expand Up @@ -204,6 +205,7 @@ func NewMage(character core.Character, options *proto.Player) *Mage {
mage.waterElemental = mage.NewWaterElemental(mage.Rotation.WaterElementalDisobeyChance)
}

wotlk.ConstructValkyrPets(&mage.Character)
return mage
}

Expand Down
2 changes: 2 additions & 0 deletions sim/priest/shadow/shadow_priest.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package shadow

import (
"github.com/wowsims/wotlk/sim/common/wotlk"
"time"

"github.com/wowsims/wotlk/sim/core"
Expand Down Expand Up @@ -48,6 +49,7 @@ func NewShadowPriest(character core.Character, options *proto.Player) *ShadowPri

spriest.EnableResumeAfterManaWait(spriest.tryUseGCD)
spriest.CanRolloverSWP = spriest.Talents.MindFlay && spriest.Talents.PainAndSuffering > 0
wotlk.ConstructValkyrPets(&spriest.Character)

return spriest
}
Expand Down
2 changes: 2 additions & 0 deletions sim/warlock/warlock.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package warlock

import (
"github.com/wowsims/wotlk/sim/common/wotlk"
"time"

"github.com/wowsims/wotlk/sim/core"
Expand Down Expand Up @@ -239,6 +240,7 @@ func NewWarlock(character core.Character, options *proto.Player) *Warlock {
}

warlock.applyWeaponImbue()
wotlk.ConstructValkyrPets(&warlock.Character)

return warlock
}
Expand Down
1 change: 1 addition & 0 deletions ui/core/proto_utils/action_id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ const petNameToActionId: Record<string, ActionId> = {
'Gargoyle': ActionId.fromSpellId(49206),
'Ghoul': ActionId.fromSpellId(46584),
'Army of the Dead': ActionId.fromSpellId(42650),
'Valkyr': ActionId.fromSpellId(71844),
};

// https://wowhead.com/wotlk/hunter-pets
Expand Down

0 comments on commit 0865c00

Please sign in to comment.