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 Synapse swap CD when having identical ItemIDs #1312

Merged
merged 1 commit into from
Jan 18, 2025
Merged
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
17 changes: 15 additions & 2 deletions sim/core/item_swaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,24 @@ func (swap *ItemSwap) RegisterActive(itemID int32) {

// Helper for handling Enchant On Use effects to set a 30s cd on the related spell.
func (swap *ItemSwap) ProcessTinker(spell *Spell, slots []proto.ItemSlot) {
swap.character.RegisterItemSwapCallback(slots, func(sim *Simulation, _ proto.ItemSlot) {
swap.character.RegisterItemSwapCallback(slots, func(sim *Simulation, slot proto.ItemSlot) {
if spell == nil || !swap.initialized {
return
}
spell.CD.Set(sim.CurrentTime + max(spell.CD.TimeToReady(sim), time.Second*30))

isUniqueItem := swap.GetEquippedItemBySlot(slot).ID != swap.GetUnequippedItemBySlot(slot).ID

var newSpellCD time.Duration
timeToReady := spell.CD.TimeToReady(sim)
if isUniqueItem {
// Unique items have a 30s CD regardless of the spell CD being > 30s or not
newSpellCD = max(timeToReady, time.Second*30)
} else {
// Items with the same ItemID share the CD and does not get reset to 30s
newSpellCD = TernaryDuration(timeToReady > 30, timeToReady, time.Second*30)
}

spell.CD.Set(sim.CurrentTime + newSpellCD)
})
}

Expand Down
Loading