"use strict";
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;
