Skip to content

Commit

Permalink
address #242, fix FH Advantage rules, add house rule for FH Advantage…
Browse files Browse the repository at this point in the history
…, fix forcedLinks on conclusions, improve scenario chart and world map, fix double use of keyboard shortcut
  • Loading branch information
Lurkars committed Mar 18, 2024
1 parent 47db92f commit d3a5efd
Show file tree
Hide file tree
Showing 26 changed files with 421 additions and 165 deletions.
6 changes: 0 additions & 6 deletions data/fh/scenarios/090.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
},
"edition": "fh",
"complexity": 2,
"unlocks": [
"91"
],
"forcedLinks": [
"91"
],
"monsters": [
"frozen-corpse",
"ice-wraith",
Expand Down
2 changes: 1 addition & 1 deletion data/gh/deck/living-corpse.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
{
"type": "move",
"value": 1,
"valueType": "minus"
"valueType": "plus"
},
{
"type": "sufferDamage",
Expand Down
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.92.1",
"version": "0.92.2",
"license": "AGPL3",
"description": "Gloomhaven Secretariat is a Gloomhaven/Frosthaven Companion app.",
"homepage": "https://gloomhaven-secretariat.de",
Expand Down
4 changes: 2 additions & 2 deletions resources/keyboard-shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The following keyboard shortcuts are currently implemented:
- <kbd>1-6</kbd>: toggle through element state
- <kbd>h</kbd>: toggle *Hide absent figures*
- <kbd>s</kbd>: select figure/standee for opening menu with number key (<kbd>0-9</kbd>)
- <kbd>d</kbd>: difficulty/level menu
- <kbd>x</kbd>: difficulty/level menu
- <kbd>e</kbd>: scenario effects menu
- <kbd>f</kbd>: (finish) scenario menu
- <kbd>p</kbd>: open party sheet
Expand All @@ -26,8 +26,8 @@ The following keyboard shortcuts are currently implemented:
- <kbd>?</kbd>: show keyboard shortcuts

On any open figure/standee menu, those shortcuts are disabled, currently shortcuts available in figure/standee:
- <kbd>←</kbd>: dec. current HP
- <kbd>→</kbd>: inc. current HP
- <kbd>←</kbd>: dec. current HP
- <kbd>0</kbd>-<kbd>9</kbd>: toggle condition/condition modifier
- <kbd>b</kbd>: inc. Bless
- <kbd>SHIFT</kbd> + <kbd>B</kbd>: dec. Bless
Expand Down
27 changes: 17 additions & 10 deletions src/app/game/businesslogic/AttackModifierManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,29 @@ export class AttackModifierManager {

if (card.rolling) {
additionalDraw = fhRules;
} else {
if (attackModifierDeck.current == attackModifierDeck.cards.length - 1 || !fhRules) {
return;
while (card.rolling) {
if (attackModifierDeck.current == attackModifierDeck.cards.length - 1) {
return;
}
attackModifierDeck.current = attackModifierDeck.current + 1;
card = attackModifierDeck.cards[attackModifierDeck.current];
gameManager.uiChange.emit();
}
} else {
attackModifierDeck.current = attackModifierDeck.current + 1;
card = attackModifierDeck.cards[attackModifierDeck.current];
gameManager.uiChange.emit();
}

while (card.rolling) {
gameManager.uiChange.emit();
if (attackModifierDeck.current == attackModifierDeck.cards.length - 1) {
return;
if (fhRules && settingsManager.settings.amAdvantageHouseRule && card.rolling) {
while (card.rolling) {
if (attackModifierDeck.current == attackModifierDeck.cards.length - 1) {
return;
}
attackModifierDeck.current = attackModifierDeck.current + 1;
card = attackModifierDeck.cards[attackModifierDeck.current];
gameManager.uiChange.emit();
}
}
attackModifierDeck.current = attackModifierDeck.current + 1;
card = attackModifierDeck.cards[attackModifierDeck.current];
}

if (additionalDraw) {
Expand Down
1 change: 1 addition & 0 deletions src/app/game/model/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class Settings {
alwaysLootApplyDialog = false;
alwaysLootDeck: boolean = false;
amAdvantage: boolean = false;
amAdvantageHouseRule: boolean = false;
animations: boolean = true;
applyBuildingRewards: boolean = true;
applyConditions: boolean = true;
Expand Down
10 changes: 6 additions & 4 deletions src/app/ui/figures/party/treasures/treasures-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<img class="icon" src="./assets/images/scenario/treasure.svg">
<span [ghs-label]="'party.campaign.treasures'"></span>
</div>
<label>
<input type="checkbox" [(ngModel)]="select" (change)="update()">
<label *ngIf="!data.scenario">
<input type="checkbox" [(ngModel)]="batchSelect" (change)="update()">
<span [ghs-label]="'party.campaign.treasures.batchSelect'"></span>
</label>
</div>
Expand Down Expand Up @@ -36,7 +36,9 @@

<div class="buttons">
<a class="cancel" (click)="close()"><span [ghs-label]="'cancel'"></span></a>
<a class="apply" *ngIf="select" [ngClass]="{'disabled' : selected.length == 0}" (click)="apply()"><span
[ghs-label]="'party.campaign.treasures.applySelect'"></span></a>
<a class="loot" *ngIf="data.scenario" [ngClass]="{'disabled' : selected.length == 0}"
(click)="toggleTreasure(selected[0], true)"><span [ghs-label]="'party.campaign.treasures.loot'"></span></a>
<a class="apply" *ngIf="batchSelect || data.scenario" [ngClass]="{'disabled' : selected.length == 0}"
(click)="apply()"><span [ghs-label]="'party.campaign.treasures.applySelect'"></span></a>
</div>
</div>
10 changes: 9 additions & 1 deletion src/app/ui/figures/party/treasures/treasures-dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
margin-top: calc(var(--ghs-unit) * 2 * var(--ghs-dialog-factor));
font-family: var(--ghs-font-title);
font-size: calc(var(--ghs-unit) * 3 * var(--ghs-dialog-factor));
justify-content: space-evenly;
justify-content: space-between;
align-items: center;

a {
Expand All @@ -150,5 +150,13 @@
pointer-events: none;
color: var(--ghs-color-gray);
}

.loot {
color: var(--ghs-color-yellow);

&.disabled {
color: var(--ghs-color-darkgray);
}
}
}
}
20 changes: 14 additions & 6 deletions src/app/ui/figures/party/treasures/treasures-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export class TreasuresDialogComponent implements OnInit, OnDestroy {
treasures: Record<string, number[]> = {};
looted: number[] = [];
selected: number[] = [];
select: boolean = true;
batchSelect: boolean = true;

constructor(@Inject(DIALOG_DATA) data: { edition: string }, private dialogRef: DialogRef, private dialog: Dialog) {
constructor(@Inject(DIALOG_DATA) public data: { edition: string, scenario: ScenarioData | undefined }, private dialogRef: DialogRef, private dialog: Dialog) {
this.edition = data.edition;
this.batchSelect = data.scenario == undefined;
}


Expand All @@ -51,10 +52,10 @@ export class TreasuresDialogComponent implements OnInit, OnDestroy {
this.treasures = {};
this.looted = [];
this.selected = [];
gameManager.scenarioManager.scenarioData(this.edition).filter((scenarioData) => (gameManager.scenarioManager.isSuccess(scenarioData) || gameManager.game.party.casualScenarios.find((value) => scenarioData.index == value.index && scenarioData.edition == value.edition && scenarioData.group == value.group))).forEach((scenarioData) => {
gameManager.scenarioManager.scenarioData(this.edition).filter((scenarioData) => !this.data.scenario && (gameManager.scenarioManager.isSuccess(scenarioData) || gameManager.game.party.casualScenarios.find((value) => scenarioData.index == value.index && scenarioData.edition == value.edition && scenarioData.group == value.group)) || this.data.scenario && scenarioData.edition == this.data.scenario.edition && scenarioData.index == this.data.scenario.index && scenarioData.group == this.data.scenario.group).forEach((scenarioData) => {
let treasures: number[] = gameManager.scenarioManager.getAllTreasures(scenarioData).filter((value) => typeof value === 'number').map((value) => +value);

if (!this.select) {
if (!this.batchSelect) {
treasures = treasures.filter((value) => !this.hasTreasure('' + value, this.edition));
}

Expand All @@ -70,13 +71,20 @@ export class TreasuresDialogComponent implements OnInit, OnDestroy {
})
}

toggleTreasure(index: number) {
if (this.select) {
toggleTreasure(index: number, forceLoot: boolean = false) {
if (this.batchSelect && !forceLoot) {
if (this.selected.indexOf(index) == -1) {
this.selected.push(index);
} else {
this.selected.splice(this.selected.indexOf(index), 1);
}
} else if (this.data.scenario && !forceLoot) {
if (this.selected.indexOf(index) == -1) {
this.selected = [];
this.selected.push(index);
} else {
this.selected.splice(this.selected.indexOf(index), 1);
}
} else if (this.looted.indexOf(index) == -1) {
this.dialog.open(ScenarioTreasuresDialogComponent,
{
Expand Down
3 changes: 3 additions & 0 deletions src/app/ui/figures/party/world-map/world-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export class WorldMapComponent implements AfterViewInit {
crs: L.CRS.Simple,
maxBounds: [[height * -0.5, width * -0.5], [height * 1.5, width * 1.5]],
minZoom: -4,
zoomDelta: 0.25,
zoomSnap: 0.25,
wheelPxPerZoomLevel: 240,
attributionControl: false
});
var bounds: LatLngBoundsLiteral = [[0, 0], [height, width]];
Expand Down
18 changes: 15 additions & 3 deletions src/app/ui/footer/scenario/summary/scenario-summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -714,22 +714,34 @@
[ngClass]="{'denied' : gameManager.stateManager.permissions && (!gameManager.stateManager.permissions.round || !gameManager.stateManager.permissions.scenario || !gameManager.stateManager.permissions.characters)}">
<a class="cancel" (click)="close()"><span [ghs-label]="'scenario.summary.cancel'"></span></a>
<span class="links"
*ngIf="success && (gameManager.game.party.campaignMode || forceCampaign) && (scenario.links && scenario.links.length > 0 || scenario.forcedLinks && scenario.forcedLinks.length > 0)">
*ngIf="success && (gameManager.game.party.campaignMode || forceCampaign) && (scenario.links && scenario.links.length > 0 || scenario.forcedLinks && scenario.forcedLinks.length > 0 || conclusion && conclusion.forcedLinks && conclusion.forcedLinks.length > 0)">
<ng-container *ngIf="scenario.forcedLinks && scenario.forcedLinks.length > 0">
<span class="text"><span [ghs-label]="'scenario.summary.forcedLinks'"></span></span>
<a class="apply forced-link" (click)="finish(index)" *ngFor="let index of scenario.forcedLinks">
<span [ghs-label]="'scenario.summary.link'" [ghs-label-args]="[index]"></span>
</a>
</ng-container>
<ng-container *ngIf="(!scenario.forcedLinks || scenario.forcedLinks.length == 0)">
<ng-container *ngIf="conclusion && conclusion.forcedLinks && conclusion.forcedLinks.length > 0">
<span class="text"><span [ghs-label]="'scenario.summary.forcedLinks'"></span></span>
<a class="apply forced-link" (click)="finish(index)" *ngFor="let index of conclusion.forcedLinks">
<span [ghs-label]="'scenario.summary.link'" [ghs-label-args]="[index]"></span>
</a>
</ng-container>
<ng-container
*ngIf="(!scenario.forcedLinks || scenario.forcedLinks.length == 0) && (!conclusion || !conclusion.forcedLinks || conclusion.forcedLinks.length == 0)">
<span class="text"><span [ghs-label]="'scenario.summary.links'"></span></span>
<a class="link" (click)="finish(index)" *ngFor="let index of scenario.links">
<span [ghs-label]="'scenario.summary.link'" [ghs-label-args]="[index]"></span>
</a>
<ng-container *ngIf="conclusion && conclusion.links">
<a class="link" (click)="finish(index)" *ngFor="let index of conclusion.links">
<span [ghs-label]="'scenario.summary.link'" [ghs-label-args]="[index]"></span>
</a>
</ng-container>
</ng-container>
</span>
<a class="apply"
*ngIf="!success || !gameManager.game.party.campaignMode || alreadyWarning || forceCampaign || !scenario.forcedLinks || scenario.forcedLinks.length == 0"
*ngIf="!success || !gameManager.game.party.campaignMode || alreadyWarning || forceCampaign || ((!scenario.forcedLinks || scenario.forcedLinks.length == 0) && (!conclusion || !conclusion.forcedLinks || conclusion.forcedLinks.length == 0))"
(click)="finish()"><span
[ghs-label]="conclusionOnly ? 'scenario.summary.solve' : 'scenario.summary.apply'"></span></a>
<a class="restart" *ngIf="!success" (click)="restart()"><span [ghs-label]="(lootColumns.length > 0 ?
Expand Down
2 changes: 1 addition & 1 deletion src/app/ui/footer/scenario/summary/scenario-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export class ScenarioSummaryComponent implements OnDestroy {
}

addWeek(): boolean {
return gameManager.fhRules() && ((gameManager.game.party.campaignMode || this.forceCampaign) && this.success && !this.conclusionOnly && !this.scenario.solo) && !this.scenario.conclusion && !this.scenario.forcedLinks && settingsManager.settings.automaticPassTime && settingsManager.settings.partySheet;
return gameManager.fhRules() && ((gameManager.game.party.campaignMode || this.forceCampaign) && this.success && !this.conclusionOnly && !this.scenario.solo) && !this.scenario.conclusion && (!this.scenario.forcedLinks || !this.scenario.forcedLinks.length) && (!this.conclusion || !this.conclusion.forcedLinks || !this.conclusion.forcedLinks.length) && settingsManager.settings.automaticPassTime && settingsManager.settings.partySheet;
}

weekSections(): ScenarioData[] {
Expand Down
3 changes: 2 additions & 1 deletion src/app/ui/header/menu/campaign/campaign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class CampaignMenuComponent implements OnInit {
this.conditions = Object.values(ConditionName).map((name) => new Condition(name)).filter((condition) => condition.types.indexOf(ConditionType.hidden) == -1);
this.amConditions = Object.values(ConditionName).map((name) => new Condition(name)).filter((condition) => condition.types.indexOf(ConditionType.amDeck) != -1);
this.editionConditions = gameManager.conditions(gameManager.game.edition, true).map((condition) => condition.name);
this.worldMap = false;
const editionData = gameManager.editionData.find((editionData) => editionData.edition == gameManager.game.edition);
if (editionData) {
if (editionData.worldMap) {
Expand All @@ -74,7 +75,7 @@ export class CampaignMenuComponent implements OnInit {
}
gameManager.game.edition = edition;
gameManager.game.party.edition = edition;
this.editionConditions = gameManager.conditions(gameManager.game.edition, true).map((condition) => condition.name);
this.update();
gameManager.stateManager.after();
}

Expand Down
Loading

0 comments on commit d3a5efd

Please sign in to comment.