Fix apv2, WIP
This commit is contained in:
@@ -3,44 +3,7 @@
|
||||
* Extend the base Actor document by defining a custom roll data structure which is ideal for the Simple system.
|
||||
* @extends {Actor}
|
||||
*/
|
||||
export class VermineActor extends Actor {
|
||||
|
||||
/** @override */
|
||||
prepareBaseData() {
|
||||
// Data modifications in this step occur before processing embedded
|
||||
// documents or derived data.
|
||||
|
||||
// Initialize wound data to prevent undefined errors with active effects
|
||||
if (!this.system.minorWound) this.system.minorWound = { value: 0, min: 0, max: 5, threshold: 1 };
|
||||
if (!this.system.majorWound) this.system.majorWound = { value: 0, min: 0, max: 4, threshold: 4 };
|
||||
if (!this.system.deadlyWound) this.system.deadlyWound = { value: 0, min: 0, max: 2, threshold: 8 };
|
||||
|
||||
// Initialize combatStatus to prevent errors
|
||||
if (!this.system.combatStatus) {
|
||||
this.system.combatStatus = { difficulty: "9", label: "Passif" };
|
||||
}
|
||||
|
||||
if (this.type == 'character') {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** @override */
|
||||
prepareEmbeddedDocuments() {
|
||||
// Check if effects are already being applied in this preparation cycle
|
||||
// In Foundry V11+, the parent prepareEmbeddedDocuments() calls applyActiveEffects()
|
||||
// If this is called multiple times in the same cycle, we get the "phase already completed" error
|
||||
const phase = this.effects?.applicationPhase;
|
||||
|
||||
// If we're already in the middle of applying effects (initial or final phase),
|
||||
// don't call super as it would try to apply effects again
|
||||
if (phase === "initial" || phase === "final") {
|
||||
return;
|
||||
}
|
||||
|
||||
// If effects haven't been applied yet, proceed normally
|
||||
super.prepareEmbeddedDocuments();
|
||||
}
|
||||
export default class VermineActor extends Actor {
|
||||
|
||||
/**
|
||||
* @override
|
||||
|
||||
Reference in New Issue
Block a user