Skip to content

Commit

Permalink
disable battel goal reminder for BB, fix round shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
Lurkars committed Jun 4, 2024
1 parent 58764f2 commit 65da4a7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gloomhavensecretariat",
"version": "0.99.0",
"version": "0.99.1",
"license": "AGPL3",
"description": "Gloomhaven Secretariat is a Gloomhaven/Frosthaven Companion app.",
"homepage": "https://gloomhaven-secretariat.de",
Expand Down
2 changes: 1 addition & 1 deletion src/app/ui/footer/footer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export class FooterComponent implements OnInit {
}

battleGoals(): boolean {
return !this.missingInitiative() && settingsManager.settings.battleGoals && settingsManager.settings.battleGoalsReminder && gameManager.game.scenario != undefined && gameManager.roundManager.firstRound && !gameManager.game.figures.every((figure) => !(figure instanceof Character) || figure.battleGoal || figure.absent);
return !this.missingInitiative() && settingsManager.settings.battleGoals && settingsManager.settings.battleGoalsReminder && gameManager.game.scenario != undefined && gameManager.roundManager.firstRound && !gameManager.game.figures.every((figure) => !(figure instanceof Character) || figure.battleGoal || figure.absent) && !gameManager.bbRules();
}

activeHint(): boolean {
Expand Down
21 changes: 19 additions & 2 deletions src/app/ui/footer/hint-dialog/hint-dialog.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Dialog, DialogRef } from "@angular/cdk/dialog";
import { Component } from "@angular/core";
import { Component, HostListener } from "@angular/core";
import { gameManager, GameManager } from "src/app/game/businesslogic/GameManager";
import { settingsManager } from "src/app/game/businesslogic/SettingsManager";
import { Character } from "src/app/game/model/Character";
Expand Down Expand Up @@ -95,7 +95,7 @@ export class HintDialogComponent {
}

battleGoals(): boolean {
return !this.missingInitiative() && settingsManager.settings.battleGoals && settingsManager.settings.battleGoalsReminder && gameManager.game.scenario != undefined && gameManager.roundManager.firstRound && !gameManager.game.figures.every((figure) => !(figure instanceof Character) || figure.battleGoal || figure.absent);
return !this.missingInitiative() && settingsManager.settings.battleGoals && settingsManager.settings.battleGoalsReminder && gameManager.game.scenario != undefined && gameManager.roundManager.firstRound && !gameManager.game.figures.every((figure) => !(figure instanceof Character) || figure.battleGoal || figure.absent) && !gameManager.bbRules();
}

finish(): boolean {
Expand All @@ -106,4 +106,21 @@ export class HintDialogComponent {
return !this.active() && !this.empty() && gameManager.game.figures.some((figure) => figure instanceof Character) && gameManager.game.figures.every((figure) => !(figure instanceof Character) || figure instanceof Character && (!gameManager.entityManager.isAlive(figure) || figure.absent));
}


@HostListener('document:keydown', ['$event'])
onKeyEnter(event: KeyboardEvent) {
if (event.key === 'Enter') {
if (this.active()) {
this.confirm();
} else if (this.finish()) {
this.finishScenario(true);
} else if (this.failed()) {
this.finishScenario(false);
} else if (this.battleGoals()) {
this.confirm();
}
event.preventDefault();
event.stopPropagation();
}
}
}
4 changes: 1 addition & 3 deletions src/app/ui/helper/keyboard-shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ export class KeyboardShortcuts implements OnInit, OnDestroy {
document.body.style.setProperty('--ghs-factor', this.currentZoom + '');
event.preventDefault();
} else if ((!this.dialogOpen || this.allowed.indexOf('round') != -1) && this.footer && !event.ctrlKey && !event.shiftKey && !this.zoomInterval && event.key.toLowerCase() === 'n') {
if (!this.footer.disabled()) {
this.footer.next();
}
this.footer.next();
} else if ((!this.dialogOpen || this.allowed.indexOf('am') != -1) && !event.ctrlKey && !event.shiftKey && !this.zoomInterval && gameManager.game.state == GameState.next && (event.key.toLowerCase() === 'm' || settingsManager.settings.amAdvantage && (event.key.toLowerCase() === 'a' || event.key.toLowerCase() === 'd'))) {
const activeFigure = gameManager.game.figures.find((figure) => figure.active);
let deck: AttackModifierDeck | undefined = undefined;
Expand Down

0 comments on commit 65da4a7

Please sign in to comment.