Skip to content

Commit

Permalink
Merge branch 'master' into feature/generic-auto-gemming
Browse files Browse the repository at this point in the history
  • Loading branch information
1337LutZ committed Oct 22, 2023
2 parents d00ed0d + e12724b commit 9378f3e
Show file tree
Hide file tree
Showing 333 changed files with 21,381 additions and 22,736 deletions.
Binary file modified assets/database/db.bin
Binary file not shown.
1,351 changes: 634 additions & 717 deletions assets/database/db.json

Large diffs are not rendered by default.

Binary file modified assets/database/leftover_db.bin
Binary file not shown.
11 changes: 4 additions & 7 deletions assets/database/leftover_db.json

Large diffs are not rendered by default.

4,514 changes: 2,259 additions & 2,255 deletions assets/db_inputs/wowhead_gearplannerdb.txt

Large diffs are not rendered by default.

8,877 changes: 4,441 additions & 4,436 deletions assets/db_inputs/wowhead_item_tooltips.csv

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ message Player {

// Items/enchants/gems/etc to include in the database.
SimDatabase database = 35;

double nibelung_average_casts = 43;
// hack to set a proper default value
bool nibelung_average_casts_set = 44;
}

message Party {
Expand Down
3 changes: 3 additions & 0 deletions proto/ui.proto
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ message SavedSettings {
bool in_front_of_target = 11;
double distance_from_target = 12;
HealingModel healing_model = 13;
double nibelung_average_casts = 15;
// hack to set a proper default value
bool nibelung_average_casts_set = 16;
}

message SavedTalents {
Expand Down
9 changes: 8 additions & 1 deletion sim/common/wotlk/nibelung.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ func MakeNibelungTriggerAura(agent core.Agent, isHeroic bool) {
for _, petAgent := range character.PetAgents {
if valkyr, ok := petAgent.(*ValkyrPet); ok && !valkyr.IsEnabled() {
valkyr.registerSmite(isHeroic)
valkyr.EnableWithTimeout(sim, petAgent, valkyrAura.Duration)

averageCasts := character.NibelungAverageCasts
duration := min(time.Duration(averageCasts/16*30)*time.Second, time.Second*30)
valkyrAura.Duration = max(duration, time.Millisecond*250)

if averageCasts > 0 {
valkyr.EnableWithTimeout(sim, petAgent, valkyrAura.Duration)
}
break
}
}
Expand Down
24 changes: 16 additions & 8 deletions sim/common/wotlk/stat_bonus_procs.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,8 @@ func init() {
ICD: time.Second * 100,
})
newProcStatBonusEffect(ProcStatBonusEffect{
Name: "Ashen Band of Unmatched Destruction",
// Ashen Band of Unmatched Destruction
Name: "Frostforged Sage",
ID: 50397,
AuraID: 72416,
Bonus: stats.Stats{stats.SpellPower: 285},
Expand All @@ -573,7 +574,8 @@ func init() {
ICD: time.Second * 60,
})
newProcStatBonusEffect(ProcStatBonusEffect{
Name: "Ashen Band of Endless Destruction",
// Ashen Band of Endless Destruction
Name: "Frostforged Sage",
ID: 50398,
AuraID: 72416,
Bonus: stats.Stats{stats.SpellPower: 285},
Expand All @@ -585,7 +587,8 @@ func init() {
ICD: time.Second * 60,
})
newProcStatBonusEffect(ProcStatBonusEffect{
Name: "Ashen Band of Unmatched Vengeance",
// Ashen Band of Unmatched Vengeance
Name: "Frostforged Champion",
ID: 50401,
AuraID: 72412,
Bonus: stats.Stats{stats.AttackPower: 480, stats.RangedAttackPower: 480},
Expand All @@ -597,7 +600,8 @@ func init() {
ICD: time.Second * 60,
})
newProcStatBonusEffect(ProcStatBonusEffect{
Name: "Ashen Band of Endless Vengeance",
// Ashen Band of Endless Vengeance
Name: "Frostforged Champion",
ID: 50402,
AuraID: 72412,
Bonus: stats.Stats{stats.AttackPower: 480, stats.RangedAttackPower: 480},
Expand All @@ -609,7 +613,8 @@ func init() {
ICD: time.Second * 60,
})
newProcStatBonusEffect(ProcStatBonusEffect{
Name: "Ashen Band of Unmatched Courage",
// Ashen Band of Unmatched Courage
Name: "Frostforged Defender",
ID: 50403,
AuraID: 72414,
Bonus: stats.Stats{stats.Armor: 2400},
Expand All @@ -621,7 +626,8 @@ func init() {
ICD: time.Second * 60,
})
newProcStatBonusEffect(ProcStatBonusEffect{
Name: "Ashen Band of Endless Courage",
// Ashen Band of Endless Courage
Name: "Frostforged Defender",
ID: 50404,
AuraID: 72414,
Bonus: stats.Stats{stats.Armor: 2400},
Expand All @@ -633,7 +639,8 @@ func init() {
ICD: time.Second * 60,
})
newProcStatBonusEffect(ProcStatBonusEffect{
Name: "Ashen Band of Unmatched Might",
// Ashen Band of Unmatched Might
Name: "Frostforged Champion",
ID: 52571,
AuraID: 72412,
Bonus: stats.Stats{stats.AttackPower: 480, stats.RangedAttackPower: 480},
Expand All @@ -645,7 +652,8 @@ func init() {
ICD: time.Second * 60,
})
newProcStatBonusEffect(ProcStatBonusEffect{
Name: "Ashen Band of Endless Might",
// Ashen Band of Endless Might
Name: "Frostforged Champion",
ID: 52572,
AuraID: 72412,
Bonus: stats.Stats{stats.AttackPower: 480, stats.RangedAttackPower: 480},
Expand Down
8 changes: 7 additions & 1 deletion sim/core/apl.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ func (apl *APLRotation) DoNextAction(sim *Simulation) {

i := 0
apl.inLoop = true
apl.unit.StartAPLLoop(sim)

for nextAction := apl.getNextAction(sim); nextAction != nil; i, nextAction = i+1, apl.getNextAction(sim) {
if i > 1000 {
panic(fmt.Sprintf("[USER_ERROR] Infinite loop detected, current action:\n%s", nextAction))
Expand All @@ -206,11 +208,14 @@ func (apl *APLRotation) DoNextAction(sim *Simulation) {
apl.unit.Log(sim, "No available actions!")
}

if apl.unit.GCD.IsReady(sim) {
gcdReady := apl.unit.GCD.IsReady(sim)
if gcdReady {
apl.unit.WaitUntil(sim, sim.CurrentTime+time.Millisecond*50)
} else {
apl.unit.DoNothing()
}

apl.unit.DoneAPLLoop(sim, gcdReady)
}

func (apl *APLRotation) getNextAction(sim *Simulation) *APLAction {
Expand All @@ -229,6 +234,7 @@ func (apl *APLRotation) getNextAction(sim *Simulation) *APLAction {

func (apl *APLRotation) shouldInterruptChannel(sim *Simulation) bool {
channeledDot := apl.unit.ChanneledDot

if channeledDot.MaxTicksRemaining() == 0 {
// Channel has ended, but apl.unit.ChanneledDot hasn't been cleared yet meaning the aura is still active.
return false
Expand Down
12 changes: 9 additions & 3 deletions sim/core/apl_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ func (action *APLAction) GetAllActions() []*APLAction {
func (action *APLAction) GetAllAPLValues() []APLValue {
var values []APLValue
for _, a := range action.GetAllActions() {
values = append(values, a.impl.GetAPLValues()...)
unprocessed := a.impl.GetAPLValues()
if a.condition != nil {
values = append(values, a.condition)
values = append(values, a.condition.GetInnerValues()...)
unprocessed = append(unprocessed, a.condition)
}

for len(unprocessed) > 0 {
next := unprocessed[len(unprocessed)-1]
unprocessed = unprocessed[:len(unprocessed)-1]
values = append(values, next)
unprocessed = append(unprocessed, next.GetInnerValues()...)
}
}
return FilterSlice(values, func(val APLValue) bool { return val != nil })
Expand Down
4 changes: 3 additions & 1 deletion sim/core/apl_actions_casting.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package core

import (
"fmt"

"github.com/wowsims/wotlk/sim/core/proto"
)

Expand Down Expand Up @@ -73,6 +72,9 @@ func (rot *APLRotation) newActionChannelSpell(config *proto.APLActionChannelSpel
allowRecast: config.AllowRecast,
}
}
func (action *APLActionChannelSpell) GetAPLValues() []APLValue {
return []APLValue{action.interruptIf}
}
func (action *APLActionChannelSpell) IsReady(sim *Simulation) bool {
return action.spell.CanCast(sim, action.target.Get())
}
Expand Down
13 changes: 13 additions & 0 deletions sim/core/apl_values_operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,19 @@ func (rot *APLRotation) coerceToSameType(value1 APLValue, value2 APLValue) (APLV
return coerced[0], coerced[1]
}

// Utility function which returns the constant float value of a Const or Coerced(Const) APL value.
// Returns -1 if the value is not a constant, or does not have a float value.
func getConstAPLFloatValue(value APLValue) float64 {
if constValue, isConst := value.(*APLValueConst); isConst {
return constValue.GetFloat(nil)
} else if coercedValue, isCoerced := value.(*APLValueCoerced); isCoerced {
if _, innerIsConst := coercedValue.inner.(*APLValueConst); innerIsConst {
return coercedValue.GetFloat(nil)
}
}
return -1
}

type APLValueCompare struct {
DefaultAPLValueImpl
op proto.APLValueCompare_ComparisonOperator
Expand Down
20 changes: 13 additions & 7 deletions sim/core/attack.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,10 @@ func (aa *AutoAttacks) TrySwingMH(sim *Simulation, target *Unit) {

attackSpell := aa.MaybeReplaceMHSwing(sim, aa.MHAuto)

attackSpell.Cast(sim, target)
// Update swing timer BEFORE the cast, so that APL checks for TimeToNextAuto behave correctly
// if the attack causes APL evaluations (e.g. from rage gain).
aa.MainhandSwingAt = sim.CurrentTime + aa.curMHSwingDuration
attackSpell.Cast(sim, target)

if !sim.Options.Interactive {
if aa.unit.IsUsingAPL {
Expand Down Expand Up @@ -537,8 +539,10 @@ func (aa *AutoAttacks) TrySwingOH(sim *Simulation, target *Unit) {
return
}

aa.OHAuto.Cast(sim, target)
// Update swing timer BEFORE the cast, so that APL checks for TimeToNextAuto behave correctly
// if the attack causes APL evaluations (e.g. from rage gain).
aa.OffhandSwingAt = sim.CurrentTime + aa.curOHSwingDuration
aa.OHAuto.Cast(sim, target)

if !sim.Options.Interactive {
if aa.unit.IsUsingAPL {
Expand All @@ -555,8 +559,10 @@ func (aa *AutoAttacks) TrySwingRanged(sim *Simulation, target *Unit) {
return
}

aa.RangedAuto.Cast(sim, target)
// Update swing timer BEFORE the cast, so that APL checks for TimeToNextAuto behave correctly
// if the attack causes APL evaluations.
aa.RangedSwingAt = sim.CurrentTime + aa.RangedSwingSpeed()
aa.RangedAuto.Cast(sim, target)

if !sim.Options.Interactive {
if aa.unit.IsUsingAPL {
Expand Down Expand Up @@ -680,11 +686,11 @@ func (aa *AutoAttacks) DelayRangedUntil(sim *Simulation, readyAt time.Duration)

// Returns the time at which the next attack will occur.
func (aa *AutoAttacks) NextAttackAt() time.Duration {
nextAttack := aa.MainhandSwingAt
if aa.IsDualWielding && aa.OffhandSwingAt < nextAttack {
nextAttack = aa.OffhandSwingAt
if aa.IsDualWielding && aa.OffhandSwingAt < aa.MainhandSwingAt {
return aa.OffhandSwingAt
} else {
return aa.MainhandSwingAt
}
return nextAttack
}

type PPMManager struct {
Expand Down
Loading

0 comments on commit 9378f3e

Please sign in to comment.