Dev notes ·

Phase 0, Step 8: the loot drop (data-driven itemization)

  • User confirmed Step 7 works (armoured cube takes 10 hits, profiles tune live).
Done (compiled cleanly 15:23; waiting on the user to play)
  • Code/Runtime/Core/: IRandom + SystemRandom (seedable rolls, no UnityEngine.Random in rules) and Weighted.PickIndex (weighted choice for rarity, bases, affixes).
  • Code/Runtime/Stats/StatModifier.cs: one stat change (Flat or Percent). Item bases and affix rolls are lists of these; Step 9 applies them on equip.
  • Code/Runtime/Items/ (namespace EmbersOfOlympus.Items):
    • ItemSlot (10 slots from act-1-items §4), ItemRarity with the canon names Mortal / Blessed / Heroic (0 / 1–2 / 3–4 affixes). Relic waits for Step 19.
    • ItemDefinition (SO, Create → Embers → Items): id, name key, slot, icon, base stats.
    • AffixDefinition (SO): id, name key, prefix/suffix, stat, kind, T1–T3 ranges, allowed slots, weight.
    • ItemInstance + AffixRoll: the rolled item (saved by id; definition refs re-attach on load, later). Definition vs rolled instance is the genre's core.
    • ItemText: localized name ("Sharp Bronze Spear of Warding" via item.name.format, first prefix + base + first suffix), rarity labels, stat lines.
  • Code/Runtime/Loot/:
    • LootTable (SO): drop chance, rarity weights, weighted item bases, affix pool, max affix tier (Act 1 = mostly T1–T2).
    • LootRoller (pure): drop chance → rarity → base → affixes (count by rarity, fitting the slot, weighted, never the same affix twice) → whole-number value in the tier range. If a slot has too few affixes (rings), the item drops to the rarity it earned instead of a "Heroic" with one affix.
    • LootDropper (on enemies): on death, rolls and spawns the drop on the ground.
    • LootDrop (prefab Prefabs/PF_LootDrop): spinning marker + beam. Rarity shows in colour + height + width (+ pulse for Heroic): colourblind-safe, never colour alone. Mortal: short thin grey; Blessed: medium blue; Heroic: tall wide gold, throbbing.
  • Code/Editor/LootDataBuilder.cs: Embers → Loot → Create Grey-box Loot Data makes 9 real Act 1 bases (Bronze Spear, Wooden Aspis, Pilos Cap, Linothorax, Leather Bracers, Sandals, Woven Girdle, Bone Charm-cord, Copper Band), 9 affixes and LT_Greybox_Trash (100% drop, 55/30/15 rarity, max T2). Only creates what's missing. Embers → Loot → Roll 20 Test Drops prints 20 rolls to the Console (good b-roll).
  • Scene builder: every enemy gets a LootDropper (table + prefab).
  • Localization: 9 item names, 9 affix names and item.name.format in narrative.csv; rarity labels and 11 stat.<stat>.<flat|percent> lines in systems.csv. Renamed stat.damage.format → stat.damage.flat (only LocTests used it; updated).
  • Tests: WeightedTests (3), LootRollerTests (11 incl. 3 cases), ItemTextTests (5, against the real CSVs). Expected total ≈ 48.
Decisions
  • Only affixes whose stats exist today: Stalwart, Vigorous, Plated, Reinforced, Sharp, Cruel, Swift, of Warding, of Light. Might/Finesse/crit/etc. come with their stats.
  • act-1-items marks Plated/Reinforced as (S); the doc calls P/S "a soft convention", so adjective names are prefixes ("Plated Linothorax") and "of X" names suffixes, so the composed names read naturally.
  • No floating item labels yet: TextMesh Pro isn't imported. Names show in the Console; world labels arrive with the Step 9 UI.
  • Heroic items don't get the canon "place + date" names yet (flavour, later).

All dev notes