Skip to content

Commit

Permalink
Remove duplicate spaces in the calc description (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrianshChari authored Oct 6, 2023
1 parent 81a9ea7 commit 784a65a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
8 changes: 4 additions & 4 deletions calc/src/desc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,16 +869,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

0 comments on commit 784a65a

Please sign in to comment.