Skip to content

Commit

Permalink
Merge pull request #3612 from wowsims/apl
Browse files Browse the repository at this point in the history
Fix APL issue with Fan of Knives and different types in math operations
  • Loading branch information
jimmyt857 authored Sep 4, 2023
2 parents b0b3c5c + 61988dd commit 9f27946
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
3 changes: 3 additions & 0 deletions sim/core/apl_values_operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ type APLValueMath struct {

func (rot *APLRotation) newValueMath(config *proto.APLValueMath) APLValue {
lhs, rhs := rot.newAPLValue(config.Lhs), rot.newAPLValue(config.Rhs)
if config.Op == proto.APLValueMath_OpAdd || config.Op == proto.APLValueMath_OpSub {
lhs, rhs = rot.coerceToSameType(lhs, rhs)
}
if lhs == nil || rhs == nil {
return nil
}
Expand Down
2 changes: 0 additions & 2 deletions sim/core/energy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (

// Time between energy ticks.
const EnergyTickDuration = time.Millisecond * 100

// Extra 0.2 because Blizzard
const EnergyPerTick = 1.0

// OnEnergyGain is called any time energy is increased.
Expand Down
12 changes: 12 additions & 0 deletions sim/core/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,15 @@ func (unit *Unit) RegisterPrepullAction(doAt time.Duration, action func(*Simulat
Action: action,
})
}

func (env *Environment) PrepullStartTime() time.Duration {
if !env.IsFinalized() {
panic("Env not yet finalized")
}

if len(env.prepullActions) == 0 {
return 0
} else {
return env.prepullActions[0].DoAt
}
}
2 changes: 1 addition & 1 deletion sim/core/sim.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func (sim *Simulation) runPendingActions(max time.Duration) {

func (sim *Simulation) PrePull() {
if len(sim.Environment.prepullActions) > 0 {
sim.CurrentTime = sim.Environment.prepullActions[0].DoAt
sim.CurrentTime = sim.Environment.PrepullStartTime()

for _, prepullAction := range sim.Environment.prepullActions {
if prepullAction.DoAt > sim.CurrentTime {
Expand Down
5 changes: 4 additions & 1 deletion sim/rogue/fan_of_knives.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ const FanOfKnivesSpellID int32 = 51723
func (rogue *Rogue) makeFanOfKnivesWeaponHitSpell(isMH bool) *core.Spell {
var procMask core.ProcMask
var weaponMultiplier float64
var actionID core.ActionID
if isMH {
actionID = core.ActionID{SpellID: FanOfKnivesSpellID}.WithTag(1)
weaponMultiplier = core.TernaryFloat64(rogue.HasDagger(core.MainHand), 1.05, 0.7)
procMask = core.ProcMaskMeleeMHSpecial
} else {
actionID = core.ActionID{SpellID: FanOfKnivesSpellID}.WithTag(2)
weaponMultiplier = core.TernaryFloat64(rogue.HasDagger(core.OffHand), 1.05, 0.7)
weaponMultiplier *= rogue.dwsMultiplier()
procMask = core.ProcMaskMeleeOHSpecial
}

return rogue.RegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: FanOfKnivesSpellID},
ActionID: actionID,
SpellSchool: core.SpellSchoolPhysical,
ProcMask: procMask,
Flags: core.SpellFlagMeleeMetrics | SpellFlagColdBlooded,
Expand Down

0 comments on commit 9f27946

Please sign in to comment.