Work on creating more of the necessary data models
This commit is contained in:
parent
ef9a3f2542
commit
eb8d4f7c11
8 changed files with 56 additions and 15 deletions
|
|
@ -8,10 +8,10 @@ const ammoTypes = [`quivers`, `mags`, `cells`];
|
||||||
|
|
||||||
const stats = [ `build`, `meta`, `presence`, `hands`, `tilt`, `rng` ];
|
const stats = [ `build`, `meta`, `presence`, `hands`, `tilt`, `rng` ];
|
||||||
|
|
||||||
const buildSkills = [ "defense", "magic", "melee", "platforming", "strength", ];
|
const buildSkills = [ `defense`, `magic`, `melee`, `platforming`, `strength`, ];
|
||||||
const metaSkills = [ "alchemy", "arcanum", "dreams", "lore", "navigation", ];
|
const metaSkills = [ `alchemy`, `arcanum`, `dreams`, `lore`, `navigation`, ];
|
||||||
const presenceSkills = [ "animal_handling", "perception", "sneak", "speech", "vibes", ];
|
const presenceSkills = [ `animal_handling`, `perception`, `sneak`, `speech`, `vibes`, ];
|
||||||
const handsSkills = [ "accuracy", "crafting", "engineering", "explosives", "piloting", ];
|
const handsSkills = [ `accuracy`, `crafting`, `engineering`, `explosives`, `piloting`, ];
|
||||||
|
|
||||||
const allSkills = [
|
const allSkills = [
|
||||||
...buildSkills,
|
...buildSkills,
|
||||||
|
|
@ -27,6 +27,11 @@ const skills = {
|
||||||
hands: handsSkills,
|
hands: handsSkills,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const itemTiers = [
|
||||||
|
`simple`, `greater`,
|
||||||
|
`rare`, `legendary`
|
||||||
|
];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
stats,
|
stats,
|
||||||
statDice,
|
statDice,
|
||||||
|
|
@ -39,4 +44,5 @@ export default {
|
||||||
handsSkills,
|
handsSkills,
|
||||||
allSkills,
|
allSkills,
|
||||||
skills,
|
skills,
|
||||||
|
itemTiers,
|
||||||
};
|
};
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import PlayerActor from "./Player.mjs";
|
import PlayerActor from "./Player.mjs";
|
||||||
|
|
||||||
|
/** @extends {Actor} */
|
||||||
export class ActorHandler extends Actor {
|
export class ActorHandler extends Actor {
|
||||||
proxyTargets = {
|
proxyTargets = {
|
||||||
player: PlayerActor,
|
player: PlayerActor,
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
import AspectItem from "./Aspect.mjs";
|
import AspectItem from "./Aspect.mjs";
|
||||||
|
import SpellItem from "./Spell.mjs";
|
||||||
|
|
||||||
/**
|
/** @extends {Item} */
|
||||||
* @extends {Item}
|
|
||||||
*/
|
|
||||||
export class ItemHandler extends Item {
|
export class ItemHandler extends Item {
|
||||||
/** @override */
|
|
||||||
|
|
||||||
proxyTargets = {
|
proxyTargets = {
|
||||||
aspect: AspectItem,
|
aspect: AspectItem,
|
||||||
|
spell: SpellItem
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(data, ctx) {
|
constructor(data, ctx) {
|
||||||
|
|
@ -19,6 +17,11 @@ export class ItemHandler extends Item {
|
||||||
return this.proxyTargets[this.type];
|
return this.proxyTargets[this.type];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async migrateSystemData() {
|
||||||
|
if (!this.fn?.migrateSystemData) return;
|
||||||
|
this.fn?.migrateSystemData.bind(this)();
|
||||||
|
};
|
||||||
|
|
||||||
async proxyFunction(funcName, ...args) {
|
async proxyFunction(funcName, ...args) {
|
||||||
if (!this.fn?.[funcName]) return;
|
if (!this.fn?.[funcName]) return;
|
||||||
return await this.fn?.[funcName].bind(this)(...args);
|
return await this.fn?.[funcName].bind(this)(...args);
|
||||||
|
|
|
||||||
10
module/documents/Item/Spell.mjs
Normal file
10
module/documents/Item/Spell.mjs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import { ItemHandler } from "./Handler.mjs";
|
||||||
|
|
||||||
|
/** @this {ItemHandler} */
|
||||||
|
async function migrateSystemData() {
|
||||||
|
this.system
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
migrateSystemData,
|
||||||
|
};
|
||||||
|
|
@ -1,11 +1,22 @@
|
||||||
|
import { itemTiers } from "../../config.mjs";
|
||||||
|
|
||||||
export class CommonItemData extends foundry.abstract.TypeDataModel {
|
export class CommonItemData extends foundry.abstract.TypeDataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
return {
|
return {
|
||||||
cost: new fields.NumberField({
|
buy: new fields.NumberField({
|
||||||
initial: null,
|
initial: null,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
}),
|
}),
|
||||||
|
usage_cost: new fields.NumberField({
|
||||||
|
initial: null,
|
||||||
|
nullable: true,
|
||||||
|
}),
|
||||||
|
tier: new fields.StringField({
|
||||||
|
initial: `simple`,
|
||||||
|
nullable: false,
|
||||||
|
choices: itemTiers,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
15
module/models/Item/Equipment.mjs
Normal file
15
module/models/Item/Equipment.mjs
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { DescribedItemData } from "./DescribedItemData.mjs";
|
||||||
|
|
||||||
|
export class EquipmentItemData extends DescribedItemData {
|
||||||
|
static defineSchema() {
|
||||||
|
const fields = foundry.data.fields;
|
||||||
|
return mergeObject(super.defineSchema(), {
|
||||||
|
extra_inventory: new fields.NumberField({
|
||||||
|
initial: null,
|
||||||
|
nullable: true,
|
||||||
|
required: false,
|
||||||
|
}),
|
||||||
|
material
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -4,7 +4,6 @@ export class PetItemData extends DescribedItemData {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
return mergeObject(super.defineSchema(), {
|
return mergeObject(super.defineSchema(), {
|
||||||
purchase: new fields.NumberField({ initial: 0, }),
|
|
||||||
upkeep: new fields.NumberField({ intial: null, nullable: true }),
|
upkeep: new fields.NumberField({ intial: null, nullable: true }),
|
||||||
pokeballd: new fields.BooleanField({ initial: false }),
|
pokeballd: new fields.BooleanField({ initial: false }),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,6 @@ export class TransportationItemData extends DescribedItemData {
|
||||||
initial: null,
|
initial: null,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
}),
|
}),
|
||||||
purchase: new fields.NumberField({
|
|
||||||
initial: null,
|
|
||||||
nullable: true,
|
|
||||||
}),
|
|
||||||
upkeep: new fields.NumberField({
|
upkeep: new fields.NumberField({
|
||||||
initial: null,
|
initial: null,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue