feat: implement ConjuredItemUpdater

Conjured items degrade twice as fast: -2 before sell-by, -4 after,
never below 0. Registered in ItemUpdaterFactory.Default() and resolved
by the Conjured prefix rule, so the whole Conjured family is covered.

The four Conjured spec tests go green. The ThirtyDays approval snapshot
now shows the intended Conjured-only diff; it is re-approved in the
next commit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Artur Goloyad 2026-07-25 20:51:28 +02:00
parent 4074da89e3
commit eb87a35411
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,17 @@
namespace GildedRoseKata;
public class ConjuredItemUpdater : ItemUpdaterBase
{
// Matched by prefix in ItemUpdaterFactory: handles every "Conjured..." item.
public override string Name => ItemUpdaterFactory.ConjuredPrefix;
public override void Update(Item item)
{
item.Quality = ClampQuality(item.Quality - 2);
item.SellIn -= 1;
if (item.SellIn < 0)
{
item.Quality = ClampQuality(item.Quality - 2);
}
}
}

View File

@ -31,6 +31,7 @@ public class ItemUpdaterFactory : IItemUpdaterFactory
new AgedBrieUpdater(),
new SulfurasUpdater(),
new BackstagePassUpdater(),
new ConjuredItemUpdater(),
});
public IItemUpdater Get(Item item)