Модуль:ArmorStats: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 55: | Строка 55: | ||
-- Формируем сообщение в зависимости от значений sprintModifier и walkModifier | -- Формируем сообщение в зависимости от значений sprintModifier и walkModifier | ||
if sprintModifier and walkModifier then | if sprintModifier and walkModifier then | ||
if sprintModifier == 1 and walkModifier == 1 then | if sprintModifier == 1 and walkModifier == 1 then | ||
speedDescription = "" | speedDescription = "" | ||
elseif sprintModifier == walkModifier then | |||
local percent = round(math.abs(sprintModifier - 1) * 100) | |||
local action = sprintModifier > 1 and "Повышает" or "Понижает" | |||
speedDescription = string.format("* %s скорость передвижения на <span style=\"color:yellow\">'''%d %%'''</span>\n", action, percent) | |||
else | else | ||
speedDescription = "" | |||
for _, modifier in ipairs({{sprintModifier, "бега"}, {walkModifier, "ходьбы"}}) do | |||
local value, actionType = modifier[1], modifier[2] | |||
if value ~= 1 then | |||
local percent = round(math.abs(value - 1) * 100) | |||
local action = value > 1 and "Повышает" or "Понижает" | |||
speedDescription = speedDescription .. string.format("* %s скорость %s на <span style=\"color:yellow\">'''%d %%'''</span>\n", action, actionType, percent) | |||
local | |||
speedDescription = | |||
end | end | ||
end | end | ||