Line 3: |
Line 3: |
| shipmodule.data = shipdb.KanmusuData | | shipmodule.data = shipdb.KanmusuData |
| | | |
− | local function hp_married(hp, hp_max) | + | local function getMarriedHp(hp, maxHp) |
− | return math.min(hp_max, hp + ({4, 4, 4, 5, 6, 7, 7, 8, 8, 9})[math.floor(hp / 10) + 1]) | + | return math.min(maxHp, hp + ({4, 4, 4, 5, 6, 7, 7, 8, 8, 9})[math.floor(hp / 10) + 1]) |
| + | end |
| + | |
| + | local function tooltip(content, title) |
| + | return tostring(mw.html.create('span'):attr('title', title):addClass('explain'):wikitext(content)) |
| end | | end |
| | | |
Line 104: |
Line 108: |
| local statLabel = '<th style="width: 65px; {{border-radius|12px 4px 4px 12px}} padding-left: 5px; padding-right: 5px; background-color: #eae1d1; color: #a3965c; text-align: right; vertical-align: baseline;">' | | local statLabel = '<th style="width: 65px; {{border-radius|12px 4px 4px 12px}} padding-left: 5px; padding-right: 5px; background-color: #eae1d1; color: #a3965c; text-align: right; vertical-align: baseline;">' |
| local statBox = '<td style="{{border-radius|4px 12px 12px 4px}} padding-left: 5px; padding-right: 5px; border: 1px solid #a3965c; text-align: left; vertical-align: baseline;">' | | local statBox = '<td style="{{border-radius|4px 12px 12px 4px}} padding-left: 5px; padding-right: 5px; border: 1px solid #a3965c; text-align: left; vertical-align: baseline;">' |
− | -- HP & FP
| + | |
| local hp = shipmodule.data[shipNum]["hp"][1] | | local hp = shipmodule.data[shipNum]["hp"][1] |
− | local hp_max = shipmodule.data[shipNum]["hp"][2] | + | local maxHp = shipmodule.data[shipNum]["hp"][2] |
− | local hp_m = hp_married(hp, hp_max) | + | local marriedHp = getMarriedHp(hp, maxHp) |
− | local HPinfo = statLabel .. 'HP [[File:IcoHP.png|HP]]</th>' .. statBox .. hp .. '→' .. hp_m .. '</td>' | + | local maxModHp = math.min(hp + 2, maxHp) |
| + | local maxModMarriedHp = math.min(marriedHp + 2, maxHp) |
| + | local hpSpan1 = tooltip(hp, string.format('%d with DE modernization', maxModHp)) |
| + | local hpSpan2 = tooltip(marriedHp, string.format('%d with DE modernization', maxModMarriedHp)) |
| + | local HPinfo = statLabel .. 'HP [[File:IcoHP.png|HP]]</th>' .. statBox .. hpSpan1 .. '→' .. hpSpan2 .. '</td>' |
| + | |
| local FPinfo = statLabel .. 'FP [[File:IcoAtk.png|Firepower]]</th>' .. statBox .. shipmodule.data[shipNum]["fp"][1] .. '→' .. shipmodule.data[shipNum]["fp"][2] .. '</td>' | | local FPinfo = statLabel .. 'FP [[File:IcoAtk.png|Firepower]]</th>' .. statBox .. shipmodule.data[shipNum]["fp"][1] .. '→' .. shipmodule.data[shipNum]["fp"][2] .. '</td>' |
| | | |