Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.1.2 #892

Merged
merged 9 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# v3.1.2

## Bugfixes
* [#888] Max and Current HP not set correctly during character creation

## Chores
* [#891] Merged Finnish language updates from Crowdin

---

# v3.1.1

## Bugfixes
Expand Down
134 changes: 67 additions & 67 deletions i18n/fi.yaml

Large diffs are not rendered by default.

184 changes: 92 additions & 92 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
"del": "^7.1.0",
"glob": "^11.0.0",
"gulp": "^5.0.0",
"gulp-eslint-new": "^2.2.0",
"gulp-eslint-new": "^2.3.0",
"gulp-if": "^3.0.0",
"gulp-sass": "^5.1.0",
"gulp-yaml": "^2.0.4",
"json-stable-stringify-pretty": "^1.2.0",
"marked": "^13.0.2",
"marked": "^14.1.2",
"merge-stream": "^2.0.0",
"nedb-promises": "^6.2.3",
"rollup": "^4.18.1",
"sass": "^1.77.6",
"yaml": "^2.4.5",
"rollup": "^4.21.2",
"sass": "^1.78.0",
"yaml": "^2.5.1",
"yargs": "^17.7.2"
}
}
8 changes: 8 additions & 0 deletions system/src/apps/CharacterGeneratorSD.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,14 @@ export default class CharacterGeneratorSD extends FormApplication {

await newActor.createEmbeddedDocuments("Item", characterItems);

let maxHP = newActor.system.attributes.hp.base + newActor.system.attributes.hp.bonus;
let newHP = maxHP;

await newActor.update({
"system.attributes.hp.max": maxHP,
"system.attributes.hp.value": newHP,
});

if (userId !== game.userId) {
const ownership = newActor.ownership;
ownership[userId] = CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER;
Expand Down
50 changes: 27 additions & 23 deletions system/src/apps/LevelUpSD.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ export default class LevelUpSD extends FormApplication {
}

async _onRollHP() {

// roll HP
const data = {
rollType: "hp",
actor: this.data.actor,
Expand Down Expand Up @@ -293,7 +291,6 @@ export default class LevelUpSD extends FormApplication {
}

async _finalizeLevelUp() {

// update actor XP and level
let newXP = 0;

Expand All @@ -302,57 +299,64 @@ export default class LevelUpSD extends FormApplication {
newXP = this.data.actor.system.level.xp - (this.data.actor.system.level.value * 10);
}

// Add items first as they may include HP / Con bonuses
let allItems = [
...this.data.talents,
];

// load all spells into allItems
for (let i = 1; i <= 5; i++) {
allItems = [
...allItems,
...this.data.spells[i].objects,
];
}

// Names for audit log
const itemNames = [];
allItems.forEach(x => itemNames.push(x.name));

// add talents and spells to actor
await this.data.actor.createEmbeddedDocuments("Item", allItems);

// calculate new HP base
let newBaseHP = this.data.actor.system.attributes.hp.base + this.data.rolls.hp;
let newValueHP = this.data.actor.system.attributes.hp.value + this.data.rolls.hp;
let newMaxHP = newBaseHP + this.data.actor.system.attributes.hp.bonus;

if (this.data.targetLevel === 1) {
let hpConMod = this.data.actor.system.abilities.con.mod;
// apply conmod to a set minimum 1 HP
if ((this.data.rolls.hp + hpConMod) > 1) {
newBaseHP = this.data.rolls.hp + hpConMod;

}
else {
newBaseHP = 1;
}
newValueHP = newBaseHP;
}

let allItems = [
...this.data.talents,
];

// load all spells into allItems
for (let i = 1; i <= 5; i++) {
allItems = [
...allItems,
...this.data.spells[i].objects,
];
newValueHP = newBaseHP + this.data.actor.system.attributes.hp.bonus;
newMaxHP = newValueHP;
}

// load audit log, check for valid data, add new entry
let auditLog = this.data.actor.system?.auditlog ?? {};
if (auditLog.constructor !== Object) auditLog = {};

const itemNames = [];
allItems.forEach(x => itemNames.push(x.name));
auditLog[this.data.targetLevel] = {
baseHP: newBaseHP,
itemsGained: itemNames,
};

// update values on actor
await this.data.actor.update({
"system.level.value": this.data.targetLevel,
"system.level.xp": newXP,
"system.attributes.hp.base": newBaseHP,
"system.attributes.hp.max": newMaxHP,
"system.attributes.hp.value": newValueHP,
"system.auditLog": auditLog,
"system.level.value": this.data.targetLevel,
"system.level.xp": newXP,
});

// add talents and spells to actor
await this.data.actor.createEmbeddedDocuments("Item", allItems);

this.close();
}
}
19 changes: 19 additions & 0 deletions system/src/migrations/updates/Update_240910_1.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { UpdateBaseSD } from "../UpdateBaseSD.mjs";

export default class Update_240910_1 extends UpdateBaseSD {
static version = 240910.1;

async updateActor(actorData) {
if (actorData.type !== "Player") return;
if (actorData.system.attributes.hp.max !== 0) return;

const maxHP = actorData.system.attributes.hp.base
+ actorData.system.attributes.hp.bonus;

const updateData = {
"system.attributes.hp.max": maxHP,
};

return updateData;
}
}
1 change: 1 addition & 0 deletions system/src/migrations/updates/_module.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ export {default as Update_231025_1} from "./Update_231025_1.mjs";
export {default as Update_231112_1} from "./Update_231112_1.mjs";
export {default as Update_231125_1} from "./Update_231125_1.mjs";
export {default as Update_231216_1} from "./Update_231216_1.mjs";
export {default as Update_240910_1} from "./Update_240910_1.mjs";
2 changes: 1 addition & 1 deletion system/system.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "shadowdark",
"title": "Shadowdark RPG",
"description": "A system for playing the Shadowdark RPG from Arcane Library",
"version": "3.1.1",
"version": "3.1.2",
"compatibility": {
"minimum": "12",
"verified": "12"
Expand Down