fix: Cleans up more spells (#1122)
This commit is contained in:
parent
068bafd9b6
commit
c5d1927df3
15 changed files with 48 additions and 72 deletions
11
Projects/UOContent/Migrations/Server.Mobiles.Clone.v0.json
Normal file
11
Projects/UOContent/Migrations/Server.Mobiles.Clone.v0.json
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"version": 0,
|
||||||
|
"type": "Server.Mobiles.Clone",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "Caster",
|
||||||
|
"type": "Server.Mobile",
|
||||||
|
"rule": "SerializableInterfaceMigrationRule"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -209,6 +209,11 @@ namespace Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (totalDamage <= 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
m.Damage(totalDamage, from);
|
m.Damage(totalDamage, from);
|
||||||
return totalDamage;
|
return totalDamage;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ namespace Server.Spells
|
||||||
{
|
{
|
||||||
private static readonly int[] _manaTable = { 4, 6, 9, 11, 14, 20, 40, 50 };
|
private static readonly int[] _manaTable = { 4, 6, 9, 11, 14, 20, 40, 50 };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Starts at Circle -2 to account for scrolls
|
* Starts at Circle -2 to account for scrolls
|
||||||
* Mana requirements formula: (14 * (circle - 1)) + 2 = 50% probability
|
* Mana requirements formula: (14 * (circle - 1)) + 2 = 50% probability
|
||||||
* Add or subtract 20 for max or min limits
|
* Add or subtract 20 for max or min limits
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@ namespace Server.Spells
|
||||||
private static readonly SpellInfo _info = new("Gargoyle Flight", null, -1, 9002);
|
private static readonly SpellInfo _info = new("Gargoyle Flight", null, -1, 9002);
|
||||||
private bool m_Stop;
|
private bool m_Stop;
|
||||||
|
|
||||||
public FlySpell(Mobile caster)
|
public FlySpell(Mobile caster) : base(caster, null, _info)
|
||||||
: base(caster, null, _info)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ namespace Server.Spells.Mysticism
|
||||||
Reagent.Nightshade
|
Reagent.Nightshade
|
||||||
);
|
);
|
||||||
|
|
||||||
public AnimatedWeaponSpell(Mobile caster, Item scroll = null)
|
public AnimatedWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||||
: base(caster, scroll, _info)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ namespace Server.Spells.Mysticism
|
||||||
Reagent.MandrakeRoot
|
Reagent.MandrakeRoot
|
||||||
);
|
);
|
||||||
|
|
||||||
public EagleStrikeSpell(Mobile caster, Item scroll = null)
|
public EagleStrikeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||||
: base(caster, scroll, _info)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ namespace Server.Spells.Mysticism
|
||||||
Reagent.MandrakeRoot
|
Reagent.MandrakeRoot
|
||||||
);
|
);
|
||||||
|
|
||||||
public HailStormSpell(Mobile caster, Item scroll = null)
|
public HailStormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||||
: base(caster, scroll, _info)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ namespace Server.Spells.Mysticism
|
||||||
Reagent.Bloodmoss
|
Reagent.Bloodmoss
|
||||||
);
|
);
|
||||||
|
|
||||||
public NetherCycloneSpell(Mobile caster, Item scroll = null)
|
public NetherCycloneSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||||
: base(caster, scroll, _info)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,7 @@ namespace Server.Spells.Mysticism
|
||||||
|
|
||||||
private static readonly Dictionary<Mobile, SpellPlagueTimer> _table = new();
|
private static readonly Dictionary<Mobile, SpellPlagueTimer> _table = new();
|
||||||
|
|
||||||
public SpellPlagueSpell(Mobile caster, Item scroll = null)
|
public SpellPlagueSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||||
: base(caster, scroll, _info)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@ namespace Server.Spells.Mysticism
|
||||||
|
|
||||||
private static readonly Dictionary<Mobile, ResistanceMod[]> _table = new();
|
private static readonly Dictionary<Mobile, ResistanceMod[]> _table = new();
|
||||||
|
|
||||||
public StoneFormSpell(Mobile caster, Item scroll = null)
|
public StoneFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||||
: base(caster, scroll, _info)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,7 @@ namespace Server.Spells.Necromancy
|
||||||
|
|
||||||
private static readonly Dictionary<Mobile, DefaultSkillMod> _table = new();
|
private static readonly Dictionary<Mobile, DefaultSkillMod> _table = new();
|
||||||
|
|
||||||
public EvilOmenSpell(Mobile caster, Item scroll = null)
|
public EvilOmenSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||||
: base(caster, scroll, _info)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,14 +82,13 @@ namespace Server.Spells.Necromancy
|
||||||
|
|
||||||
public static bool EndEffect(Mobile m)
|
public static bool EndEffect(Mobile m)
|
||||||
{
|
{
|
||||||
if (!_table.Remove(m, out var mod))
|
if (_table.Remove(m, out var mod))
|
||||||
{
|
{
|
||||||
return false;
|
mod.Remove();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mod?.Remove();
|
return false;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Server.Collections;
|
using Server.Collections;
|
||||||
using Server.Items;
|
using Server.Items;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
|
|
@ -18,8 +17,7 @@ namespace Server.Spells.Necromancy
|
||||||
Reagent.PigIron
|
Reagent.PigIron
|
||||||
);
|
);
|
||||||
|
|
||||||
public WitherSpell(Mobile caster, Item scroll = null)
|
public WitherSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||||
: base(caster, scroll, _info)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,8 @@ namespace Server.Spells.Ninjitsu
|
||||||
{
|
{
|
||||||
damage /= 2;
|
damage /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_target.Damage(damage, _attacker); // Damage is direct.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -141,14 +143,7 @@ namespace Server.Spells.Ninjitsu
|
||||||
|
|
||||||
var maxDamage = Steps >= 5 ? 62 : 22;
|
var maxDamage = Steps >= 5 ? 62 : 22;
|
||||||
damage = Math.Clamp((int)(baseDamage + stalkingBonus), 0, maxDamage) + _damageBonus;
|
damage = Math.Clamp((int)(baseDamage + stalkingBonus), 0, maxDamage) + _damageBonus;
|
||||||
}
|
|
||||||
|
|
||||||
if (Core.ML)
|
|
||||||
{
|
|
||||||
_target.Damage(damage, _attacker); // Damage is direct.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Damage is physical.
|
// Damage is physical.
|
||||||
AOS.Damage(
|
AOS.Damage(
|
||||||
_target,
|
_target,
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@ namespace Server.Spells.Ninjitsu
|
||||||
/*
|
/*
|
||||||
* Pub40 changed pvp damage max to 55%
|
* Pub40 changed pvp damage max to 55%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return 1.0 + GetBonus(attacker) / (Core.ML && attacker.Player && defender.Player ? 40 : 10);
|
return 1.0 + GetBonus(attacker) / (Core.ML && attacker.Player && defender.Player ? 40 : 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using ModernUO.Serialization;
|
||||||
using Server.Items;
|
using Server.Items;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Spells;
|
using Server.Spells;
|
||||||
|
|
@ -34,29 +35,21 @@ namespace Server.Spells.Ninjitsu
|
||||||
|
|
||||||
public static void AddClone(Mobile m)
|
public static void AddClone(Mobile m)
|
||||||
{
|
{
|
||||||
if (m == null)
|
if (m != null)
|
||||||
{
|
{
|
||||||
return;
|
_cloneCount[m] = 1 + (_cloneCount.TryGetValue(m, out var count) ? count : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_cloneCount[m] = 1 + (_cloneCount.TryGetValue(m, out var count) ? count : 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RemoveClone(Mobile m)
|
public static void RemoveClone(Mobile m)
|
||||||
{
|
{
|
||||||
if (m == null || !_cloneCount.TryGetValue(m, out var count))
|
_cloneCount.Remove(m, out var count);
|
||||||
|
if (m == null || count <= 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count <= 1)
|
_cloneCount[m] = count - 1;
|
||||||
{
|
|
||||||
_cloneCount.Remove(m);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_cloneCount[m]--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckCast()
|
public override bool CheckCast()
|
||||||
|
|
@ -122,13 +115,15 @@ namespace Server.Spells.Ninjitsu
|
||||||
|
|
||||||
namespace Server.Mobiles
|
namespace Server.Mobiles
|
||||||
{
|
{
|
||||||
public class Clone : BaseCreature
|
[SerializationGenerator(0)]
|
||||||
|
public partial class Clone : BaseCreature
|
||||||
{
|
{
|
||||||
private Mobile m_Caster;
|
[SerializableField(0)]
|
||||||
|
private Mobile _caster;
|
||||||
|
|
||||||
public Clone(Mobile caster) : base(AIType.AI_Melee, FightMode.None)
|
public Clone(Mobile caster) : base(AIType.AI_Melee, FightMode.None)
|
||||||
{
|
{
|
||||||
m_Caster = caster;
|
_caster = caster;
|
||||||
|
|
||||||
Body = caster.Body;
|
Body = caster.Body;
|
||||||
|
|
||||||
|
|
@ -171,11 +166,7 @@ namespace Server.Mobiles
|
||||||
new UnsummonTimer(this, duration).Start();
|
new UnsummonTimer(this, duration).Start();
|
||||||
SummonEnd = Core.Now + duration;
|
SummonEnd = Core.Now + duration;
|
||||||
|
|
||||||
MirrorImage.AddClone(m_Caster);
|
MirrorImage.AddClone(_caster);
|
||||||
}
|
|
||||||
|
|
||||||
public Clone(Serial serial) : base(serial)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override BaseAI ForcedAI => new CloneAI(this);
|
protected override BaseAI ForcedAI => new CloneAI(this);
|
||||||
|
|
@ -216,28 +207,14 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
public override void OnAfterDelete()
|
public override void OnAfterDelete()
|
||||||
{
|
{
|
||||||
MirrorImage.RemoveClone(m_Caster);
|
MirrorImage.RemoveClone(_caster);
|
||||||
base.OnAfterDelete();
|
base.OnAfterDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Serialize(IGenericWriter writer)
|
[AfterDeserialization]
|
||||||
|
private void AfterDeserialization()
|
||||||
{
|
{
|
||||||
base.Serialize(writer);
|
MirrorImage.AddClone(_caster);
|
||||||
|
|
||||||
writer.WriteEncodedInt(0); // version
|
|
||||||
|
|
||||||
writer.Write(m_Caster);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Deserialize(IGenericReader reader)
|
|
||||||
{
|
|
||||||
base.Deserialize(reader);
|
|
||||||
|
|
||||||
var version = reader.ReadEncodedInt();
|
|
||||||
|
|
||||||
m_Caster = reader.ReadEntity<Mobile>();
|
|
||||||
|
|
||||||
MirrorImage.AddClone(m_Caster);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue