Begin working on making there be per-subtype classes for class methods

This commit is contained in:
Oliver-Akins 2024-01-07 00:54:16 -07:00
parent b4dcad9eee
commit 07bebdba4d
6 changed files with 88 additions and 25 deletions

View file

@ -0,0 +1,22 @@
import { PlayerActor } from "./Player.mjs";
export class ActorHandler extends Actor {
actorTypes = {
player: PlayerActor,
};
constructor(data, ctx) {
super(data, ctx);
};
/** @type {class|undefined} */
get fn() {
return this.actorTypes[this.type];
};
createCustomSpell() {
if (!this.fn?.createCustomSpell) return;
this.fn.createCustomSpell.bind(this)();
this.sheet.render(true);
};
};

View file

@ -0,0 +1,10 @@
export class PlayerActor {
static createCustomSpell() {
let customUUID = `Spell.Custom.${randomID()}`;
this.system.spells[customUUID] = {
name: ``,
cost: ``,
description: ``,
};
};
};