Skip to content

Commit

Permalink
fix hp rolls with new class items
Browse files Browse the repository at this point in the history
  • Loading branch information
Muttley committed Sep 23, 2023
1 parent d0a5901 commit 05bdfcf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
18 changes: 8 additions & 10 deletions system/src/documents/ActorSD.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ export default class ActorSD extends Actor {
}

async getArmorClass() {
return await this.updateArmorClass();
const ac = await this.updateArmorClass();
return ac;
}

async isClaimedByUser() {
Expand Down Expand Up @@ -896,15 +897,11 @@ export default class ActorSD extends Actor {
}

// Add AC from effects
this.system.attributes.ac.value =
newArmorClass + parseInt(this.system.bonuses.acBonus, 10);
newArmorClass += parseInt(this.system.bonuses.acBonus, 10);

// await Actor.updateDocuments([{
// _id: this._id,
// "system.attributes.ac.value": newArmorClass,
// }]);
this.updateSource({"system.attributes.ac.value": newArmorClass});

return this.system.attributes.ac.value;
return newArmorClass;
}

async usePotion(itemId) {
Expand Down Expand Up @@ -1044,7 +1041,7 @@ export default class ActorSD extends Actor {
}

async _playerRollHP(options={}) {
if (this.system.class === "") {
if (!this.backgroundItems.class) {
ui.notifications.error(
game.i18n.format("SHADOWDARK.error.general.no_character_class"),
{permanent: false}
Expand All @@ -1063,7 +1060,8 @@ export default class ActorSD extends Actor {
options.dialogTemplate = "systems/shadowdark/templates/dialog/roll-dialog.hbs";
options.chatCardTemplate = "systems/shadowdark/templates/chat/roll-hp.hbs";

const parts = [CONFIG.SHADOWDARK.CLASS_HD[this.system.class]];
const parts = [this.backgroundItems.class.system.hitPoints];

await CONFIG.DiceSD.RollDialog(parts, data, options);
}

Expand Down
3 changes: 0 additions & 3 deletions system/src/documents/__tests__/documents-actor.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,6 @@ export default ({ describe, it, after, before, expect }) => {
it("has luck", () => {
expect(actor.system.luck).is.not.undefined;
});
it("has title", () => {
expect(actor.system.title).is.not.undefined;
});

after(async () => {
await actor.delete();
Expand Down

0 comments on commit 05bdfcf

Please sign in to comment.