fix: Fixes buffs don't start/stop properly. Streamlines constructor and Add/Remove buffs. (#2082)

This commit is contained in:
mark1145 2025-01-25 13:20:23 +11:00 • committed by GitHub
parent c8f13b2933
commit d5160bd6db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 651 additions and 616 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Server.Engines.BuffIcons;
using Server.Mobiles;
using Server.Targeting;
@ -86,8 +87,8 @@ public class BloodOathSpell : NecromancerSpell, ITargetingSpell<Mobile>
var timer = new ExpireTimer(Caster, m, duration);
timer.Start();
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.BloodOathCaster, 1075659, duration, Caster, m.Name));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.BloodOathCurse, 1075661, duration, m, Caster.Name));
(Caster as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.BloodOathCaster, 1075659, duration, m.Name));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.BloodOathCurse, 1075661, duration, Caster.Name));
_table[m] = timer;
HarmfulSpell(m);
@ -119,8 +120,8 @@ public class BloodOathSpell : NecromancerSpell, ITargetingSpell<Mobile>
timer.Stop();
BuffInfo.RemoveBuff(caster, BuffIcon.BloodOathCaster);
BuffInfo.RemoveBuff(target, BuffIcon.BloodOathCurse);
(caster as PlayerMobile)?.RemoveBuff(BuffIcon.BloodOathCaster);
(target as PlayerMobile)?.RemoveBuff(BuffIcon.BloodOathCurse);
return true;
}

View file

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using Server.Engines.BuffIcons;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Necromancy;
@ -80,7 +82,7 @@ public class CorpseSkinSpell : NecromancerSpell, ITargetingSpell<Mobile>
timer = new ExpireTimer(m, mods, duration);
timer.Start();
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.CorpseSkin, 1075663, duration, m));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.CorpseSkin, 1075663, duration));
_table[m] = timer;
@ -129,7 +131,7 @@ public class CorpseSkinSpell : NecromancerSpell, ITargetingSpell<Mobile>
}
Stop();
BuffInfo.RemoveBuff(_mobile, BuffIcon.CorpseSkin);
(_mobile as PlayerMobile)?.RemoveBuff(BuffIcon.CorpseSkin);
_table.Remove(_mobile);
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Server.Engines.BuffIcons;
using Server.Mobiles;
using Server.Targeting;
@ -64,7 +65,7 @@ public class EvilOmenSpell : NecromancerSpell, ITargetingSpell<Mobile>
HarmfulSpell(m);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EvilOmen, 1075647, 1075648, duration, m));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.EvilOmen, 1075647, 1075648, duration));
}
}

View file

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using Server.Engines.BuffIcons;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Necromancy;
@ -72,7 +74,7 @@ public class MindRotSpell : NecromancerSpell, ITargetingSpell<Mobile>
{
timer.Stop();
m.SendLocalizedMessage(1060872); // Your mind feels normal again.
BuffInfo.RemoveBuff(m, BuffIcon.Mindrot);
(m as PlayerMobile)?.RemoveBuff(BuffIcon.Mindrot);
return true;
}
@ -101,7 +103,7 @@ public class MindRotSpell : NecromancerSpell, ITargetingSpell<Mobile>
timer.Start();
_table[target] = timer;
BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Mindrot, 1075665, duration, target));
(target as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.Mindrot, 1075665, duration));
target.SendLocalizedMessage(1074384);
}
}

View file

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using Server.Engines.BuffIcons;
using Server.Misc;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Necromancy;
@ -70,7 +72,7 @@ public class PainSpikeSpell : NecromancerSpell, ITargetingSpell<Mobile>
buffTime = timer.Next - Core.Now;
}
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.PainSpike, 1075667, buffTime, m, Convert.ToString((int)damage)));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.PainSpike, 1075667, buffTime, Convert.ToString((int)damage)));
// TODO: Find a better way to do this
StaminaSystem.DFA = DFAlgorithm.PainSpike;
@ -109,7 +111,7 @@ public class PainSpikeSpell : NecromancerSpell, ITargetingSpell<Mobile>
_mobile.Hits += _toRestore;
}
BuffInfo.RemoveBuff(_mobile, BuffIcon.PainSpike);
(_mobile as PlayerMobile)?.RemoveBuff(BuffIcon.PainSpike);
}
}
}

View file

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using Server.Engines.BuffIcons;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Necromancy;
@ -96,7 +98,7 @@ public class StrangleSpell : NecromancerSpell, ITargetingSpell<Mobile>
var maxDamage = ((int)power + 1) * 3;
var args = $"{minDamage}\t{maxDamage}";
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Strangle, 1075794, 1075795, duration, m, args));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.Strangle, 1075794, 1075795, duration, args));
}
}