Add maximumCoupResult and minimumFumbleResult to actor data

This commit is contained in:
Johannes Loher 2021-03-04 00:41:57 +01:00
parent 87205f6193
commit b07ee31b38
3 changed files with 16 additions and 3 deletions

View file

@ -65,11 +65,15 @@ export class DS4Item extends Item<DS4ItemData> {
);
}
const owner = (this.actor as unknown) as DS4Actor; // TODO(types): Improve so that the concrete Actor type is known here
const ownerDataData = ((this.actor as unknown) as DS4Actor).data.data; // TODO(types): Improve so that the concrete Actor type is known here
const weaponBonus = this.data.data.weaponBonus;
const combatValue = await this.getCombatValueKeyForAttackType(this.data.data.attackType);
const checkTargetValue = (owner.data.data.combatValues[combatValue].total as number) + weaponBonus;
await createCheckRoll(checkTargetValue, { rollMode: game.settings.get("core", "rollMode") }); // TODO: Get maxCritSuccess and minCritFailure from Actor once we store them there
const checkTargetValue = (ownerDataData.combatValues[combatValue].total as number) + weaponBonus;
await createCheckRoll(checkTargetValue, {
rollMode: game.settings.get("core", "rollMode"),
maxCritSuccess: ownerDataData.rolling.maximumCoupResult,
minCritFailure: ownerDataData.rolling.minimumFumbleResult,
});
}
private async getCombatValueKeyForAttackType(attackType: AttackType): Promise<"meleeAttack" | "rangedAttack"> {