## Overhaul to Stamina (Overweight) System
### Added configurations
```json
{
"settings": {
"stamina.enableMountStamina": "True",
"stamina.cannotMoveWhenFatigued": "True",
"stamina.stonesPerOverweightLoss": "25",
"stamina.stonesOverweightAllowance": "4",
"stamina.baseOverweightLoss": "5",
"stamina.additionalLossWhenBelow": "0.1",
"stamina.mountLastMoveStepsReset": "01:00:00:00",
"stamina.enableMountStamina": "True",
"stamina.useMountStaminaOnlyWhenOverloaded": "False",
},
}
```
- `stamina.cannotMoveWhenFatigued` - By default, Pre-AOS expansions will outright block a player if they are fatigued. A player is fatigued when they run out of stamina by any mechanism.
- `stamina.stonesPerOverweightLoss` - The amount of stamina lost for every X stones above overweight. Example, if a person is overweight 28 stones overweight, then there there is 1 additional stamina. 28 / 25 = 1 (no decimals, no rounding)
- `stamina.stonesOverweightAllowance` - The number of stones allowed before overweight penalties take affect. This _does not_ substract from the overweight stones calculation.
- `stamina.baseOverweightLoss` - The base amount of stamina loss for being overweight. While running, the final amount is multiplied by 2. If mount stamina is turned off, then the final amount is divided by 3 while mounted.
### Mount stamina
Mounts have a new property `StepsMax` to determine the maximum steps they can take before being fatigued. To regain steps, the player _must stay on the mount and not move_ (per OSI). The gain rates are configurable. If a mount is dismounted, or the player logs off, the mount is considered inactive and mounts regain all of their steps after _24 hours_.
### Changes to player stamina
Players now have a proper inactivity time reset for their steps. If a player is idle for 16 seconds (including logging off, or the server being offline), then the steps counter is rest.
### Developer Notes
- `StepsTaken` - This field has been removed. It was not serialized and could not be used reliably. If a developer was using it, then the recommendation is to build a mechanism to track total steps another way.
- `IHasStamina` - This new interface was added and currently `IMount` and `PlayerMobile` are valid types.
Important: Entities that are sent to the StaminaSystem for tracking (mounts, players, or something else), must be an `ISerializable` to be serialized properly. If they are not, then the serialization system will record a null, and nothing will be deserialized upon world load. No errors will be given.
154 lines
4.6 KiB
C#
154 lines
4.6 KiB
C#
using ModernUO.Serialization;
|
|
using Server.Items;
|
|
|
|
namespace Server.Mobiles
|
|
{
|
|
[SerializationGenerator(2, false)]
|
|
public partial class SwampDragon : BaseMount
|
|
{
|
|
public override string DefaultName => "a swamp dragon";
|
|
|
|
[Constructible]
|
|
public SwampDragon() : base(0x31A, 0x3EBD, AIType.AI_Melee, FightMode.Aggressor)
|
|
{
|
|
BaseSoundID = 0x16A;
|
|
|
|
SetStr(201, 300);
|
|
SetDex(66, 85);
|
|
SetInt(61, 100);
|
|
|
|
SetHits(121, 180);
|
|
|
|
SetDamage(3, 4);
|
|
|
|
SetDamageType(ResistanceType.Physical, 75);
|
|
SetDamageType(ResistanceType.Poison, 25);
|
|
|
|
SetResistance(ResistanceType.Physical, 35, 40);
|
|
SetResistance(ResistanceType.Fire, 20, 30);
|
|
SetResistance(ResistanceType.Cold, 20, 40);
|
|
SetResistance(ResistanceType.Poison, 20, 30);
|
|
SetResistance(ResistanceType.Energy, 30, 40);
|
|
|
|
SetSkill(SkillName.Anatomy, 45.1, 55.0);
|
|
SetSkill(SkillName.MagicResist, 45.1, 55.0);
|
|
SetSkill(SkillName.Tactics, 45.1, 55.0);
|
|
SetSkill(SkillName.Wrestling, 45.1, 55.0);
|
|
|
|
Fame = 2000;
|
|
Karma = -2000;
|
|
|
|
Hue = 0x851;
|
|
|
|
Tamable = true;
|
|
ControlSlots = 1;
|
|
MinTameSkill = 93.9;
|
|
}
|
|
|
|
public override string CorpseName => "a swamp dragon corpse";
|
|
|
|
[InvalidateProperties]
|
|
[SerializableField(0)]
|
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
private bool _bardingExceptional;
|
|
|
|
[InvalidateProperties]
|
|
[SerializableField(1)]
|
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
private string _bardingCraftedBy;
|
|
|
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
[InvalidateProperties]
|
|
[SerializableField(3)]
|
|
private int _bardingHP;
|
|
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
[SerializableProperty(2)]
|
|
public bool HasBarding
|
|
{
|
|
get => _hasBarding;
|
|
set
|
|
{
|
|
_hasBarding = value;
|
|
|
|
if (_hasBarding)
|
|
{
|
|
Hue = CraftResources.GetHue(_bardingResource);
|
|
Body = 0x31F;
|
|
ItemID = 0x3EBE;
|
|
}
|
|
else
|
|
{
|
|
Hue = 0x851;
|
|
Body = 0x31A;
|
|
ItemID = 0x3EBD;
|
|
}
|
|
InvalidateProperties();
|
|
this.MarkDirty();
|
|
}
|
|
}
|
|
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
[SerializableProperty(4)]
|
|
public CraftResource BardingResource
|
|
{
|
|
get => _bardingResource;
|
|
set
|
|
{
|
|
_bardingResource = value;
|
|
|
|
if (_hasBarding)
|
|
{
|
|
Hue = CraftResources.GetHue(value);
|
|
}
|
|
|
|
InvalidateProperties();
|
|
this.MarkDirty();
|
|
}
|
|
}
|
|
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
public int BardingMaxHP => _bardingExceptional ? 2500 : 1000;
|
|
|
|
public override int StepsMax => 4480;
|
|
public override bool ReacquireOnMovement => true;
|
|
public override bool AutoDispel => !Controlled;
|
|
public override FoodType FavoriteFood => FoodType.Meat;
|
|
public override int Meat => 19;
|
|
public override int Hides => 20;
|
|
public override int Scales => 5;
|
|
public override ScaleType ScaleType => ScaleType.Green;
|
|
public override bool CanAngerOnTame => true;
|
|
|
|
public override bool OverrideBondingReqs() => true;
|
|
|
|
public override int GetIdleSound() => 0x2CE;
|
|
|
|
public override int GetDeathSound() => 0x2CC;
|
|
|
|
public override int GetHurtSound() => 0x2D1;
|
|
|
|
public override int GetAttackSound() => 0x2C8;
|
|
|
|
public override double GetControlChance(Mobile m, bool useBaseSkill = false) => 1.0;
|
|
|
|
public override void GetProperties(IPropertyList list)
|
|
{
|
|
base.GetProperties(list);
|
|
|
|
if (_hasBarding && _bardingExceptional && _bardingCraftedBy != null)
|
|
{
|
|
list.Add(1060853, _bardingCraftedBy); // armor exceptionally crafted by ~1_val~
|
|
}
|
|
}
|
|
|
|
private void Deserialize(IGenericReader reader, int version)
|
|
{
|
|
_bardingExceptional = reader.ReadBool();
|
|
_bardingCraftedBy = reader.ReadString();
|
|
_hasBarding = reader.ReadBool();
|
|
_bardingHP = reader.ReadInt();
|
|
_bardingResource = (CraftResource)reader.ReadInt();
|
|
}
|
|
}
|
|
}
|