Moving Shot charged its mana in `OnBeforeSwing`, before `BaseRanged.OnSwing` decided whether to fire. A swing that fired nothing (a paralyzed or frozen archer, no ammo, a failed harmful check) still took the mana and left the move armed. Every swing after that charged again, so inside the 3-second window you paid twice, until the archer ran out of mana. `OnBeforeSwing` now only checks the mana. Moving Shot's own `OnHit`/`OnMiss` charge it, and those only run once a shot has fired. This is how the other weapon abilities pay. A miss still costs mana. A parried shot no longer does: the parry clears the move before `OnHit` runs, the same as for every other ability.
42 lines
1.5 KiB
C#
42 lines
1.5 KiB
C#
namespace Server.Items
|
|
{
|
|
/// <summary>
|
|
/// Available on some crossbows, this special move allows archers to fire while on the move.
|
|
/// This shot is somewhat less accurate than normal, but the ability to fire while running is a clear advantage.
|
|
/// </summary>
|
|
public class MovingShot : WeaponAbility
|
|
{
|
|
public override int BaseMana => 15;
|
|
public override int AccuracyBonus => -25;
|
|
|
|
public override bool ValidatesDuringHit => false;
|
|
|
|
// Mana is only checked here; OnHit/OnMiss charge it, since they run only for a shot that actually fired.
|
|
public override bool OnBeforeSwing(Mobile attacker, Mobile defender) =>
|
|
Validate(attacker) && CheckMana(attacker, false);
|
|
|
|
public override void OnMiss(Mobile attacker, Mobile defender)
|
|
{
|
|
// Validates in OnSwing for accuracy scalar
|
|
|
|
ClearCurrentAbility(attacker);
|
|
|
|
if (CheckMana(attacker, true))
|
|
{
|
|
attacker.SendLocalizedMessage(1060089); // You fail to execute your special move
|
|
}
|
|
}
|
|
|
|
public override void OnHit(Mobile attacker, Mobile defender, int damage, WorldLocation worldLocation)
|
|
{
|
|
// Validates in OnSwing for accuracy scalar
|
|
|
|
ClearCurrentAbility(attacker);
|
|
|
|
if (CheckMana(attacker, true))
|
|
{
|
|
attacker.SendLocalizedMessage(1060216); // Your shot was successful
|
|
}
|
|
}
|
|
}
|
|
}
|