Begin working on making there be per-subtype classes for class methods
This commit is contained in:
parent
b4dcad9eee
commit
07bebdba4d
6 changed files with 88 additions and 25 deletions
22
module/documents/Actor/Handler.mjs
Normal file
22
module/documents/Actor/Handler.mjs
Normal 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);
|
||||
};
|
||||
};
|
||||
10
module/documents/Actor/Player.mjs
Normal file
10
module/documents/Actor/Player.mjs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export class PlayerActor {
|
||||
static createCustomSpell() {
|
||||
let customUUID = `Spell.Custom.${randomID()}`;
|
||||
this.system.spells[customUUID] = {
|
||||
name: ``,
|
||||
cost: ``,
|
||||
description: ``,
|
||||
};
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue