Skip to content

Commit

Permalink
hotfix trial selection #595
Browse files Browse the repository at this point in the history
  • Loading branch information
Lurkars committed Oct 29, 2024
1 parent 922553e commit 9f08862
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app/ui/figures/character/sheet/character-sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,15 +523,14 @@ export class CharacterSheetComponent implements OnInit, AfterViewInit {
if (settingsManager.settings.fhSecondEdition) {
trial = gameManager.trialsManager.cardIdSecondPrinting(trial);
}
if (!this.character.progress.trial || this.character.progress.trial.name != event.target.value) {

if (!this.character.progress.trial || this.character.progress.trial.name != '' + trial) {
const editionData = gameManager.editionData.find((editionData) => editionData.edition == gameManager.currentEdition() && editionData.trials && editionData.trials.length);
if (editionData) {
const trialCard = editionData.trials.find((trialCard) => trialCard.cardId == trial && trialCard.edition == gameManager.currentEdition());
if (trialCard) {
event.target.classList.remove('error');
event.target.classList.add('warning');
if (!gameManager.game.figures.find((figure) => figure instanceof Character && figure.progress.trial && figure.progress.trial.edition == gameManager.currentEdition() && figure.progress.trial.name == event.target.value)) {
if (!gameManager.game.figures.find((figure) => figure instanceof Character && figure.progress.trial && figure.progress.trial.edition == gameManager.currentEdition() && figure.progress.trial.name == '' + trial)) {
gameManager.stateManager.before("setTrial", gameManager.characterManager.characterName(this.character), event.target.value);
this.character.progress.trial = new Identifier('' + trial, gameManager.currentEdition());
const currentTrialIndex = Math.max(...gameManager.game.figures.filter((figure) => figure instanceof Character).map((character) =>
Expand All @@ -542,7 +541,8 @@ export class CharacterSheetComponent implements OnInit, AfterViewInit {
event.target.classList.remove('warning');
gameManager.stateManager.after();
} else if (this.character.progress.trial) {
event.target.value = this.character.progress.trial.name;
trial = settingsManager.settings.fhSecondEdition ? gameManager.trialsManager.cardIdSecondPrinting(+this.character.progress.trial.name) : +this.character.progress.trial.name;
event.target.value = trial;
}
}
}
Expand Down

0 comments on commit 9f08862

Please sign in to comment.