mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-07-26 17:21:23 +00:00
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:
parent
4074da89e3
commit
eb87a35411
17
csharp.xUnit/GildedRose/ConjuredItemUpdater.cs
Normal file
17
csharp.xUnit/GildedRose/ConjuredItemUpdater.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -31,6 +31,7 @@ public class ItemUpdaterFactory : IItemUpdaterFactory
|
|||||||
new AgedBrieUpdater(),
|
new AgedBrieUpdater(),
|
||||||
new SulfurasUpdater(),
|
new SulfurasUpdater(),
|
||||||
new BackstagePassUpdater(),
|
new BackstagePassUpdater(),
|
||||||
|
new ConjuredItemUpdater(),
|
||||||
});
|
});
|
||||||
|
|
||||||
public IItemUpdater Get(Item item)
|
public IItemUpdater Get(Item item)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user