From faedbcc44b4b288595c0ca927ed3c422b2751a26 Mon Sep 17 00:00:00 2001 From: OKinane <15254824+OKinane@users.noreply.github.com> Date: Sat, 11 Mar 2023 15:34:26 +0100 Subject: [PATCH] add Conjured alternative version --- csharpcore/GildedRose/GildedRose.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/csharpcore/GildedRose/GildedRose.cs b/csharpcore/GildedRose/GildedRose.cs index a5a6468f..63ba47af 100644 --- a/csharpcore/GildedRose/GildedRose.cs +++ b/csharpcore/GildedRose/GildedRose.cs @@ -26,17 +26,18 @@ namespace GildedRoseKata { SetQuality(i, quantity => quantity + 1, quantity => quantity + 2); } - else if (Items[i].Name == "Conjured") - { - SetQuality(i, quantity => quantity - 2, quantity => quantity - 4); - } else if (Items[i].Name == "Backstage passes to a TAFKAL80ETC concert") { SetQuality(i, quantity => GetNewBackstageQuality(i), q => 0); } else { - SetQuality(i, quantity => quantity - 1, quantity => quantity - 2); + int coef = 1; + if (Items[i].Name == "Conjured") + { + coef = 2; + } + SetQuality(i, quantity => quantity - 1 * coef, quantity => quantity - 2 * coef); } } }