23 lines
785 B
JavaScript
23 lines
785 B
JavaScript
import { BaseGameValidator } from "../../../../shared/BaseGameValidator";
|
|
|
|
export class ExemploValidator extends BaseGameValidator {
|
|
validatePhase(history, config, gameConfig, sceneRef) {
|
|
// Lê a posição lógica final do jogador diretamente da cena (fonte de verdade)
|
|
const { jogadorLogico } = sceneRef;
|
|
const alvo = config?.alvo;
|
|
|
|
if (jogadorLogico.col === alvo.col && jogadorLogico.row === alvo.row) {
|
|
return this.success();
|
|
}
|
|
|
|
return this.failure(
|
|
gameConfig?.mensagens?.naoAlcancou || "O personagem não chegou ao alvo. Tente de novo!"
|
|
);
|
|
}
|
|
}
|
|
|
|
export function validationSolution(history, config, gameConfig, sceneRef) {
|
|
const validator = new ExemploValidator();
|
|
return validator.validate(history, config, gameConfig, sceneRef);
|
|
}
|