update dual-type defender explanation

This commit is contained in:
Tobias Nauen
2026-03-06 08:49:00 +01:00
parent 18f913b978
commit e87899b24e
2 changed files with 8 additions and 5 deletions

View File

@@ -206,18 +206,21 @@ export class Game {
explanation += `<strong>${defInfo.name}</strong>`;
} else {
const defInfos = defenderTypes.map(t => getTypeInfo(t));
explanation += `<strong>${defInfos[0].name} / ${defInfos[1].name}</strong>`;
explanation += `<strong>${defInfos[0].name}</strong> and <strong>${defInfos[1].name}</strong>`;
}
const effective = getEffectiveness(attackType, defenderTypes);
const effectLabel = effectivenessToLabel(effective);
explanation += `<br><br>Effectiveness: <strong>${effectLabel.label}</strong>`;
explanation += `<br><br>Overall effectiveness: <strong>${effectLabel.label}</strong>`;
if (defenderTypes.length > 1) {
const first = getEffectiveness(attackType, [defenderTypes[0]]);
const second = getEffectiveness(attackType, [defenderTypes[1]]);
explanation += `<br><small>(${effectivenessToLabel(first).short} × ${effectivenessToLabel(second).short} = ${effectLabel.short})</small>`;
const def1Info = getTypeInfo(defenderTypes[0]);
const def2Info = getTypeInfo(defenderTypes[1]);
explanation += `<br><br>Against <strong>${def1Info.name}</strong>: <strong>${effectivenessToLabel(first).label}</strong>`;
explanation += `<br>Against <strong>${def2Info.name}</strong>: <strong>${effectivenessToLabel(second).label}</strong>`;
}
return explanation;

View File

@@ -33,7 +33,7 @@ function render(): void {
const q = state.currentQuestion;
const defenderHtml = q.defenderTypes.length === 1
? renderTypeBadge(q.defenderTypes[0], 'large')
: `${renderTypeBadge(q.defenderTypes[0], 'large')} / ${renderTypeBadge(q.defenderTypes[1], 'large')}`;
: `${renderTypeBadge(q.defenderTypes[0], 'large')} ${renderTypeBadge(q.defenderTypes[1], 'large')}`;
const optionsHtml = state.showResult ? '' : options.map((opt, i) => {
let cls = 'option-btn';
@@ -108,7 +108,7 @@ function render(): void {
function renderCombinationItem(combo: CombinationStats): string {
const defenderHtml = combo.defenderTypes.length === 1
? renderTypeBadge(combo.defenderTypes[0], 'small')
: `${renderTypeBadge(combo.defenderTypes[0], 'small')} / ${renderTypeBadge(combo.defenderTypes[1], 'small')}`;
: `${renderTypeBadge(combo.defenderTypes[0], 'small')} ${renderTypeBadge(combo.defenderTypes[1], 'small')}`;
const accuracyClass = combo.accuracy >= 80 ? 'high' : combo.accuracy >= 50 ? 'medium' : 'low';