mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 07:51:29 +00:00
🔨 convert LegendaryItem from anemic to rich
This commit is contained in:
parent
9ec9e54cb1
commit
4ccea7cf66
@ -1,6 +1,5 @@
|
||||
package com.gildedrose.items;
|
||||
|
||||
import com.gildedrose.item_helpers.ItemHandler;
|
||||
import com.gildedrose.item_helpers.ItemType;
|
||||
import com.gildedrose.main.Item;
|
||||
|
||||
@ -9,15 +8,15 @@ public class LegendaryItem implements ItemType {
|
||||
public static final int LEGENDARY_ITEM_QUALITY = 80;
|
||||
public static final String LEGENDARY = "Sulfuras, Hand of Ragnaros";
|
||||
|
||||
private final ItemHandler item;
|
||||
private final Item item;
|
||||
|
||||
public LegendaryItem(Item item) {
|
||||
this.item = new ItemHandler(item);
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateQuality() {
|
||||
item.decrementSellInDate();
|
||||
decrementSellInDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -25,6 +24,10 @@ public class LegendaryItem implements ItemType {
|
||||
return LEGENDARY;
|
||||
}
|
||||
|
||||
public void decrementSellInDate() {
|
||||
item.sellIn--;
|
||||
}
|
||||
|
||||
public static boolean isLegendary(Item item) {
|
||||
return item.name.equals(LEGENDARY);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user