Fixed statuseffect changes in a57bec2 not being added to one of the overloads of the Apply method

This commit is contained in:
Joonas Rikkonen
2018-03-09 17:55:06 +02:00
parent 738910e123
commit a8dda856cc

View File

@@ -277,11 +277,16 @@ namespace Barotrauma
if (this.type != type || !HasRequiredItems(entity)) return;
if (targetNames != null && !targetNames.Contains(target.Name)) return;
if (duration > 0.0f && !Stackable)
{
//ignore if not stackable and there's already an identical statuseffect
if (DurationList.Any(d => d.Parent == this && d.Entity == entity && d.Targets.Count == 1 && d.Targets[0] == target)) return;
DurationListElement existingEffect = DurationList.Find(d => d.Parent == this && d.Targets.Count == 1 && d.Targets[0] == target));
if (existingEffect != null)
{
existingEffect.Timer = Math.Max(existingEffect.Timer, duration);
return;
}
}
List<ISerializableEntity> targets = new List<ISerializableEntity>();