pifpouf
This commit is contained in:
+36
-24
@@ -21,10 +21,7 @@ export class VermineActor extends Actor {
|
||||
// documents or derived data.
|
||||
|
||||
if (this.type == 'character') {
|
||||
this._setAgeType();
|
||||
this._setCharacterEffort();
|
||||
this._setCharacterSelfControl();
|
||||
this._setCharacterThresholds();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,11 +41,41 @@ export class VermineActor extends Actor {
|
||||
|
||||
// Make separate methods for each Actor type (character, npc, etc.) to keep
|
||||
// things organized.
|
||||
this._prepareCharacterData(actorData);
|
||||
this._prepareNpcData(actorData);
|
||||
switch (this.type) {
|
||||
case "character":
|
||||
this._prepareCharacterData(actorData);
|
||||
break;
|
||||
case "npc":
|
||||
this._prepareNpcData(actorData);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare Character type specific data
|
||||
*/
|
||||
_prepareCharacterData(actorData) {
|
||||
if (actorData.type !== 'character') return;
|
||||
this._setAgeType();
|
||||
this._setCharacterEffort();
|
||||
this._setCharacterSelfControl();
|
||||
this._setCharacterThresholds();
|
||||
// Make modifications to data here. For example:
|
||||
const systemData = actorData.system;
|
||||
|
||||
// Loop through ability scores, and add their modifiers to our sheet output.
|
||||
for (let [key, ability] of Object.entries(systemData.abilities)) {
|
||||
// Calculate the modifier using d20 rules.
|
||||
ability.mod = Math.floor((ability.value - 10) / 2);
|
||||
}
|
||||
this.prepareCombatStatus();
|
||||
|
||||
}
|
||||
prepareCombatStatus() {
|
||||
//combat initiative reaction difficulty
|
||||
console.log(this.system.combatStatus)
|
||||
switch (parseInt(this.system.combatStatus.difficulty)) {
|
||||
case 5: this.system.combatStatus.label = "Offensif";
|
||||
break;
|
||||
@@ -59,26 +86,10 @@ export class VermineActor extends Actor {
|
||||
default:
|
||||
this.system.combatStatus.label = "Passif";
|
||||
this.system.combatStatus.difficulty = "9";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare Character type specific data
|
||||
*/
|
||||
_prepareCharacterData(actorData) {
|
||||
if (actorData.type !== 'character') return;
|
||||
|
||||
// Make modifications to data here. For example:
|
||||
const systemData = actorData.system;
|
||||
|
||||
// Loop through ability scores, and add their modifiers to our sheet output.
|
||||
for (let [key, ability] of Object.entries(systemData.abilities)) {
|
||||
// Calculate the modifier using d20 rules.
|
||||
ability.mod = Math.floor((ability.value - 10) / 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare NPC type specific data.
|
||||
*/
|
||||
@@ -88,6 +99,7 @@ export class VermineActor extends Actor {
|
||||
// Make modifications to data here. For example:
|
||||
const systemData = actorData.system;
|
||||
systemData.xp = (systemData.cr * systemData.cr) * 100;
|
||||
this.prepareCombatStatus()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -81,13 +81,13 @@ export class VermineItem extends Item {
|
||||
|
||||
// If there's no roll data, send a chat message.
|
||||
|
||||
let mess = new ChatMessage({
|
||||
let mess = {
|
||||
speaker: speaker,
|
||||
rollMode: rollMode,
|
||||
flavor: label,
|
||||
});
|
||||
};
|
||||
mess.content = await renderTemplate(`systems/vermine2047/templates/item/chatCards/${this.type}.html`, { item: this, message: mess }) ?? null;
|
||||
console.log(mess)
|
||||
ChatMessage.create(mess)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ export class TraitSelector extends Application {
|
||||
/* -------------------------------------------- */
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
id: "TRAITS_SELECTOR",
|
||||
classes: ["vermine2047", "trait-selector"],
|
||||
title: game.i18n.localize("VERMINE.traits_selector"),
|
||||
template: 'systems/vermine2047/templates/applications/choose-traits.hbs',
|
||||
popOut: true,
|
||||
@@ -161,7 +161,7 @@ export class TraitSelector extends Application {
|
||||
if (inp.type == "checkbox") {
|
||||
inp.checked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.render(true)
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ export default class RollDialog extends Dialog {
|
||||
}
|
||||
},
|
||||
close: close,
|
||||
|
||||
}
|
||||
return super({ ...conf, ...data }, options);
|
||||
};
|
||||
|
||||
@@ -43,6 +43,8 @@ export const preloadHandlebarsTemplates = async function () {
|
||||
"systems/vermine2047/templates/item/partials/traits.html",
|
||||
"systems/vermine2047/templates/item/partials/header.hbs",
|
||||
"systems/vermine2047/templates/item/partials/physicalItems.hbs",
|
||||
"systems/vermine2047/templates/item/chatCards/parts/base.html",
|
||||
|
||||
|
||||
]);
|
||||
};
|
||||
@@ -125,6 +127,7 @@ export const registerHandlebarsHelpers = function () {
|
||||
});
|
||||
//return damge data
|
||||
Handlebars.registerHelper('getDamagesData', function (damageObject, prop) {
|
||||
|
||||
let propObject = damageObject[prop]
|
||||
let propValue = propObject[damageObject.value - 1]
|
||||
return propValue
|
||||
|
||||
Reference in New Issue
Block a user