Skip to content

Commit

Permalink
fix summon condition removement, prepare refactor standee for summon
Browse files Browse the repository at this point in the history
  • Loading branch information
Lurkars committed Nov 5, 2023
1 parent 488c68f commit c2c9efc
Show file tree
Hide file tree
Showing 9 changed files with 261 additions and 88 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.80.4",
"version": "0.80.5",
"license": "AGPL3",
"description": "Gloomhaven Secretariat is a Gloomhaven Companion app.",
"homepage": "https://gloomhaven-secretariat.de",
Expand Down
4 changes: 0 additions & 4 deletions src/app/game/model/ObjectiveEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ export class ObjectiveEntity implements Entity {
dormant: boolean = false;
revealed: boolean = false;

// workaround
type: "" = "";
summon: "" = "";

// from entity
active: boolean = false;
off: boolean = false;
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 @@ -183,7 +183,8 @@
</div>

<div *ngIf="settingsManager.settings.characterItems" class="items-button" ghs-pointer-input
(singleClick)="openItems()" (doubleClick)="openItems(true)" [ghs-label]="'game.items'" [ghs-label-attribute]="'title'">
(singleClick)="openItems()" (doubleClick)="openItems(true)" [ghs-label]="'game.items'"
[ghs-label-attribute]="'title'">
<img
[src]="settingsManager.settings.fhStyle ? './assets/images/fh/items/item-back-fh.png' : './assets/images/items/item-back.png'" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/ui/figures/character/summon/summon.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<div class="conditions">
<span class="condition-container" *ngFor="let entityCondition of activeConditions; let index = index"
[ngClass]="{'expired' : entityCondition.expired, 'center' : ((activeConditions).length % 2) == 1 && (activeConditions).length == index + 1}">
<span class="condition">
<span class="condition" ghs-pointer-input (doubleClick)="removeCondition(entityCondition)">
<img
[src]="'./assets/images' + (settingsManager.settings.fhStyle ? '/fh' : '') + '/condition/' + entityCondition.name + '.svg'"
[style.z-index]="index * 10 + entityCondition.value" />
Expand Down
5 changes: 5 additions & 0 deletions src/app/ui/figures/character/summon/summon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,9 @@ export class SummonEntityComponent implements OnInit, OnDestroy {
}
}

removeCondition(entityCondition: EntityCondition) {
gameManager.stateManager.before(...gameManager.entityManager.undoInfos(this.summon, this.character, "removeCondition"), entityCondition.name);
gameManager.entityManager.removeCondition(this.summon, entityCondition, entityCondition.permanent);
gameManager.stateManager.after();
}
}
45 changes: 31 additions & 14 deletions src/app/ui/figures/standee/standee.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
<div class="entity-border"
[ngClass]="{'dead' : entity.dead, 'off' : !entity.dormant && entity.off, 'dormant' : entity.dormant, 'revealed' : !entity.dormant && entity.revealed && settingsManager.settings.scenarioRooms, 'active' : !entity.dormant && entity.active && settingsManager.settings.activeStandees, 'active-focus': !entity.dormant && entity.active && settingsManager.settings.activeStandees && !figure.active, 'denied' : gameManager.isMonster(figure) && !gameManager.stateManager.monsterPermissions[figure.name + '|' + figure.edition] || (gameManager.isObjective(figure) || gameManager.isObjectiveContainer(figure)) && gameManager.stateManager.permissions && !gameManager.stateManager.permissions.characters || gameManager.isCharacter(figure) && !gameManager.stateManager.characterPermissions[figure.name + '|' + figure.edition], 'action-hint-border' : actionHints.length > 0 && (actionHints.length % 2) == 1 && activeConditions.length == 0 && entity.summon == SummonState.false, 'fh': settingsManager.settings.theme == 'fh', 'modern': settingsManager.settings.theme == 'modern'}"
[ngClass]="{'dead' : entity.dead, 'off' : !entity.dormant && entity.off, 'dormant' : entity.dormant, 'revealed' : !entity.dormant && entity.revealed && settingsManager.settings.scenarioRooms, 'active' : !entity.dormant && entity.active && settingsManager.settings.activeStandees, 'active-focus': !entity.dormant && entity.active && settingsManager.settings.activeStandees && !figure.active,'monster' : gameManager.isMonsterEntity(entity), 'objective' : gameManager.isObjectiveEntity(entity), 'summon' : gameManager.isSummon(entity), 'denied' : gameManager.isMonster(figure) && !gameManager.stateManager.monsterPermissions[figure.name + '|' + figure.edition] || (gameManager.isObjective(figure) || gameManager.isObjectiveContainer(figure)) && gameManager.stateManager.permissions && !gameManager.stateManager.permissions.characters || gameManager.isCharacter(figure) && !gameManager.stateManager.characterPermissions[figure.name + '|' + figure.edition], 'action-hint-border' : actionHints.length > 0 && (actionHints.length % 2) == 1 && activeConditions.length == 0 && (gameManager.isObjectiveEntity(entity) && gameManager.isMonsterEntity(entity) && gameManager.toMonsterEntity(entity).summon == SummonState.false || gameManager.isSummon(entity) && gameManager.toSummon(entity).state == SummonState.false), 'fh': settingsManager.settings.theme == 'fh', 'modern': settingsManager.settings.theme == 'modern'}"
[entityAnimation]="entity.dead">
<div class="entity" [ngClass]="entity.type">
<div #standee class="standee">
<div class="entity" [ngClass]="gameManager.isMonsterEntity(entity) ? gameManager.toMonsterEntity(entity).type : ''">
<div #standee class="standee"
[ngClass]="{'monster-standee' : gameManager.isMonsterEntity(entity), 'objective-standee' : gameManager.isObjectiveEntity(entity), 'summon-standee' : gameManager.isSummon(entity)}">

