Skip to content

Commit

Permalink
address #456, #467, #468, #469, #470
Browse files Browse the repository at this point in the history
  • Loading branch information
Lurkars committed Dec 13, 2023
1 parent d04fa75 commit f2b5473
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 40 deletions.
4 changes: 2 additions & 2 deletions data/fh/scenarios/093B.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"edition": "fh",
"complexity": 2,
"rewards": {
"items": [
"235"
"itemBlueprints": [
"79"
]
},
"monsters": [
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.83.6",
"version": "0.83.7",
"license": "AGPL3",
"description": "Gloomhaven Secretariat is a Gloomhaven Companion app.",
"homepage": "https://gloomhaven-secretariat.de",
Expand Down
3 changes: 3 additions & 0 deletions src/app/ui/figures/actions/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ export class ActionComponent implements OnInit, OnDestroy {
if (this.action.valueType == ActionValueType.plus) {
return statValue + EntityValueFunction(this.action.value);
} else if (this.action.valueType == ActionValueType.minus) {
if (!statValue) {
return "-";
}
return statValue - EntityValueFunction(this.action.value);
}
}
Expand Down
42 changes: 33 additions & 9 deletions src/app/ui/footer/scenario/summary/scenario-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,18 +534,42 @@ export class ScenarioSummaryComponent {
}

changeCollectiveGold(event: any, index: number) {
gameManager.stateManager.before("finishScenario.dialog.collectiveGold", '' + index, event.target.value);
this.collectiveGold[index] = +event.target.value;
this.updateFinish();
gameManager.stateManager.after();
let value = +event.target.value;
const old = this.collectiveGold[index] || 0;
this.collectiveGold[index] = 0;
if (value < 0) {
value = 0;
} else if (value > this.availableCollectiveGold()) {
value = this.availableCollectiveGold();
}
this.collectiveGold[index] = old;
if (value != (this.collectiveGold[index] || 0)) {
gameManager.stateManager.before("finishScenario.dialog.collectiveGold", '' + index, event.target.value);
this.collectiveGold[index] = +event.target.value;
this.updateFinish();
gameManager.stateManager.after();
}
event.target.value = value;
}

changeCollectiveResource(event: any, index: number, type: LootType) {
gameManager.stateManager.before("finishScenario.dialog.collectiveResource", type, '' + index, event.target.value);
this.collectiveResources[index] = this.collectiveResources[index] || {};
this.collectiveResources[index][type] = +event.target.value;
this.updateFinish();
gameManager.stateManager.after();
let value = +event.target.value;
const old = this.collectiveResources[index][type] || 0;
this.collectiveResources[index][type] = 0;
if (value < 0) {
value = 0;
} else if (value > this.availableCollectiveResource(type)) {
value = this.availableCollectiveResource(type);
}
this.collectiveResources[index][type] = old;
if (value != (this.collectiveResources[index][type] || 0)) {
gameManager.stateManager.before("finishScenario.dialog.collectiveResource", type, '' + index, event.target.value);
this.collectiveResources[index] = this.collectiveResources[index] || {};
this.collectiveResources[index][type] = value;
this.updateFinish();
gameManager.stateManager.after();
}
event.target.value = value;
}

changeCalendarSectionManual(event: any, index: number) {
Expand Down
9 changes: 7 additions & 2 deletions src/app/ui/header/element/element.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ ghs-element {
}
}

&.new #outline {
display: none;
&.new #outline path {
fill: var(--ghs-color-gray) !important;
}

}

&:hover .element-svg {
Expand All @@ -78,6 +79,10 @@ ghs-element {
#bg {
opacity: 1 !important;
}

&.new #outline path {
fill: var(--ghs-color-white) !important;
}
}

