More WIP on 0.8.x migration

This commit is contained in:
Johannes Loher 2021-06-30 03:53:52 +02:00
parent ef01698178
commit 6b39284164
16 changed files with 427 additions and 321 deletions

View file

@ -5,12 +5,18 @@
import { ModifiableDataBaseTotal } from "../common/common-data";
import { DS4 } from "../config";
import { DS4Item } from "../item/item";
import { ItemType } from "../item/item-data";
import { DS4ArmorPreparedData, DS4ShieldPreparedData } from "../item/item-prepared-data";
import { ItemType } from "../item/item-data-source";
import { DS4ArmorDataProperties, DS4ShieldDataProperties } from "../item/item-data-properties";
import { createCheckRoll } from "../rolls/check-factory";
import { isAttribute, isTrait } from "./actor-data-source";
import { Check } from "./actor-data-properties";
import { DS4Item } from "../item/item";
declare global {
interface DocumentClassConfig {
Actor: typeof DS4Actor;
}
}
/**
* The Actor class for DS4
@ -84,9 +90,9 @@ export class DS4Actor extends Actor {
(changes: (foundry.data.ActiveEffectData["changes"][number] & { effect: ActiveEffect })[], e) => {
if (e.data.disabled) return changes;
const item = this.getOriginatingItemOfActiveEffect(e);
if (item?.isNonEquippedEuipable()) return changes; // TODO: DS4Item
if (item?.isNonEquippedEuipable()) return changes;
const factor = item?.activeEffectFactor ?? 1; // TODO: DS4Item
const factor = item?.activeEffectFactor ?? 1;
const newChanges = e.data.changes.filter(predicate).flatMap((c) => {
const changeSource = c.toObject();
@ -110,8 +116,7 @@ export class DS4Actor extends Actor {
this.overrides = expandObject({ ...flattenObject(this.overrides), ...overrides });
}
// TODO: returns DS4Item | undefined
protected getOriginatingItemOfActiveEffect(effect: ActiveEffect): Item | undefined {
protected getOriginatingItemOfActiveEffect(effect: ActiveEffect): DS4Item | undefined {
return this.items.find((item) => item.uuid === effect.data.origin);
}
@ -272,7 +277,6 @@ export class DS4Actor extends Actor {
* Handle how changes to a Token attribute bar are applied to the Actor.
* This only differs from the base implementation by also allowing negative values.
* @override
* TODO: Adjust return type
*/
async modifyTokenAttribute(
attribute: string,