Combat: ability archetype byte (MC-6 dispatch spike)
byte Archetype on AbilityDefBlob (AbilityArchetype enum: Projectile/Hitscan/Cone/Aoe), authored on AbilityDefinition + baked in AbilityDatabaseAuthoring, read at dispatch in AbilityFireSystem -- NOT folded through EffectiveAbilityStats/StatRecomputeSystem (static identity, not a tunable stat; MC-4 review BURST-1). All current abilities are Projectile (0) -> zero behaviour change; the dispatch read-point is the de-risk spike for MC-6 hitscan/cone/aoe. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,6 +47,7 @@ namespace ProjectM.Authoring
|
|||||||
ProjectileSpeed = def.ProjectileSpeed,
|
ProjectileSpeed = def.ProjectileSpeed,
|
||||||
Range = def.Range,
|
Range = def.Range,
|
||||||
AutoTargetRange = def.AutoTargetRange,
|
AutoTargetRange = def.AutoTargetRange,
|
||||||
|
Archetype = (byte)def.Archetype,
|
||||||
AutoTargetConeRadians = math.radians(def.AutoTargetConeDegrees),
|
AutoTargetConeRadians = math.radians(def.AutoTargetConeDegrees),
|
||||||
CooldownTicks = def.CooldownTicks,
|
CooldownTicks = def.CooldownTicks,
|
||||||
Name = def.DisplayName,
|
Name = def.DisplayName,
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ namespace ProjectM.Authoring
|
|||||||
public class AbilityDefinition : ScriptableObject
|
public class AbilityDefinition : ScriptableObject
|
||||||
{
|
{
|
||||||
public AbilityId Id = AbilityId.Primary;
|
public AbilityId Id = AbilityId.Primary;
|
||||||
|
[Tooltip("Ability kind for the fire-dispatch. Only Projectile is wired today; the rest are the MC-6 spike.")]
|
||||||
|
public AbilityArchetype Archetype = AbilityArchetype.Projectile;
|
||||||
public string DisplayName = "Ability";
|
public string DisplayName = "Ability";
|
||||||
|
|
||||||
[Header("Combat")]
|
[Header("Combat")]
|
||||||
|
|||||||
@@ -3,10 +3,21 @@ using Unity.Entities;
|
|||||||
|
|
||||||
namespace ProjectM.Simulation
|
namespace ProjectM.Simulation
|
||||||
{
|
{
|
||||||
|
/// <summary>Ability KIND for the AbilityFireSystem dispatch (MC-4 spike for MC-6). Backed by <c>byte</c> so the
|
||||||
|
/// baked blob stores a byte (the Burst cross-assembly enum rule); the runtime switch compares the byte value.</summary>
|
||||||
|
public enum AbilityArchetype : byte
|
||||||
|
{
|
||||||
|
Projectile = 0, // today's path: spawn a projectile ghost
|
||||||
|
Hitscan = 1, // MC-6
|
||||||
|
Cone = 2, // MC-6 (melee-style cone via the ability system)
|
||||||
|
Aoe = 3, // MC-6
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>One authored ability definition, baked immutable into the AbilityDatabase blob.</summary>
|
/// <summary>One authored ability definition, baked immutable into the AbilityDatabase blob.</summary>
|
||||||
public struct AbilityDefBlob
|
public struct AbilityDefBlob
|
||||||
{
|
{
|
||||||
public byte Id; // AbilityId
|
public byte Id; // AbilityId
|
||||||
|
public byte Archetype; // AbilityArchetype (0 = Projectile); read at dispatch in AbilityFireSystem (MC-6 spike)
|
||||||
public float Damage;
|
public float Damage;
|
||||||
public float ProjectileSpeed;
|
public float ProjectileSpeed;
|
||||||
public float Range;
|
public float Range;
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ namespace ProjectM.Simulation
|
|||||||
// Per-ability projectile ghost prefabs live on the AbilityDatabase singleton's companion buffer.
|
// Per-ability projectile ghost prefabs live on the AbilityDatabase singleton's companion buffer.
|
||||||
var dbEntity = SystemAPI.GetSingletonEntity<AbilityDatabase>();
|
var dbEntity = SystemAPI.GetSingletonEntity<AbilityDatabase>();
|
||||||
var abilityPrefabs = SystemAPI.GetBuffer<AbilityPrefabElement>(dbEntity);
|
var abilityPrefabs = SystemAPI.GetBuffer<AbilityPrefabElement>(dbEntity);
|
||||||
|
var abilityDb = SystemAPI.GetSingleton<AbilityDatabase>();
|
||||||
|
|
||||||
bool isServer = state.WorldUnmanaged.IsServer();
|
bool isServer = state.WorldUnmanaged.IsServer();
|
||||||
|
|
||||||
@@ -99,6 +100,14 @@ namespace ProjectM.Simulation
|
|||||||
continue; // still cooling down
|
continue; // still cooling down
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MC-4 spike for MC-6: dispatch on the authored ability ARCHETYPE byte (baked in the blob, read here -- NOT
|
||||||
|
// folded through EffectiveAbilityStats; it is static identity, not a tunable stat). All current
|
||||||
|
// abilities are Projectile (0); hitscan/cone/aoe archetypes plug in at this point in MC-6.
|
||||||
|
ref var adb = ref abilityDb.Value.Value;
|
||||||
|
byte archetype = adb.TryGetAbility(abilityRef.ValueRO.Id, out var adef) ? adef.Archetype : (byte)AbilityArchetype.Projectile;
|
||||||
|
if (archetype != (byte)AbilityArchetype.Projectile)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Resolve the projectile ghost prefab for this player's selected ability id.
|
// Resolve the projectile ghost prefab for this player's selected ability id.
|
||||||
Entity prefab = Entity.Null;
|
Entity prefab = Entity.Null;
|
||||||
for (int i = 0; i < abilityPrefabs.Length; i++)
|
for (int i = 0; i < abilityPrefabs.Length; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user