ModernUO/Projects/UOContent/Mobiles/VirtualMountItem.cs
Kamron Batman 90fa2e09de
fix: Fixes mount stamina, adds Pub46+ Ethereal stamina (#1716)
### Summary
* Makes mount stamina significantly faster.
* Reduces absolute reset from 24 hours to 4 hours.
* Adds Pub 46+ Ethereal stamina where the stamina is global to all mounts for the player
* Removes serialization of stamina entirely because it's ok if it gets reset during shard restarts.
2024-04-05 21:05:16 -07:00

47 lines
1 KiB
C#

using System;
using ModernUO.Serialization;
namespace Server.Mobiles;
[SerializationGenerator(0, false)]
public partial class VirtualMountItem : Item, IMountItem, IMount
{
public VirtualMountItem(Mobile mob) : base(0x3EA0)
{
Layer = Layer.Mount;
_rider = mob;
}
public IMount Mount => this;
[SerializableProperty(0)]
public Mobile Rider
{
get => _rider;
set { }
}
[AfterDeserialization(false)]
private void AfterDeserialize()
{
if (_rider == null)
{
Delete();
}
}
// If this is ever equipped by a player, steps are treated the same as Ethereal mounts
public int StepsMax => 3840;
public int StepsGainedPerIdleTime => 1;
public TimeSpan IdleTimePerStepsGain => TimeSpan.FromSeconds(1);
public void OnRiderDamaged(int amount, Mobile from, bool willKill)
{
}
public override DeathMoveResult OnParentDeath(Mobile parent)
{
Delete();
return DeathMoveResult.RemainEquipped;
}
}