&.consume {
Expand Down
18 changes: 10 additions & 8 deletions src/app/ui/header/menu/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -659,14 +659,15 @@
<div class="condition-list">
<div class="hint-container" *ngFor="let condition of applyConditionsExcludes; let i = index;">
<div class="condition"
[ngClass]="{'immunity': settingsManager.settings.applyConditionsExcludes.indexOf(condition) != -1}"
(click)="toggleApplyConditionsExclude(condition)">
[ngClass]="{'immunity': settingsManager.settings.applyConditionsExcludes.indexOf(condition.name) != -1}"
(click)="toggleApplyConditionsExclude(condition.name)">
<img
[src]="'./assets/images' + (settingsManager.settings.fhStyle ? '/fh' : '') + '/condition/' + condition + '.svg'" />
[src]="'./assets/images' + (settingsManager.settings.fhStyle ? '/fh' : '') + '/condition/' + condition.name + '.svg'" />
<span *ngIf="condition.types.indexOf(ConditionType.value) != -1" class="value">X</span>
</div>
<img src="./assets/images/hint.svg" class="hint-trigger ghs-svg">
<span class="hint" [ngClass]="{'right': i > 2}">
<span class="text" [ghs-label]="'settings.applyConditions.hint.' + condition "></span>
<span class="text" [ghs-label]="'settings.applyConditions.hint.' + condition.name "></span>
</span>
</div>
</div>
Expand Down Expand Up @@ -710,14 +711,15 @@
<div class="condition-list">
<div class="hint-container" *ngFor="let condition of activeApplyConditionsExcludes; let i = index">
<div class="condition"
[ngClass]="{'immunity': settingsManager.settings.activeApplyConditionsExcludes.indexOf(condition) != -1}"
(click)="toggleActiveApplyConditionsExclude(condition)">
[ngClass]="{'immunity': settingsManager.settings.activeApplyConditionsExcludes.indexOf(condition.name) != -1}"
(click)="toggleActiveApplyConditionsExclude(condition.name)">
<img
[src]="'./assets/images' + (settingsManager.settings.fhStyle ? '/fh' : '') + '/condition/' + condition + '.svg'" />
[src]="'./assets/images' + (settingsManager.settings.fhStyle ? '/fh' : '') + '/condition/' + condition.name + '.svg'" />
<span *ngIf="condition.types.indexOf(ConditionType.value) != -1" class="value">X</span>
</div>
<img src="./assets/images/hint.svg" class="hint-trigger ghs-svg">
<span class="hint" [ngClass]="{'right': i > 2}">
<span class="text" [ghs-label]="'settings.activeApplyConditions.hint.' + condition"></span>
<span class="text" [ghs-label]="'settings.activeApplyConditions.hint.' + condition.name"></span>
</span>
</div>
</div>
Expand Down
12 changes: 12 additions & 0 deletions src/app/ui/header/menu/settings/settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
cursor: pointer;
width: calc(var(--ghs-unit) * 3.5 * var(--ghs-dialog-factor));
height: calc(var(--ghs-unit) * 3.5 * var(--ghs-dialog-factor));
position: relative;
display: flex;

&.immunity {
opacity: 0.7;
Expand All @@ -41,6 +43,16 @@
width: 100%;
height: auto;
}

.value {
font-family: var(--ghs-font-title);
font-size: calc(var(--ghs-unit) * 1.3 * var(--ghs-dialog-factor));
color: var(--ghs-color-white);
position: absolute;
bottom: 0;
left: calc(var(--ghs-unit) * 1.8 * var(--ghs-dialog-factor));
transform: translateX(-50%);
}
}

