From 80b9ef71cf38334b8e07a04ac69d32a58ab63767 Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Sat, 24 Aug 2024 23:46:49 -0400 Subject: [PATCH] Better damage scaling for items --- internal/items/items.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/items/items.go b/internal/items/items.go index 944a6d4..ffd946d 100644 --- a/internal/items/items.go +++ b/internal/items/items.go @@ -228,7 +228,7 @@ func (item *Item) ScaleDPS(level int) (float64, error) { maximum := adjDps * float64(100+(rand.IntN(25)+28)) // If the weapon has secondary damage, scale that as well based on the ratio of the primary damage - if item.MinDmg2 != nil && item.MaxDmg2 != nil { + if *item.MinDmg2 != 0 && *item.MaxDmg2 != 0 { ratioMin := float64(*item.MinDmg2) / float64(*item.MinDmg1) ratioMax := float64(*item.MaxDmg2) / float64(*item.MaxDmg1) minimum2 := ratioMin * float64(minimum) @@ -248,6 +248,8 @@ func (item *Item) ScaleDPS(level int) (float64, error) { item.MinDmg1 = &minimum item.MaxDmg1 = &maximum + dps, _ = item.GetDPS() + return dps, nil } @@ -504,7 +506,7 @@ func (item *Item) ScaleItem(itemLevel int, itemQuality int) (bool, error) { log.Printf("Failed to scale DPS: %v", err) return false, err } - log.Printf("DPS: %.1f scaled up from previous dps %v", dps, predps) + log.Printf("DPS: %.1f scaled up from previous dps %v: Min %v - Max %v", dps, predps, *item.MinDmg1, *item.MaxDmg1) } item.cleanSpells()