Add maximumCoupResult and minimumFumbleResult to actor data
This commit is contained in:
parent
87205f6193
commit
b07ee31b38
3 changed files with 16 additions and 3 deletions
|
@ -17,6 +17,7 @@ interface DS4ActorDataDataBase {
|
|||
attributes: DS4ActorDataDataAttributes;
|
||||
traits: DS4ActorDataDataTraits;
|
||||
combatValues: DS4ActorDataDataCombatValues;
|
||||
rolling: DS4ActorDataDataRolling;
|
||||
}
|
||||
|
||||
interface DS4ActorDataDataAttributes {
|
||||
|
@ -45,6 +46,11 @@ interface DS4ActorDataDataCombatValues {
|
|||
targetedSpellcasting: ModifiableData<number>;
|
||||
}
|
||||
|
||||
interface DS4ActorDataDataRolling {
|
||||
maximumCoupResult?: number;
|
||||
minimumFumbleResult?: number;
|
||||
}
|
||||
|
||||
interface DS4CharacterDataData extends DS4ActorDataDataBase {
|
||||
baseInfo: DS4CharacterDataDataBaseInfo;
|
||||
progression: DS4CharacterDataDataProgression;
|
||||
|
|
|
@ -25,6 +25,9 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item> {
|
|||
prepareBaseData(): void {
|
||||
const data = this.data;
|
||||
|
||||
data.data.rolling.minimumFumbleResult = 20;
|
||||
data.data.rolling.maximumCoupResult = 1;
|
||||
|
||||
const attributes = data.data.attributes;
|
||||
Object.values(attributes).forEach(
|
||||
(attribute: ModifiableData<number>) => (attribute.total = attribute.base + attribute.mod),
|
||||
|
|
|
@ -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"> {
|
||||
|
|
Loading…
Reference in a new issue