Skip to content

Commit

Permalink
address #613
Browse files Browse the repository at this point in the history
  • Loading branch information
Lurkars committed Oct 2, 2024
1 parent 358a2ce commit afa1607
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 25 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.100.4",
"version": "0.100.5",
"license": "AGPL3",
"description": "Gloomhaven Secretariat is a Gloomhaven/Frosthaven Companion app.",
"homepage": "https://gloomhaven-secretariat.de",
Expand Down
4 changes: 2 additions & 2 deletions src/app/ui/figures/loot/loot-deck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ export class LootDeckComponent implements OnInit, OnDestroy, OnChanges {
}, !settingsManager.settings.animations ? 0 : (this.vertical ? 1050 : 1850));
}

draw(event: any) {
if (this.compact && this.fullscreen) {
draw(event: any, forceDraw: boolean = false) {
if (this.compact && this.fullscreen && !forceDraw) {
this.openFullscreen(event);
} else if (!this.disabled && this.deck.cards.length > 0) {
if (!this.drawTimeout && this.deck.current < (this.deck.cards.length - (this.queue == 0 ? 0 : 1))) {
Expand Down
8 changes: 4 additions & 4 deletions src/app/ui/footer/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<div class="deck am-deck ally-deck" *ngIf="hasAllyAttackModifierDeck"
[ngClass]="{'collapsed' : !gameManager.game.allyAttackModifierDeck.active || compact && (gameManager.game.lootDeck.active || gameManager.game.challengeDeck.active), 'initial' : gameManager.game.allyAttackModifierDeck.active && gameManager.game.allyAttackModifierDeck.current < 0, 'partial' : gameManager.game.allyAttackModifierDeck.active && gameManager.game.allyAttackModifierDeck.current == 0, 'full' : gameManager.game.allyAttackModifierDeck.active && gameManager.game.allyAttackModifierDeck.current > 0, 'no-monster-deck' : !settingsManager.settings.monsterAttackModifierDeck}">
<ghs-attackmodifier-deck [deck]="gameManager.game.allyAttackModifierDeck" [ally]="true"
<ghs-attackmodifier-deck #allyAttackModifierDeck [deck]="gameManager.game.allyAttackModifierDeck" [ally]="true"
(before)="beforeAllyAttackModifierDeck($event)" (after)="afterAllyAttackModifierDeck($event)" numeration="A"
[bottom]="true"></ghs-attackmodifier-deck>

Expand All @@ -34,7 +34,7 @@

<div #monsterDeck class="deck am-deck monster-deck" *ngIf="settingsManager.settings.monsterAttackModifierDeck"
[ngClass]="{'collapsed' : !gameManager.game.monsterAttackModifierDeck.active || compact && (gameManager.game.lootDeck.active || gameManager.game.challengeDeck.active), 'initial' : gameManager.game.monsterAttackModifierDeck.active && gameManager.game.monsterAttackModifierDeck.current < 0, 'partial' : gameManager.game.monsterAttackModifierDeck.active && (gameManager.game.monsterAttackModifierDeck.current == 0 || gameManager.game.monsterAttackModifierDeck.bb && gameManager.game.monsterAttackModifierDeck.current >= 0 && !gameManager.game.monsterAttackModifierDeck.state), 'full' : gameManager.game.monsterAttackModifierDeck.active && (!gameManager.game.monsterAttackModifierDeck.bb && gameManager.game.monsterAttackModifierDeck.current > 0 || gameManager.game.monsterAttackModifierDeck.bb && gameManager.game.monsterAttackModifierDeck.current >= 0 && gameManager.game.monsterAttackModifierDeck.state)}">
<ghs-attackmodifier-deck [deck]="gameManager.game.monsterAttackModifierDeck"
<ghs-attackmodifier-deck #monsterAttackModifierDeck [deck]="gameManager.game.monsterAttackModifierDeck"
(before)="beforeMonsterAttackModifierDeck($event)" (after)="afterMonsterAttackModifierDeck($event)" numeration="m"
[bottom]="true"></ghs-attackmodifier-deck>

Expand All @@ -46,8 +46,8 @@

<div class="deck loot-deck"
[ngClass]="{'collapsed' : !gameManager.game.lootDeck.active, 'initial' : gameManager.game.lootDeck.active && gameManager.game.lootDeck.current < 0,'partial' : gameManager.game.lootDeck.active && gameManager.game.lootDeck.current == 0, 'full' : gameManager.game.lootDeck.active && gameManager.game.lootDeck.current > 0}"
*ngIf="settingsManager.settings.lootDeck && (lootDeck || settingsManager.settings.alwaysLootDeck || gameManager.fhRules())">
<ghs-loot-deck [deck]="gameManager.game.lootDeck" (before)="beforeLootDeck($event)" (after)="afterLootDeck($event)"
*ngIf="settingsManager.settings.lootDeck && (lootDeckEnabeld || settingsManager.settings.alwaysLootDeck || gameManager.fhRules())">
<ghs-loot-deck #lootDeck [deck]="gameManager.game.lootDeck" (before)="beforeLootDeck($event)" (after)="afterLootDeck($event)"
[bottom]="true"></ghs-loot-deck>

<div class="active-toggle"
Expand Down
15 changes: 9 additions & 6 deletions src/app/ui/footer/footer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import { Character } from 'src/app/game/model/Character';
import { GameState } from 'src/app/game/model/Game';
import { Monster } from 'src/app/game/model/Monster';
import { ObjectiveContainer } from 'src/app/game/model/ObjectiveContainer';
import { AttackModiferDeckChange } from '../figures/attackmodifier/attackmodifierdeck';
import { LootDeckChange } from '../figures/loot/loot-deck';
import { AttackModiferDeckChange, AttackModifierDeckComponent } from '../figures/attackmodifier/attackmodifierdeck';
import { ChallengeDeckChange } from '../figures/challenges/challenge-deck';
import { LootDeckChange, LootDeckComponent } from '../figures/loot/loot-deck';
import { HintDialogComponent } from './hint-dialog/hint-dialog';
import { LevelComponent } from './level/level';
import { ScenarioComponent } from './scenario/scenario';
import { ScenarioConclusionComponent } from './scenario/scenario-conclusion/scenario-conclusion';
import { ScenarioSummaryComponent } from './scenario/summary/scenario-summary';
import { ChallengeDeckChange } from '../figures/challenges/challenge-deck';

@Component({
selector: 'ghs-footer',
Expand All @@ -28,13 +28,16 @@ export class FooterComponent implements OnInit {
@ViewChild('monsterDeck', { static: false }) monsterDeck!: ElementRef;
@ViewChild('ghsLevel', { static: false }) ghsLevel!: LevelComponent;
@ViewChild('ghsScenario', { static: false }) ghsScenario!: ScenarioComponent;
@ViewChild('monsterAttackModifierDeck', { static: false }) monsterAttackModifierDeck!: AttackModifierDeckComponent;
@ViewChild('allyAttackModifierDeck', { static: false }) allyAttackModifierDeck!: AttackModifierDeckComponent;
@ViewChild('lootDeck', { static: false }) lootDeck!: LootDeckComponent;

gameManager: GameManager = gameManager;
settingsManager: SettingsManager = settingsManager;
GameState = GameState;
currentTime: string = "";
hasAllyAttackModifierDeck: boolean = false;
lootDeck: boolean = false;
lootDeckEnabeld: boolean = false;

compact: boolean = false;

Expand All @@ -45,12 +48,12 @@ export class FooterComponent implements OnInit {
ngOnInit(): void {
this.hasAllyAttackModifierDeck = settingsManager.settings.allyAttackModifierDeck && (settingsManager.settings.alwaysAllyAttackModifierDeck || gameManager.fhRules() && gameManager.game.figures.some((figure) => figure instanceof Monster && (figure.isAlly || figure.isAllied) || figure instanceof ObjectiveContainer && figure.objectiveId && gameManager.objectiveManager.objectiveDataByObjectiveIdentifier(figure.objectiveId)?.allyDeck) || gameManager.game.scenario && gameManager.game.scenario.allyDeck) || false;

this.lootDeck = settingsManager.settings.lootDeck && Object.keys(gameManager.game.lootDeck.cards).length > 0;
this.lootDeckEnabeld = settingsManager.settings.lootDeck && Object.keys(gameManager.game.lootDeck.cards).length > 0;

gameManager.uiChange.subscribe({
next: () => {
this.hasAllyAttackModifierDeck = settingsManager.settings.allyAttackModifierDeck && (settingsManager.settings.alwaysAllyAttackModifierDeck || gameManager.fhRules() && gameManager.game.figures.some((figure) => figure instanceof Monster && (figure.isAlly || figure.isAllied) || figure instanceof ObjectiveContainer && figure.objectiveId && gameManager.objectiveManager.objectiveDataByObjectiveIdentifier(figure.objectiveId)?.allyDeck) || gameManager.game.scenario && gameManager.game.scenario.allyDeck) || false;
this.lootDeck = settingsManager.settings.lootDeck && Object.keys(gameManager.game.lootDeck.cards).length > 0;
this.lootDeckEnabeld = settingsManager.settings.lootDeck && Object.keys(gameManager.game.lootDeck.cards).length > 0;
}
})

Expand Down
14 changes: 4 additions & 10 deletions src/app/ui/helper/keyboard-shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,11 @@ export class KeyboardShortcuts implements OnInit, OnDestroy {
gameManager.stateManager.after();
}
event.preventDefault();
} else if ((!this.dialogOpen || this.allowed.indexOf('loot') != -1) && gameManager.game.state == GameState.next && !event.ctrlKey && !event.shiftKey && !this.zoomInterval && event.key.toLowerCase() === 'l' && settingsManager.settings.lootDeck && gameManager.game.lootDeck.cards.length > 0) {
gameManager.stateManager.before('lootDeckDraw');
gameManager.game.lootDeck.active = true;
const activeCharacter = gameManager.game.figures.find((figure) => figure instanceof Character && figure.active);
if (!settingsManager.settings.alwaysLootApplyDialog && activeCharacter instanceof Character) {
gameManager.lootManager.drawCard(gameManager.game.lootDeck, activeCharacter);
} else {
gameManager.lootManager.drawCard(gameManager.game.lootDeck, undefined);
} else if ((!this.dialogOpen || this.allowed.indexOf('loot') != -1) && gameManager.game.state == GameState.next && !event.ctrlKey && !event.shiftKey && !this.zoomInterval && event.key.toLowerCase() === 'l' && settingsManager.settings.lootDeck && gameManager.game.lootDeck.cards.length > 0 && this.footer && this.footer.lootDeck) {
if (!this.footer.lootDeck.deck.active) {
this.footer.toggleLootDeck();
}
gameManager.stateManager.after();

this.footer.lootDeck.draw(event, true);
event.preventDefault();
} else if (!this.dialogOpen && !event.ctrlKey && event.key === 'Tab' && gameManager.game.figures.length > 0) {
if (gameManager.game.state == GameState.next) {
Expand Down

0 comments on commit afa1607

Please sign in to comment.