## 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.
139 lines
3.8 KiB
C#
139 lines
3.8 KiB
C#
using ModernUO.Serialization;
|
|
using System.Collections.Generic;
|
|
using Server.ContextMenus;
|
|
using Server.Items;
|
|
|
|
namespace Server.Mobiles
|
|
{
|
|
[SerializationGenerator(0, false)]
|
|
public partial class Beetle : BaseMount
|
|
{
|
|
public override string DefaultName => "a giant beetle";
|
|
|
|
[Constructible]
|
|
public Beetle() : base( 0x317, 0x3EBC, AIType.AI_Melee)
|
|
{
|
|
SetStr(300);
|
|
SetDex(100);
|
|
SetInt(500);
|
|
|
|
SetHits(200);
|
|
|
|
SetDamage(7, 20);
|
|
|
|
SetDamageType(ResistanceType.Physical, 100);
|
|
|
|
SetResistance(ResistanceType.Physical, 30, 40);
|
|
SetResistance(ResistanceType.Fire, 20, 30);
|
|
SetResistance(ResistanceType.Cold, 20, 30);
|
|
SetResistance(ResistanceType.Poison, 20, 30);
|
|
SetResistance(ResistanceType.Energy, 20, 30);
|
|
|
|
SetSkill(SkillName.MagicResist, 80.0);
|
|
SetSkill(SkillName.Tactics, 100.0);
|
|
SetSkill(SkillName.Wrestling, 100.0);
|
|
|
|
Fame = 4000;
|
|
Karma = -4000;
|
|
|
|
Tamable = true;
|
|
ControlSlots = 3;
|
|
MinTameSkill = 29.1;
|
|
|
|
var pack = Backpack;
|
|
|
|
pack?.Delete();
|
|
|
|
pack = new StrongBackpack();
|
|
pack.Movable = false;
|
|
|
|
AddItem(pack);
|
|
}
|
|
|
|
public override int StepsMax => 4480;
|
|
public override string CorpseName => "a giant beetle corpse";
|
|
public virtual double BoostedSpeed => 0.1;
|
|
|
|
public override bool SubdueBeforeTame => true; // Must be beaten into submission
|
|
public override bool ReduceSpeedWithDamage => false;
|
|
|
|
public override FoodType FavoriteFood => FoodType.Meat;
|
|
|
|
public override int GetAngerSound() => 0x21D;
|
|
|
|
public override int GetIdleSound() => 0x21D;
|
|
|
|
public override int GetAttackSound() => 0x162;
|
|
|
|
public override int GetHurtSound() => 0x163;
|
|
|
|
public override int GetDeathSound() => 0x21D;
|
|
|
|
public override void OnHarmfulSpell(Mobile from)
|
|
{
|
|
if (!Controlled && ControlMaster == null)
|
|
{
|
|
CurrentSpeed = BoostedSpeed;
|
|
}
|
|
}
|
|
|
|
public override void OnCombatantChange()
|
|
{
|
|
if (Combatant == null && !Controlled && ControlMaster == null)
|
|
{
|
|
CurrentSpeed = PassiveSpeed;
|
|
}
|
|
}
|
|
|
|
public override bool OnBeforeDeath()
|
|
{
|
|
if (!base.OnBeforeDeath())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
PackAnimal.CombineBackpacks(this);
|
|
|
|
return true;
|
|
}
|
|
|
|
public override DeathMoveResult GetInventoryMoveResultFor(Item item) => DeathMoveResult.MoveToCorpse;
|
|
|
|
public override bool IsSnoop(Mobile from)
|
|
{
|
|
if (PackAnimal.CheckAccess(this, from))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return base.IsSnoop(from);
|
|
}
|
|
|
|
public override bool OnDragDrop(Mobile from, Item item)
|
|
{
|
|
if (CheckFeed(from, item))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
if (PackAnimal.CheckAccess(this, from))
|
|
{
|
|
AddToBackpack(item);
|
|
return true;
|
|
}
|
|
|
|
return base.OnDragDrop(from, item);
|
|
}
|
|
|
|
public override bool CheckNonlocalDrop(Mobile from, Item item, Item target) => PackAnimal.CheckAccess(this, from);
|
|
|
|
public override bool CheckNonlocalLift(Mobile from, Item item) => PackAnimal.CheckAccess(this, from);
|
|
|
|
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
|
{
|
|
base.GetContextMenuEntries(from, list);
|
|
|
|
PackAnimal.GetContextMenuEntries(this, from, list);
|
|
}
|
|
}
|
|
}
|