mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 16:01:42 +00:00
Add Conjured mana cake implementation
The quality of the cake decreases twice as fast as the default, so we pass these levels of quality decay to the quality behavior constructor
This commit is contained in:
parent
2b4307cd31
commit
2ba07cce25
@ -18,6 +18,7 @@ public class ItemBehaviorPicker {
|
||||
public static final String ITEM_AGED_BRIE = "Aged Brie";
|
||||
public static final String ITEM_SULFURAS_HAND_OF_RAGNAROS = "Sulfuras, Hand of Ragnaros";
|
||||
public static final String ITEM_BACKSTAGE_PASSES = "Backstage passes to a TAFKAL80ETC concert";
|
||||
public static final String ITEM_CONJURED_MANA_CAKE = "Conjured Mana Cake";
|
||||
|
||||
public static ItemBehavior forName(String name) {
|
||||
|
||||
@ -25,6 +26,7 @@ public class ItemBehaviorPicker {
|
||||
case ITEM_AGED_BRIE: return getAgedBrieItemBehavior();
|
||||
case ITEM_SULFURAS_HAND_OF_RAGNAROS: return getSulfurusHandOfRagnarosItemBehavior();
|
||||
case ITEM_BACKSTAGE_PASSES: return getBackstagePassesItemBehavior();
|
||||
case ITEM_CONJURED_MANA_CAKE: return getConjuredItemBehavior();
|
||||
default: return getDefaultItemBehavior();
|
||||
}
|
||||
}
|
||||
@ -42,6 +44,10 @@ public class ItemBehaviorPicker {
|
||||
return ItemBehaviorImpl.of(StagedIncreasingQualityBehavior.withStages(stages, 1), DecreasingSellInBehavior.newInstance());
|
||||
}
|
||||
|
||||
private static ItemBehavior getConjuredItemBehavior() {
|
||||
return ItemBehaviorImpl.of(DecreasingQualityBehavior.newInstance(2, 4), DecreasingSellInBehavior.newInstance());
|
||||
}
|
||||
|
||||
private static ItemBehavior getDefaultItemBehavior() {
|
||||
return ItemBehaviorImpl.of(DecreasingQualityBehavior.newInstance(), DecreasingSellInBehavior.newInstance());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user