scrabble-solver
Version:
Scrabble Solver 2 - Free, open-source, cross-platform, multi-language analysis tool for Scrabble, Scrabble Duel, Super Scrabble, Letter League, Literaki, and Kelimelik. Quickly find the top-scoring words using the given board and tiles.
28 lines (27 loc) • 853 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CharacterBonus = void 0;
const constants_1 = require("@scrabble-solver/constants");
const Bonus_1 = require("./Bonus");
class CharacterBonus extends Bonus_1.Bonus {
constructor() {
super(...arguments);
this.type = constants_1.BONUS_CHARACTER;
}
canApply(config, cell) {
return super.canApply(config, cell) && this.matchesCellTileScore(config, cell);
}
matchesCellTileScore(config, cell) {
if (typeof this.score === 'undefined') {
return true;
}
return this.score === config.pointsMap[cell.tile.character];
}
get value() {
return {
characterMultiplier: this.multiplier,
wordMultiplier: 1,
};
}
}
exports.CharacterBonus = CharacterBonus;