🔨 convert LegendaryItem from anemic to rich

This commit is contained in:
Velizar Todorov 2021-11-30 17:38:04 +01:00
parent 9ec9e54cb1
commit 4ccea7cf66

View File

@ -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);
}