(thanks jenny) printing of ranged damage and blocking abilities now working!

main
Lavfluff 1 month ago
parent 074a8c5cb6
commit d9ac33ac2e

@ -61,17 +61,26 @@
} }
// then get the amount of icons // then get the amount of icons
preg_match_all('/\d+/', $iconNumbers, $matches); preg_match_all('/([0-9]*[.])?[0-9]+/', $iconNumbers, $matches);
$numbers = $matches[0]; $numbers = $matches[0];
$min = $numbers[0]; $min = $numbers[0];
$max = $numbers[1]; $max = $numbers[1];
if ($iconNumbers === '100-100') { if ($iconNumbers === '100-100') {
echo "<img class=\"iconType\" src=\"$iconImage\" alt=\"$iconType\"> 100&percnt;"; echo "<img class=\"iconType\" src=\"$iconImage\" alt=\"$iconType\"> 100&percnt;";
} elseif ($min !== $max) {
} else { } else {
// print icon image for each point // print icon image for each point up to the rounded min
for ($i = 1; $i <= $min; $i++) { $roundedMin = ceil($min);
$roundedRemainingIcons = floor($max - $min);
for ($i = 1; $i <= $roundedMin; $i++) {
echo "<img class=\"iconType\" src=\"$iconImage\" alt=\"$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 "<img class=\"iconType\" src=\"$iconImage\" alt=\"$iconType\">"; echo "<img class=\"iconType\" src=\"$iconImage\" alt=\"$iconType\">";
} }
} }

Loading…
Cancel
Save