Initial system import

This commit is contained in:
2025-12-25 23:08:06 +01:00
commit 4beb5806eb
4623 changed files with 682363 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
export { default as HamalronArme } from "./arme.mjs"
export { default as HamalronArmure } from "./armure.mjs"
export { default as HamalronCompetence } from "./competence.mjs"
export { default as HamalronEquipement } from "./equipement.mjs"
export { default as HamalronFaction } from "./faction.mjs"
export { default as HamalronLangue } from "./langue.mjs"
export { default as HamalronPersonnage } from "./personnage.mjs"
export { default as HamalronPeuple } from "./peuple.mjs"
export { default as HamalronPNJ } from "./pnj.mjs"
export { default as HamalronRegion } from "./region.mjs"
export { default as HamalronSortilege } from "./sortilege.mjs"
export { default as HamalronTarot } from "./tarot.mjs"
+25
View File
@@ -0,0 +1,25 @@
import { SYSTEM } from "../config/system.mjs"
export default class HamalronArme extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const schema = {}
const requiredInteger = { required: true, nullable: false, integer: true }
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.weaponType = new fields.StringField({ required: true, initial: "melee", choices: Object.fromEntries(Object.entries(SYSTEM.WEAPON_TYPES).map(([key, val]) => [key, val.label])) })
schema.cout = new fields.NumberField({ required: true, initial: 0, min: 0 })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["HAMALRON.Arme"]
prepareDerivedData() {
super.prepareDerivedData();
let actor = this.parent?.actor;
}
}
+20
View File
@@ -0,0 +1,20 @@
import { SYSTEM } from "../config/system.mjs"
export default class HamalronArmure extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const schema = {}
const requiredInteger = { required: true, nullable: false, integer: true }
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.protection = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true })
schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["HAMALRON.Armure"]
}
+18
View File
@@ -0,0 +1,18 @@
import { SYSTEM } from "../config/system.mjs";
export default class HamalronCompetence extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields;
const schema = {};
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.type = new fields.StringField({ required: true, initial: "generale", choices: Object.fromEntries(Object.entries(SYSTEM.COMPETENCE_TYPES).map(([key, val]) => [key, val.label])) });
schema.carteSymbole = new fields.StringField({ required: true, initial: "coupe", choices: Object.fromEntries(Object.entries(SYSTEM.TAROT_SYMBOLES).map(([key, val]) => [key, val.label])) });
schema.niveau = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true });
return schema;
}
/** @override */
static LOCALIZATION_PREFIXES = ["HAMALRON.Competence"];
}
+20
View File
@@ -0,0 +1,20 @@
import { SYSTEM } from "../config/system.mjs"
export default class HamalronEquipement extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const schema = {}
const requiredInteger = { required: true, nullable: false, integer: true }
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.quantity = new fields.NumberField({ required: true, initial: 1, min: 0, integer: true })
schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["HAMALRON.Equipement"]
}
+15
View File
@@ -0,0 +1,15 @@
import { SYSTEM } from "../config/system.mjs";
export default class HamalronFaction extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields;
const schema = {};
schema.description = new fields.HTMLField({ required: true, textSearch: true })
return schema;
}
/** @override */
static LOCALIZATION_PREFIXES = ["HAMALRON.Faction"];
}
+16
View File
@@ -0,0 +1,16 @@
import { SYSTEM } from "../config/system.mjs";
export default class HamalronFaction extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields;
const schema = {};
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.niveau = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true });
return schema;
}
/** @override */
static LOCALIZATION_PREFIXES = ["HAMALRON.Faction"];
}
+84
View File
@@ -0,0 +1,84 @@
import { SYSTEM } from "../config/system.mjs"
import HamalronTirageTarot from "../documents/tirage-tarot.mjs"
export default class HamalronPersonnage extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const requiredInteger = { required: true, nullable: false, integer: true }
const schema = {}
// Stats
const symboleCarte = (label) => {
const schema = {
label: new fields.StringField({ required: true, initial: label }),
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
max: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
}
return new fields.SchemaField(schema, { label })
}
schema.cartesSucces = new fields.SchemaField(
Object.values(SYSTEM.TAROT_SYMBOLES).reduce((obj, stat) => {
obj[stat.id] = symboleCarte(stat.label)
return obj
}, {}),
)
schema.resistances = new fields.SchemaField(
Object.values(SYSTEM.TAROT_SYMBOLES).reduce((obj, stat) => {
obj[stat.id] = symboleCarte(stat.label)
return obj
}, {}),
)
schema.historial = new fields.HTMLField({ required: true, textSearch: true })
schema.progression = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
schema.biodata = new fields.SchemaField({
age: new fields.StringField({ required: true, nullable: false, initial: "" }),
gender: new fields.StringField({ required: true, nullable: false, initial: "" }),
height: new fields.StringField({ required: true, nullable: false, initial: "" }),
eyes: new fields.StringField({ required: true, nullable: false, initial: "" }),
birthplace: new fields.StringField({ required: true, nullable: false, initial: "" }),
hair: new fields.StringField({ required: true, nullable: false, initial: "" }),
home: new fields.StringField({ required: true, nullable: false, initial: "" }),
weight: new fields.StringField({ required: true, nullable: false, initial: "" }),
})
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["HAMALRON.Personnage"]
prepareDerivedData() {
super.prepareDerivedData();
}
/** */
/**
* Rolls a dice for a character.
* @param {("save"|"resource|damage")} rollType The type of the roll.
* @param {number} rollItem The target value for the roll. Which caracteristic or resource. If the roll is a damage roll, this is the id of the item.
* @returns {Promise<null>} - A promise that resolves to null if the roll is cancelled.
*/
async roll(rollType, rollItem) {
let opponentTarget
const hasTarget = opponentTarget !== undefined
let roll = await HamalronTirageTarot.prompt({
rollType,
rollItem,
actorId: this.parent.id,
actorName: this.parent.name,
actorImage: this.parent.img,
hasTarget,
target: opponentTarget
})
if (!roll) return null
await roll.toMessage({}, { rollMode: roll.options.rollMode })
}
}
+15
View File
@@ -0,0 +1,15 @@
import { SYSTEM } from "../config/system.mjs";
export default class HamalronPeuple extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields;
const schema = {};
schema.description = new fields.HTMLField({ required: true, textSearch: true })
return schema;
}
/** @override */
static LOCALIZATION_PREFIXES = ["HAMALRON.Peuple"];
}
+45
View File
@@ -0,0 +1,45 @@
import { SYSTEM } from "../config/system.mjs"
import HamalronTirageTarot from "../documents/tirage-tarot.mjs"
export default class HamalronPNJ extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const requiredInteger = { required: true, nullable: false, integer: true }
const schema = {}
schema.enemyType = new fields.StringField({
required: true,
initial: "mook",
choices: Object.fromEntries(Object.entries(SYSTEM.ENEMY_TYPES).map(([key, val]) => [key, val.label]))
})
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.notes = new fields.HTMLField({ required: true, textSearch: true })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["HAMALRON.PNJ"]
async roll(rollType, rollItem) {
let opponentTarget
const hasTarget = opponentTarget !== undefined
let roll = await HamalronTirageTarot.prompt({
rollType,
rollItem,
actorId: this.parent.id,
actorName: this.parent.name,
actorImage: this.parent.img,
traits: this.parent.items.filter(i => i.type === "trait"),
hasTarget,
target: opponentTarget
})
if (!roll) return null
await roll.toMessage({}, { rollMode: roll.options.rollMode })
}
}
+17
View File
@@ -0,0 +1,17 @@
import { SYSTEM } from "../config/system.mjs"
export default class HamalronRegion extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const schema = {}
const requiredInteger = { required: true, nullable: false, integer: true }
schema.description = new fields.HTMLField({ required: true, textSearch: true })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["HAMALRON.Region"]
}
+18
View File
@@ -0,0 +1,18 @@
import { SYSTEM } from "../config/system.mjs"
export default class HamalronSortilege extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const schema = {}
const requiredInteger = { required: true, nullable: false, integer: true }
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.categorie = new fields.StringField({ required: true, initial: "malefica", choices: Object.fromEntries(Object.entries(SYSTEM.SORTILEGE_CATEGORIES).map(([key, val]) => [key, val.label])) })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["HAMALRON.Ritual"]
}
+26
View File
@@ -0,0 +1,26 @@
import { SYSTEM } from "../config/system.mjs";
export default class HamalronTarot extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields;
const schema = {};
schema.type = new fields.StringField({ required: true, nullable: false, choices: Object.fromEntries(Object.entries(SYSTEM.TAROT_TYPES).map(([key, val]) => [key, val.label])), initial: "atout" });
schema.symbole = new fields.StringField({ required: true, nullable: false, choices: Object.fromEntries(Object.entries(SYSTEM.TAROT_SYMBOLES).map(([key, val]) => [key, val.label])), initial: "coupe" });
schema.valeur = new fields.StringField({
required: true, nullable: false, choices: Object.fromEntries(Object.entries(SYSTEM.TAROT_VALEURS).map(([key, val]) => [key, val.label])), initial: "1"
});
schema.description = new fields.HTMLField({ required: true, textSearch: true });
schema.image = new fields.FilePathField({
required: false,
categories: ["IMAGE"],
default: "icons/svg/treasure.svg",
})
return schema;
}
/** @override */
static LOCALIZATION_PREFIXES = ["HAMALRON.Tarot"];
}