scoreboard players set #width temp 0
execute if score *dmg.template temp matches ..-1 run scoreboard players set #width temp 1
execute if score *dmg.template temp matches ..-1 run scoreboard players operation *dmg.template temp *= -1 const
scoreboard players operation @s math_in = *dmg.template temp
scoreboard players operation @s math_in /= 100 const
function piyo:math/log_10
scoreboard players operation #width temp += @s math_out
scoreboard players operation #width temp *= -6 const
scoreboard players add #width temp 30
scoreboard players remove #width temp 8
function widthify:widthify
scoreboard players operation *dmg.template_width temp = #spacer temp

scoreboard players operation *dmg.template_whole temp = *dmg.template temp
scoreboard players operation *dmg.template_whole temp /= 100 const
scoreboard players operation *dmg.template_tenths temp = *dmg.template temp
scoreboard players operation *dmg.template_tenths temp %= 100 const
scoreboard players operation *dmg.template_tenths temp /= 10 const

data modify storage piyo:temp damage_tooltips append value '[{"text":"element_icon ","color":"white","italic":false},{"score":{"name":"*dmg.template_whole","objective":"temp"},"color":"element_color","italic":false},{"text":".","color":"element_color","italic":false},{"score":{"name":"*dmg.template_tenths","objective":"temp"},"color":"element_color","italic":false},{"score":{"name":"*dmg.template_width","objective":"temp"},"font":"space:space"}]'