|
189 | 189 | background: var(--or-2); |
190 | 190 | } |
191 | 191 |
|
| 192 | + .result-info { |
| 193 | + display: grid; |
| 194 | + gap: 0.35rem; |
| 195 | + font-size: 0.95rem; |
| 196 | + color: var(--foreground-subtle); |
| 197 | + margin-top: 0.35rem; |
| 198 | + } |
| 199 | + |
| 200 | + .result-info__item { |
| 201 | + margin: 0; |
| 202 | + } |
| 203 | + |
192 | 204 | @media (max-width: 720px) { |
193 | 205 | body { |
194 | 206 | padding: 20px 16px 40px; |
@@ -240,6 +252,7 @@ <h1>eRepublik Air Damage Calculator</h1> |
240 | 252 | <p class="helper-text" id="influence-breakdown"></p> |
241 | 253 | </div> |
242 | 254 | </div> |
| 255 | + <div class="result-info" id="result-info" aria-live="polite"></div> |
243 | 256 | </div> |
244 | 257 | </section> |
245 | 258 |
|
@@ -527,6 +540,7 @@ <h1>eRepublik Air Damage Calculator</h1> |
527 | 540 | const influenceValue = document.getElementById('influence'); |
528 | 541 | const timeWrapper = document.getElementById('time-wrapper'); |
529 | 542 | const timeEstimate = document.getElementById('time-estimate'); |
| 543 | + const resultInfo = document.getElementById('result-info'); |
530 | 544 | const ebInput = document.getElementById('ebs'); |
531 | 545 | const eb2Input = document.getElementById('ebs2'); |
532 | 546 | const eb3Input = document.getElementById('ebs3'); |
@@ -629,6 +643,13 @@ <h1>eRepublik Air Damage Calculator</h1> |
629 | 643 | return `≈${formatNumber(minutes)}m:${remainingSeconds}s`; |
630 | 644 | }; |
631 | 645 |
|
| 646 | + const formatDuration = (seconds) => { |
| 647 | + const wholeSeconds = Math.max(0, Math.ceil(seconds)); |
| 648 | + const minutes = Math.floor(wholeSeconds / 60); |
| 649 | + const remainingSeconds = String(wholeSeconds % 60).padStart(2, '0'); |
| 650 | + return `${minutes}m${remainingSeconds}s`; |
| 651 | + }; |
| 652 | + |
632 | 653 | const clampNumber = (value, min, max) => { |
633 | 654 | if (Number.isNaN(value)) return min; |
634 | 655 | if (typeof max === 'number') { |
@@ -789,6 +810,49 @@ <h1>eRepublik Air Damage Calculator</h1> |
789 | 810 | tooltipPopover.textContent = activeWrapper.dataset.tooltipContent; |
790 | 811 | } |
791 | 812 | } |
| 813 | + |
| 814 | + const infoMessages = []; |
| 815 | + const weaponQuality = { |
| 816 | + q1: 1, |
| 817 | + q2: 2, |
| 818 | + q3: 3, |
| 819 | + q4: 4, |
| 820 | + q5: 5 |
| 821 | + }[weapon]; |
| 822 | + |
| 823 | + if (weaponQuality) { |
| 824 | + const weaponsNeeded = Math.ceil(energy / weaponQuality); |
| 825 | + infoMessages.push(`${formatNumber(weaponsNeeded)} weapons required to deploy ${formatNumber(energy)} energy`); |
| 826 | + } |
| 827 | + |
| 828 | + if (isStinger) { |
| 829 | + const stingersNeeded = Math.ceil(energy / 3); |
| 830 | + infoMessages.push(`${formatNumber(stingersNeeded)} stingers required to deploy ${formatNumber(energy)} energy`); |
| 831 | + } |
| 832 | + |
| 833 | + const boostersSelected = boosterPercent > 0 |
| 834 | + || influenceBoosterPercent > 0 |
| 835 | + || rankBoosterPercent > 0; |
| 836 | + |
| 837 | + const boostersDurationSeconds = 10 * 60; |
| 838 | + if (boostersSelected && timeSecondsRounded > boostersDurationSeconds) { |
| 839 | + const boostersNeeded = Math.ceil(timeSecondsRounded / boostersDurationSeconds); |
| 840 | + infoMessages.push(`You may need ${formatNumber(boostersNeeded)}+ boosters because the deploy time is ${formatDuration(timeSecondsRounded)} (assuming each booster lasts 10m)`); |
| 841 | + } |
| 842 | + |
| 843 | + const damageAcceleratorDurationSeconds = 5 * 60; |
| 844 | + if (damageAcceleratorMultiplier > 1 && timeSecondsRounded > damageAcceleratorDurationSeconds) { |
| 845 | + const acceleratorsNeeded = Math.ceil(timeSecondsRounded / damageAcceleratorDurationSeconds); |
| 846 | + infoMessages.push(`You may need ${formatNumber(acceleratorsNeeded)}+ damage accelerators because the deploy time is ${formatDuration(timeSecondsRounded)} (assuming each accelerator lasts 5m)`); |
| 847 | + } |
| 848 | + |
| 849 | + resultInfo.innerHTML = ''; |
| 850 | + infoMessages.forEach((message) => { |
| 851 | + const item = document.createElement('p'); |
| 852 | + item.className = 'result-info__item'; |
| 853 | + item.textContent = message; |
| 854 | + resultInfo.appendChild(item); |
| 855 | + }); |
792 | 856 | } |
793 | 857 |
|
794 | 858 | energyInput.addEventListener('input', () => { |
|
0 commit comments