Skip to content

Commit

Permalink
address #598
Browse files Browse the repository at this point in the history
  • Loading branch information
Lurkars committed Jul 16, 2024
1 parent 314f895 commit 9d82b10
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 62 deletions.
62 changes: 31 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gloomhavensecretariat",
"version": "0.99.16",
"version": "0.99.17",
"license": "AGPL3",
"description": "Gloomhaven Secretariat is a Gloomhaven/Frosthaven Companion app.",
"homepage": "https://gloomhaven-secretariat.de",
Expand Down Expand Up @@ -104,7 +104,7 @@
"@types/jasmine": "~5.1.4",
"@types/leaflet": "^1.9.12",
"@types/uuid": "^10.0.0",
"electron": "^31.2.0",
"electron": "^31.2.1",
"electron-builder": "^24.13.3",
"http-server": "^14.1.1",
"husky": "^9.0.11",
Expand Down
73 changes: 44 additions & 29 deletions src/app/game/businesslogic/RoundManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,40 +277,55 @@ export class RoundManager {
});
}

if (!skipSummons && figure instanceof Character && settingsManager.settings.activeSummons && gameManager.entityManager.isAlive(figure)) {
const activeSummon = figure.summons.find((summon) => gameManager.entityManager.isAlive(summon, true) && summon.active);
const nextSummon = figure.summons.find((summon, index, self) => (!activeSummon || index > self.indexOf(activeSummon)) && gameManager.entityManager.isAlive(summon, true) && summon.tags.indexOf('prism_mode') == -1);

figure.summons.slice(activeSummon ? figure.summons.indexOf(activeSummon) : 0, nextSummon ? figure.summons.indexOf(nextSummon) : figure.summons.length).forEach((prevSummon, index, self) => {
prevSummon.active = false;
if (settingsManager.settings.expireConditions) {
gameManager.entityManager.expireConditions(prevSummon);
}
if (settingsManager.settings.applyConditions && (!activeSummon || index > 0)) {
gameManager.entityManager.applyConditionsTurn(prevSummon, figure);
gameManager.entityManager.applyConditionsAfter(prevSummon, figure);
}
})
if (figure instanceof Character && gameManager.entityManager.isAlive(figure)) {
if (!skipSummons && settingsManager.settings.activeSummons) {
const activeSummon = figure.summons.find((summon) => gameManager.entityManager.isAlive(summon, true) && summon.active);
const nextSummon = figure.summons.find((summon, index, self) => (!activeSummon || index > self.indexOf(activeSummon)) && gameManager.entityManager.isAlive(summon, true) && summon.tags.indexOf('prism_mode') == -1);

figure.summons.slice(activeSummon ? figure.summons.indexOf(activeSummon) : 0, nextSummon ? figure.summons.indexOf(nextSummon) : figure.summons.length).forEach((prevSummon, index, self) => {
prevSummon.active = false;
if (settingsManager.settings.expireConditions) {
gameManager.entityManager.expireConditions(prevSummon);
}
if (settingsManager.settings.applyConditions && (!activeSummon || index > 0)) {
gameManager.entityManager.applyConditionsTurn(prevSummon, figure);
gameManager.entityManager.applyConditionsAfter(prevSummon, figure);
}
})

if (nextSummon) {
nextSummon.active = true;
if (settingsManager.settings.applyConditions) {
gameManager.entityManager.applyConditionsTurn(nextSummon, figure);
}
if (nextSummon.dead) {
this.turn(figure);
if (nextSummon) {
nextSummon.active = true;
if (settingsManager.settings.applyConditions) {
gameManager.entityManager.applyConditionsTurn(nextSummon, figure);
}
if (nextSummon.dead) {
this.turn(figure);
}
} else {
this.game.elementBoard.forEach((element) => {
if (element.state == ElementState.new) {
element.state = ElementState.strong;
}
})
figure.summons.forEach((summon) => {
if (summon.active) {
summon.active = false;
}
});
}
} else {
this.game.elementBoard.forEach((element) => {
if (element.state == ElementState.new) {
element.state = ElementState.strong;
}
})
figure.summons.forEach((summon) => {
if (summon.active) {
summon.active = false;
summon.active = false;
if (gameManager.entityManager.isAlive(summon)) {
if (settingsManager.settings.expireConditions) {
gameManager.entityManager.expireConditions(summon);
}
if (settingsManager.settings.applyConditions) {
gameManager.entityManager.applyConditionsTurn(summon, figure);
gameManager.entityManager.applyConditionsAfter(summon, figure);
}
}
});
})
}
}

Expand Down

0 comments on commit 9d82b10

Please sign in to comment.