Files
Project-M/Assets/_Project/Scripts/Simulation/Combat/ClassSwapUtil.cs
T
kronic 9f61f7c6fe LANTERN kit into the shipping scene + frame rename (audit H2/M4)
H2 was the audit's sharpest finding: in Game.unity every player spawned
with four ability sockets pointing at SparkIds the baked AbilityDatabase
did not contain, so all four resolved to Damage=0 Range=0 Cooldown=0.
Melee and dash were the only working combat verbs in the built game.
Cause: the 5 LANTERN Sparks were added to GymSub.unity and never to
Gameplay.unity.

- Gameplay.unity's AbilityDatabaseAuthoring now carries all 9 defs (the
  4 legacy ids keep their numbers; Sparks are 5-9) with their effect
  prefabs. Live-verified in Play: sockets now read
  Vortex 8dmg/6range/420cd, Blink 20range/1cd, Hook & Pull
  15dmg/25range/120cd, Light Zone 6dmg/5range/480cd.
- Removed 6 orphaned authoring GameObjects the purge left behind in the
  subscene (StorageSpawner, StructureCatalog, ItemDatabase,
  SpitterProjectileConfig, BoonCatalog, MetaCatalog) and the RoomDressing
  object in Game.unity — the latter is what scattered 47 Synty desert
  props into the seabed murk.
- Deleted 4 now-unreferenced prefabs: EnemySpit, Pylon, Storage, Wall.
- Frame rename (M4): FrameKind.Warrior/Ranger -> Bathynaut/Harpooner,
  93 identifier sites. Byte values pinned (2/3), so no ghost-hash or save
  impact. The menu said "Warrior"/"Ranger" to players three weeks after
  the frames were renamed in design.
- Menu now reads LANTERN / "Light is territory — co-op descent" instead
  of "PROJECT M" / "Frontier colony — co-op" (the Awakening-Engine
  tagline, two directions stale).
- Removed the "Replay Tutorial" button and the Settings ONBOARDING
  section: both drove coach-marks DR-051 deleted. The settings fields
  still round-trip so existing settings files load unchanged.

All four project scenes + all prefabs verified free of missing scripts.
Server measured at 59.6 ticks/s against a 60 Hz target. 295/295 green.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 13:11:58 -07:00

37 lines
2.1 KiB
C#

using Unity.Entities;
namespace ProjectM.Simulation
{
/// <summary>
/// The ONE in-place frame-swap effect, shared by the editor dev tool (DebugOp.SetClass) and the player-facing
/// frame select. Re-seeds the frame's stat band via <see cref="ClassTraits.Reapply"/>; the caller then writes
/// FrameId/PlayerClass, re-seeds the socket loadout, and calls <see cref="HealClamp"/> (a static can't resolve
/// singletons or SystemAPI.SetComponent, so the caller passes the resolved pieces). Server-authoritative +
/// prediction-correct (StatRecomputeSystem refolds EffectiveCharacterStats next tick).
///
/// HISTORY (2026-08-07 audit purge): this also used to strip and replay a PERMANENT-META band
/// (MetaUpgradeCatalog + MetaTierState) so an Aether-bought upgrade followed the frame across a swap. The meta
/// shop belonged to the superseded base/expedition direction and was deleted; only the frame band remains.
/// </summary>
public static class ClassSwapUtil
{
/// <summary>Re-seed the frame stat band for <paramref name="rawClass"/> on <paramref name="mods"/>.
/// Returns the normalized frame id (the caller writes FrameId/PlayerClass + re-seeds the socket
/// loadout).</summary>
public static void Apply(byte rawClass, DynamicBuffer<StatModifier> mods, out byte newClass)
{
newClass = ClassTraits.Normalize(rawClass);
ClassTraits.Reapply(newClass, mods);
}
/// <summary>Heal/down-clamp a LIVING player's Current to the new class's full max (blob base folded with the
/// just-reseeded <paramref name="mods"/>, like StatRecomputeSystem). Doubles as the down-clamp when the new
/// class's max is lower (Bathynaut +30 HP vs Harpooner -15%). No-op on a corpse (Current&lt;=0) — respawn refills.</summary>
public static void HealClamp(ref Health health, float baseMaxHealth, DynamicBuffer<StatModifier> mods)
{
if (health.Current > 0f)
health.Current = StatMath.Apply(baseMaxHealth, StatTarget.MaxHealth, mods);
}
}
}