RC-21 | Hero | Guts Data
This commit is contained in:
parent
9f0fea1467
commit
4406531713
2 changed files with 22 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { barAttribute } from "../helpers.mjs";
|
||||||
import { gameTerms } from "../../gameTerms.mjs";
|
import { gameTerms } from "../../gameTerms.mjs";
|
||||||
|
|
||||||
const { fields } = foundry.data;
|
const { fields } = foundry.data;
|
||||||
|
|
@ -35,6 +36,7 @@ export class HeroData extends foundry.abstract.TypeDataModel {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
guts: barAttribute(0, 5),
|
||||||
coin: new fields.SchemaField({
|
coin: new fields.SchemaField({
|
||||||
gold: new fields.NumberField({
|
gold: new fields.NumberField({
|
||||||
initial: 5,
|
initial: 5,
|
||||||
|
|
|
||||||
20
module/data/helpers.mjs
Normal file
20
module/data/helpers.mjs
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
const { fields } = foundry.data;
|
||||||
|
|
||||||
|
export function barAttribute(min, initial, max = undefined) {
|
||||||
|
return new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({
|
||||||
|
min,
|
||||||
|
initial,
|
||||||
|
max,
|
||||||
|
integer: true,
|
||||||
|
nullable: false,
|
||||||
|
}),
|
||||||
|
max: new fields.NumberField({
|
||||||
|
min,
|
||||||
|
initial,
|
||||||
|
max,
|
||||||
|
integer: true,
|
||||||
|
nullable: false,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue