Skip to content

Commit

Permalink
address #626, improve and fix Attack Modifier (still needs improvement)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lurkars committed Nov 13, 2024
1 parent 930f285 commit 254ec93
Show file tree
Hide file tree
Showing 17 changed files with 965 additions and 1,055 deletions.
2 changes: 1 addition & 1 deletion data/bb/deck/gloomtoad.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"subActions": [
{
"type": "condition",
"value": "poison",
"value": "muddle",
"small": true
}
]
Expand Down
13 changes: 9 additions & 4 deletions data/cc/character/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,17 @@
"value": "wound"
},
{
"type": "condition",
"value": "wound",
"type": "required",
"effects": [
{
"type": "specialTarget",
"value": "self"
"type": "condition",
"value": "wound",
"effects": [
{
"type": "specialTarget",
"value": "self"
}
]
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion data/cc/label/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"6": "Trigger an ongoing effect on Chaotic Recursion six or more times in one round"
},
"wildborn": {
"1": "suffer %game.damage:2%",
"1": "instead if you suffer %game.damage:2%",
"2": "Add +1 %game.action.attack% per collected %data.action.custom.cc-essence%",
"3": "Place this card in your active area. On your next commanded attack, discard this card to add +2 %game.action.attack%",
"4": "On your next commanded attack, discard this card to add +2 %game.action.attack%",
Expand Down
2 changes: 1 addition & 1 deletion data/toa/character/gemstone.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"effects": [
{
"type": "custom",
"value": "instead if the attack has %game.condition.pierce%"
"value": "instead if the attack has %game.action.pierce%"
}
]
}
Expand Down
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.103.0",
"version": "0.103.1",
"license": "AGPL3",
"description": "Gloomhaven Secretariat is a Gloomhaven/Frosthaven Companion app.",
"homepage": "https://gloomhaven-secretariat.de",
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { InteractiveActionsComponent } from './ui/figures/actions/interactive/in
import { ActionSummonComponent } from './ui/figures/actions/summon/action-summon';
import { AttackModifierComponent } from './ui/figures/attackmodifier/attackmodifier';
import { AttackModifierDrawComponent } from './ui/figures/attackmodifier/attackmodifier-draw';
import { AttackModifierEffectsComponent } from './ui/figures/attackmodifier/attackmodifier-effects';
import { AttackModifierEffectComponent } from './ui/figures/attackmodifier/attackmodifier-effect';
import { AttackModifierDeckComponent } from './ui/figures/attackmodifier/attackmodifierdeck';
import { AttackModifierDeckDialogComponent } from './ui/figures/attackmodifier/attackmodifierdeck-dialog';
import { AttackModifierDeckFullscreenComponent } from './ui/figures/attackmodifier/attackmodifierdeck-fullscreen';
Expand Down Expand Up @@ -182,7 +182,7 @@ describe('AppComponent', () => {
AttackModifierDeckDialogComponent,
AttackModifierDeckFullscreenComponent,
AttackModifierDrawComponent,
AttackModifierEffectsComponent,
AttackModifierEffectComponent,
AttackModifierStandaloneComponent,
AttackModifierToolComponent,
AutocompleteDirective,
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { InteractiveActionsComponent } from './ui/figures/actions/interactive/in
import { ActionSummonComponent } from './ui/figures/actions/summon/action-summon';
import { AttackModifierComponent } from './ui/figures/attackmodifier/attackmodifier';
import { AttackModifierDrawComponent } from './ui/figures/attackmodifier/attackmodifier-draw';
import { AttackModifierEffectsComponent } from './ui/figures/attackmodifier/attackmodifier-effects';
import { AttackModifierEffectComponent } from './ui/figures/attackmodifier/attackmodifier-effect';
import { AttackModifierDeckComponent } from './ui/figures/attackmodifier/attackmodifierdeck';
import { AttackModifierDeckDialogComponent } from './ui/figures/attackmodifier/attackmodifierdeck-dialog';
import { AttackModifierDeckFullscreenComponent } from './ui/figures/attackmodifier/attackmodifierdeck-fullscreen';
Expand Down Expand Up @@ -184,7 +184,7 @@ import { TreasuresToolComponent } from './ui/tools/treasures/treasures-tool';
AttackModifierDeckDialogComponent,
AttackModifierDeckFullscreenComponent,
AttackModifierDrawComponent,
AttackModifierEffectsComponent,
AttackModifierEffectComponent,
AttackModifierStandaloneComponent,
AttackModifierToolComponent,
AutocompleteDirective,
Expand Down
214 changes: 214 additions & 0 deletions src/app/ui/figures/attackmodifier/attackmodifier-effect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
<span class="effect-wrapper {{effect.type}}" *ngIf="effect"
[ngClass]="{'fh': settingsManager.settings.fhStyle, 'new-style' : newStyle, 'town-guard': townGuard}">
<span class="effect" [ngSwitch]="effect.type">
<ng-container *ngSwitchCase="AttackModifierEffectType.condition">
<img class="full" [ngClass]="{'target' : getTarget() || getRange()}"
[src]="'./assets/images/' + (settingsManager.settings.fhStyle ? 'fh/' : '') + 'condition/' + effect.value.split(':')[0] + '.svg'" />
<span *ngIf="effect.value.split(':').length > 1" class="value">{{effect.value.split(':')[1]}}</span>

<span class="target-value-container {{'target-' + getTarget().replace('game.specialTarget.','')}}"
*ngIf="getTarget()">
<span class="target-value text-white" [ghs-label]="getTarget().split(':')[0]"
[ghs-label-args]="getTarget().split(':').slice(1)" [style]="newStyle ? 'fh' : false"></span>
</span>
<span class="target-value-container range" *ngIf="getRange()">
<span class="target-value text-white" [ghs-label]="getRange()" [style]="newStyle ? 'fh' : false"></span>
</span>
</ng-container>
<ng-container *ngSwitchCase="AttackModifierEffectType.element">
<img class="full" [ngClass]="{'sub-effects' : effect.effects && effect.effects.length}"
[src]="'./assets/images/' + (settingsManager.settings.fhStyle ? 'fh/' : '') + 'element/' + effect.value + '.svg'" />

<div class="sub-effects" *ngFor="let subEffect of effect.effects">
<ghs-attackmodifier-effect [attackModifier]="attackModifier" [effect]="subEffect" [offsetWidth]="offsetWidth"
[newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</ng-container>

<span class="element-half-container" *ngSwitchCase="AttackModifierEffectType.elementHalf">
<span class="element-half">
<img
[src]="'./assets/images/' + (settingsManager.settings.fhStyle ? 'fh/' : '') + 'element/' + effect.value.split('|')[0] + '.svg'">
</span>
<span class="element-half">
<img
[src]="'./assets/images/' + (settingsManager.settings.fhStyle ? 'fh/' : '') + 'element/' + effect.value.split('|')[1] + '.svg'">
</span>
</span>

<ng-container *ngSwitchCase="AttackModifierEffectType.elementConsume">
<span class="element consume">
<img
[src]="'./assets/images/' + (settingsManager.settings.fhStyle ? 'fh/' : '') + 'element/' + effect.value + '.svg'">
</span>
<span class="divider">:</span>
<div class="sub-effects" *ngFor="let subEffect of effect.effects">
<ghs-attackmodifier-effect [attackModifier]="attackModifier" [effect]="subEffect" [offsetWidth]="offsetWidth"
[newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</ng-container>

<div class="effect-container heal-container" *ngSwitchCase="AttackModifierEffectType.heal"
[style.border-width]="(offsetWidth * 0.020) + 'px'"
[ngClass]="{'target' : getTarget() || getRange(), 'sub-effects' : subEffects().length > 0}">
<img [ngClass]="{'ghs-svg' : isGhsSvg(effect.type)}" [src]="'./assets/images/action/' + effect.type + '.svg'" />
<span class="value" *ngIf="effect.value">{{+effect.value | ghsValueSign}}</span>
<span class="target-value-container {{'target-' + getTarget().replace('game.specialTarget.','')}}"
*ngIf="getTarget()">
<span class="target-value text-white" [ghs-label]="getTarget().split(':')[0]"
[ghs-label-args]="getTarget().split(':').slice(1)" [style]="newStyle ? 'fh' : false"></span>
</span>
<span class="target-value-container range" *ngIf="getRange()">
<span class="target-value text-white" [ghs-label]="getRange()" [style]="newStyle ? 'fh' : false"></span>
</span>
<div class="sub-effects">
<span class="divider">,</span>
<ghs-attackmodifier-effect *ngFor="let subEffect of subEffects()" [attackModifier]="attackModifier"
[effect]="subEffect" [offsetWidth]="offsetWidth" [newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</div>

<div class="effect-container shield-container" *ngSwitchCase="AttackModifierEffectType.shield"
[style.border-width]="(offsetWidth * 0.020) + 'px'" [ngClass]="{'target' : getTarget() || getRange()}">
<img [ngClass]="{'ghs-svg' : isGhsSvg(effect.type)}"
[src]="'./assets/images/' + (settingsManager.settings.fhStyle ? 'fh/' : '') + 'action/' + effect.type + '.svg'" />
<span class="value" *ngIf="effect.value">{{+effect.value}}</span>
<span class="target-value-container {{'target-' + getTarget().replace('game.specialTarget.','')}}"
*ngIf="getTarget()">
<span class="target-value text-white" [ghs-label]="getTarget().split(':')[0]"
[ghs-label-args]="getTarget().split(':').slice(1)" [style]="newStyle ? 'fh' : false"></span>
</span>
<span class="target-value-container range" *ngIf="getRange()">
<span class="target-value text-white" [ghs-label]="getRange()" [style]="newStyle ? 'fh' : false"></span>
</span>
<div class="sub-effects">
<ghs-attackmodifier-effect *ngFor="let subEffect of subEffects()" [attackModifier]="attackModifier"
[effect]="subEffect" [offsetWidth]="offsetWidth" [newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</div>
<div class="effect-container retaliate-container" *ngSwitchCase="AttackModifierEffectType.retaliate"
[style.border-width]="(offsetWidth * 0.020) + 'px'" [ngClass]="{'target' : getTarget() || getRange()}">
<img [ngClass]="{'ghs-svg' : isGhsSvg(effect.type)}"
[src]="'./assets/images/' + (settingsManager.settings.fhStyle ? 'fh/' : '') + 'action/' + effect.type + '.svg'" />
<span class="value" *ngIf="effect.value">{{+effect.value}}</span>
<span class="target-value-container {{'target-' + getTarget().replace('game.specialTarget.','')}}"
*ngIf="getTarget()">
<span class="target-value text-white" [ghs-label]="getTarget().split(':')[0]"
[ghs-label-args]="getTarget().split(':').slice(1)" [style]="newStyle ? 'fh' : false"></span>
</span>
<span class="target-value-container range" *ngIf="getRange()">
<span class="target-value text-white" [ghs-label]="getRange()" [style]="newStyle ? 'fh' : false"></span>
</span>
<div class="sub-effects">
<ghs-attackmodifier-effect [attackModifier]="attackModifier" *ngFor="let subEffect of subEffects()"
[effect]="subEffect" [offsetWidth]="offsetWidth" [newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</div>

<ng-container *ngSwitchCase="AttackModifierEffectType.target">
<img class="full" [src]="'./assets/images/attackmodifier/target.svg'" />

<div class="sub-effects" *ngIf="effect.effects">
<ghs-attackmodifier-effect [attackModifier]="attackModifier" *ngFor="let subEffect of effect.effects"
[effect]="subEffect" [offsetWidth]="offsetWidth" [newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</ng-container>

<ng-container *ngSwitchCase="AttackModifierEffectType.area">
<ghs-action-hex [value]="effect.value"></ghs-action-hex>

<div class="sub-effects" *ngIf="effect.effects">
<ghs-attackmodifier-effect [attackModifier]="attackModifier" *ngFor="let subEffect of effect.effects"
[effect]="subEffect" [offsetWidth]="offsetWidth" [newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</ng-container>

<ng-container *ngSwitchCase="AttackModifierEffectType.refreshItem">
<span class="card-action">
<img class="ghs-svg" src="./assets/images/action/card/refresh.svg" />
<img class="overlay" src="./assets/images/action/card/overlay/refresh.svg" />
</span>
<div class="sub-effects" *ngIf="effect.effects">
<ghs-attackmodifier-effect [attackModifier]="attackModifier" *ngFor="let subEffect of effect.effects"
[effect]="subEffect" [offsetWidth]="offsetWidth" [newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</ng-container>

<ng-container *ngSwitchCase="AttackModifierEffectType.refreshSpentItem">
<div class="card-action-container">
<span class="card-action">
<img class="ghs-svg" src="./assets/images/action/card/refresh.svg" />
<img class="overlay" src="./assets/images/action/card/overlay/refresh.svg" />
</span>
<span class="label"><span [ghs-label]="'game.attackModifiers.effects.refreshSpentItem'"></span></span>

<div class="sub-effects" *ngIf="effect.effects">
<ghs-attackmodifier-effect [attackModifier]="attackModifier" *ngFor="let subEffect of effect.effects"
[effect]="subEffect" [offsetWidth]="offsetWidth" [newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</div>
</ng-container>

<ng-container *ngSwitchCase="AttackModifierEffectType.recoverRandomDiscard">
<span class="card-action">
<img class="ghs-svg" src="./assets/images/action/card/recover.svg" />
<img class="overlay" src="./assets/images/action/card/overlay/recover.svg" />
</span>
<div class="sub-effects" *ngIf="effect.effects">
<ghs-attackmodifier-effect [attackModifier]="attackModifier" *ngFor="let subEffect of effect.effects"
[effect]="subEffect" [offsetWidth]="offsetWidth" [newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</ng-container>

<ng-container *ngSwitchCase="AttackModifierEffectType.custom">
<ng-container *ngIf="!effect.icon">
<span class="custom-value-container">
<span class="custom-value" [ngClass]="{'text-white' : !settingsManager.settings.fhStyle || townGuard}"
[ghs-label]="effect.value + ''"></span>
</span>
</ng-container>
<ng-container *ngIf="effect.icon">
<span class="effect-icon">
<img [src]="'./assets/images/action/custom/' + effect.value + '.svg'" />
</span>
</ng-container>

<div class="sub-effects" *ngIf="effect.effects">
<ghs-attackmodifier-effect [attackModifier]="attackModifier" *ngFor="let subEffect of effect.effects"
[effect]="subEffect" [offsetWidth]="offsetWidth" [newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</ng-container>


<ng-container *ngSwitchCase="AttackModifierEffectType.or">
<span class="or-label" [ngClass]="{'new-style' : newStyle}"><span [ghs-label]="'or'"></span></span>
<ghs-attackmodifier-effect [attackModifier]="attackModifier" *ngFor="let subEffect of effect.effects"
[effect]="subEffect" [offsetWidth]="offsetWidth" [newStyle]="newStyle"></ghs-attackmodifier-effect>
</ng-container>


<ng-container *ngSwitchCase="AttackModifierEffectType.changeType">
<img class="overlay" [src]="'./assets/images/attackmodifier/overlays/replace/' +effect.value + '.png'" />
<div class="sub-effects" *ngIf="effect.effects">
<ghs-attackmodifier-effect [attackModifier]="attackModifier" *ngFor="let subEffect of effect.effects"
[effect]="subEffect" [offsetWidth]="offsetWidth" [newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</ng-container>

<span class="required-container" *ngSwitchCase="AttackModifierEffectType.required">
<span *ngIf="effect.value" class="label" [ghs-label]="'' + effect.value"></span>
<span *ngIf="!effect.value" class="label">!</span>
<div class="sub-effects">
<ghs-attackmodifier-effect *ngFor="let subEffect of effect.effects" [attackModifier]="attackModifier"
[effect]="subEffect" [offsetWidth]="offsetWidth" [newStyle]="newStyle"></ghs-attackmodifier-effect>
</div>
</span>

<ng-container *ngSwitchDefault>
<img class="full" [ngClass]="{'ghs-svg' : isGhsSvg(effect.type)}"
[src]="'./assets/images/' + (settingsManager.settings.fhStyle ? 'fh/' : '') + 'action/' + effect.type + '.svg'" />
<span class="value" *ngIf="effect.value">{{+effect.value}}</span>
</ng-container>

</span>
</span>
Loading

0 comments on commit 254ec93

Please sign in to comment.