<ghs-summon-sheet *ngIf="gameManager.isSummon(entity) && gameManager.toSummon(entity).active"
[summon]="gameManager.toSummon(entity)"></ghs-summon-sheet>

<div class="background-image-container">
<div class="background-image"
[style.background-image]="figure.noThumbnail || settingsManager.settings.disableArtwork ? '': 'url(' + gameManager.monsterManager.monsterThumbnail(figure) + ')'">
[style.background-image]="figure.noThumbnail || settingsManager.settings.disableArtwork || !gameManager.isMonster(figure) ? '': 'url(' + gameManager.monsterManager.monsterThumbnail(gameManager.toMonster(figure)) + ')'">
</div>
</div>
<span class="number" [ngClass]="{'highlight' : entity.number < 1 && !settingsManager.settings.disableAnimations}">
<span class="value">{{entity.number < 0 ? '?' : entity.number}}</span>
</span>
<span class="health" [ghs-label]="'game.health'"
[ghs-label-attribute]="'title'">{{EntityValueFunction(entity.maxHealth) > 0 ? ((entity.health + health) | ghsMinZero) : '-'}}
<span class="value-overlay" [value-sign]="health" [hideEmpty]="true" [container]="true"></span>
</span>
</span>

<span *ngIf="gameManager.isSummon(entity)" class="summon-state"
[ngClass]="{'active' : gameManager.toSummon(entity).state == SummonState.true, 'new' : gameManager.toSummon(entity).state == SummonState.new, 'center' : (gameManager.toSummon(entity).entityConditions.length % 2) == 0}">
<img src="./assets/images/summons/{{gameManager.toSummon(entity).color}}.png">
<span class="summon-number">
<span *ngIf="gameManager.toSummon(entity).number == 0">-</span>
<span *ngIf="gameManager.toSummon(entity).number > 0">{{gameManager.toSummon(entity).number}}</span></span>
</span>


<span class="health" [ghs-label]="'game.health'"
[ghs-label-attribute]="'title'">{{EntityValueFunction(entity.maxHealth) > 0 ? ((entity.health + health) |
ghsMinZero) : '-'}}
<span class="value-overlay" [value-sign]="health" [hideEmpty]="true" [container]="true"></span>
</span>
</div>

<div class="conditions actions">
Expand Down Expand Up @@ -45,7 +61,7 @@

<div class="conditions">
<span class="condition-container" *ngFor="let entityCondition of activeConditions; let index = index;"
[ngClass]="{'center' : entity.summon == SummonState.false && ((activeConditions).length % 2) == 1 && (activeConditions).length == index + 1, 'expired' : entityCondition.expired}">
[ngClass]="{'center' : (gameManager.isMonsterEntity(entity) && gameManager.toMonsterEntity(entity).summon == SummonState.false || gameManager.isSummon(entity) || gameManager.isObjectiveEntity(entity)) && ((activeConditions).length % 2) == 1 && (activeConditions).length == index + 1, 'expired' : entityCondition.expired}">
<span class="condition" ghs-pointer-input (doubleClick)="removeCondition(entityCondition)">
<img
[src]="'./assets/images' + (settingsManager.settings.fhStyle ? '/fh' : '') + '/condition/' + entityCondition.name + '.svg'"
Expand All @@ -64,11 +80,12 @@
[style.z-index]="index * 10 + entityCondition.value + 3"></span>
</span>
</span>
<span *ngIf="entity.summon && entity.summon != SummonState.false" class="summon-container"
[ngClass]="{'center' : (entity.entityConditions.length % 2) == 0}">
<span
*ngIf="gameManager.isMonsterEntity(entity) && gameManager.toMonsterEntity(entity).summon != SummonState.false"
class="summon-container" [ngClass]="{'center' : (entity.entityConditions.length % 2) == 0}">
<span class="summon"
[ngClass]="{'active' : entity.summon == SummonState.true, 'new' : entity.summon == SummonState.new}">
<img src="./assets/images/summons/{{figure.summonColor}}.png">
[ngClass]="{'active' : gameManager.isMonsterEntity(entity) && gameManager.toMonsterEntity(entity).summon == SummonState.true, 'new' : gameManager.isMonsterEntity(entity) && gameManager.toMonsterEntity(entity).summon == SummonState.new}">
<img src="./assets/images/summons/{{ gameManager.toMonster(figure).summonColor }}.png">
</span>
</span>
</div>
Expand Down
Loading

0 comments on commit c2c9efc

Please sign in to comment.