Initial commit: Theriapolis baseline at port/godot branch point
Captures the pre-Godot-port state of the codebase. This is the rollback anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md). All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
namespace Theriapolis.Core.Items;
|
||||
|
||||
/// <summary>
|
||||
/// Equipment slot a single <see cref="ItemInstance"/> occupies when worn or
|
||||
/// wielded. Each slot holds at most one item. Two-handed weapons clear the
|
||||
/// OffHand slot when equipped.
|
||||
///
|
||||
/// Natural-weapon enhancers (Fang Caps, Claw Sheaths, Hoof Plates, Antler Tips,
|
||||
/// Horn Rings) attach to a *specific* anatomical slot — they do not share with
|
||||
/// general-purpose worn items, so each gets its own enum entry.
|
||||
/// </summary>
|
||||
public enum EquipSlot : byte
|
||||
{
|
||||
MainHand = 0,
|
||||
OffHand = 1,
|
||||
Body = 2,
|
||||
Helm = 3,
|
||||
Cloak = 4,
|
||||
Boots = 5,
|
||||
AdaptivePack = 6,
|
||||
NaturalWeaponFang = 7,
|
||||
NaturalWeaponClaw = 8,
|
||||
NaturalWeaponHoof = 9,
|
||||
NaturalWeaponAntler = 10,
|
||||
NaturalWeaponHorn = 11,
|
||||
}
|
||||
|
||||
public static class EquipSlotExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Maps an <see cref="Data.ItemDef.EnhancerSlot"/> string ("fang", "claw",
|
||||
/// "hoof", "antler", "horn") to the corresponding NaturalWeapon* slot.
|
||||
/// Returns null if the string isn't a recognized natural-weapon location.
|
||||
/// </summary>
|
||||
public static EquipSlot? FromEnhancerSlot(string? raw) => raw?.ToLowerInvariant() switch
|
||||
{
|
||||
"fang" => EquipSlot.NaturalWeaponFang,
|
||||
"claw" => EquipSlot.NaturalWeaponClaw,
|
||||
"hoof" => EquipSlot.NaturalWeaponHoof,
|
||||
"antler" => EquipSlot.NaturalWeaponAntler,
|
||||
"horn" => EquipSlot.NaturalWeaponHorn,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary>Parses a snake_case JSON value (e.g. "main_hand") into an EquipSlot.</summary>
|
||||
public static EquipSlot? FromJson(string? raw) => raw?.ToLowerInvariant() switch
|
||||
{
|
||||
"main_hand" => EquipSlot.MainHand,
|
||||
"off_hand" => EquipSlot.OffHand,
|
||||
"body" => EquipSlot.Body,
|
||||
"helm" => EquipSlot.Helm,
|
||||
"cloak" => EquipSlot.Cloak,
|
||||
"boots" => EquipSlot.Boots,
|
||||
"adaptive_pack" => EquipSlot.AdaptivePack,
|
||||
"natural_weapon_fang" => EquipSlot.NaturalWeaponFang,
|
||||
"natural_weapon_claw" => EquipSlot.NaturalWeaponClaw,
|
||||
"natural_weapon_hoof" => EquipSlot.NaturalWeaponHoof,
|
||||
"natural_weapon_antler" => EquipSlot.NaturalWeaponAntler,
|
||||
"natural_weapon_horn" => EquipSlot.NaturalWeaponHorn,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user