add templates
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user