fix: Fixes PainSpike, ManaVampire, Evil Omen, and Curse (#1622)
Co-authored-by: Kamron Batman <3953314+kamronbatman@users.noreply.github.com>
This commit is contained in:
parent
fec78040bc
commit
4ebdc75bdf
9 changed files with 119 additions and 73 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Server.Diagnostics;
|
namespace Server.Diagnostics;
|
||||||
|
|
|
||||||
|
|
@ -5884,7 +5884,7 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
||||||
|
|
||||||
public virtual bool CanBeDamaged() => !m_Blessed;
|
public virtual bool CanBeDamaged() => !m_Blessed;
|
||||||
|
|
||||||
public virtual void Damage(int amount, Mobile from = null, bool informMount = true)
|
public virtual void Damage(int amount, Mobile from = null, bool informMount = true, bool ignoreEvilOmen = false)
|
||||||
{
|
{
|
||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1415,7 +1415,7 @@ namespace Server.Mobiles
|
||||||
return chance / 1000.0;
|
return chance / 1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Damage(int amount, Mobile from = null, bool informMount = true)
|
public override void Damage(int amount, Mobile from = null, bool informMount = true, bool ignoreEvilOmen = false)
|
||||||
{
|
{
|
||||||
var oldHits = Hits;
|
var oldHits = Hits;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2769,11 +2769,11 @@ namespace Server.Mobiles
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Damage(int amount, Mobile from = null, bool informMount = true)
|
public override void Damage(int amount, Mobile from = null, bool informMount = true, bool ignoreEvilOmen = false)
|
||||||
{
|
{
|
||||||
var damageBonus = 1.0;
|
var damageBonus = 1.0;
|
||||||
|
|
||||||
if (EvilOmenSpell.EndEffect(this) && !PainSpikeSpell.UnderEffect(this))
|
if (EvilOmenSpell.EndEffect(this) && !ignoreEvilOmen)
|
||||||
{
|
{
|
||||||
damageBonus += 0.25;
|
damageBonus += 0.25;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -291,11 +291,14 @@ namespace Server.Spells
|
||||||
caster,
|
caster,
|
||||||
target,
|
target,
|
||||||
type,
|
type,
|
||||||
GetOffset(caster, target, type, false, skillCheck),
|
GetOffset(caster, target, type, false),
|
||||||
duration
|
duration,
|
||||||
|
skillCheck
|
||||||
);
|
);
|
||||||
|
|
||||||
public static bool AddStatBonus(Mobile caster, Mobile target, StatType type, int bonus, TimeSpan duration)
|
public static bool AddStatBonus(
|
||||||
|
Mobile caster, Mobile target, StatType type, int bonus, TimeSpan duration, bool skillCheck = false
|
||||||
|
)
|
||||||
{
|
{
|
||||||
var name = $"[Magic] {type} Buff";
|
var name = $"[Magic] {type} Buff";
|
||||||
|
|
||||||
|
|
@ -311,20 +314,37 @@ namespace Server.Spells
|
||||||
target.RemoveStatMod(mod);
|
target.RemoveStatMod(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (skillCheck)
|
||||||
|
{
|
||||||
|
caster.CheckSkill(SkillName.EvalInt, 0.0, 120.0);
|
||||||
|
}
|
||||||
|
|
||||||
target.AddStatMod(new StatMod(type, name, bonus, duration));
|
target.AddStatMod(new StatMod(type, name, bonus, duration));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetCurse(Mobile caster, Mobile target, StatType type)
|
||||||
|
{
|
||||||
|
var name = $"[Magic] {type} Curse";
|
||||||
|
|
||||||
|
var mod = target.GetStatMod(name);
|
||||||
|
|
||||||
|
return mod?.Offset ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool AddStatCurse(Mobile caster, Mobile target, StatType type, TimeSpan duration, bool skillCheck = true) =>
|
public static bool AddStatCurse(Mobile caster, Mobile target, StatType type, TimeSpan duration, bool skillCheck = true) =>
|
||||||
AddStatCurse(
|
AddStatCurse(
|
||||||
caster,
|
caster,
|
||||||
target,
|
target,
|
||||||
type,
|
type,
|
||||||
GetOffset(caster, target, type, true, skillCheck),
|
GetOffset(caster, target, type, true),
|
||||||
duration
|
duration,
|
||||||
|
skillCheck
|
||||||
);
|
);
|
||||||
|
|
||||||
public static bool AddStatCurse(Mobile caster, Mobile target, StatType type, int curse, TimeSpan duration)
|
public static bool AddStatCurse(
|
||||||
|
Mobile caster, Mobile target, StatType type, int curse, TimeSpan duration, bool skillCheck = false
|
||||||
|
)
|
||||||
{
|
{
|
||||||
var malus = -curse;
|
var malus = -curse;
|
||||||
var name = $"[Magic] {type} Curse";
|
var name = $"[Magic] {type} Curse";
|
||||||
|
|
@ -341,6 +361,12 @@ namespace Server.Spells
|
||||||
target.RemoveStatMod(mod);
|
target.RemoveStatMod(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (skillCheck)
|
||||||
|
{
|
||||||
|
caster.CheckSkill(SkillName.EvalInt, 0.0, 120.0);
|
||||||
|
target.CheckSkill(SkillName.MagicResist, 0.0, 120.0);
|
||||||
|
}
|
||||||
|
|
||||||
target.AddStatMod(new StatMod(type, name, malus, duration));
|
target.AddStatMod(new StatMod(type, name, malus, duration));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -351,47 +377,29 @@ namespace Server.Spells
|
||||||
|
|
||||||
public static double GetOffsetScalar(Mobile caster, Mobile target, bool curse)
|
public static double GetOffsetScalar(Mobile caster, Mobile target, bool curse)
|
||||||
{
|
{
|
||||||
double percent;
|
var percent = curse
|
||||||
|
? 8 + (caster.Skills.EvalInt.Value - target.Skills.MagicResist.Value) / 10
|
||||||
if (curse)
|
: 1 + caster.Skills.EvalInt.Value / 10;
|
||||||
{
|
|
||||||
percent = 8 + (caster.Skills.EvalInt.Value - target.Skills.MagicResist.Value) / 10;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
percent = 1 + caster.Skills.EvalInt.Value / 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
percent *= 0.01;
|
percent *= 0.01;
|
||||||
|
|
||||||
return Math.Max(percent, 0);
|
return Math.Max(percent, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetOffset(Mobile caster, Mobile target, StatType type, bool curse, bool skillCheck)
|
public static int GetOffset(Mobile caster, Mobile target, StatType type, bool curse)
|
||||||
{
|
{
|
||||||
if (!Core.AOS)
|
if (!Core.AOS)
|
||||||
{
|
{
|
||||||
return 1 + (int)(caster.Skills.Magery.Value * 0.1);
|
return 1 + (int)(caster.Skills.Magery.Value * 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skillCheck)
|
|
||||||
{
|
|
||||||
caster.CheckSkill(SkillName.EvalInt, 0.0, 120.0);
|
|
||||||
|
|
||||||
if (curse)
|
|
||||||
{
|
|
||||||
target.CheckSkill(SkillName.MagicResist, 0.0, 120.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var percent = GetOffsetScalar(caster, target, curse);
|
var percent = GetOffsetScalar(caster, target, curse);
|
||||||
|
|
||||||
return type switch
|
return type switch
|
||||||
{
|
{
|
||||||
StatType.Str => (int)(target.RawStr * percent),
|
StatType.Str => (int)(target.RawStr * percent),
|
||||||
StatType.Dex => (int)(target.RawDex * percent),
|
StatType.Dex => (int)(target.RawDex * percent),
|
||||||
StatType.Int => (int)(target.RawInt * percent),
|
StatType.Int => (int)(target.RawInt * percent)
|
||||||
_ => 1 + (int)(caster.Skills.Magery.Value * 0.1)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ namespace Server.Spells.Fifth
|
||||||
|
|
||||||
if (Core.AOS)
|
if (Core.AOS)
|
||||||
{
|
{
|
||||||
var secs = (int)(GetDamageSkill(Caster) / 10 - GetResistSkill(m) / 10);
|
var secs = (GetDamageSkill(Caster) / 10 - GetResistSkill(m) / 10);
|
||||||
|
|
||||||
if (!Core.AOS)
|
if (!Core.AOS)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Server.Targeting;
|
using Server.Targeting;
|
||||||
|
|
||||||
|
|
@ -23,6 +24,66 @@ namespace Server.Spells.Fourth
|
||||||
|
|
||||||
public override SpellCircle Circle => SpellCircle.Fourth;
|
public override SpellCircle Circle => SpellCircle.Fourth;
|
||||||
|
|
||||||
|
public static bool DoCurse(Mobile caster, Mobile m)
|
||||||
|
{
|
||||||
|
var duration = SpellHelper.GetDuration(caster, m);
|
||||||
|
|
||||||
|
if (duration == TimeSpan.Zero)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow curse duration to refresh if the new curse is longer
|
||||||
|
if (_table.TryGetValue(m, out var existingTimer) && existingTimer.Next - Core.Now > duration && Core.AOS)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newStrOffset = SpellHelper.GetOffset(caster, m, StatType.Str, true);
|
||||||
|
var newDexOffset = SpellHelper.GetOffset(caster, m, StatType.Dex, true);
|
||||||
|
var newIntOffset = SpellHelper.GetOffset(caster, m, StatType.Int, true);
|
||||||
|
|
||||||
|
if (newStrOffset == 0 && newDexOffset == 0 && newIntOffset == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var oldStrOffset = SpellHelper.GetCurse(caster, m, StatType.Str);
|
||||||
|
var oldDexOffset = SpellHelper.GetCurse(caster, m, StatType.Dex);
|
||||||
|
var oldIntOffset = SpellHelper.GetCurse(caster, m, StatType.Int);
|
||||||
|
|
||||||
|
if (oldStrOffset <= newStrOffset && oldDexOffset <= newDexOffset && oldIntOffset <= newIntOffset)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var strCurse = SpellHelper.AddStatCurse(caster, m, StatType.Str, newStrOffset, duration);
|
||||||
|
var dexCurse = SpellHelper.AddStatCurse(caster, m, StatType.Dex, newDexOffset, duration);
|
||||||
|
var intCurse = SpellHelper.AddStatCurse(caster, m, StatType.Int, newIntOffset, duration, true);
|
||||||
|
|
||||||
|
if (!strCurse && !dexCurse && !intCurse)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
existingTimer?.Stop();
|
||||||
|
m.UpdateResistances();
|
||||||
|
_table[m] = Timer.DelayCall(duration, mob => RemoveEffect(mob), m);
|
||||||
|
|
||||||
|
m.Spell?.OnCasterHurt();
|
||||||
|
|
||||||
|
m.Paralyzed = false;
|
||||||
|
|
||||||
|
m.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
|
||||||
|
m.PlaySound(0x1E1);
|
||||||
|
|
||||||
|
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));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void Target(Mobile m)
|
public void Target(Mobile m)
|
||||||
{
|
{
|
||||||
if (CheckHSequence(m))
|
if (CheckHSequence(m))
|
||||||
|
|
@ -30,31 +91,15 @@ namespace Server.Spells.Fourth
|
||||||
SpellHelper.Turn(Caster, m);
|
SpellHelper.Turn(Caster, m);
|
||||||
|
|
||||||
SpellHelper.CheckReflect((int)Circle, Caster, ref m);
|
SpellHelper.CheckReflect((int)Circle, Caster, ref m);
|
||||||
var length = SpellHelper.GetDuration(Caster, m);
|
|
||||||
|
|
||||||
SpellHelper.AddStatCurse(Caster, m, StatType.Str, length, false);
|
if (DoCurse(Caster, m))
|
||||||
SpellHelper.AddStatCurse(Caster, m, StatType.Dex, length);
|
|
||||||
SpellHelper.AddStatCurse(Caster, m, StatType.Int, length);
|
|
||||||
|
|
||||||
if (Caster.Player && m.Player)
|
|
||||||
{
|
{
|
||||||
RemoveEffect(m);
|
HarmfulSpell(m);
|
||||||
_table[m] = Timer.DelayCall(length, () => RemoveEffect(m));
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DoHurtFizzle();
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Spell?.OnCasterHurt();
|
|
||||||
|
|
||||||
m.Paralyzed = false;
|
|
||||||
|
|
||||||
m.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
|
|
||||||
m.PlaySound(0x1E1);
|
|
||||||
|
|
||||||
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, length, m, args));
|
|
||||||
|
|
||||||
HarmfulSpell(m);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FinishSequence();
|
FinishSequence();
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ namespace Server.Spells.Necromancy
|
||||||
|
|
||||||
// TODO: Find a better way to do this
|
// TODO: Find a better way to do this
|
||||||
StaminaSystem.DFA = DFAlgorithm.PainSpike;
|
StaminaSystem.DFA = DFAlgorithm.PainSpike;
|
||||||
m.Damage((int)damage, Caster);
|
m.Damage((int)damage, Caster, ignoreEvilOmen: true);
|
||||||
SpellHelper.DoLeech((int)damage, Caster, m);
|
SpellHelper.DoLeech((int)damage, Caster, m);
|
||||||
StaminaSystem.DFA = DFAlgorithm.Standard;
|
StaminaSystem.DFA = DFAlgorithm.Standard;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,26 +45,20 @@ namespace Server.Spells.Seventh
|
||||||
toDrain /= 2;
|
toDrain /= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (CheckResisted(m))
|
||||||
|
{
|
||||||
|
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (CheckResisted(m))
|
toDrain = m.Mana;
|
||||||
{
|
|
||||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toDrain = m.Mana;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will not drain more than the target has currently and will not put the caster over his maximum mana
|
// Will not drain more than the target has currently
|
||||||
toDrain = Math.Clamp(toDrain, 0, Math.Min(m.Mana, Caster.ManaMax - Caster.Mana));
|
toDrain = Math.Min(m.Mana, toDrain);
|
||||||
|
m.Mana -= toDrain;
|
||||||
|
|
||||||
if (toDrain > 0)
|
Caster.Mana += toDrain;
|
||||||
{
|
|
||||||
m.Mana -= toDrain;
|
|
||||||
Caster.Mana += toDrain;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Core.AOS)
|
if (Core.AOS)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue