Consumable host: initialise at activation, dispose at expiry, instantiate consumables
ActivateConsumable runs Initialize on the effect's behaviours; expiry disposes them before Resolver.Forget, so a consumable's modifiers exist exactly while its effect is active. ItemManager.CreateInstance returns a ConsumableItem for a consumable design. StatResolver.DetachModifier drops an entry left with nothing attached, so ModifierEntryCount returns to baseline. LoadoutTests' hand-built ConsumableItem goes through CreateInstance. Builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
739eee4a8e
commit
aaab561f98
5 changed files with 20 additions and 7 deletions
|
|
@ -141,6 +141,9 @@ public class StatResolver
|
|||
{
|
||||
set.Scale.Remove(modifierKey);
|
||||
set.Constant.Remove(modifierKey);
|
||||
// An entry with nothing attached is no entry: a modifier that is gone leaves no trace in the resolver.
|
||||
if (set.Scale.Count == 0 && set.Constant.Count == 0)
|
||||
_modifiers.Remove(entry);
|
||||
}
|
||||
_cache.Remove(entry);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue