From d9ac33ac2e2d5262021499e5ff58f79065715f10 Mon Sep 17 00:00:00 2001 From: Lavfluff Date: Sat, 23 Nov 2024 00:15:08 +0100 Subject: [PATCH] :sparkles: (thanks jenny) printing of ranged damage and blocking abilities now working! --- src/index.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/index.php b/src/index.php index cd4ccb7..4b0237f 100644 --- a/src/index.php +++ b/src/index.php @@ -61,17 +61,26 @@ } // then get the amount of icons - preg_match_all('/\d+/', $iconNumbers, $matches); + preg_match_all('/([0-9]*[.])?[0-9]+/', $iconNumbers, $matches); $numbers = $matches[0]; $min = $numbers[0]; $max = $numbers[1]; if ($iconNumbers === '100-100') { echo "\"$iconType\" 100%"; - } elseif ($min !== $max) { - } else { - // print icon image for each point - for ($i = 1; $i <= $min; $i++) { + // print icon image for each point up to the rounded min + $roundedMin = ceil($min); + $roundedRemainingIcons = floor($max - $min); + for ($i = 1; $i <= $roundedMin; $i++) { + echo "\"$iconType\""; + } + // TODO: - Handle conditional icons/effects + if(!($max - $min > 0)) { + return; + } + // for each icon afterwards, if any, print it with a + separator + echo " + "; + for($i = 1; $i <= $roundedRemainingIcons; $i++) { echo "\"$iconType\""; } }