Merge remote-tracking branch 'origin/master' into 024-not-possible-to-manage-active-effects-on-owned-items

This commit is contained in:
Johannes Loher 2021-01-08 00:00:11 +01:00
commit 2a03ed273f
12 changed files with 126 additions and 50 deletions

View file

@ -25,8 +25,9 @@ interface UsableResource<T> {
used: T;
}
interface CurrentData<T> extends ModifiableData<T> {
current: T;
interface ResourceData<T> extends ModifiableData<T> {
value: T;
max?: T;
}
// Blueprint in case we need more detailed differentiation
@ -42,7 +43,7 @@ interface DS4ActorDataTraits {
}
interface DS4ActorDataCombatValues {
hitPoints: CurrentData<number>;
hitPoints: ResourceData<number>;
defense: ModifiableData<number>;
initiative: ModifiableData<number>;
movement: ModifiableData<number>;

View file

@ -18,5 +18,7 @@ export class DS4Actor extends Actor<DS4ActorDataType, DS4ItemDataType, DS4Item>
Object.values(combatValues).forEach(
(combatValue: ModifiableData<number>) => (combatValue.total = combatValue.base + combatValue.mod),
);
combatValues.hitPoints.max = combatValues.hitPoints.total;
}
}

View file

@ -49,6 +49,7 @@ export const DS4 = {
trinket: "DS4.ItemTypeTrinket",
equipment: "DS4.ItemTypeEquipment",
talent: "DS4.ItemTypeTalent",
racialAbility: "DS4.ItemTypeRacialAbility",
},
/**

View file

@ -1,6 +1,13 @@
import { ModifiableData } from "../actor/actor-data";
export type DS4ItemDataType = DS4Weapon | DS4Armor | DS4Shield | DS4Trinket | DS4Equipment | DS4Talent;
export type DS4ItemDataType =
| DS4Weapon
| DS4Armor
| DS4Shield
| DS4Trinket
| DS4Equipment
| DS4Talent
| DS4RacialAbility;
// types
@ -26,6 +33,7 @@ interface DS4TalentRank extends ModifiableData<number> {
interface DS4Shield extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable, DS4ItemProtective {}
interface DS4Trinket extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable {}
interface DS4Equipment extends DS4ItemBase, DS4ItemPhysical {}
type DS4RacialAbility = DS4ItemBase;
// templates