Pristine copy of the installed deltagreen 1.7.0 release build. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
60 lines
1.4 KiB
JavaScript
60 lines
1.4 KiB
JavaScript
import { DGDamageRoll, DGLethalityRoll } from "../roll/roll.js";
|
|
|
|
/**
|
|
* Extend the basic Item with some very simple modifications.
|
|
* @extends {Item}
|
|
*/
|
|
export default class DeltaGreenItem extends Item {
|
|
/**
|
|
* Augment the basic Item data model with additional dynamic data.
|
|
*/
|
|
prepareData() {
|
|
super.prepareData();
|
|
|
|
// Get the Item's data
|
|
const itemData = this;
|
|
const actorData = this.actor || {};
|
|
const { system } = itemData;
|
|
}
|
|
|
|
/**
|
|
* Handle clickable rolls.
|
|
* @param {Event} event The originating click event
|
|
* @private
|
|
*/
|
|
async roll(isCrit = false) {
|
|
// Basic template rendering data
|
|
const item = this;
|
|
const { actor } = this;
|
|
const actorSystemData = this.actor.system || {};
|
|
|
|
let roll;
|
|
if (item.system.isLethal) {
|
|
roll = new DGLethalityRoll(
|
|
"1D100",
|
|
{},
|
|
{ rollType: "lethality", actor, item },
|
|
);
|
|
} else {
|
|
// regular damage roll
|
|
let diceFormula = item.system.damage;
|
|
const skillType = item.system.skill;
|
|
|
|
if (skillType === "unarmed_combat" || skillType === "melee_weapons") {
|
|
diceFormula += actorSystemData.statistics.str.meleeDamageBonusFormula;
|
|
}
|
|
|
|
if (isCrit) {
|
|
diceFormula = `2*(${diceFormula})`;
|
|
}
|
|
|
|
roll = new DGDamageRoll(
|
|
diceFormula,
|
|
{},
|
|
{ rollType: "damage", actor, item },
|
|
);
|
|
}
|
|
return actor.sheet.processRoll({}, roll);
|
|
}
|
|
}
|