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,7 @@
using System;
using System.Collections.Generic;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells.Bushido;
@ -69,13 +71,19 @@ public class Confidence : SamuraiSpell
if (Core.HS)
{
var bushido = m.Skills.Bushido.Fixed;
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Confidence, 1060596, 1153809, TimeSpan.FromSeconds(30), m,
$"{bushido / 120}\t{bushido / 50}\t{"100"}"
));
(m as PlayerMobile)?.AddBuff(
new BuffInfo(
BuffIcon.Confidence,
1060596,
1153809,
TimeSpan.FromSeconds(30),
$"{bushido / 120}\t{bushido / 50}\t{"100"}"
)
);
}
else
{
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Confidence, 1060596, TimeSpan.FromSeconds(30), m));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.Confidence, 1060596, TimeSpan.FromSeconds(30)));
}
}
@ -97,7 +105,7 @@ public class Confidence : SamuraiSpell
if (StopConfidenceTimer(m))
{
OnEffectEnd(m, typeof(Confidence));
BuffInfo.RemoveBuff(m, BuffIcon.Confidence);
(m as PlayerMobile)?.RemoveBuff(BuffIcon.Confidence);
}
}

View file

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells.Bushido;
@ -42,14 +44,12 @@ public class HonorableExecution : SamuraiMove
timer = new HonorableExecutionTimer(attacker, swingBonus);
BuffInfo.AddBuff(
attacker,
(attacker as PlayerMobile)?.AddBuff(
new BuffInfo(
BuffIcon.HonorableExecution,
1060595,
1153807,
TimeSpan.FromSeconds(20.0),
attacker,
$"{swingBonus}"
)
);
@ -76,23 +76,20 @@ public class HonorableExecution : SamuraiMove
if (Core.HS)
{
BuffInfo.AddBuff(
attacker,
(attacker as PlayerMobile)?.AddBuff(
new BuffInfo(
BuffIcon.HonorableExecution,
1060595,
1153808,
TimeSpan.FromSeconds(7.0),
attacker,
$"{resSpells}\t{40}\t{40}\t{40}\t{40}\t{40}"
)
);
}
else
{
BuffInfo.AddBuff(
attacker,
new BuffInfo(BuffIcon.HonorableExecution, 1060595, TimeSpan.FromSeconds(7.0), attacker)
(attacker as PlayerMobile)?.AddBuff(
new BuffInfo(BuffIcon.HonorableExecution, 1060595, TimeSpan.FromSeconds(7.0))
);
}
}

View file

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells.Chivalry;
@ -52,24 +54,19 @@ public class DivineFurySpell : PaladinSpell
if (Core.HS) // Publish 71 with boost
{
BuffInfo.AddBuff(
Caster,
(Caster as PlayerMobile)?.AddBuff(
new BuffInfo(
BuffIcon.DivineFury,
1060589,
1150218,
delay,
Caster,
$"{timer.AttackBonus}\t{timer.DamageBonus}\t{timer.WeaponSpeed}\t{timer.DefendMalus}"
)
);
}
else
{
BuffInfo.AddBuff(
Caster,
new BuffInfo(BuffIcon.DivineFury, 1060589, 1075634, delay, Caster)
);
(Caster as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.DivineFury, 1060589, 1075634, delay));
}
}
@ -116,7 +113,7 @@ public class DivineFurySpell : PaladinSpell
RemoveTimer(m);
m.Delta(MobileDelta.WeaponDamage);
m.PlaySound(0xF8);
BuffInfo.RemoveBuff(m, BuffIcon.DivineFury);
(m as PlayerMobile)?.RemoveBuff(BuffIcon.DivineFury);
}
public static bool UnderEffect(Mobile m) => _table.ContainsKey(m);

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells.Chivalry
@ -49,9 +50,8 @@ namespace Server.Spells.Chivalry
mobile.EnemyOfOneType = null;
mobile.WaitingForEnemy = true;
BuffInfo.AddBuff(
mobile,
new BuffInfo(BuffIcon.EnemyOfOne, 1075653, 1044111, TimeSpan.FromMinutes(delay), mobile)
mobile.AddBuff(
new BuffInfo(BuffIcon.EnemyOfOne, 1075653, 1044111, TimeSpan.FromMinutes(delay))
);
}
}

View file

