mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Remove DualityDie class (#535)
This commit is contained in:
parent
c0661dbca6
commit
ef42f1f782
4 changed files with 11 additions and 23 deletions
|
|
@ -8,7 +8,7 @@ import RegisterHandlebarsHelpers from './module/helpers/handlebarsHelper.mjs';
|
||||||
import { enricherConfig, enricherRenderSetup } from './module/enrichers/_module.mjs';
|
import { enricherConfig, enricherRenderSetup } from './module/enrichers/_module.mjs';
|
||||||
import { getCommandTarget, rollCommandToJSON } from './module/helpers/utils.mjs';
|
import { getCommandTarget, rollCommandToJSON } from './module/helpers/utils.mjs';
|
||||||
import { NarrativeCountdowns } from './module/applications/ui/countdowns.mjs';
|
import { NarrativeCountdowns } from './module/applications/ui/countdowns.mjs';
|
||||||
import { DHRoll, DualityRoll, D20Roll, DamageRoll, DualityDie } from './module/dice/_module.mjs';
|
import { DHRoll, DualityRoll, D20Roll, DamageRoll } from './module/dice/_module.mjs';
|
||||||
import { enrichedDualityRoll } from './module/enrichers/DualityRollEnricher.mjs';
|
import { enrichedDualityRoll } from './module/enrichers/DualityRollEnricher.mjs';
|
||||||
import { registerCountdownHooks } from './module/data/countdowns.mjs';
|
import { registerCountdownHooks } from './module/data/countdowns.mjs';
|
||||||
import {
|
import {
|
||||||
|
|
@ -42,18 +42,12 @@ Hooks.once('init', () => {
|
||||||
];
|
];
|
||||||
|
|
||||||
CONFIG.Dice.daggerheart = {
|
CONFIG.Dice.daggerheart = {
|
||||||
DualityDie: DualityDie,
|
|
||||||
DHRoll: DHRoll,
|
DHRoll: DHRoll,
|
||||||
DualityRoll: DualityRoll,
|
DualityRoll: DualityRoll,
|
||||||
D20Roll: D20Roll,
|
D20Roll: D20Roll,
|
||||||
DamageRoll: DamageRoll
|
DamageRoll: DamageRoll
|
||||||
};
|
};
|
||||||
|
|
||||||
CONFIG.Dice.terms = {
|
|
||||||
...CONFIG.Dice.terms,
|
|
||||||
DualityDie
|
|
||||||
};
|
|
||||||
|
|
||||||
CONFIG.Dice.rolls = [...CONFIG.Dice.rolls, DHRoll, DualityRoll, D20Roll, DamageRoll];
|
CONFIG.Dice.rolls = [...CONFIG.Dice.rolls, DHRoll, DualityRoll, D20Roll, DamageRoll];
|
||||||
Roll.CHAT_TEMPLATE = 'systems/daggerheart/templates/ui/chat/foundryRoll.hbs';
|
Roll.CHAT_TEMPLATE = 'systems/daggerheart/templates/ui/chat/foundryRoll.hbs';
|
||||||
Roll.TOOLTIP_TEMPLATE = 'systems/daggerheart/templates/ui/chat/foundryRollTooltip.hbs';
|
Roll.TOOLTIP_TEMPLATE = 'systems/daggerheart/templates/ui/chat/foundryRollTooltip.hbs';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
export { default as D20Roll } from './d20Roll.mjs';
|
export { default as D20Roll } from './d20Roll.mjs';
|
||||||
export { default as DamageRoll } from './damageRoll.mjs';
|
export { default as DamageRoll } from './damageRoll.mjs';
|
||||||
export { default as DHRoll } from './dhRoll.mjs';
|
export { default as DHRoll } from './dhRoll.mjs';
|
||||||
export { default as DualityDie } from './dualityDie.mjs';
|
|
||||||
export { default as DualityRoll } from './dualityRoll.mjs';
|
export { default as DualityRoll } from './dualityRoll.mjs';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
export default class DualityDie extends foundry.dice.terms.Die {
|
|
||||||
constructor({ number = 1, faces = 12, ...args } = {}) {
|
|
||||||
super({ number, faces, ...args });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -25,26 +25,26 @@ export default class DualityRoll extends D20Roll {
|
||||||
|
|
||||||
get dHope() {
|
get dHope() {
|
||||||
// if ( !(this.terms[0] instanceof foundry.dice.terms.Die) ) return;
|
// if ( !(this.terms[0] instanceof foundry.dice.terms.Die) ) return;
|
||||||
if (!(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
|
if (!(this.dice[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
|
||||||
return this.dice[0];
|
return this.dice[0];
|
||||||
// return this.#hopeDice;
|
// return this.#hopeDice;
|
||||||
}
|
}
|
||||||
|
|
||||||
set dHope(faces) {
|
set dHope(faces) {
|
||||||
if (!(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
|
if (!(this.dice[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
|
||||||
this.terms[0].faces = this.getFaces(faces);
|
this.terms[0].faces = this.getFaces(faces);
|
||||||
// this.#hopeDice = `d${face}`;
|
// this.#hopeDice = `d${face}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
get dFear() {
|
get dFear() {
|
||||||
// if ( !(this.terms[1] instanceof foundry.dice.terms.Die) ) return;
|
// if ( !(this.terms[1] instanceof foundry.dice.terms.Die) ) return;
|
||||||
if (!(this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
|
if (!(this.dice[1] instanceof foundry.dice.terms.Die)) this.createBaseDice();
|
||||||
return this.dice[1];
|
return this.dice[1];
|
||||||
// return this.#fearDice;
|
// return this.#fearDice;
|
||||||
}
|
}
|
||||||
|
|
||||||
set dFear(faces) {
|
set dFear(faces) {
|
||||||
if (!(this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
|
if (!(this.dice[1] instanceof foundry.dice.terms.Die)) this.createBaseDice();
|
||||||
this.dice[1].faces = this.getFaces(faces);
|
this.dice[1].faces = this.getFaces(faces);
|
||||||
// this.#fearDice = `d${face}`;
|
// this.#fearDice = `d${face}`;
|
||||||
}
|
}
|
||||||
|
|
@ -119,22 +119,22 @@ export default class DualityRoll extends D20Roll {
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
static fromData(data) {
|
static fromData(data) {
|
||||||
data.terms[0].class = game.system.api.dice.DualityDie.name;
|
data.terms[0].class = foundry.dice.terms.Die.name;
|
||||||
data.terms[2].class = game.system.api.dice.DualityDie.name;
|
data.terms[2].class = foundry.dice.terms.Die.name;
|
||||||
return super.fromData(data);
|
return super.fromData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
createBaseDice() {
|
createBaseDice() {
|
||||||
if (
|
if (
|
||||||
this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie &&
|
this.dice[0] instanceof foundry.dice.terms.Die &&
|
||||||
this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie
|
this.dice[1] instanceof foundry.dice.terms.Die
|
||||||
) {
|
) {
|
||||||
this.terms = [this.terms[0], this.terms[1], this.terms[2]];
|
this.terms = [this.terms[0], this.terms[1], this.terms[2]];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.terms[0] = new CONFIG.Dice.daggerheart.DualityDie();
|
this.terms[0] = new foundry.dice.terms.Die({ faces: 12 });
|
||||||
this.terms[1] = new foundry.dice.terms.OperatorTerm({ operator: '+' });
|
this.terms[1] = new foundry.dice.terms.OperatorTerm({ operator: '+' });
|
||||||
this.terms[2] = new CONFIG.Dice.daggerheart.DualityDie();
|
this.terms[2] = new foundry.dice.terms.Die({ faces: 12 });
|
||||||
}
|
}
|
||||||
|
|
||||||
applyAdvantage() {
|
applyAdvantage() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue