Working conjured items.

This commit is contained in:
Povilas Brilius 2020-05-01 20:52:03 +03:00
parent 82dc714539
commit 1e1826519f
2 changed files with 3 additions and 4 deletions

View File

@ -16,7 +16,6 @@ $items = array(
new Item('Backstage passes to a TAFKAL80ETC concert', 15, 20),
new Item('Backstage passes to a TAFKAL80ETC concert', 10, 49),
new Item('Backstage passes to a TAFKAL80ETC concert', 5, 49),
// this conjured item does not work properly yet
new Item('Conjured Mana Cake', 3, 6)
);
@ -28,8 +27,8 @@ if (count($argv) > 1) {
}
for ($i = 0; $i < $days; $i++) {
echo("-------- day $i --------\n");
echo("name\tsellIn\tquality\n");
echo '-------- Day ' . ($i + 1) . ' --------' . PHP_EOL;
echo("Name\tSell in\tQuality\n");
foreach ($items as $item) {
echo $item . PHP_EOL;
}

View File

@ -57,7 +57,7 @@ final class GildedRose
if ($item->name !== 'Aged Brie' && $item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
if ($item->quality > 0) {
if (strstr($item->name, 'Conjured') === 0) {
if (strstr($item->name, 'Conjured', true) === '') {
$item->quality -= 2;
} else {
$item->quality--;