Skip to content

Commit

Permalink
fix treasure offset, address #96
Browse files Browse the repository at this point in the history
  • Loading branch information
Lurkars committed Oct 16, 2024
1 parent 85d6107 commit dbc10cc
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 8 deletions.
3 changes: 2 additions & 1 deletion data/fh/challenges.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
},
{
"cardId": 1487,
"automation": "fully"
"automation": "fully",
"implemented": true
},
{
"cardId": 1488,
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.101.0",
"version": "0.101.1",
"license": "AGPL3",
"description": "Gloomhaven Secretariat is a Gloomhaven/Frosthaven Companion app.",
"homepage": "https://gloomhaven-secretariat.de",
Expand Down
4 changes: 3 additions & 1 deletion src/app/game/businesslogic/ChallengesManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class ChallengesManager {

game: Game;
available: boolean = false;
enabled: boolean = false;

constructor(game: Game) {
this.game = game;
Expand Down Expand Up @@ -78,7 +79,8 @@ export class ChallengesManager {
}

update() {
this.available = settingsManager.settings.fhChallenges && gameManager.fhRules() && this.game.party.buildings.find((buildingModel) => buildingModel.name == 'town-hall' && buildingModel.level && buildingModel.state != 'wrecked') != undefined
this.available = gameManager.fhRules() && this.game.party.buildings.find((buildingModel) => buildingModel.name == 'town-hall' && buildingModel.level && buildingModel.state != 'wrecked') != undefined;
this.enabled = settingsManager.settings.fhChallenges && this.available;

if (this.available && this.game.edition) {
// build challenge deck if not present
Expand Down
2 changes: 1 addition & 1 deletion src/app/game/businesslogic/EntityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ export class EntityManager {
entityCondition.highlight = false;

// apply Challenge #1487
if (gameManager.challengesManager.available && gameManager.challengesManager.isActive(1487, 'fh') && entityCondition.types.indexOf(ConditionType.negative) && entityCondition.name != ConditionName.wound && entity instanceof Character && !this.isImmune(entity, entity, ConditionName.wound)) {
if (gameManager.challengesManager.enabled && gameManager.challengesManager.isActive(1487, 'fh') && entityCondition.types.indexOf(ConditionType.negative) && entityCondition.name != ConditionName.wound && entity instanceof Character && !this.isImmune(entity, entity, ConditionName.wound)) {
this.addCondition(entity, new Condition(ConditionName.wound), active, off);
}

Expand Down
1 change: 1 addition & 0 deletions src/app/game/model/data/Challenges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export class ChallengeCard implements Editional {
cardId: number = 0;
edition: string = "";
automation: "fully" | "partial" | undefined;
implemented: boolean = false;

}

Expand Down
3 changes: 3 additions & 0 deletions src/app/ui/figures/challenges/challenge-card.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<div class="card-id">
<span *ngIf="challenge.cardId < 10">0</span>{{challenge.cardId}}
</div>
<div class="automation" *ngIf="challenge.implemented" [ghs-tooltip]="'challenges.automation.hint'">
<img class="ghs-svg" src="./assets/images/automation.svg">
</div>
</ng-container>
</div>
</div>
Expand Down
16 changes: 16 additions & 0 deletions src/app/ui/figures/challenges/challenge-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@
filter: var(--ghs-filter-outline);
}

.automation {
position: absolute;
bottom: 11%;
left: 14%;
display: flex;
justify-content: center;
align-items: center;

.ghs-svg {
width: 1.5em;
height: auto;
filter: var(--ghs-filter-darkgray);
}

}

}

.card-back {
Expand Down
2 changes: 1 addition & 1 deletion src/app/ui/figures/party/party-sheet-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ export class PartySheetDialogComponent implements OnInit, OnDestroy {
indexElement.classList.add('error');
const editionData = gameManager.editionData.find((editionData) => editionData.edition == edition);
if (editionData && editionData.treasures) {
const treasureIndex = +treasure - (editionData.treasureOffset || 0);
const treasureIndex = +treasure - (editionData.treasureOffset || 0) - 1;
if (treasureIndex >= 0 && treasureIndex < editionData.treasures.length) {
gameManager.stateManager.before("addTreasure", edition, treasure);
this.party.treasures = this.party.treasures || [];
Expand Down
2 changes: 1 addition & 1 deletion src/app/ui/footer/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

<div class="deck challenge-deck"
[ngClass]="{'collapsed' : !gameManager.game.challengeDeck.active, 'initial' : gameManager.game.challengeDeck.active && gameManager.game.challengeDeck.current <= gameManager.game.challengeDeck.finished ,'partial' : gameManager.game.challengeDeck.current > gameManager.game.challengeDeck.finished,'partial-2' : gameManager.game.challengeDeck.current > gameManager.game.challengeDeck.finished + 1 , 'full' : gameManager.game.challengeDeck.active && gameManager.game.challengeDeck.current > gameManager.game.challengeDeck.finished + 2}"
*ngIf="settingsManager.settings.fhChallenges && gameManager.challengesManager.available">
*ngIf="settingsManager.settings.fhChallenges && gameManager.challengesManager.enabled">
<ghs-challenge-deck [deck]="gameManager.game.challengeDeck" (before)="beforeChallengeDeck($event)"
(after)="afterChallengeDeck($event)" [bottom]="true"></ghs-challenge-deck>

Expand Down
1 change: 1 addition & 0 deletions src/assets/images/automation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
"cancel": "Cancel",
"challenges": {
".": "Challenges",
"automation": {
"hint": "Effect of this card is automatically applied!"
},
"deck": {
"clear": {
".": "Disgard drawn Challenge",
Expand Down

0 comments on commit dbc10cc

Please sign in to comment.