@ -1,5 +1,6 @@
using System;
using Server.Collections;
using Server.Engines.BuffIcons;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
@ -142,14 +143,17 @@ namespace Server.Spells.Chivalry
sendEffect = SpellPlagueSpell.RemoveEffect(m) || sendEffect;
// TODO: Move these into their respective end effect methods
BuffInfo.RemoveBuff(m, BuffIcon.Clumsy);
BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind);
BuffInfo.RemoveBuff(m, BuffIcon.Weaken);
BuffInfo.RemoveBuff(m, BuffIcon.Curse);
BuffInfo.RemoveBuff(m, BuffIcon.MassCurse);
BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike);
BuffInfo.RemoveBuff(m, BuffIcon.Strangle);
BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen);
if (m is PlayerMobile pm)
{
pm.RemoveBuff(BuffIcon.Clumsy);
pm.RemoveBuff(BuffIcon.FeebleMind);
pm.RemoveBuff(BuffIcon.Weaken);
pm.RemoveBuff(BuffIcon.Curse);
pm.RemoveBuff(BuffIcon.MassCurse);
pm.RemoveBuff(BuffIcon.MortalStrike);
pm.RemoveBuff(BuffIcon.Strangle);
pm.RemoveBuff(BuffIcon.EvilOmen);
}
if (sendEffect)
{

View file

@ -1,6 +1,8 @@
using System;
using Server.Engines.BuffIcons;
using Server.Engines.ConPVP;
using Server.Items;
using Server.Mobiles;
using Server.Spells.Fourth;
using Server.Spells.Mysticism;
using Server.Spells.Necromancy;
@ -109,15 +111,17 @@ namespace Server.Spells.Chivalry
BloodOathSpell.RemoveCurse(m);
SpellPlagueSpell.RemoveEffect(m);
// TODO: Move these into their respective end effect methods
BuffInfo.RemoveBuff(m, BuffIcon.Clumsy);
BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind);
BuffInfo.RemoveBuff(m, BuffIcon.Weaken);
BuffInfo.RemoveBuff(m, BuffIcon.Curse);
BuffInfo.RemoveBuff(m, BuffIcon.MassCurse);
BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike);
BuffInfo.RemoveBuff(m, BuffIcon.Strangle);
BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen);
if (m is PlayerMobile pm)
{
pm.RemoveBuff(BuffIcon.Clumsy);
pm.RemoveBuff(BuffIcon.FeebleMind);
pm.RemoveBuff(BuffIcon.Weaken);
pm.RemoveBuff(BuffIcon.Curse);
pm.RemoveBuff(BuffIcon.MassCurse);
pm.RemoveBuff(BuffIcon.MortalStrike);
pm.RemoveBuff(BuffIcon.Strangle);
pm.RemoveBuff(BuffIcon.EvilOmen);
}
}
else
{

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using ModernUO.CodeGeneratedEvents;
using Server.Engines.BuffIcons;
using Server.Factions;
using Server.Items;
using Server.Mobiles;
@ -114,7 +115,7 @@ namespace Server.Spells.Fifth
Timer.StartTimer(duration, () => EndIncognito(Caster), out var timerToken);
_table[Caster] = timerToken;
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Incognito, 1075819, duration, Caster));
pm?.AddBuff(new BuffInfo(BuffIcon.Incognito, 1075819, duration));
}
else
{
@ -139,7 +140,7 @@ namespace Server.Spells.Fifth
timerToken.Cancel();
}
BuffInfo.RemoveBuff(m, BuffIcon.Incognito);
(m as PlayerMobile)?.RemoveBuff(BuffIcon.Incognito);
}
public static void EndIncognito(Mobile m)

View file

@ -1,5 +1,6 @@
using System.Collections.Generic;
using ModernUO.CodeGeneratedEvents;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells.Fifth
@ -70,7 +71,7 @@ namespace Server.Spells.Fifth
Caster.RemoveResistanceMod(mods[i]);
}
BuffInfo.RemoveBuff(Caster, BuffIcon.MagicReflection);
(Caster as PlayerMobile)?.RemoveBuff(BuffIcon.MagicReflection);
}
else
{
@ -98,7 +99,9 @@ namespace Server.Spells.Fifth
var buffFormat = $"{physiMod}\t+{otherMod}\t+{otherMod}\t+{otherMod}\t+{otherMod}";
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.MagicReflection, 1075817, buffFormat, true));
(Caster as PlayerMobile)?.AddBuff(
new BuffInfo(BuffIcon.MagicReflection, 1075817, args: buffFormat, retainThroughDeath: true)
);
}
}
}
@ -147,7 +150,7 @@ namespace Server.Spells.Fifth
m.RemoveResistanceMod(mods[i]);
}
BuffInfo.RemoveBuff(m, BuffIcon.MagicReflection);
(m as PlayerMobile)?.RemoveBuff(BuffIcon.MagicReflection);
}
}
}

