mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +00:00
Merge pull request #7 from Decker-Matthew-R/Decker-Refactor-Branch3
Added Conjure Item
This commit is contained in:
commit
06bfb84143
@ -5,6 +5,7 @@ class GildedRose {
|
|||||||
public static final String AGED_BRIE = "Aged Brie";
|
public static final String AGED_BRIE = "Aged Brie";
|
||||||
public static final String SULFURAS = "Sulfuras, Hand of Ragnaros";
|
public static final String SULFURAS = "Sulfuras, Hand of Ragnaros";
|
||||||
public static final String BACKSTAGE = "Backstage passes to a TAFKAL80ETC concert";
|
public static final String BACKSTAGE = "Backstage passes to a TAFKAL80ETC concert";
|
||||||
|
public static final String CONJURED = "Conjured Mana Cake";
|
||||||
|
|
||||||
private Item[] items;
|
private Item[] items;
|
||||||
|
|
||||||
@ -19,11 +20,12 @@ class GildedRose {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateItemQuality(Item item) {
|
private void updateItemQuality(Item item) {
|
||||||
|
int degradeRate = item.name.equals(CONJURED) ? -2 : -1;
|
||||||
if (!item.name.equals(AGED_BRIE)
|
if (!item.name.equals(AGED_BRIE)
|
||||||
&& !item.name.equals(BACKSTAGE)) {
|
&& !item.name.equals(BACKSTAGE)) {
|
||||||
if (item.quality > 0) {
|
if (item.quality > 0) {
|
||||||
if (!item.name.equals(SULFURAS)) {
|
if (!item.name.equals(SULFURAS)) {
|
||||||
adjustQuality(item, -1);
|
adjustQuality(item, degradeRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -48,7 +50,7 @@ class GildedRose {
|
|||||||
if (!item.name.equals(AGED_BRIE)) {
|
if (!item.name.equals(AGED_BRIE)) {
|
||||||
if (!item.name.equals(BACKSTAGE)) {
|
if (!item.name.equals(BACKSTAGE)) {
|
||||||
if (!item.name.equals(SULFURAS)) {
|
if (!item.name.equals(SULFURAS)) {
|
||||||
adjustQuality(item, -1);
|
adjustQuality(item, degradeRate);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item.quality = item.quality - item.quality;
|
item.quality = item.quality - item.quality;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user