Upgrade
This commit is contained in:
@ -2,7 +2,10 @@
|
||||
import { SoSDialogCombatActions } from "./sos-dialog-combat-actions.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class SoSUtility {
|
||||
const severity2malus = { "none": 0, "light": -1, "moderate": -2, "severe": -3, "critical": -4};
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class SoSUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async preloadHandlebarsTemplates() {
|
||||
@ -16,6 +19,8 @@ import { SoSDialogCombatActions } from "./sos-dialog-combat-actions.js";
|
||||
'systems/foundryvtt-shadows-over-sol/templates/item-sheet.html',
|
||||
'systems/foundryvtt-shadows-over-sol/templates/item-geneline-sheet.html',
|
||||
'systems/foundryvtt-shadows-over-sol/templates/item-subculture-sheet.html',
|
||||
'systems/foundryvtt-shadows-over-sol/templates/item-weapon-sheet.html',
|
||||
'systems/foundryvtt-shadows-over-sol/templates/item-commongear-sheet.html',
|
||||
|
||||
'systems/foundryvtt-shadows-over-sol/templates/dialog-flip.html'
|
||||
]
|
||||
@ -82,6 +87,23 @@ import { SoSDialogCombatActions } from "./sos-dialog-combat-actions.js";
|
||||
d.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getConsequenceMalus(severity) {
|
||||
return severity2malus[severity] ?? 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static computeEncumbrance( items) {
|
||||
let trappings = items.filter( item => item.type == 'gear' || item.type == 'armor' || item.type == 'weapon' );
|
||||
let sumEnc = 0;
|
||||
for (let object of trappings) {
|
||||
if ( (!object.data.worn) && (!object.data.neg) && (!object.data.containerid || object.data.containerid == "") ) {
|
||||
sumEnc += (object.big > 0) ? object.big : 1;
|
||||
}
|
||||
}
|
||||
return sumEnc;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static closeAction(event) {
|
||||
let uniqId = event.currentTarget.attributes['data-uniq-id'].value;
|
||||
|
Reference in New Issue
Block a user