Remove some unnecessary casts and fallbacks
This commit is contained in:
parent
17633ced68
commit
cb5ad74a71
2 changed files with 11 additions and 13 deletions
|
@ -75,7 +75,7 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item, DS4ActorPreparedData>
|
|||
|
||||
return changes.concat(
|
||||
e.data.changes.filter(predicate).flatMap((c) => {
|
||||
const duplicatedChange = duplicate(c) as ActiveEffect.Change;
|
||||
const duplicatedChange = duplicate(c);
|
||||
duplicatedChange.priority = duplicatedChange.priority ?? duplicatedChange.mode * 10;
|
||||
return Array(factor).fill({
|
||||
...duplicatedChange,
|
||||
|
@ -172,19 +172,17 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item, DS4ActorPreparedData>
|
|||
const data = this.data.data;
|
||||
const armorValueOfEquippedItems = this._calculateArmorValueOfEquippedItems();
|
||||
|
||||
data.combatValues.hitPoints.base =
|
||||
(data.attributes.body.total ?? 0) + (data.traits.constitution.total ?? 0) + 10;
|
||||
data.combatValues.hitPoints.base = data.attributes.body.total + data.traits.constitution.total + 10;
|
||||
data.combatValues.defense.base =
|
||||
(data.attributes.body.total ?? 0) + (data.traits.constitution.total ?? 0) + armorValueOfEquippedItems;
|
||||
data.combatValues.initiative.base = (data.attributes.mobility.total ?? 0) + (data.traits.agility.total ?? 0);
|
||||
data.combatValues.movement.base = (data.attributes.mobility.total ?? 0) / 2 + 1;
|
||||
data.combatValues.meleeAttack.base = (data.attributes.body.total ?? 0) + (data.traits.strength.total ?? 0);
|
||||
data.combatValues.rangedAttack.base =
|
||||
(data.attributes.mobility.total ?? 0) + (data.traits.dexterity.total ?? 0);
|
||||
data.attributes.body.total + data.traits.constitution.total + armorValueOfEquippedItems;
|
||||
data.combatValues.initiative.base = data.attributes.mobility.total + data.traits.agility.total;
|
||||
data.combatValues.movement.base = data.attributes.mobility.total / 2 + 1;
|
||||
data.combatValues.meleeAttack.base = data.attributes.body.total + data.traits.strength.total;
|
||||
data.combatValues.rangedAttack.base = data.attributes.mobility.total + data.traits.dexterity.total;
|
||||
data.combatValues.spellcasting.base =
|
||||
(data.attributes.mind.total ?? 0) + (data.traits.aura.total ?? 0) - armorValueOfEquippedItems;
|
||||
data.attributes.mind.total + data.traits.aura.total - armorValueOfEquippedItems;
|
||||
data.combatValues.targetedSpellcasting.base =
|
||||
(data.attributes.mind.total ?? 0) + (data.traits.dexterity.total ?? 0) - armorValueOfEquippedItems;
|
||||
data.attributes.mind.total + data.traits.dexterity.total - armorValueOfEquippedItems;
|
||||
|
||||
Object.values(data.combatValues).forEach(
|
||||
(combatValue: ModifiableDataBaseTotal<number>) => (combatValue.total = combatValue.base + combatValue.mod),
|
||||
|
|
|
@ -94,7 +94,7 @@ export class DS4Item extends Item<DS4ItemData, DS4ItemPreparedData> {
|
|||
const ownerDataData = actor.data.data;
|
||||
const weaponBonus = this.data.data.weaponBonus;
|
||||
const combatValue = await this.getCombatValueKeyForAttackType(this.data.data.attackType);
|
||||
const checkTargetNumber = (ownerDataData.combatValues[combatValue].total as number) + weaponBonus;
|
||||
const checkTargetNumber = ownerDataData.combatValues[combatValue].total + weaponBonus;
|
||||
|
||||
await createCheckRoll(checkTargetNumber, {
|
||||
rollMode: game.settings.get("core", "rollMode") as Const.DiceRollMode, // TODO(types): Type this setting in upstream
|
||||
|
@ -138,7 +138,7 @@ export class DS4Item extends Item<DS4ItemData, DS4ItemPreparedData> {
|
|||
);
|
||||
}
|
||||
const spellType = this.data.data.spellType;
|
||||
const checkTargetNumber = (ownerDataData.combatValues[spellType].total as number) + (spellBonus ?? 0);
|
||||
const checkTargetNumber = ownerDataData.combatValues[spellType].total + (spellBonus ?? 0);
|
||||
|
||||
await createCheckRoll(checkTargetNumber, {
|
||||
rollMode: game.settings.get("core", "rollMode") as Const.DiceRollMode, // TODO(types): Type this setting in upstream
|
||||
|
|
Loading…
Reference in a new issue