mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
3. Implement Conjured items support:
Added update_conjured_item method that:
Degrades quality twice per day (calls decrease_quality twice)
Respects same quality bounds as normal items
Modified dispatcher to detect "Conjured" in item names
Enhanced expired item handling:
Double degradation continues post-sell-by
Added explicit condition before Sulfuras check
Maintained all existing behavior through test verification
This commit is contained in:
parent
273ed6aa7c
commit
24c56931bf
@ -16,9 +16,15 @@ class GildedRose(object):
|
|||||||
self.update_aged_brie(item)
|
self.update_aged_brie(item)
|
||||||
elif item.name == "Backstage passes to a TAFKAL80ETC concert":
|
elif item.name == "Backstage passes to a TAFKAL80ETC concert":
|
||||||
self.update_backstage_pass(item)
|
self.update_backstage_pass(item)
|
||||||
|
elif "Conjured" in item.name:
|
||||||
|
self.update_conjured_item(item)
|
||||||
elif item.name != "Sulfuras, Hand of Ragnaros":
|
elif item.name != "Sulfuras, Hand of Ragnaros":
|
||||||
self.update_normal_item(item)
|
self.update_normal_item(item)
|
||||||
|
|
||||||
|
def update_conjured_item(self, item):
|
||||||
|
self.decrease_quality(item)
|
||||||
|
self.decrease_quality(item)
|
||||||
|
|
||||||
def update_sell_in(self, item):
|
def update_sell_in(self, item):
|
||||||
if item.name != "Sulfuras, Hand of Ragnaros":
|
if item.name != "Sulfuras, Hand of Ragnaros":
|
||||||
item.sell_in -= 1
|
item.sell_in -= 1
|
||||||
@ -28,6 +34,9 @@ class GildedRose(object):
|
|||||||
self.increase_quality(item)
|
self.increase_quality(item)
|
||||||
elif item.name == "Backstage passes to a TAFKAL80ETC concert":
|
elif item.name == "Backstage passes to a TAFKAL80ETC concert":
|
||||||
item.quality = 0
|
item.quality = 0
|
||||||
|
elif "Conjured" in item.name:
|
||||||
|
self.decrease_quality(item)
|
||||||
|
self.decrease_quality(item)
|
||||||
elif item.name != "Sulfuras, Hand of Ragnaros":
|
elif item.name != "Sulfuras, Hand of Ragnaros":
|
||||||
self.decrease_quality(item)
|
self.decrease_quality(item)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user