using System.Collections.Generic;
using ProjectM.Simulation;
using UnityEngine;
namespace ProjectM.Authoring
{
///
/// Designer-facing definition of one item (resource, tool, weapon, gear, consumable). Numeric/byte fields
/// are baked into the ItemDatabase blob (immutable, Burst-fast runtime config). Category and Tier are
/// BYTES, not enums, to dodge BOTH the MCP enum-drop hazard (manage_* silently drop enum fields when set
/// via tooling) AND the cross-assembly enum-in-Burst hazard. UI icon/description are deferred to a later
/// managed lookup keyed by id, exactly like AbilityDefinition.
///
[CreateAssetMenu(menuName = "Project M/Item Definition", fileName = "Item_")]
public class ItemDefinition : ScriptableObject
{
[Tooltip("Stable item id (ushort range). Keep 1=Aether, 2=Ore, 3=Biomass; reserve >3 for new items; 0 = none.")]
public int ItemId = 4;
public string DisplayName = "Item";
[Tooltip("ItemCategory byte: 0=Resource, 1=Tool, 2=Weapon, 3=Gear, 4=Consumable.")]
public byte Category = ItemCategory.Resource;
[Tooltip("Progression tier (0 = base). Higher-tier tools harvest higher-tier nodes / hit harder.")]
public byte Tier = 0;
[Min(1)]
[Tooltip("Max units that stack in one inventory slot (1 for non-stacking equipment).")]
public int StackMax = 999;
[Header("Equipment (Phase 1)")]
[Tooltip("EquipSlotId byte: 0=Weapon, 1=Armor, 2=Trinket, 3=Tool, 255=not equippable.")]
public byte EquipSlot = 255;
[Tooltip("AbilityId granted when equipped in the Weapon slot (0=none): 1=Primary, 2=FastLight, 3=SlowHeavy.")]
public byte GrantedAbilityId = 0;
[Tooltip("Stat modifiers granted while equipped (first 4 used).")]
public List Mods = new List();
}
/// Designer-facing stat-mod grant on an equippable item; the baker writes the first 4 into ItemDefBlob's inline mod slots.
[System.Serializable]
public struct ItemModAuthoring
{
[Tooltip("StatTarget byte: 0=Damage,1=CooldownTicks,2=Range,3=ProjectileSpeed,4=AutoTargetRange,5=AutoTargetCone,6=MoveSpeed,7=TurnRate,8=MaxHealth.")]
public byte Target;
[Tooltip("ModOp byte: 0=Flat, 1=PercentAdd, 2=PercentMult.")]
public byte Op;
public float Value;
}
}