View file

@ -1,3 +1,5 @@
using Server.Engines.BuffIcons;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.First
@ -39,7 +41,7 @@ namespace Server.Spells.First
var percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, true) * 100);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Clumsy, 1075831, length, m, percentage.ToString()));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.Clumsy, 1075831, length, percentage.ToString()));
HarmfulSpell(m);
}

View file

@ -1,3 +1,5 @@
using Server.Engines.BuffIcons;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.First
@ -41,7 +43,7 @@ namespace Server.Spells.First
var percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, true) * 100);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.FeebleMind, 1075833, length, m, percentage.ToString()));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.FeebleMind, 1075833, length, percentage.ToString()));
HarmfulSpell(m);
}

View file

@ -1,4 +1,6 @@
using System;
using Server.Engines.BuffIcons;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.First;
@ -46,7 +48,7 @@ public class NightSightSpell : MagerySpell, ITargetingSpell<Mobile>
m.PlaySound(0x1E3);
// Night Sight/You ignore lighting effects
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.NightSight, 1075643));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.NightSight, 1075643));
}
else if (m == Caster)
{

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using ModernUO.CodeGeneratedEvents;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells.First
@ -72,7 +73,7 @@ namespace Server.Spells.First
Caster.RemoveResistanceMod(mods[i]);
}
BuffInfo.RemoveBuff(Caster, BuffIcon.ReactiveArmor);
(Caster as PlayerMobile)?.RemoveBuff(BuffIcon.ReactiveArmor);
}
else
{
@ -102,7 +103,7 @@ namespace Server.Spells.First
var physresist = 15 + (int)(Caster.Skills.Inscribe.Value / 20);
var args = $"{physresist}\t{5}\t{5}\t{5}\t{5}";
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.ReactiveArmor, 1075812, 1075813, args));
(Caster as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.ReactiveArmor, 1075812, 1075813, args: args));
}
}
@ -157,7 +158,7 @@ namespace Server.Spells.First
m.RemoveResistanceMod(mods[i]);
}
BuffInfo.RemoveBuff(m, BuffIcon.ReactiveArmor);
(m as PlayerMobile)?.RemoveBuff(BuffIcon.ReactiveArmor);
}
}
}

View file

@ -1,3 +1,5 @@
using Server.Engines.BuffIcons;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.First
@ -39,7 +41,7 @@ namespace Server.Spells.First
var percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, true) * 100);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Weaken, 1075837, length, m, percentage.ToString()));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.Weaken, 1075837, length, percentage.ToString()));
HarmfulSpell(m);
}

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.Fourth
@ -80,7 +82,7 @@ namespace Server.Spells.Fourth
var percentage = (int)(SpellHelper.GetOffsetScalar(caster, m, true) * 100);
var args = $"{percentage}\t{percentage}\t{percentage}\t{10}\t{10}\t{10}\t{10}";
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Curse, 1075835, 1075836, duration, m, args));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.Curse, 1075835, 1075836, duration, args));
return true;
}

View file

@ -1,4 +1,6 @@
using System;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells
{
@ -55,11 +57,10 @@ namespace Server.Spells
public override void OnCast()
{
Caster.Flying = false;
BuffInfo.RemoveBuff(Caster, BuffIcon.Fly);
Caster.Animate(60, 10, 1, true, false, 0);
Caster.SendLocalizedMessage(1112567); // You are flying.
Caster.Flying = true;
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Fly, 1112567));
(Caster as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.Fly, 1112567));
FinishSequence();
}
}

View file

