gilded_rose.sh: closer to original

This commit is contained in:
Nitsan Avni 2023-12-26 12:27:11 +01:00
parent 887ad0b60d
commit 7658124173

View File

@ -10,42 +10,46 @@ update_quality() {
if [[ $name != "Aged Brie" && $name != "Backstage passes to a TAFKAL80ETC concert" ]]; then if [[ $name != "Aged Brie" && $name != "Backstage passes to a TAFKAL80ETC concert" ]]; then
if ((quality > 0)); then if ((quality > 0)); then
if [[ $name != "Sulfuras, Hand of Ragnaros" ]]; then if [[ $name != "Sulfuras, Hand of Ragnaros" ]]; then
((quality--)) quality=$((quality - 1))
fi fi
fi fi
else else
if ((quality < 50)); then if ((quality < 50)); then
((quality++)) quality=$((quality + 1))
if [[ $name == "Backstage passes to a TAFKAL80ETC concert" ]]; then if [[ $name == "Backstage passes to a TAFKAL80ETC concert" ]]; then
if ((sell_in < 11)) && ((quality < 50)); then if ((sell_in < 11)); then
((quality++)) if ((quality < 50)); then
quality=$((quality + 1))
fi
fi
if ((sell_in < 6)); then
if ((quality < 50)); then
quality=$((quality + 1))
fi fi
if ((sell_in < 6)) && ((quality < 50)); then
((quality++))
fi fi
fi fi
fi fi
fi fi
if [[ $name != "Sulfuras, Hand of Ragnaros" ]]; then if [[ $name != "Sulfuras, Hand of Ragnaros" ]]; then
((sell_in--)) sell_in=$((sell_in - 1))
fi
if ((sell_in < 0)); then if ((sell_in < 0)); then
if [[ $name != "Aged Brie" ]]; then if [[ $name != "Aged Brie" ]]; then
if [[ $name != "Backstage passes to a TAFKAL80ETC concert" ]]; then if [[ $name != "Backstage passes to a TAFKAL80ETC concert" ]]; then
if ((quality > 0)); then if ((quality > 0)); then
if [[ $name != "Sulfuras, Hand of Ragnaros" ]]; then if [[ $name != "Sulfuras, Hand of Ragnaros" ]]; then
((quality--)) quality=$((quality - 1))
fi fi
fi fi
else else
quality=0 quality=$((quality - quality))
fi fi
else else
if ((quality < 50)); then if ((quality < 50)); then
((quality++)) quality=$((quality + 1))
fi
fi fi
fi fi
fi fi