This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
foundryvtt-beam-saber/module/blades-item.js
megastruktur 11b5b3b5b0
GH-51 Dice Macro
- Closes #51
- Adds Dice Rolling buttons to Character Sheet
- Adds Dice Rolling button to Tools panel
- Refactors file names
2020-05-25 19:00:53 +03:00

51 lines
923 B
JavaScript

/**
* Extend the basic Item
* @extends {Item}
*/
export class BladesItem extends Item {
/* override */
prepareData() {
super.prepareData();
const item_data = this.data;
const data = item_data.data;
if (item_data.type === "cohort") {
this._prepareCohort(data);
}
}
/**
* Prepares Cohort data
*
* @param {object} data
*/
_prepareCohort(data) {
let quality = 0;
let scale = 0;
// Adds Scale and Quality
if (this.actor) {
switch (data.cohort[0]) {
case "Gang":
scale = parseInt(this.actor.data.data.tier[0]);
quality = parseInt(this.actor.data.data.tier[0]);
break;
case "Expert":
scale = 1;
quality = parseInt(this.actor.data.data.tier[0]) + 1;
break;
}
}
data.scale = scale;
data.quality = quality;
this.data.data = data;
}
}