@ -4,6 +4,8 @@ using Server.Spells.Fourth;
using Server.Spells.Necromancy;
using Server.Targeting;
using Server.Collections;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells.Mysticism;
@ -198,15 +200,18 @@ public class CleansingWindsSpell : MysticSpell, ITargetingSpell<Mobile>
curseLevel += 2;
}
BuffInfo.RemoveBuff(m, BuffIcon.Clumsy);
BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind);
BuffInfo.RemoveBuff(m, BuffIcon.Weaken);
BuffInfo.RemoveBuff(m, BuffIcon.Curse);
BuffInfo.RemoveBuff(m, BuffIcon.MassCurse);
BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike);
BuffInfo.RemoveBuff(m, BuffIcon.CorpseSkin);
BuffInfo.RemoveBuff(m, BuffIcon.Strangle);
BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen);
if (m is PlayerMobile pm)
{
pm.RemoveBuff(BuffIcon.Clumsy);
pm.RemoveBuff(BuffIcon.FeebleMind);
pm.RemoveBuff(BuffIcon.Weaken);
pm.RemoveBuff(BuffIcon.Curse);
pm.RemoveBuff(BuffIcon.MassCurse);
pm.RemoveBuff(BuffIcon.MortalStrike);
pm.RemoveBuff(BuffIcon.CorpseSkin);
pm.RemoveBuff(BuffIcon.Strangle);
pm.RemoveBuff(BuffIcon.EvilOmen);
}
return curseLevel;
}

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using ModernUO.CodeGeneratedEvents;
using Server.Engines.BuffIcons;
using Server.Mobiles;
using Server.Targeting;
@ -78,7 +79,7 @@ public class SpellPlagueSpell : MysticSpell, ITargetingSpell<Mobile>
if (_table.Remove(m, out var timer))
{
timer.Stop();
BuffInfo.RemoveBuff(m, BuffIcon.SpellPlague);
(m as PlayerMobile)?.RemoveBuff(BuffIcon.SpellPlague);
return true;
}
@ -129,9 +130,8 @@ public class SpellPlagueSpell : MysticSpell, ITargetingSpell<Mobile>
public void StartPlague()
{
BuffInfo.AddBuff(
_target,
new BuffInfo(BuffIcon.SpellPlague, 1031690, 1080167, TimeSpan.FromSeconds(8.5), _target)
(_target as PlayerMobile)?.AddBuff(
new BuffInfo(BuffIcon.SpellPlague, 1031690, 1080167, TimeSpan.FromSeconds(8.5))
);
_nextExplosion = Core.Now + TimeSpan.FromSeconds(1);
@ -184,7 +184,7 @@ public class SpellPlagueSpell : MysticSpell, ITargetingSpell<Mobile>
else
{
_table.Remove(_target);
BuffInfo.RemoveBuff(_target, BuffIcon.SpellPlague);
(_target as PlayerMobile)?.RemoveBuff(BuffIcon.SpellPlague);
}
_next = null;

View file

@ -1,5 +1,6 @@
using System.Collections.Generic;
using ModernUO.CodeGeneratedEvents;
using Server.Engines.BuffIcons;
using Server.Factions;
using Server.Mobiles;
using Server.Spells.Fifth;
@ -118,14 +119,12 @@ namespace Server.Spells.Mysticism
var damageBonus = (int)((GetBaseSkill(Caster) + GetDamageSkill(Caster)) / 12.0);
var resistCap = (int)((GetBaseSkill(Caster) + GetDamageSkill(Caster)) / 48.0);
BuffInfo.AddBuff(
Caster,
(Caster as PlayerMobile)?.AddBuff(
new BuffInfo(
BuffIcon.StoneForm,
1080145,
1080146,
$"-10\t-2\t{offset}\t{resistCap}\t{damageBonus}",
false
args: $"-10\t-2\t{offset}\t{resistCap}\t{damageBonus}"
)
);
}
@ -151,7 +150,7 @@ namespace Server.Spells.Mysticism
m.BodyMod = 0;
m.HueMod = -1;
BuffInfo.RemoveBuff(m, BuffIcon.StoneForm);
(m as PlayerMobile)?.RemoveBuff(BuffIcon.StoneForm);
}
}
}

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));
}
}

View file

@ -1,4 +1,6 @@
using Server.Engines.BuffIcons;
using Server.Engines.ConPVP;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Second
@ -34,7 +36,7 @@ namespace Server.Spells.Second
var percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, false) * 100);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Agility, 1075841, length, m, percentage.ToString()));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.Agility, 1075841, length, percentage.ToString()));
}
}

View file

