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

[Warrior] Implement charge as an actual movement out and back in #1237

Merged
merged 7 commits into from
Dec 16, 2024
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
14 changes: 14 additions & 0 deletions sim/common/cata/enchant_effects.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,4 +576,18 @@ func init() {

character.ItemSwap.RegisterOnSwapItemForEnchantEffect(4267, aura)
})

movementSpeedEnchants := []int32{
3232, // Enchant Boots - Tuskarr's Vitality
4104, // Enchant Boots - Lavawalker
4105, // Enchant Boots - Assassin's Step
4062, // Enchant Boots - Earthen Vitality
}

for _, enchantID := range movementSpeedEnchants {
core.NewEnchantEffect(enchantID, func(agent core.Agent) {
character := agent.GetCharacter()
character.NewMovementSpeedAura("Minor Run Speed", core.ActionID{SpellID: 13889}, 0.08)
})
}
}
8 changes: 4 additions & 4 deletions sim/common/cata/metagems.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ func init() {
// Keep these in order by item ID

// Fleet Shadowspirit Diamond
// PLACEHODLER - Until we implement movement speed
// core.NewItemEffect(52289, func(agent core.Agent) {
// agent.GetCharacter().MultiplyStat(Stats.Speed, 1.09)
// })
core.NewItemEffect(52289, func(agent core.Agent) {
character := agent.GetCharacter()
character.NewMovementSpeedAura("Minor Run Speed", core.ActionID{SpellID: 13889}, 0.08)
})

// Bracing Shadowspirit Diamond
core.NewItemEffect(52292, func(agent core.Agent) {
Expand Down
2 changes: 1 addition & 1 deletion sim/core/apl_actions_misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (action *APLActionMove) IsReady(sim *Simulation) bool {
func (action *APLActionMove) Execute(sim *Simulation) {
moveRange := action.moveRange.GetFloat(sim)
if sim.Log != nil {
action.unit.Log(sim, "Moving to %s", moveRange)
action.unit.Log(sim, "[DEBUG] Moving to %.1f yards", moveRange)
}

action.unit.MoveTo(moveRange, sim)
Expand Down
40 changes: 34 additions & 6 deletions sim/core/movement.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (unit *Unit) UpdatePosition(sim *Simulation) {
return
}

unit.OnMovement(unit.DistanceFromTarget, MovementUpdate)
unit.OnMovement(sim, unit.DistanceFromTarget, MovementUpdate)

// update auto attack state
if unit.AutoAttacks.mh.enabled != unit.AutoAttacks.mh.IsInRange() {
Expand Down Expand Up @@ -109,7 +109,7 @@ func (unit *Unit) FinalizeMovement(sim *Simulation) {
unit.UpdatePosition(sim)
unit.moveAura.Deactivate(sim)

unit.OnMovement(unit.DistanceFromTarget, MovementEnd)
unit.OnMovement(sim, unit.DistanceFromTarget, MovementEnd)
}

func registerMovementAction(unit *Unit, sim *Simulation, speed float64, endTime time.Duration) {
Expand All @@ -130,7 +130,7 @@ func registerMovementAction(unit *Unit, sim *Simulation, speed float64, endTime
unit.FinalizeMovement(sim)
}

unit.OnMovement(unit.DistanceFromTarget, MovementStart)
unit.OnMovement(sim, unit.DistanceFromTarget, MovementStart)
unit.movementAction = &movementAction
sim.AddPendingAction(&movementAction.PendingAction)
}
Expand All @@ -143,20 +143,25 @@ const (
MovementEnd
)

type MovementCallback func(position float64, kind MovementUpdateType)
type MovementCallback func(sim *Simulation, position float64, kind MovementUpdateType)

func (unit *Unit) RegisterMovementCallback(callback MovementCallback) {
unit.movementCallbacks = append(unit.movementCallbacks, callback)
}

func (unit *Unit) OnMovement(position float64, kind MovementUpdateType) {
func (unit *Unit) OnMovement(sim *Simulation, position float64, kind MovementUpdateType) {
for _, movementCallback := range unit.movementCallbacks {
movementCallback(position, kind)
movementCallback(sim, position, kind)
}
}

func (unit *Unit) MultiplyMovementSpeed(sim *Simulation, amount float64) {
oldMultiplier := unit.PseudoStats.MovementSpeedMultiplier
oldSpeed := unit.GetMovementSpeed()
unit.PseudoStats.MovementSpeedMultiplier *= amount
if sim.Log != nil {
unit.Log(sim, "[DEBUG] Movement speed changed from %.2f (%.2f%%) to %.2f (%.2f%%)", oldSpeed, (oldMultiplier-1)*100.0, unit.GetMovementSpeed(), (unit.PseudoStats.MovementSpeedMultiplier-1)*100.0)
}

// we have a pending movement action that depends on our movement speed
if unit.movementAction != nil && unit.movementAction.speed != 0 {
Expand All @@ -173,3 +178,26 @@ func (unit *Unit) GetMovementSpeed() float64 {

return 8. * unit.PseudoStats.MovementSpeedMultiplier
}

func (unit *Unit) NewMovementSpeedAura(label string, actionID ActionID, multiplier float64) *Aura {
aura := MakePermanent(unit.GetOrRegisterAura(Aura{
Label: label,
ActionID: actionID,
}))

aura.NewMovementSpeedEffect(multiplier)

return aura
}

func (aura *Aura) NewMovementSpeedEffect(multiplier float64) *ExclusiveEffect {
return aura.NewExclusiveEffect("MovementSpeed", true, ExclusiveEffect{
Priority: multiplier,
OnGain: func(ee *ExclusiveEffect, sim *Simulation) {
ee.Aura.Unit.MultiplyMovementSpeed(sim, 1+multiplier)
},
OnExpire: func(ee *ExclusiveEffect, sim *Simulation) {
ee.Aura.Unit.MultiplyMovementSpeed(sim, 1.0/(1+multiplier))
},
})
}
4 changes: 2 additions & 2 deletions sim/core/spell.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,9 @@ func (unit *Unit) RegisterSpell(config SpellConfig) *Spell {
oldExtraCastCondition := spell.ExtraCastCondition
spell.ExtraCastCondition = func(sim *Simulation, target *Unit) bool {
if ((spell.MinRange != 0) && (spell.Unit.DistanceFromTarget < spell.MinRange)) || ((spell.MaxRange != 0) && (spell.Unit.DistanceFromTarget > spell.MaxRange)) {
if sim.Log != nil {
/*if sim.Log != nil {
sim.Log("Cannot cast spell %s, out of range!", spell.ActionID)
}
}*/

return false
}
Expand Down
1 change: 1 addition & 0 deletions sim/death_knight/presences.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func (dk *DeathKnight) registerUnholyPresenceAura(timer *core.Timer) {
},
})
presenceAura.NewExclusiveEffect(presenceEffectCategory, true, core.ExclusiveEffect{})
presenceAura.NewMovementSpeedEffect(0.15)

dk.RegisterSpell(core.SpellConfig{
ActionID: actionID,
Expand Down
6 changes: 4 additions & 2 deletions sim/druid/forms.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ func (druid *Druid) registerCatFormSpell() {
druid.PseudoStats.ThreatMultiplier *= 0.71
druid.PseudoStats.SpiritRegenMultiplier *= AnimalSpiritRegenSuppression
druid.PseudoStats.BaseDodgeChance += 0.02 * float64(druid.Talents.FeralSwiftness)
druid.PseudoStats.MovementSpeedMultiplier *= 1.0 + 0.15*float64(druid.Talents.FeralSwiftness)

druid.AddStatsDynamic(sim, statBonus)
druid.EnableDynamicStatDep(sim, agiApDep)
Expand Down Expand Up @@ -147,7 +146,6 @@ func (druid *Druid) registerCatFormSpell() {
druid.PseudoStats.ThreatMultiplier /= 0.71
druid.PseudoStats.SpiritRegenMultiplier /= AnimalSpiritRegenSuppression
druid.PseudoStats.BaseDodgeChance -= 0.02 * float64(druid.Talents.FeralSwiftness)
druid.PseudoStats.MovementSpeedMultiplier /= 1.0 + 0.15*float64(druid.Talents.FeralSwiftness)

druid.AddStatsDynamic(sim, statBonus.Invert())
druid.DisableDynamicStatDep(sim, agiApDep)
Expand Down Expand Up @@ -181,6 +179,10 @@ func (druid *Druid) registerCatFormSpell() {
},
})

if druid.Talents.FeralSwiftness > 0 {
druid.CatFormAura.NewMovementSpeedEffect(0.15 * float64(druid.Talents.FeralSwiftness))
}

energyMetrics := druid.NewEnergyMetrics(actionID)

druid.CatForm = druid.RegisterSpell(Any, core.SpellConfig{
Expand Down
11 changes: 11 additions & 0 deletions sim/paladin/talents_retribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
func (paladin *Paladin) applyRetributionTalents() {
paladin.applyCrusade()
paladin.applyRuleOfLaw()
paladin.applyPursuitOfJustice()
paladin.applySanctityOfBattle()
paladin.applySealsOfCommand()
paladin.applySanctifiedWrath()
Expand Down Expand Up @@ -46,6 +47,16 @@ func (paladin *Paladin) applyRuleOfLaw() {
})
}

func (paladin *Paladin) applyPursuitOfJustice() {
if paladin.Talents.PursuitOfJustice == 0 {
return
}

spellID := []int32{0, 26022, 26023}[paladin.Talents.PursuitOfJustice]
multiplier := []float64{0, 0.08, 0.15}[paladin.Talents.PursuitOfJustice]
paladin.NewMovementSpeedAura("Pursuit of Justice", core.ActionID{SpellID: spellID}, multiplier)
}

func (paladin *Paladin) applySanctityOfBattle() {
if !paladin.Talents.SanctityOfBattle {
return
Expand Down
6 changes: 6 additions & 0 deletions sim/rogue/talents.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ func (rogue *Rogue) ApplyTalents() {
ClassMask: RogueSpellHemorrhage | RogueSpellFanOfKnives,
})
}

if rogue.Talents.Quickening > 0 {
spellID := []int32{0, 24090, 31209}[rogue.Talents.Quickening]
multiplier := []float64{0, 0.08, 0.15}[rogue.Talents.Quickening]
rogue.NewMovementSpeedAura("Quickening", core.ActionID{SpellID: spellID}, multiplier)
}
}

// DWSMultiplier returns the offhand damage multiplier
Expand Down
Loading
Loading