Skip to content

Commit

Permalink
Move reforging up to apply before enchants
Browse files Browse the repository at this point in the history
  • Loading branch information
ToxicKevinFerm committed Feb 29, 2024
1 parent 2391c00 commit 7d8f3c0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sim/core/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ func NewItem(itemSpec ItemSpec) Item {
panic(fmt.Sprintf("No item with id: %d", itemSpec.ID))
}

if itemSpec.Reforging != nil {
if validateReforging(&item, *itemSpec.Reforging) {
item.Reforging = itemSpec.Reforging
} else {
panic(fmt.Sprintf("When validating reforging for item %d, the stat reforging for %s to %s could not be validated", itemSpec.ID, itemSpec.Reforging.FromStat.String(), itemSpec.Reforging.ToStat.String()))
}
}

if itemSpec.Enchant != 0 {
if enchant, ok := EnchantsByEffectID[itemSpec.Enchant]; ok {
item.Enchant = enchant
Expand All @@ -280,14 +288,6 @@ func NewItem(itemSpec ItemSpec) Item {
// }
}

if itemSpec.Reforging != nil {
if validateReforging(&item, *itemSpec.Reforging) {
item.Reforging = itemSpec.Reforging
} else {
panic(fmt.Sprintf("When validating reforging for item %d, the stat reforging for %s to %s could not be validated", itemSpec.ID, itemSpec.Reforging.FromStat.String(), itemSpec.Reforging.ToStat.String()))
}
}

if len(itemSpec.Gems) > 0 {
// Need to do this to account for possible extra gem sockets.
numGems := len(item.GemSockets)
Expand Down

0 comments on commit 7d8f3c0

Please sign in to comment.