Skip to content

Commit

Permalink
address #404, #406, fix fh crossover errors, fix AM perk remove issue…
Browse files Browse the repository at this point in the history
…, fix/improve settings, adjust merge of

#405
  • Loading branch information
Lurkars committed Sep 28, 2023
1 parent fe4d2a6 commit bb0d3af
Show file tree
Hide file tree
Showing 23 changed files with 334 additions and 89 deletions.
4 changes: 2 additions & 2 deletions data/fh-crossover/character/circles.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@
"effects": [
{
"type": "element",
"value": "air"
"value": "earth"
}
]
}
Expand All @@ -388,7 +388,7 @@
"effects": [
{
"type": "element",
"value": "earth"
"value": "air"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion data/fh-crossover/character/squidface.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
},
{
"type": "custom",
"custom": "<b>Xorn's Boom:</b> Once each scenario, during your turn, cause each enemy that has %game.condition.poison% to duffer %game.damage:1% and gain %game.condition.muddle% and each ally who has %game.condition.poison% to suffer %game.damage:1% to gain %game.condition.strengthen%",
"custom": "<b>Xorn's Boon:</b> Once each scenario, during your turn, cause each enemy that has %game.condition.poison% to duffer %game.damage:1% and gain %game.condition.muddle% and each ally who has %game.condition.poison% to suffer %game.damage:1% to gain %game.condition.strengthen%",
"count": 2,
"combined": true
}
Expand Down
2 changes: 1 addition & 1 deletion data/fh/label-spoiler/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
".": "Feathered Cloak"
},
"fh-70": {
"1": "When you suffer %game.damage% from %game.action,retaliate%, reduce the %game.damage% to 1. If it already 1, reduce it to 0 instead.",
"1": "When you suffer %game.damage% from %game.action.retaliate%, reduce the %game.damage% to 1. If it already 1, reduce it to 0 instead.",
".": "Aesther Robe"
},
"fh-71": {
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.77.8",
"version": "0.77.9",
"license": "AGPL3",
"description": "Gloomhaven Secretariat is a Gloomhaven Companion app.",
"homepage": "https://gloomhaven-secretariat.de",
Expand Down
26 changes: 20 additions & 6 deletions src/app/game/businesslogic/AttackModifierManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ export class AttackModifierManager {
return count;
}

findByAttackModifier(attackModifiers: AttackModifier[], attackModifier: AttackModifier): AttackModifier | undefined {
findByAttackModifier(attackModifiers: AttackModifier[], attackModifier: AttackModifier, ignoreCharacter: boolean = false): AttackModifier | undefined {
return attackModifiers.find((other) => {
let am = Object.assign(new AttackModifier(attackModifier.type, attackModifier.value, attackModifier.valueType), attackModifier);
am.id = "";
Expand All @@ -436,6 +436,9 @@ export class AttackModifierManager {
clone.id = "";
clone.revealed = false;
clone.shuffle = other.shuffle || false;
if (ignoreCharacter && clone.character) {
clone.character = false;
}

return JSON.stringify(am) == JSON.stringify(clone);
});
Expand All @@ -458,12 +461,23 @@ export class AttackModifierManager {
removeCards(attackModifierDeck: AttackModifierDeck, cards: PerkCard[]) {
cards.forEach((card) => {
for (let cardCount = 0; cardCount < card.count; cardCount++) {
const toReplace = this.findByAttackModifier(attackModifierDeck.cards, card.attackModifier);
if (toReplace) {
const replaceIndex = attackModifierDeck.cards.indexOf(toReplace);
let removed: boolean = false;
let toRemove = this.findByAttackModifier(attackModifierDeck.cards, card.attackModifier);
if (toRemove) {
const replaceIndex = attackModifierDeck.cards.indexOf(toRemove);
attackModifierDeck.cards.splice(replaceIndex, 1);
} else {
console.warn("Did not found AM to replace: ", card.attackModifier, attackModifierDeck);
removed = true;
} else if (!card.attackModifier.id && !card.attackModifier.character) {
toRemove = this.findByAttackModifier(attackModifierDeck.cards, card.attackModifier, true);
if (toRemove) {
const replaceIndex = attackModifierDeck.cards.indexOf(toRemove);
attackModifierDeck.cards.splice(replaceIndex, 1);
removed = true;
}
}

if (!removed) {
console.warn("Did not found AM to remove: ", card.attackModifier, attackModifierDeck);
}
}
})
Expand Down
4 changes: 4 additions & 0 deletions src/app/game/businesslogic/StateManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,15 @@ export class StateManager {
settings.disableAnimations = settingsManager.settings.disableAnimations;
settings.disableArtwork = settingsManager.settings.disableArtwork;
settings.disableColumns = settingsManager.settings.disableColumns;
settings.disableDragFigures = settingsManager.settings.disableDragFigures;
settings.disablePinchZoom = settingsManager.settings.disablePinchZoom;
settings.disableWakeLock = settingsManager.settings.disableWakeLock;
settings.dragValues = settingsManager.settings.dragValues;
settings.fhStyle = settingsManager.settings.fhStyle;
settings.fontsize = settingsManager.settings.fontsize;
settings.globalFontsize = settingsManager.settings.globalFontsize;
settings.fullscreen = settingsManager.settings.fullscreen;
settings.hints = settingsManager.settings.hints;
settings.portraitMode = settingsManager.settings.portraitMode;
settings.pressDoubleClick = settingsManager.settings.pressDoubleClick;
settings.serverAutoconnect = settingsManager.settings.serverAutoconnect;
Expand All @@ -339,6 +342,7 @@ export class StateManager {
settings.showOnlyUnfinishedScenarios = settingsManager.settings.showOnlyUnfinishedScenarios;
settings.statAnimations = settingsManager.settings.statAnimations;
settings.theme = settingsManager.settings.theme;
settings.tooltips = settingsManager.settings.tooltips;
settings.zoom = settingsManager.settings.zoom;

settingsManager.setSettings(Object.assign(new Settings(), settings));
Expand Down
1 change: 1 addition & 0 deletions src/app/game/model/CharacterProgress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export class CharacterProgress {
experience: number = 0;
gold: number = 0;
loot: Partial<Record<LootType, number>> = {};
itemNotes: string = "";
items: Identifier[] = [];
equippedItems: AdditionalIdentifier[] = [];
personalQuest: number = 0;
Expand Down
24 changes: 20 additions & 4 deletions src/app/ui/figures/ability/ability.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,25 @@
position: relative;
z-index: 1;

&::before {
content: ' ';
position: absolute;
width: 100%;
height: 100%;
background-image: url('~src/assets/images/monster/abilities/monster-ability-front.png');
background-position: 0em -0.8em;
background-size: 100% auto;
background-repeat: no-repeat;
z-index: 0;
}

&::after {
content: ' ';
position: absolute;
width: 100%;
height: 100%;
background-image: url('~src/assets/images/monster/abilities/monster-ability-front-repeat.png');
background-position: 0em -0.8em;
background-position: 0em -2.8em;
background-size: 100% auto;
background-repeat: repeat-y;
z-index: -1;
Expand Down Expand Up @@ -132,14 +144,14 @@
background-attachment: local;
height: 100%;

&.bottom-actions::after {
&.bottom-actions::before {
background-position: top;
background-image: url('~src/assets/images/monster/abilities/monster-ability-front-bottom.png');
}

&.character-actions {

&::after {
&::before {
background-position: top;
background-color: var(--ghs-ability-color);
background-image: url('~src/assets/images/character/abilities/character-ability-front.png'), url('~src/assets/images/character/abilities/character-ability-front-blend.png');
Expand Down Expand Up @@ -332,11 +344,15 @@

.ability-front {

&::before {
background-image: url('~src/assets/images/fh/monster/abilities/monster-ability-front.png');
}

&::after {
background-image: url('~src/assets/images/fh/monster/abilities/monster-ability-front-repeat.png');
}

&.bottom-actions::after {
&.bottom-actions::before {
background-image: url('~src/assets/images/monster/abilities/monster-ability-front-bottom.png');
}

Expand Down
3 changes: 2 additions & 1 deletion src/app/ui/figures/character/character.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@
<img src="./assets/images/status/experience.svg" />
<span class="value-overlay" [value-sign]="experience" [hideEmpty]="true" [container]="true"></span>
</span>
<span class="loot" *ngIf="!settingsManager.settings.alwaysLootDeck && !gameManager.fhRules()"
<span class="loot"
*ngIf="!settingsManager.settings.lootDeck || !settingsManager.settings.alwaysLootDeck && !gameManager.fhRules()"
[ghs-label]="'game.loot'" [ghs-label-attribute]="'title'" ghs-pointer-input (dragMove)="dragLootMove($event)"
(dragEnd)="dragLootEnd($event)" (dragCancel)="dragCancel($event)" [relative]="true" [screenWidth]="true"
(singleClick)="openEntityMenu($event)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
&.unavailable {
cursor: not-allowed;
border-color: var(--ghs-color-darkgray);
filter: grayscale(0.3);
filter: grayscale(0.7);

}

Expand Down
81 changes: 44 additions & 37 deletions src/app/ui/figures/items/items.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,51 @@
<div class="items">
<label><span [ghs-label]="'game.items'"></span>:</label>
<div class="item-list">
<div class="item-entry" *ngFor="let item of items; let index = index;">
<span class="icon">
<img *ngIf="item.slot" [src]="'./assets/images/items/slots/' + item.slot +'.svg'">
<span *ngIf="!item.slot" class="item placeholder" [ghs-label]="'%game.itemFh.' + item.id + '%'"></span>
</span>
<span class="id">{{item.id}}.</span>
<span class="name"
[ngClass]="{'disabled' : gameManager.game.state != GameState.draw || gameManager.game.round > 0}"
ghs-pointer-input (singleClick)="toggleEquippedItem(item)"
(doubleClick)="toggleEquippedItem(item,true)">
<span>{{item.name}}</span>
<span *ngIf="item.edition != itemEdition">&nbsp;(<span [ghs-label]="'data.edition.' +
<ng-container *ngIf="settingsManager.settings.characterItems">
<div class="item-list">
<div class="item-entry" *ngFor="let item of items; let index = index;">
<span class="icon">
<img *ngIf="item.slot" [src]="'./assets/images/items/slots/' + item.slot +'.svg'">
<span *ngIf="!item.slot" class="item placeholder"
[ghs-label]="'%game.itemFh.' + item.id + '%'"></span>
</span>
<span class="id">{{item.id}}.</span>
<span class="name"
[ngClass]="{'disabled' : gameManager.game.state != GameState.draw || gameManager.game.round > 0}"
ghs-pointer-input (singleClick)="toggleEquippedItem(item)"
(doubleClick)="toggleEquippedItem(item,true)">
<span>{{item.name}}</span>
<span *ngIf="item.edition != itemEdition">&nbsp;(<span [ghs-label]="'data.edition.' +
item.edition"></span>)</span>
</span>
<span class="spacer"></span>
<span class="equipped" *ngIf="isEquipped(item)">
<img src="./assets/images/check.svg">
</span>
<div class="effect hint-container" *ngIf="gameManager.characterManager.itemEffect(item)">
<img src="./assets/images/hint.svg" class="hint-trigger ghs-svg" [ghsTooltip]="'game.items.effect'"
[hint]="true">
</span>
<span class="spacer"></span>
<span class="equipped" *ngIf="isEquipped(item)">
<img src="./assets/images/check.svg">
</span>
<div class="effect hint-container" *ngIf="gameManager.characterManager.itemEffect(item)">
<img src="./assets/images/hint.svg" class="hint-trigger ghs-svg" [ghsTooltip]="'game.items.effect'"
[hint]="true">
</div>
<span class="minus-one" *ngIf="isEquipped(item) && item.minusOne"
[ngClass]="{'ignore' : gameManager.characterManager.ignoreNegativeItemEffects(character)}">
<img src="./assets/images/action/card/minus1.svg">
x{{item.minusOne}}
</span>
<a class="button loot" (click)="sellItem(item)"><img src="./assets/images/loot.svg">
{{gameManager.itemManager.itemSellValue(item)}}
</a>
<a class="button remove" (click)="removeItem(item)"><img src="./assets/images/close.svg"></a>
</div>
<span class="minus-one" *ngIf="isEquipped(item) && item.minusOne"
[ngClass]="{'ignore' : gameManager.characterManager.ignoreNegativeItemEffects(character)}">
<img src="./assets/images/action/card/minus1.svg">
x{{item.minusOne}}
</span>
<a class="button loot" (click)="sellItem(item)"><img src="./assets/images/loot.svg">
{{gameManager.itemManager.itemSellValue(item)}}
</a>
<a class="button remove" (click)="removeItem(item)"><img src="./assets/images/close.svg"></a>
</div>
</div>
<div class="item-form">
<a class="shop" (click)="itemDialog()"><img src="./assets/images/items/item.svg"><span
[ghs-label]="'game.items.character.shop'"></span></a>
<div class="item-form">
<a class="shop" (click)="itemDialog()"><img src="./assets/images/items/item.svg"><span
[ghs-label]="'game.items.character.shop'"></span></a>

<a *ngIf="brewing" (click)="brewDialog()"><img src="./assets/images/fh/brewing.svg"><span
[ghs-label]="'game.items.brewing'"></span></a>
</div>
<a *ngIf="brewing" (click)="brewDialog()"><img src="./assets/images/fh/brewing.svg"><span
[ghs-label]="'game.items.brewing'"></span></a>
</div>
</ng-container>

<textarea *ngIf="!settingsManager.settings.characterItems" [value]="character.progress.itemNotes"
(change)="setItemNotes($event)" [ghs-label]="'game.items'"
[ghs-label-attribute]="'placeholder'"></textarea>
</div>
10 changes: 10 additions & 0 deletions src/app/ui/figures/items/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Subscription } from "rxjs";
import { Dialog } from "@angular/cdk/dialog";
import { ItemsBrewDialog } from "./brew/brew";
import { ItemsDialogComponent } from "./dialog/items-dialog";
import { SettingsManager, settingsManager } from "src/app/game/businesslogic/SettingsManager";


@Component({
Expand All @@ -28,6 +29,7 @@ export class CharacterItemsComponent implements OnInit, OnDestroy {
herbs: LootType[] = [LootType.rockroot, LootType.snowthistle, LootType.axenut, LootType.flamefruit, LootType.corpsecap, LootType.arrowvine];

gameManager: GameManager = gameManager;
settingsManager: SettingsManager = settingsManager;
GameState = GameState;

constructor(private dialog: Dialog) { }
Expand Down Expand Up @@ -307,4 +309,12 @@ export class CharacterItemsComponent implements OnInit, OnDestroy {
gameManager.stateManager.after();
}
}

setItemNotes(event: any) {
if (this.character.progress.itemNotes != event.target.value) {
gameManager.stateManager.before("setItems", "data.character." + this.character.name, event.target.value);
this.character.progress.itemNotes = event.target.value;
gameManager.stateManager.after();
}
}
}
2 changes: 1 addition & 1 deletion src/app/ui/footer/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

<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="lootDeck || settingsManager.settings.alwaysLootDeck || gameManager.fhRules()">
*ngIf="settingsManager.settings.lootDeck && (lootDeck || settingsManager.settings.alwaysLootDeck || gameManager.fhRules())">
<ghs-loot-deck [deck]="gameManager.game.lootDeck" (before)="beforeLootDeck($event)" (after)="afterLootDeck($event)"
[bottom]="true"></ghs-loot-deck>

Expand Down
Loading

0 comments on commit bb0d3af

Please sign in to comment.