TFC-ing Intensity Levels

It's barely useful... but still easier then original, i guess?

FSN = * #first SN digit
LSN = * #last SN digit
B = * #battery amount
BH = * #battery holder amount
P = * #port amount
r = * #color of the button, see below
###########################
X = FSN*BH+1
Y = LSN*P+1
Z=(X+Y)*(2+B%2)*Y
mul1= (5r+Z%5-2)*sign(r)-2
mul2= sign(X%10-4.5)((10(X%10)+Y%10)-49.5)+0.5
A = floor(((Z%5)+1)*Y/((Z-1)%9+1))*mul1*mul2
###########################
Z%5 # is intensity
(A+1)%10 # is the last digit of a timer
###########################
# r:
# W -4 K -3
# M -2 C -1
# R +1 B +2
# G +3 Y +4