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);
|
||||
return totalDamage;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace Server.Spells
|
|||
{
|
||||
private static readonly int[] _manaTable = { 4, 6, 9, 11, 14, 20, 40, 50 };
|
||||
|
||||
/*
|
||||
/*
|
||||
* Starts at Circle -2 to account for scrolls
|
||||
* Mana requirements formula: (14 * (circle - 1)) + 2 = 50% probability
|
||||
* 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 bool m_Stop;
|
||||
|
||||
public FlySpell(Mobile caster)
|
||||
: base(caster, null, _info)
|
||||
public FlySpell(Mobile caster) : base(caster, null, _info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ namespace Server.Spells.Mysticism
|
|||
Reagent.Nightshade
|
||||
);
|
||||
|
||||
public AnimatedWeaponSpell(Mobile caster, Item scroll = null)
|
||||
: base(caster, scroll, _info)
|
||||
public AnimatedWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ namespace Server.Spells.Mysticism
|
|||
Reagent.MandrakeRoot
|
||||
);
|
||||
|
||||
public EagleStrikeSpell(Mobile caster, Item scroll = null)
|
||||
: base(caster, scroll, _info)
|
||||
public EagleStrikeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ namespace Server.Spells.Mysticism
|
|||
Reagent.MandrakeRoot
|
||||
);
|
||||
|
||||
public HailStormSpell(Mobile caster, Item scroll = null)
|
||||
: base(caster, scroll, _info)
|
||||
public HailStormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ namespace Server.Spells.Mysticism
|
|||
Reagent.Bloodmoss
|
||||
);
|
||||
|
||||
public NetherCycloneSpell(Mobile caster, Item scroll = null)
|
||||
: base(caster, scroll, _info)
|
||||
public NetherCycloneSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@ namespace Server.Spells.Mysticism
|
|||
|
||||
private static readonly Dictionary<Mobile, SpellPlagueTimer> _table = new();
|
||||
|
||||
public SpellPlagueSpell(Mobile caster, Item scroll = null)
|
||||
: base(caster, scroll, _info)
|
||||
public SpellPlagueSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ namespace Server.Spells.Mysticism
|
|||
|
||||
private static readonly Dictionary<Mobile, ResistanceMod[]> _table = new();
|
||||
|
||||
public StoneFormSpell(Mobile caster, Item scroll = null)
|
||||
: base(caster, scroll, _info)
|
||||
public StoneFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
private static readonly Dictionary<Mobile, DefaultSkillMod> _table = new();
|
||||
|
||||
public EvilOmenSpell(Mobile caster, Item scroll = null)
|
||||
: base(caster, scroll, _info)
|
||||
public EvilOmenSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -83,14 +82,13 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
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 true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Collections;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
|
@ -18,8 +17,7 @@ namespace Server.Spells.Necromancy
|
|||
Reagent.PigIron
|
||||
);
|
||||
|
||||
public WitherSpell(Mobile caster, Item scroll = null)
|
||||
: base(caster, scroll, _info)
|
||||
public WitherSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,6 +133,8 @@ namespace Server.Spells.Ninjitsu
|
|||
{
|
||||
damage /= 2;
|
||||
}
|
||||
|
||||
_target.Damage(damage, _attacker); // Damage is direct.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -141,14 +143,7 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
var maxDamage = Steps >= 5 ? 62 : 22;
|
||||
damage = Math.Clamp((int)(baseDamage + stalkingBonus), 0, maxDamage) + _damageBonus;
|
||||
}
|
||||
|
||||
if (Core.ML)
|
||||
{
|
||||
_target.Damage(damage, _attacker); // Damage is direct.
|
||||
}
|
||||
else
|
||||
{
|
||||
// Damage is physical.
|
||||
AOS.Damage(
|
||||
_target,
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ namespace Server.Spells.Ninjitsu
|
|||
/*
|
||||
* Pub40 changed pvp damage max to 55%
|
||||
*/
|
||||
|
||||
return 1.0 + GetBonus(attacker) / (Core.ML && attacker.Player && defender.Player ? 40 : 10);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
|
|
@ -34,29 +35,21 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
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)
|
||||
{
|
||||
if (m == null || !_cloneCount.TryGetValue(m, out var count))
|
||||
_cloneCount.Remove(m, out var count);
|
||||
if (m == null || count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (count <= 1)
|
||||
{
|
||||
_cloneCount.Remove(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cloneCount[m]--;
|
||||
}
|
||||
_cloneCount[m] = count - 1;
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
|
|
@ -122,13 +115,15 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
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)
|
||||
{
|
||||
m_Caster = caster;
|
||||
_caster = caster;
|
||||
|
||||
Body = caster.Body;
|
||||
|
||||
|
|
@ -171,11 +166,7 @@ namespace Server.Mobiles
|
|||
new UnsummonTimer(this, duration).Start();
|
||||
SummonEnd = Core.Now + duration;
|
||||
|
||||
MirrorImage.AddClone(m_Caster);
|
||||
}
|
||||
|
||||
public Clone(Serial serial) : base(serial)
|
||||
{
|
||||
MirrorImage.AddClone(_caster);
|
||||
}
|
||||
|
||||
protected override BaseAI ForcedAI => new CloneAI(this);
|
||||
|
|
@ -216,28 +207,14 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
MirrorImage.RemoveClone(m_Caster);
|
||||
MirrorImage.RemoveClone(_caster);
|
||||
base.OnAfterDelete();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
[AfterDeserialization]
|
||||
private void AfterDeserialization()
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
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);
|
||||
MirrorImage.AddClone(_caster);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue