Skip to content

Commit

Permalink
Fixed magic effect power up updates cause stat reset
Browse files Browse the repository at this point in the history
Some skills update the max stat, e.g. Swell Life skill. When updating an existing effect, the max stat was reset to the normal value, and directly boosted again. When then the max value is above the current, the current gets capped to the lower max.
We prevent that now when the powerups are identical.
  • Loading branch information
sven-n committed Dec 5, 2024
1 parent 10f0433 commit 56582ed
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/GameLogic/MagicEffectsList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ private void UpdateEffect(MagicEffect effect)
//// This doesn't only save traffic, it also looks better in game.
magicEffect.Duration = effect.Duration;
magicEffect.ResetTimer();

if (magicEffect.PowerUpElements.Select(e => e.Element)
.SequenceEqual(effect.PowerUpElements.Select(e => e.Element)))
{
// if the effect power ups are the same, we can leave it like that
return;
}

foreach (var powerUp in magicEffect.PowerUpElements)
{
this._owner.Attributes.RemoveElement(powerUp.Element, powerUp.Target);
Expand Down

0 comments on commit 56582ed

Please sign in to comment.