Merge branch 'old-system' into 'master'

Fix NPCs

See merge request wintermyst/kidsonbrooms!7
This commit is contained in:
WinterMyst 2024-09-27 21:33:09 +00:00
commit efa4ac6457
3 changed files with 18 additions and 5 deletions

View File

@ -7,7 +7,7 @@ export class KidsOnBroomsActor extends Actor {
/** /**
* Override getRollData() that's supplied to rolls. * Override getRollData() that's supplied to rolls.
*/ */
getRollData() { getRollDataPC() {
let data = { ...this.system }; let data = { ...this.system };
// Wand bonuses // Wand bonuses
@ -19,6 +19,12 @@ export class KidsOnBroomsActor extends Actor {
return data; return data;
} }
getRollDataNPC() {
let data = { ...this.system};
return data;
}
_getWandBonus(type) { _getWandBonus(type) {
const bonuses = { const bonuses = {
"Wisteria": { stat: "brains", bonus: 1 }, "Wisteria": { stat: "brains", bonus: 1 },

View File

@ -40,8 +40,6 @@ async getData()
// Add roll data for TinyMCE editors. // Add roll data for TinyMCE editors.
context.rollData = context.actor.getRollData(); context.rollData = context.actor.getRollData();
// Add roll data for TinyMCE editors.
context.rollData = context.actor.getRollData();
console.log(context); console.log(context);
@ -87,7 +85,16 @@ async getData()
if (dataset.roll) { if (dataset.roll) {
let label = dataset.label ? `${dataset.label}` : ''; let label = dataset.label ? `${dataset.label}` : '';
// Get the roll data and include wand bonuses // Get the roll data and include wand bonuses
let rollData = this.actor.getRollData();
let rollData;
if(this.actor.type == "character") {
rollData = this.actor.getRollDataPC();
} else if (this.actor.type == "npc") {
rollData = this.actor.getRollDataNPC();
} else {
console.log("ERROR: UNKNOWN AUTHOR TYPE");
return;
}
let totalBonus = 0; let totalBonus = 0;
console.log(dataset.roll); console.log(dataset.roll);
// Apply wood bonus if it matches the stat being rolled for // Apply wood bonus if it matches the stat being rolled for

View File

@ -25,7 +25,7 @@
<!-- Magic rolling and input --> <!-- Magic rolling and input -->
<Fieldset class="flexrow flex-group-center"> <Fieldset class="flexrow flex-group-center">
<legend>Magic</legend> <legend>Magic</legend>
<span class="ability-mod rollable" data-roll="1{{stat.value}}x+1d4+{{stat.stat}}" data-label="Magic Roll for {{key}}" data-key="{{key}}"> <span class="ability-mod rollable" data-roll="1{{stat.value}}x+1d4x+{{stat.stat}}" data-label="Magic Roll for {{key}}" data-key="{{key}}">
<i class="fas fa-dice-d20"></i> <i class="fas fa-dice-d20"></i>
</span> </span>
</Fieldset> </Fieldset>