@ -1,4 +1,6 @@
using Server.Engines.BuffIcons;
using Server.Engines.ConPVP;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Second
@ -34,7 +36,7 @@ namespace Server.Spells.Second
var percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, false) * 100);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Cunning, 1075843, length, m, percentage.ToString()));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.Cunning, 1075843, length, percentage.ToString()));
}
}

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using ModernUO.CodeGeneratedEvents;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells.Second
@ -72,7 +73,7 @@ namespace Server.Spells.Second
target.RemoveResistanceMod(mods.Item1);
target.RemoveSkillMod(mods.Item2);
BuffInfo.RemoveBuff(target, BuffIcon.Protection);
(target as PlayerMobile)?.RemoveBuff(BuffIcon.Protection);
}
else
{
@ -91,7 +92,7 @@ namespace Server.Spells.Second
target.AddSkillMod(resistMod);
var args = $"{physLoss}\t{resistLoss}";
BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Protection, 1075814, 1075815, args));
(target as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.Protection, 1075814, 1075815, args: args));
}
}
@ -108,7 +109,7 @@ namespace Server.Spells.Second
m.RemoveResistanceMod(mods.Item1);
m.RemoveSkillMod(mods.Item2);
BuffInfo.RemoveBuff(m, BuffIcon.Protection);
(m as PlayerMobile)?.RemoveBuff(BuffIcon.Protection);
}
public override void OnCast()

View file

@ -1,4 +1,6 @@
using Server.Engines.BuffIcons;
using Server.Engines.ConPVP;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Second
@ -34,7 +36,7 @@ namespace Server.Spells.Second
var percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, false) * 100);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Strength, 1075845, length, m, percentage.ToString()));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.Strength, 1075845, length, percentage.ToString()));
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Server.Engines.BuffIcons;
using Server.Engines.ConPVP;
using Server.Items;
using Server.Mobiles;
@ -53,8 +54,11 @@ namespace Server.Spells.Sixth
var duration = TimeSpan.FromSeconds(1.2 * Caster.Skills.Magery.Value);
BuffInfo.RemoveBuff(m, BuffIcon.HidingAndOrStealth);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Invisibility, 1075825, duration, m)); // Invisibility/Invisible
if (m is PlayerMobile pm)
{
pm.RemoveBuff(BuffIcon.HidingAndOrStealth);
pm.AddBuff(new BuffInfo(BuffIcon.Invisibility, 1075825, duration)); // Invisibility/Invisible
}
Timer.StartTimer(duration,
() =>

View file

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells.Spellweaving
{
@ -62,9 +64,8 @@ namespace Server.Spells.Spellweaving
Caster.BeginAction<AttuneWeaponSpell>();
BuffInfo.AddBuff(
Caster,
new BuffInfo(BuffIcon.AttuneWeapon, 1075798, duration, Caster, damageAbsorb.ToString())
(Caster as PlayerMobile)?.AddBuff(
new BuffInfo(BuffIcon.AttuneWeapon, 1075798, duration, damageAbsorb.ToString())
);
}
@ -130,7 +131,7 @@ namespace Server.Spells.Spellweaving
_table.Remove(m_Mobile);
StartTimer(TimeSpan.FromSeconds(120), m_Mobile.EndAction<AttuneWeaponSpell>);
BuffInfo.RemoveBuff(m_Mobile, BuffIcon.AttuneWeapon);
(m_Mobile as PlayerMobile)?.RemoveBuff(BuffIcon.AttuneWeapon);
}
}
}

View file

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using Server.Collections;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells.Spellweaving
{
@ -63,9 +65,8 @@ namespace Server.Spells.Spellweaving
_table[m] = t;
BuffInfo.AddBuff(
m,
new BuffInfo(BuffIcon.EssenceOfWind, 1075802, duration, m, $"{fcMalus}\t{ssiMalus}")
(m as PlayerMobile)?.AddBuff(
new BuffInfo(BuffIcon.EssenceOfWind, 1075802, duration, $"{fcMalus}\t{ssiMalus}")
);
}
}
@ -110,7 +111,7 @@ namespace Server.Spells.Spellweaving
Stop();
_table.Remove(_defender);
BuffInfo.RemoveBuff(_defender, BuffIcon.EssenceOfWind);
(_defender as PlayerMobile)?.RemoveBuff(BuffIcon.EssenceOfWind);
}
}
}

View file

@ -1,4 +1,6 @@
using System;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells.Spellweaving
{
@ -71,7 +73,7 @@ namespace Server.Spells.Spellweaving
// Cannot cast this spell for another 5 minutes(300sec) after effect removed.
Caster.BeginAction<EtherealVoyageSpell>();
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.EtherealVoyage, 1031613, 1075805, duration, Caster));
(Caster as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.EtherealVoyage, 1031613, 1075805, duration));
}
public override void RemoveEffect(Mobile m)
@ -82,7 +84,7 @@ namespace Server.Spells.Spellweaving
Timer.StartTimer(TimeSpan.FromMinutes(5), m.EndAction<EtherealVoyageSpell>);
BuffInfo.RemoveBuff(m, BuffIcon.EtherealVoyage);
(m as PlayerMobile)?.RemoveBuff(BuffIcon.EtherealVoyage);
}
}
}

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using ModernUO.CodeGeneratedEvents;
using Server.Engines.BuffIcons;
using Server.Gumps;
using Server.Mobiles;
using Server.Targeting;
@ -67,7 +68,9 @@ namespace Server.Spells.Spellweaving
_table[m] = t;
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.GiftOfLife, 1031615, 1075807, duration, m, null, true));
(m as PlayerMobile)?.AddBuff(
new BuffInfo(BuffIcon.GiftOfLife, 1031615, 1075807, duration, retainThroughDeath: true)
);
}
}
@ -152,7 +155,7 @@ namespace Server.Spells.Spellweaving
_mobile.SendLocalizedMessage(1074776); // You are no longer protected with Gift of Life.
_table.Remove(_mobile);
BuffInfo.RemoveBuff(_mobile, BuffIcon.GiftOfLife);
(_mobile as PlayerMobile)?.RemoveBuff(BuffIcon.GiftOfLife);
}
}
}

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.Spellweaving
@ -59,9 +61,14 @@ namespace Server.Spells.Spellweaving
Caster.BeginAction<GiftOfRenewalSpell>();
BuffInfo.AddBuff(
m,
new BuffInfo(BuffIcon.GiftOfRenewal, 1031602, 1075797, TimeSpan.FromSeconds(duration), m, hitsPerRound.ToString())
(m as PlayerMobile)?.AddBuff(
new BuffInfo(
BuffIcon.GiftOfRenewal,
1031602,
1075797,
TimeSpan.FromSeconds(duration),
hitsPerRound.ToString()
)
);
}
}
@ -74,7 +81,7 @@ namespace Server.Spells.Spellweaving
public static bool StopEffect(Mobile m)
{
BuffInfo.RemoveBuff(m, BuffIcon.GiftOfRenewal);
(m as PlayerMobile)?.RemoveBuff(BuffIcon.GiftOfRenewal);
if (_table.Remove(m, out var timer))
{

View file

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using Server.Collections;
using Server.Engines.BuffIcons;
using Server.Mobiles;
namespace Server.Spells.Spellweaving
{
@ -72,9 +74,8 @@ namespace Server.Spells.Spellweaving
Timer.StartTimer(duration, () => DoExpire(m), out var timerToken);
_table[m] = timerToken;
BuffInfo.AddBuff(
m,
new BuffInfo(BuffIcon.Thunderstorm, 1075800, duration, m, GetCastRecoveryMalus(m))
(m as PlayerMobile)?.AddBuff(
new BuffInfo(BuffIcon.Thunderstorm, 1075800, duration, GetCastRecoveryMalus(m))
);
}
}
@ -95,7 +96,7 @@ namespace Server.Spells.Spellweaving
public static void DoExpire(Mobile m)
{
StopTimer(m);
BuffInfo.RemoveBuff(m, BuffIcon.Thunderstorm);
(m as PlayerMobile)?.RemoveBuff(BuffIcon.Thunderstorm);
}
}
}

View file

@ -1,4 +1,6 @@
using Server.Engines.BuffIcons;
using Server.Engines.ConPVP;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Third
@ -38,7 +40,7 @@ namespace Server.Spells.Third
var args = $"{percentage}\t{percentage}\t{percentage}";
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Bless, 1075847, 1075848, length, m, args));
(m as PlayerMobile)?.AddBuff(new BuffInfo(BuffIcon.Bless, 1075847, 1075848, length, args));
}
}