Skip to content

Commit

Permalink
Merge pull request #3288 from wowsims/apl_support
Browse files Browse the repository at this point in the history
add support for tank dk related apl
  • Loading branch information
rosenrusinov authored Jul 11, 2023
2 parents 94e36c4 + 6f05668 commit cd5b973
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 12 deletions.
5 changes: 5 additions & 0 deletions sim/deathknight/dancing_rune_weapon.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func (dk *Deathknight) registerDancingRuneWeaponCD() {
dk.RuneWeapon.BloodStrike.Cast(sim, spell.Unit.CurrentTarget)
case dk.HeartStrike:
dk.RuneWeapon.HeartStrike.Cast(sim, spell.Unit.CurrentTarget)
case dk.RuneStrike:
dk.RuneWeapon.RuneStrike.Cast(sim, spell.Unit.CurrentTarget)
case dk.DeathCoil:
dk.RuneWeapon.DeathCoil.Cast(sim, spell.Unit.CurrentTarget)
case dk.Pestilence:
Expand Down Expand Up @@ -89,6 +91,8 @@ type RuneWeaponPet struct {
HeartStrike *core.Spell
HeartStrikeOffHit *core.Spell

RuneStrike *core.Spell

Pestilence *core.Spell
BloodBoil *core.Spell

Expand All @@ -108,6 +112,7 @@ func (runeWeapon *RuneWeaponPet) Initialize() {
runeWeapon.dkOwner.registerDrwBloodStrikeSpell()
runeWeapon.dkOwner.registerDrwHeartStrikeSpell()
runeWeapon.dkOwner.registerDrwDeathCoilSpell()
runeWeapon.dkOwner.registerDrwRuneStrikeSpell()
}

func (dk *Deathknight) DrwWeaponDamage(sim *core.Simulation, spell *core.Spell) float64 {
Expand Down
15 changes: 6 additions & 9 deletions sim/deathknight/deathknight.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ type Deathknight struct {
HeartStrike *core.Spell
HeartStrikeOffHit *core.Spell

RuneStrike *core.Spell
RuneStrikeOh *core.Spell
RuneStrikeAura *core.Aura
RuneStrikeQueued bool
RuneStrikeQueue *core.Spell
RuneStrike *core.Spell
RuneStrikeOh *core.Spell
RuneStrikeAura *core.Aura

GhoulFrenzy *core.Spell
// Dummy aura for timeline metrics
Expand Down Expand Up @@ -404,15 +406,10 @@ func NewDeathknight(character core.Character, inputs DeathknightInputs, talents
maxRunicPower := 100.0 + 15.0*float64(dk.Talents.RunicPowerMastery)
currentRunicPower := math.Min(maxRunicPower, dk.Inputs.StartingRunicPower+core.TernaryFloat64(dk.Inputs.PrecastHornOfWinter, 10.0, 0.0))

runeCD := 10 * time.Second
if dk.Talents.ImprovedUnholyPresence > 0 {
runeCD = time.Duration(float64(runeCD) * (1.0 - 0.05*float64(dk.Talents.ImprovedUnholyPresence)))
}

dk.EnableRunicPowerBar(
currentRunicPower,
maxRunicPower,
runeCD,
10*time.Second,
func(sim *core.Simulation) {
if dk.onRuneSpendT10 != nil {
dk.onRuneSpendT10(sim)
Expand Down
41 changes: 39 additions & 2 deletions sim/deathknight/rune_strike.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,31 @@ func (dk *Deathknight) newRuneStrikeSpell(isMH bool) *core.Spell {
if isMH {
dk.threatOfThassarianProc(sim, result, dk.RuneStrikeOh)
dk.RuneStrikeAura.Deactivate(sim)
dk.RuneStrikeQueued = false
}
},
}
if !isMH { // only MH has cost & gcd
conf.RuneCost = core.RuneCostOptions{}
conf.Cast = core.CastConfig{}
conf.ExtraCastCondition = nil
} else {
conf.Flags |= core.SpellFlagAPL
}

return dk.RegisterSpell(conf)
}

func (dk *Deathknight) registerRuneStrikeSpell() {
dk.RuneStrikeQueue = dk.RegisterSpell(core.SpellConfig{
ActionID: RuneStrikeActionID.WithTag(0),
Flags: core.SpellFlagAPL,

ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
dk.RuneStrikeQueued = true
},
ExtraCastCondition: func(sim *core.Simulation, target *core.Unit) bool {
return dk.RuneStrikeAura.IsActive() && !dk.RuneStrikeQueued
},
})
dk.RuneStrike = dk.newRuneStrikeSpell(true)
dk.RuneStrikeOh = dk.newRuneStrikeSpell(false)

Expand All @@ -106,3 +116,30 @@ func (dk *Deathknight) registerRuneStrikeSpell() {
},
}))
}

func (dk *Deathknight) registerDrwRuneStrikeSpell() {
runeStrikeGlyphCritBonus := core.TernaryFloat64(dk.HasMajorGlyph(proto.DeathknightMajorGlyph_GlyphOfRuneStrike), 10.0, 0.0)

dk.RuneWeapon.RuneStrike = dk.RuneWeapon.RegisterSpell(core.SpellConfig{
ActionID: RuneStrikeActionID.WithTag(1),
SpellSchool: core.SpellSchoolPhysical,
ProcMask: core.ProcMaskMeleeMHSpecial,
Flags: core.SpellFlagMeleeMetrics | core.SpellFlagIncludeTargetBonusDamage,

BonusCritRating: (dk.annihilationCritBonus() + runeStrikeGlyphCritBonus) * core.CritRatingPerCritChance,
DamageMultiplier: 1.5 *
dk.darkrunedPlateRuneStrikeDamageBonus(),
CritMultiplier: dk.DefaultMeleeCritMultiplier(),
ThreatMultiplier: 1.75,

ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
baseDamage := 0.15*spell.MeleeAttackPower() + dk.DrwWeaponDamage(sim, spell)
spell.CalcAndDealDamage(sim, target, baseDamage, spell.OutcomeMeleeSpecialNoBlockDodgeParry)
},
})

if !dk.Inputs.NewDrw {
dk.RuneWeapon.RuneStrike.DamageMultiplier *= 0.5
dk.RuneWeapon.RuneStrike.Flags |= core.SpellFlagIgnoreAttackerModifiers
}
}
2 changes: 1 addition & 1 deletion sim/deathknight/tank/tank_deathknight.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func NewTankDeathknight(character core.Character, options *proto.Player) *TankDe
OffHand: tankDk.WeaponFromOffHand(tankDk.DefaultMeleeCritMultiplier()),
AutoSwingMelee: true,
ReplaceMHSwing: func(sim *core.Simulation, mhSwingSpell *core.Spell) *core.Spell {
if tankDk.RuneStrike.CanCast(sim, nil) {
if tankDk.RuneStrike.CanCast(sim, nil) && (!tankDk.IsUsingAPL || tankDk.RuneStrikeQueued) {
return tankDk.RuneStrike
} else {
return nil
Expand Down
8 changes: 8 additions & 0 deletions ui/core/proto_utils/action_id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,14 @@ export class ActionId {
}
break;
case 'Rune Strike':
if (this.tag == 0) {
name += ' (Queue)'
} else if (this.tag == 1) {
name += ' (Main Hand)';
} else if (this.tag == 2) {
name += ' (Off Hand)';
}
break;
case 'Frost Strike':
case 'Plague Strike':
case 'Blood Strike':
Expand Down

0 comments on commit cd5b973

Please sign in to comment.