Add Templates Html + Gulp Sass + Css + Basic Tree and Files
- Add Templates Html - Gulp Sass - Css - Basic Tree and Files
This commit is contained in:
63
system/scripts/dice/dietype/AbilityDie.js
Normal file
63
system/scripts/dice/dietype/AbilityDie.js
Normal file
@@ -0,0 +1,63 @@
|
||||
export class AbilityDie extends DiceTerm {
|
||||
constructor(termData) {
|
||||
super(termData);
|
||||
this.faces = 8;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
static DENOMINATION = "a";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
get formula() {
|
||||
return `${this.number}${this.constructor.DENOMINATION}${this.modifiers.join("")}`;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
evaluate({ minimize = false, maximize = false } = {}) {
|
||||
if (this._evaluated) {
|
||||
throw new Error(`This ${this.constructor.name} has already been evaluated and is immutable`);
|
||||
}
|
||||
|
||||
// Roll the initial number of dice
|
||||
for (let n = 1; n <= this.number; n++) {
|
||||
this.roll({ minimize, maximize });
|
||||
}
|
||||
|
||||
// Apply modifiers
|
||||
this._evaluateModifiers();
|
||||
|
||||
// Combine all FFG results.
|
||||
this.ffg = { success: 0, failure: 0, advantage: 0, threat: 0, triumph: 0, despair: 0, light: 0, dark: 0 };
|
||||
this.results.forEach((result) => {
|
||||
this.ffg.success += parseInt(result.ffg.success);
|
||||
this.ffg.failure += parseInt(result.ffg.failure);
|
||||
this.ffg.advantage += parseInt(result.ffg.advantage);
|
||||
this.ffg.threat += parseInt(result.ffg.threat);
|
||||
this.ffg.triumph += parseInt(result.ffg.triumph);
|
||||
this.ffg.despair += parseInt(result.ffg.despair);
|
||||
this.ffg.light += parseInt(result.ffg.light);
|
||||
this.ffg.dark += parseInt(result.ffg.dark);
|
||||
});
|
||||
|
||||
// Return the evaluated term
|
||||
this._evaluated = true;
|
||||
this._isFFG = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
roll(options) {
|
||||
const roll = super.roll(options);
|
||||
roll.ffg = CONFIG.FFG.ABILITY_RESULTS[roll.result];
|
||||
return roll;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
static getResultLabel(result) {
|
||||
return CONFIG.FFG.ABILITY_RESULTS[result].label;
|
||||
}
|
||||
}
|
||||
63
system/scripts/dice/dietype/RingsDie.js
Normal file
63
system/scripts/dice/dietype/RingsDie.js
Normal file
@@ -0,0 +1,63 @@
|
||||
export class RingsDie extends DiceTerm {
|
||||
constructor(termData) {
|
||||
super(termData);
|
||||
this.faces = 12;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
static DENOMINATION = "p";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
get formula() {
|
||||
return `${this.number}${this.constructor.DENOMINATION}${this.modifiers.join("")}`;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
evaluate({ minimize = false, maximize = false } = {}) {
|
||||
if (this._evaluated) {
|
||||
throw new Error(`This ${this.constructor.name} has already been evaluated and is immutable`);
|
||||
}
|
||||
|
||||
// Roll the initial number of dice
|
||||
for (let n = 1; n <= this.number; n++) {
|
||||
this.roll({ minimize, maximize });
|
||||
}
|
||||
|
||||
// Apply modifiers
|
||||
this._evaluateModifiers();
|
||||
|
||||
// Combine all FFG results.
|
||||
this.ffg = { success: 0, failure: 0, advantage: 0, threat: 0, triumph: 0, despair: 0, light: 0, dark: 0 };
|
||||
this.results.forEach((result) => {
|
||||
this.ffg.success += parseInt(result.ffg.success);
|
||||
this.ffg.failure += parseInt(result.ffg.failure);
|
||||
this.ffg.advantage += parseInt(result.ffg.advantage);
|
||||
this.ffg.threat += parseInt(result.ffg.threat);
|
||||
this.ffg.triumph += parseInt(result.ffg.triumph);
|
||||
this.ffg.despair += parseInt(result.ffg.despair);
|
||||
this.ffg.light += parseInt(result.ffg.light);
|
||||
this.ffg.dark += parseInt(result.ffg.dark);
|
||||
});
|
||||
|
||||
// Return the evaluated term
|
||||
this._evaluated = true;
|
||||
this._isFFG = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
roll(options) {
|
||||
const roll = super.roll(options);
|
||||
roll.ffg = CONFIG.FFG.PROFICIENCY_RESULTS[roll.result];
|
||||
return roll;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
static getResultLabel(result) {
|
||||
return CONFIG.FFG.PROFICIENCY_RESULTS[result].label;
|
||||
}
|
||||
}
|
||||
8
system/scripts/dice/pool.js
Normal file
8
system/scripts/dice/pool.js
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
/**
|
||||
* Dice pool utility specializing in the FFG special dice
|
||||
*/
|
||||
export class DicePoolL5r5e {
|
||||
|
||||
}
|
||||
8
system/scripts/dice/roll.js
Normal file
8
system/scripts/dice/roll.js
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
/**
|
||||
* New extension of the core DicePool class for evaluating rolls with the FFG DiceTerms
|
||||
*/
|
||||
export class RollL5r5e extends Roll {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user