### Summary
Eliminates `IPooledEnumerable<T>` and `eable.Free()` from `Map` for mobiles. This drastically simplifies code that iterates in range, for example:
```cs
foreach (var m in m.GetMobilesInRange(5))
{
}
```
The code above no longer requires an eable and calling `Free()`.
- [X] Fixed several locations where an NPC that was damaged would cause a server crash.
- [X] Removed an unnecessary allocation in guard fake calls (NPCs calling guards on you)
- [X] Fixes damage precision loss in Poison Strike Spell
- [X] BogThing no longer attempts to "search" for boglings to eat when it is at full health
70 lines
2 KiB
C#
70 lines
2 KiB
C#
using Server.Collections;
|
|
|
|
namespace Server.Spells.Bushido
|
|
{
|
|
public class MomentumStrike : SamuraiMove
|
|
{
|
|
public override int BaseMana => 10;
|
|
public override double RequiredSkill => 70.0;
|
|
|
|
// You prepare to strike two enemies with one blow.
|
|
public override TextDefinition AbilityMessage { get; } = 1070757;
|
|
|
|
public override void OnHit(Mobile attacker, Mobile defender, int damage)
|
|
{
|
|
if (!Validate(attacker) || !CheckMana(attacker, false))
|
|
{
|
|
return;
|
|
}
|
|
|
|
ClearCurrentMove(attacker);
|
|
|
|
var weapon = attacker.Weapon;
|
|
|
|
using var queue = PooledRefQueue<Mobile>.Create();
|
|
foreach (var m in attacker.GetMobilesInRange(weapon.MaxRange))
|
|
{
|
|
if (m != defender && m.Combatant == attacker)
|
|
{
|
|
queue.Enqueue(m);
|
|
}
|
|
}
|
|
|
|
if (queue.Count <= 0)
|
|
{
|
|
attacker.SendLocalizedMessage(1063123); // There are no valid targets to attack!
|
|
return;
|
|
}
|
|
|
|
if (!CheckMana(attacker, true))
|
|
{
|
|
return;
|
|
}
|
|
|
|
Mobile target = queue.PeekRandom();
|
|
|
|
var damageBonus = attacker.Skills.Bushido.Value / 100.0;
|
|
|
|
if (!defender.Alive)
|
|
{
|
|
damageBonus *= 1.5;
|
|
}
|
|
|
|
attacker.SendLocalizedMessage(1063171); // You transfer the momentum of your weapon into another enemy!
|
|
target!.SendLocalizedMessage(1063172); // You were hit by the momentum of a Samurai's weapon!
|
|
|
|
target.FixedParticles(0x37B9, 1, 4, 0x251D, 0, 0, EffectLayer.Waist);
|
|
|
|
attacker.PlaySound(0x510);
|
|
|
|
weapon.OnSwing(attacker, target, damageBonus);
|
|
|
|
CheckGain(attacker);
|
|
}
|
|
|
|
public override void CheckGain(Mobile m)
|
|
{
|
|
m.CheckSkill(MoveSkill, RequiredSkill, 120.0);
|
|
}
|
|
}
|
|
}
|