Skip to content

Commit

Permalink
fix crossover character marker, improve marker, fix missing escort ma…
Browse files Browse the repository at this point in the history
…rker, improve retaliate standee icon, other fixes and improvements
  • Loading branch information
Lurkars committed May 7, 2024
1 parent 0af1721 commit 564c0a2
Show file tree
Hide file tree
Showing 24 changed files with 704 additions and 78 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.95.18",
"version": "0.95.19",
"license": "AGPL3",
"description": "Gloomhaven Secretariat is a Gloomhaven/Frosthaven Companion app.",
"homepage": "https://gloomhaven-secretariat.de",
Expand Down
12 changes: 12 additions & 0 deletions src/app/game/businesslogic/GameManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,18 @@ export class GameManager {
let characterData = this.charactersData().find((value) => value.name == name && (!edition || value.edition == edition));
if (!characterData) {
characterData = this.charactersData().find((value) => value.name == name);

if (!characterData && !edition) {
edition = name.split('-')[0];
name = name.split('-').slice(1).join('-');
characterData = this.charactersData().find((value) => value.name == name && value.edition == edition);
while (name && !characterData) {
edition = edition + '-' + name.split('-')[0];
name = name.split('-').slice(1).join('-');
characterData = this.charactersData().find((value) => value.name == name && value.edition == edition);
}
}

if (!characterData) {
characterData = new CharacterData();
characterData.name = name;
Expand Down
9 changes: 5 additions & 4 deletions src/app/ui/figures/character/character.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@

<span class="action" *ngIf="character.shieldPersistent" ghs-pointer-input
(singleClick)="openEntityMenu($event)" (doubleClick)="removeShieldPersistent()">
<span class="shield-overlay">
<span class="action-overlay">
<span class="text-white" [ghs-label]="'%game.card.persistent%'"></span>
</span>
<ghs-action [action]="character.shieldPersistent" [style]="'fh'"></ghs-action>
</span>
<span class="action" *ngFor="let retaliatePersistent of character.retaliatePersistent; let i = index;"
ghs-pointer-input (singleClick)="openEntityMenu($event)" (doubleClick)="removeRetaliatePersistent(i)">
<span class="shield-overlay">
<span class="action-overlay">
<span class="text-white" [ghs-label]="'%game.card.persistent%'"></span>
</span>
<ghs-action [action]="retaliatePersistent" [style]="'fh'"></ghs-action>
Expand Down Expand Up @@ -141,8 +141,9 @@
[reverse]="settingsManager.settings.damageHP" [container]="true"></span>
</div>
<div class="markers">
<span class="marker" *ngFor="let marker of character.markers;">
<img [src]="'./assets/images/character/icons/' + marker + '.svg'" />
<span class="marker" *ngFor="let marker of character.markers;" ghs-pointer-input
(doubleClick)="removeMarker(marker)">
<img [src]="gameManager.characterManager.characterIcon(marker)" />
</span>
</div>

Expand Down
7 changes: 7 additions & 0 deletions src/app/ui/figures/character/character.scss
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@
border-radius: calc(var(--ghs-unit) * 1);
}
}

.action-overlay {
position: absolute;
z-index: 1;
top: calc(var(--ghs-unit) * 1);
left: calc(var(--ghs-unit) * -0.5);
}
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/app/ui/figures/character/character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,15 @@ export class CharacterComponent implements OnInit, OnDestroy {
gameManager.stateManager.after();
}

removeMarker(marker: string) {
const markerChar = new Character(gameManager.getCharacterData(marker), 1);
const markerName = gameManager.characterManager.characterName(markerChar);
const characterIcon = markerChar.name;
gameManager.stateManager.before(...gameManager.entityManager.undoInfos(this.character, this.character, "removeMarker"), markerName, characterIcon);
this.character.markers = this.character.markers.filter((value) => value != marker);
gameManager.stateManager.after();
}

openBattleGoals(): void {
this.dialog.open(CharacterBattleGoalsDialog, {
panelClass: ['dialog'],
Expand Down
5 changes: 3 additions & 2 deletions src/app/ui/figures/character/summon/summon.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
</div>

<div class="markers">
<span class="marker" *ngFor="let marker of summon.markers;">
<img [src]="'./assets/images/character/icons/' + marker + '.svg'" />
<span class="marker" *ngFor="let marker of summon.markers;" ghs-pointer-input
(doubleClick)="removeMarker(marker)">
<img [src]="gameManager.characterManager.characterIcon(marker)" />
</span>
<span class="marker special-tag" *ngFor="let token of specialActionsMarker;">
<span class="token" [ghs-label]="'%data.characterToken.' + character.name + '.' + token + '%'"></span>
Expand Down
9 changes: 9 additions & 0 deletions src/app/ui/figures/character/summon/summon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,13 @@ export class SummonEntityComponent implements OnInit, OnDestroy {
gameManager.entityManager.removeCondition(this.summon, entityCondition, entityCondition.permanent);
gameManager.stateManager.after();
}

removeMarker(marker: string) {
const markerChar = new Character(gameManager.getCharacterData(marker), 1);
const markerName = gameManager.characterManager.characterName(markerChar);
const characterIcon = markerChar.name;
gameManager.stateManager.before(...gameManager.entityManager.undoInfos(this.summon, this.character, "removeMarker"), markerName, characterIcon);
this.summon.markers = this.summon.markers.filter((value) => value != marker);
gameManager.stateManager.after();
}
}
2 changes: 1 addition & 1 deletion src/app/ui/figures/entity-menu/entity-menu-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@
<span *ngFor="let marker of markers()">
<a class="item" [ngClass]="{'active' : hasMarker(marker)}" (click)="toggleMarker(marker)">
<span class="condition marker">
<img [src]="'./assets/images/character/icons/' + marker + '.svg'" />
<img [src]="gameManager.characterManager.characterIcon(marker)" />
</span>
</a>
</span>
Expand Down
18 changes: 6 additions & 12 deletions src/app/ui/figures/entity-menu/entity-menu-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,16 +558,10 @@ export class EntityMenuDialogComponent {

toggleMarker(marker: string) {
if (this.data.entity) {
if (this.data.entity instanceof MonsterEntity) {
gameManager.stateManager.before(this.hasMarker(marker) ? "removeEntityMarker" : "addEntityMarker", "data.monster." + this.data.figure.name, "" + this.data.entity.number, "data.character." + marker.split('-')[1]);
} else if (this.data.entity instanceof Character) {
gameManager.stateManager.before(this.hasMarker(marker) ? "removeMarker" : "addMarker", gameManager.characterManager.characterName(this.data.entity), "data.character." + marker.split('-')[1]);
} else if (this.data.entity instanceof Summon) {
gameManager.stateManager.before(this.hasMarker(marker) ? "removeSummonMarker" : "addSummonMarker", gameManager.characterManager.characterName(this.data.figure as Character), "data.summon." + this.data.entity.name, "data.character." + marker.split('-')[1]);
} else if (this.data.figure instanceof ObjectiveContainer && this.data.entity instanceof ObjectiveEntity) {
gameManager.stateManager.before(this.hasMarker(marker) ? "removeObjectiveEntityMarker" : "addObjectiveEntityMarker", this.data.figure.title || this.data.figure.name, "" + this.data.entity.number, "data.character." + marker.split('-')[1]);
}

const markerChar = new Character(gameManager.getCharacterData(marker), 1);
const markerName = gameManager.characterManager.characterName(markerChar);
const characterIcon = markerChar.name;
gameManager.stateManager.before(...gameManager.entityManager.undoInfos(this.data.entity, this.data.figure, this.hasMarker(marker) ? "removeMarker" : "addMarker"), markerName, characterIcon);
gameManager.entityManager.toggleMarker(this.data.entity, marker);
gameManager.stateManager.after();
}
Expand Down Expand Up @@ -1167,7 +1161,7 @@ export class EntityMenuDialogComponent {
const specialTagsToTemove = this.data.entity.tags.filter((specialTag) => this.data.figure instanceof Character && this.data.figure.specialActions && this.data.figure.specialActions.find((specialAction) => specialAction.name == specialTag) != undefined && this.specialTags.indexOf(specialTag) == -1);

if (specialTagsToTemove.length) {
gameManager.stateManager.before("removeSpecialTagsSummon", gameManager.characterManager.characterName(this.data.figure), specialTagsToTemove.map((specialTag) => '%data.character.' + this.data.figure.name + '.' + specialTag + '%').join(','));
gameManager.stateManager.before("removeSpecialTagsSummon", gameManager.characterManager.characterName(this.data.figure), specialTagsToTemove.map((specialTag) => '%data.character.' + this.data.figure.name + '.' + specialTag + '%').join(','), this.data.entity.title ? this.data.entity.title : "data.summon." + this.data.entity.name);

if (specialTagsToTemove.indexOf('bone-dagger') != -1) {
this.data.entity.attack = EntityValueFunction(this.data.entity.attack) - 1;
Expand All @@ -1180,7 +1174,7 @@ export class EntityMenuDialogComponent {
const specialTagsToAdd = this.specialTags.filter((specialTag) => this.data.entity && this.data.entity.tags.indexOf(specialTag) == -1);

if (specialTagsToAdd.length) {
gameManager.stateManager.before("addSpecialTagsSummon", gameManager.characterManager.characterName(this.data.figure), specialTagsToAdd.map((specialTag) => '%data.character.' + this.data.figure.name + '.' + specialTag + '%').join(','));
gameManager.stateManager.before("addSpecialTagsSummon", gameManager.characterManager.characterName(this.data.figure), specialTagsToAdd.map((specialTag) => '%data.character.' + this.data.figure.name + '.' + specialTag + '%').join(','), this.data.entity.title ? this.data.entity.title : "data.summon." + this.data.entity.name);

if (specialTagsToAdd.indexOf('bone-dagger') != -1) {
this.data.entity.attack = EntityValueFunction(this.data.entity.attack) + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
</ng-container>
<span *ngIf="entity.maxHealth == 0">-</span>
</div>
<div class="markers">
<span class="marker" *ngFor="let marker of entity.markers;" ghs-pointer-input
(doubleClick)="removeMarker(marker)">
<img [src]="gameManager.characterManager.characterIcon(marker)" />
</span>
</div>
<div class="conditions">
<span class="condition" *ngFor="let entityCondition of activeConditions; let index = index;">
<img
Expand Down
27 changes: 27 additions & 0 deletions src/app/ui/figures/objective-container/objective-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,33 @@
}
}

.markers {
position: relative;
display: flex;
justify-content: center;
max-height: calc(var(--ghs-unit) * 7 * var(--ghs-text-factor));
padding: 0 calc(var(--ghs-unit) * 0.5 * var(--ghs-text-factor));

.marker {
display: flex;
align-items: center;
justify-content: center;
width: calc(var(--ghs-unit) * 3.8 * var(--ghs-text-factor));
background-color: var(--ghs-color-darkgray);
border-radius: 100%;
height: calc(var(--ghs-unit) * 3.8 * var(--ghs-text-factor));
margin-right: calc(var(--ghs-unit) * -1 * var(--ghs-text-factor));
border-width: calc(var(--ghs-unit) * 0.4);
border-style: solid;
border-color: var(--ghs-color-gray);

img {
width: calc(var(--ghs-unit) * 2.7 * var(--ghs-text-factor));
height: calc(var(--ghs-unit) * 2.7 * var(--ghs-text-factor));
}
}
}

.conditions {
position: relative;
display: flex;
Expand Down
12 changes: 12 additions & 0 deletions src/app/ui/figures/objective-container/objective-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { EntitiesMenuDialogComponent } from '../entities-menu/entities-menu-dial
import { EntityMenuDialogComponent } from '../entity-menu/entity-menu-dialog';
import { Monster } from 'src/app/game/model/Monster';
import { InteractiveAction } from 'src/app/game/businesslogic/ActionsManager';
import { Character } from 'src/app/game/model/Character';

@Component({
selector: 'ghs-objective-container',
Expand Down Expand Up @@ -251,6 +252,17 @@ export class ObjectiveContainerComponent implements OnInit, OnDestroy {
}
}

removeMarker(marker: string) {
if (this.entity) {
const markerChar = new Character(gameManager.getCharacterData(marker), 1);
const markerName = gameManager.characterManager.characterName(markerChar);
const characterIcon = markerChar.name;
gameManager.stateManager.before(...gameManager.entityManager.undoInfos(this.entity, this.objective, "removeMarker"), markerName, characterIcon);
this.entity.markers = this.entity.markers.filter((value) => value != marker);
gameManager.stateManager.after();
}
}

onInteractiveActionsChange(change: InteractiveAction[]) {
this.interactiveActionsChange.emit(change);
this.interactiveActions = change;
Expand Down
11 changes: 6 additions & 5 deletions src/app/ui/figures/standee/standee.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
<div class="conditions actions">
<span *ngFor="let actionHint of actionHints; let i = index;" class="condition-container"
[ngClass]="{'center' : (actionHints.length % 2) == 1 && i == actionHints.length - 1}">
<span class="condition">
<span class="condition action-hint">
<img
[src]="'./assets/images/' + (settingsManager.settings.fhStyle ? 'fh/' : '') + 'action/' + actionHint.type +'.svg'" />
<span class="value">{{actionHint.value}}</span>
[src]="'./assets/images/' + (settingsManager.settings.fhStyle ? 'fh/' : '') + 'action/hint/' + actionHint.type + '.svg'" />
<span class="value" [ngClass]="{'retaliate' : actionHint.type == 'retaliate'}">{{actionHint.value}}</span>
<span class="range" *ngIf="actionHint.range">
<img [src]="'./assets/images/' + (settingsManager.settings.fhStyle ? 'fh/' : '') + 'action/range.svg'" />
<span class="value">{{actionHint.range}}</span>
Expand All @@ -59,8 +59,9 @@
<div class="markers">
<span *ngIf="marker" class="placeholder placeholder-marker"
[ghs-label]="'%game.mapMarker.' + marker + '%'"></span>
<span class="marker" *ngFor="let marker of entity.markers;">
<img [src]="'./assets/images/character/icons/' + marker + '.svg'" />
<span class="marker" *ngFor="let marker of entity.markers;" ghs-pointer-input
(doubleClick)="removeMarker(marker)">
<img [src]="gameManager.characterManager.characterIcon(marker)" />
</span>
</div>

Expand Down
13 changes: 11 additions & 2 deletions src/app/ui/figures/standee/standee.scss
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,15 @@
transform: none;
color: var(--ghs-color-white);
font-family: var(--ghs-font-text);
font-size: calc(var(--ghs-unit) * 3 * var(--ghs-text-factor));
font-size: calc(var(--ghs-unit) * 3.3 * var(--ghs-text-factor));
line-height: calc(var(--ghs-unit) * 3 * var(--ghs-text-factor));
text-shadow: var(--ghs-outline-thin);
filter: invert(1);

&.retaliate {
font-size: calc(var(--ghs-unit) * 3.5 * var(--ghs-text-factor));
top: calc(var(--ghs-unit) * 0.7 * var(--ghs-text-factor));
}
}

img {
Expand All @@ -542,7 +547,7 @@
width: calc(var(--ghs-unit) * 2.3 * var(--ghs-text-factor));
left: calc(var(--ghs-unit) * -0.3 * var(--ghs-text-factor));
top: calc(var(--ghs-unit) * 0.3 * var(--ghs-text-factor));
font-size: calc(var(--ghs-unit) * 2 * var(--ghs-text-factor));
font-size: calc(var(--ghs-unit) * 3 * var(--ghs-text-factor));
}
}
}
Expand Down Expand Up @@ -773,6 +778,10 @@
}
}
}

.entity .conditions.actions .condition-container .condition .value.retaliate {
top: calc(var(--ghs-unit) * 1.1 * var(--ghs-text-factor));
}
}

&.modern:not(.active) {
Expand Down
9 changes: 9 additions & 0 deletions src/app/ui/figures/standee/standee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ export class StandeeComponent implements OnInit, OnDestroy {
gameManager.stateManager.after();
}

removeMarker(marker: string) {
const markerChar = new Character(gameManager.getCharacterData(marker), 1);
const markerName = gameManager.characterManager.characterName(markerChar);
const characterIcon = markerChar.name;
gameManager.stateManager.before(...gameManager.entityManager.undoInfos(this.entity, this.figure, "removeMarker"), markerName, characterIcon);
this.entity.markers = this.entity.markers.filter((value) => value != marker);
gameManager.stateManager.after();
}

doubleClick(event: any): void {
if (this.entity.revealed) {
this.entity.revealed = false;
Expand Down
Loading

0 comments on commit 564c0a2

Please sign in to comment.