Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate spaces in the calc description #570

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions calc/src/desc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -873,16 +873,16 @@ function buildDescription(description: RawDesc, attacker: Pokemon, defender: Pok
output += 'Helping Hand ';
}
if (description.isFlowerGiftAttacker) {
output += ' with an ally\'s Flower Gift ';
output += 'with an ally\'s Flower Gift ';
}
if (description.isBattery) {
output += ' Battery boosted ';
output += 'Battery boosted ';
}
if (description.isPowerSpot) {
output += ' Power Spot boosted ';
output += 'Power Spot boosted ';
}
if (description.isSwitching) {
output += ' switching boosted ';
output += 'switching boosted ';
}
output += description.moveName + ' ';
if (description.moveBP && description.moveType) {
Expand Down
20 changes: 20 additions & 0 deletions calc/src/test/calc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,26 @@ describe('calc', () => {
result = calculate(attacker, defender, Move('Revelation Dance'));
expect(result.move.type).toBe('Water');
});

test('Flower Gift, Power Spot, Battery, and switching boosts shouldn\'t have double spaces', () => {
const attacker = Pokemon('Weavile');
const defender = Pokemon('Vulpix');
const field = Field({
weather: 'Sun',
attackerSide: {
isFlowerGift: true,
isPowerSpot: true,
},
defenderSide: {
isSwitching: 'out',
},
});
const result = calculate(attacker, defender, Move('Pursuit'), field);

expect(result.desc()).toBe(
"0 Atk Weavile with an ally's Flower Gift Power Spot boosted switching boosted Pursuit (80 BP) vs. 0 HP / 0 Def Vulpix in Sun: 399-469 (183.8 - 216.1%) -- guaranteed OHKO"
);
});
});
});
});
Expand Down
Loading