From e1ad597cdedaaf89f7fd4d58738c894693d5ab8b Mon Sep 17 00:00:00 2001 From: ryma Date: Fri, 22 Apr 2022 15:51:17 -0400 Subject: [PATCH] BuffStack fix --- .../AttackableUnits/AttackableUnit.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/GameServerLib/GameObjects/AttackableUnits/AttackableUnit.cs b/GameServerLib/GameObjects/AttackableUnits/AttackableUnit.cs index 281a52dd1..a3e4d48b2 100644 --- a/GameServerLib/GameObjects/AttackableUnits/AttackableUnit.cs +++ b/GameServerLib/GameObjects/AttackableUnits/AttackableUnit.cs @@ -1190,7 +1190,11 @@ public void AddBuff(IBuff b) _game.PacketNotifier.NotifyNPC_BuffAdd2(b); } // Activate the buff for BuffScripts - b.ActivateBuff(); + for(int i = 0; i < b.MaxStacks; ++i) + { + b.ActivateBuff(); + } + } // If the buff is supposed to replace any existing buff instances of the same name else if (b.BuffAddType == BuffAddType.REPLACE_EXISTING) @@ -1219,7 +1223,11 @@ public void AddBuff(IBuff b) } // New buff means new script, so we need to activate it. - b.ActivateBuff(); + for(int i = 0; i < b.MaxStacks; ++i) + { + b.ActivateBuff(); + } + } else if (b.BuffAddType == BuffAddType.RENEW_EXISTING) { @@ -1326,7 +1334,10 @@ public void AddBuff(IBuff b) _game.PacketNotifier.NotifyNPC_BuffUpdateCount(b, b.Duration, b.TimeElapsed); } } - b.ActivateBuff(); + for(int i = 0; i < b.MaxStacks; ++i) + { + b.ActivateBuff(); + } } // If the buff is supposed to add a stack to any existing buffs of the same name and refresh their timer. // Essentially the method is: have one parent buff which has the stacks, and just refresh its time, this means no overlapping buff instances, but functionally it is the same.