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

Fix APL issue with Fan of Knives and different types in math operations #3612

Merged
merged 1 commit into from
Sep 4, 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
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
Loading