.hint-trigger {
Expand Down
15 changes: 9 additions & 6 deletions src/app/ui/header/menu/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ export class SettingsMenuComponent {
GameState = GameState;
SubMenu = SubMenu;
wakeLock: boolean;
applyConditionsExcludes: ConditionName[] = [];
activeApplyConditionsExcludes: ConditionName[] = [];
applyConditionsExcludes: Condition[] = [];
activeApplyConditionsExcludes: Condition[] = [];
WebSocket = WebSocket;
ConditionType = ConditionType;

constructor(public platform: Platform) {
this.wakeLock = 'wakeLock' in navigator;

Object.keys(ConditionName).forEach((conditionName) => {
const condition = new Condition(conditionName);
if (condition.types.indexOf(ConditionType.turn) != -1 || condition.types.indexOf(ConditionType.afterTurn) != -1) {
this.applyConditionsExcludes.push(condition.name);
} if (condition.types.indexOf(ConditionType.apply) != -1) {
this.activeApplyConditionsExcludes.push(condition.name);
if (!gameManager.game.edition || gameManager.conditions(gameManager.game.edition).map((condition) => condition.name).indexOf(condition.name) != -1 || condition.types.indexOf(ConditionType.hidden) != -1) {
if (condition.types.indexOf(ConditionType.turn) != -1 || condition.types.indexOf(ConditionType.afterTurn) != -1) {
this.applyConditionsExcludes.push(condition);
} if (condition.types.indexOf(ConditionType.apply) != -1) {
this.activeApplyConditionsExcludes.push(condition);
}
}
})
}
Expand Down
11 changes: 5 additions & 6 deletions src/app/ui/helper/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ export const applyPlaceholder = function (value: string, placeholder: string[] =
let replace: string = match;
let image: string = '';
if (type == "condition") {
image = '<img src="./assets/images/' + (fh ? 'fh/' : '') + 'condition/' + split[2] + '.svg" class="icon">';
image = '<span class="condition-icon">';
image += '<img src="./assets/images/' + (fh ? 'fh/' : '') + 'condition/' + split[2] + '.svg" class="icon">';
if (value) {
image += '<span class="value">' + value + '</span>';
}
replace = '<span class="placeholder-condition">' + (fh ? '&nbsp;' : settingsManager.getLabel('game.condition.' + split[2])) + image + '</span>';
image += '</span>';
replace = '<span class="placeholder-condition">' + (fh ? '&nbsp;' : settingsManager.getLabel('game.condition.' + split[2], [value ? value : ''])) + image + '</span>';
} else if (type == "immunity") {
image = '<span class="condition-icon immunity"><img src="./assets/images/' + (fh ? 'fh/' : '') + 'condition/' + split[2] + '.svg" class="icon"></span>';
if (value) {
image += '<span class="value">' + value + '</span>';
}
image = '<span class="condition-icon immunity"><img src="./assets/images/' + (fh ? 'fh/' : '') + 'condition/' + split[2] + '.svg" class="icon">' + (value ? '<span class="value">' + value + '</span>' : '') + '</span>';
replace = '<span class="placeholder-condition">' + (fh ? '&nbsp;' : settingsManager.getLabel('game.condition.' + split[2])) + image + '</span>';
} else if (type == "action" && split.length == 3 && !split[2].startsWith('specialTarget') && !split[2].startsWith('summon') && !split[2].startsWith('area')) {
split.splice(0, 1);
Expand Down
4 changes: 2 additions & 2 deletions src/assets/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@
"brittle": "Nachfragen ob nach erhaltenden Schaden %game.condition.brittle% angewendet werden soll um den Schaden zu erhöhen.",
"heal": "Kein Zustand, aber eine Hilfe ob %game.action.heal% angwendet werden soll wenn die Trefferpunkte erhöht werden.",
"poison": "Nachfragen ob nach erhaltenden Schaden %game.action.attack% +1 von %game.condition.poison% angewendet werden soll (inklusive %game.attackmodifier.double%).",
"poison_x": "Nachfragen ob nach erhaltenden Schaden %game.action.attack% +1 von %game.condition.poison_x% angewendet werden soll (inklusive %game.attackmodifier.double%).",
"poison_x": "Nachfragen ob nach erhaltenden Schaden %game.action.attack% +X von %game.condition.poison_x:X% angewendet werden soll (inklusive %game.attackmodifier.double%).",
"shield": "Kein Zustand, aber eine Hilfe ob nach erhaltenden Schaden %game.action.shield% angwendet werden soll.",
"ward": "Nachfragen ob nach erhaltenden Schaden %game.condition.ward% angewendet werden soll um den erhaltenden Schaden zu reduzieren."
}
Expand Down Expand Up @@ -1468,7 +1468,7 @@
"bane": "Am Ende des Zuges automatisch %game.condition.bane% Schaden hinzufügen.",
"regenerate": "Am Anfang des Zuges automatisch %game.condition.regenerate% anwenden.",
"wound": "Am Anfang des Zuges automatisch %game.condition.wound% Schaden hinzufügen.",
"wound_x": "Am Anfang des Zuges automatisch %game.condition.wound_x% Schaden hinzufügen."
"wound_x": "Am Anfang des Zuges automatisch %game.condition.wound_x:X% Schaden hinzufügen."
}
},
"applyLongRest": {
Expand Down
4 changes: 2 additions & 2 deletions src/assets/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@
"brittle": "On suffering damage, ask to apply %game.condition.brittle% and increase damage.",
"heal": "No condition, but helper if %game.action.heal% should be applied when increasing hitpoints.",
"poison": "On suffering damage, ask to apply %game.action.attack% +1 from %game.condition.poison% (including %game.attackmodifier.double%).",
"poison_x": "On suffering damage, ask to apply %game.action.attack% +1 from %game.condition.poison_x% (including %game.attackmodifier.double%).",
"poison_x": "On suffering damage, ask to apply %game.action.attack% +X from %game.condition.poison_x:X% (including %game.attackmodifier.double%).",
"shield": "No condition, but helper if %game.action.shield% should be applied when taking damage.",
"ward": "On suffering damage, ask to apply %game.condition.ward% and lowering damage."
}
Expand Down Expand Up @@ -1617,7 +1617,7 @@
"bane": "Automatic apply %game.condition.bane% damage at end of turn.",
"regenerate": "Automatic apply %game.condition.regenerate% at start of turn.",
"wound": "Automatic apply %game.condition.wound% damage at end of turn.",
"wound_x": "Automatic apply %game.condition.wound_x% damage at end of turn."
"wound_x": "Automatic apply %game.condition.wound_x:X% damage at end of turn."
}
},
"applyLongRest": {
Expand Down
10 changes: 10 additions & 0 deletions src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,16 @@ input[type="radio"] {
.icon {
margin: 0;
}

.value {
font-family: var(--ghs-font-title);
font-size: 0.6em;
color: var(--ghs-color-white);
position: absolute;
bottom: -0.2em;
left: 1.1em;
transform: translateX(-50%);
}
}
}

Expand Down

0 comments on commit f2b5473

Please sign in to comment.