Line 153: |
Line 153: |
| | | |
| local cut_in_types = { | | local cut_in_types = { |
− | torpedo = { k = 70, cap = 60 },
| + | torpedo = { k = 70, cap = 60 }, |
− | mixed = { k = 70, cap = 70 },
| + | mixed = { k = 70, cap = 70 }, |
− | main = { k = 50, cap = 55 }
| + | main = { k = 50, cap = 55 } |
| } | | } |
| | | |
| function cut_in_rate(luck, t) | | function cut_in_rate(luck, t) |
− | if luck <= t.cap then
| + | if luck <= t.cap then |
− | return math.floor(math.sqrt(t.k * luck))
| + | return math.floor(math.sqrt(t.k * luck)) |
− | else
| + | else |
− | return cut_in_rate(t.cap, t)
| + | return cut_in_rate(t.cap, t) |
− | end
| + | end |
| end | | end |
| | | |
Line 232: |
Line 232: |
| | | |
| if rank and name and ship_table and ship_table._type then | | if rank and name and ship_table and ship_table._type then |
− | local luck_diff = ship_table._luck - 50
| + | local luck_diff = ship_table._luck - 50 |
| return format{ | | return format{ |
| table_templates.table_dd_row, | | table_templates.table_dd_row, |
Line 244: |
Line 244: |
| nb_ci = "", | | nb_ci = "", |
| luck_minus_cap = luck_diff < 0 and "−" .. -luck_diff or luck_diff, | | luck_minus_cap = luck_diff < 0 and "−" .. -luck_diff or luck_diff, |
− | nb_ci_rate = cut_in_rate(ship_table._luck) .. "%", | + | nb_ci_rate = cut_in_rate(ship_table._luck, cut_in_types.torpedo) .. "%", |
| } | | } |
| else | | else |