mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
調整item.sellIn順序 且將<0的判斷塞入 item.name的判斷式中
This commit is contained in:
parent
4cfe62665d
commit
31f7d222ea
@ -17,34 +17,33 @@ class GildedRose {
|
||||
if (item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||
return;
|
||||
}
|
||||
if (item.name.equals("Aged Brie")) {
|
||||
increaseQuality(item);
|
||||
} else if (item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
increaseQuality(item);
|
||||
if (item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
if (item.sellIn < 11) {
|
||||
increaseQuality(item);
|
||||
}
|
||||
|
||||
if (item.sellIn < 6) {
|
||||
increaseQuality(item);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
decreaseQuality(item);
|
||||
}
|
||||
|
||||
item.sellIn = item.sellIn - 1;
|
||||
|
||||
if (item.sellIn < 0) {
|
||||
if (item.name.equals("Aged Brie")) {
|
||||
if (item.name.equals("Aged Brie")) {
|
||||
increaseQuality(item);
|
||||
if (item.sellIn < 0) {
|
||||
increaseQuality(item);
|
||||
} else {
|
||||
if (item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
item.quality = item.quality - item.quality;
|
||||
} else {
|
||||
decreaseQuality(item);
|
||||
}
|
||||
}
|
||||
} else if (item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
increaseQuality(item);
|
||||
|
||||
if (item.sellIn < 10) {
|
||||
increaseQuality(item);
|
||||
}
|
||||
|
||||
if (item.sellIn < 5) {
|
||||
increaseQuality(item);
|
||||
}
|
||||
|
||||
if (item.sellIn < 0) {
|
||||
item.quality = item.quality - item.quality;
|
||||
}
|
||||
|
||||
} else {
|
||||
decreaseQuality(item);
|
||||
if (item.sellIn < 0) {
|
||||
decreaseQuality(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user