Initial import with skill sheet worning

This commit is contained in:
LeRatierBretonnien 2024-11-30 08:38:13 +01:00
parent 2e96b256fb
commit df8995f8b7
52 changed files with 6986 additions and 2189 deletions

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,6 @@ export default [
prettier
},
rules: {
'prettier/prettier': 'error',
'array-bracket-spacing': ['warn', 'never'],
'array-callback-return': 'warn',
'arrow-spacing': 'warn',
@ -143,9 +142,7 @@ export default [
ignoreStrings: true,
ignoreTemplateLiterals: true,
}],
'prettier/prettier': ['error', { printWidth: 180 }],
'no-extra-boolean-cast': ['warn', { enforceForLogicalOperands: true }],
'no-extra-semi': 'warn',
'no-multi-spaces': ['warn', { ignoreEOLComments: true }],
'no-tabs': 'warn',
'no-throw-literal': 'error',
@ -159,13 +156,7 @@ export default [
'prefer-template': 'warn',
'quote-props': ['warn', 'as-needed', { keywords: false }],
quotes: ['warn', 'double', { avoidEscape: true, allowTemplateLiterals: false }],
semi: 'warn',
'space-before-blocks': ['warn', 'always'],
'space-before-function-paren': ['warn', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
semi: ["error", "never"],
'spaced-comment': 'warn',
'jsdoc/check-access': 'warn',
'jsdoc/check-alignment': 'warn',

View File

@ -1,313 +1,95 @@
{
"TYPES": {
"Actor": {
"character": "Personnage",
"opponent": "Adversaire"
"character": "Character",
"opponent": "NPC"
},
"Item": {
"path": "Voie",
"talent": "Talent",
"weapon": "Arme",
"armor": "Armure",
"spell": "Sortilège",
"attack": "Attaque"
"skill": "Skill",
"weapon": "Weapon",
"armor": "Armor",
"spell": "Spell",
"gift": "Gift",
"vulnerability": "Vulnerability",
"save": "Save",
"equipment": "Equipment"
}
},
"LETHALFANTASY": {
"Character": {
"FIELDS": {
"voies": {
"majeure": {
"nom": {
"label": "Voie"
}
},
"mineure": {
"nom": {
"label": "Voie Mineure"
}
}
"str": {
"label": "Strength"
},
"commanditaire": {
"label": "Commanditaire"
"dex": {
"label": "Dexterity"
},
"dv": {
"label": "Dé de Vie"
"int": {
"label": "Intelligence"
},
"pv": {
"value": {
"label": "Points de Vie",
"short": "PV"
}
"wis": {
"label": "Wisdom"
},
"dmax": {
"valeur": {
"label": "Dégâts max"
}
"con": {
"label": "Constitution"
},
"caracteristiques": {
"rob": {
"valeur": {
"label": "Robustesse",
"short": "Rob"
}
},
"dex": {
"valeur": {
"label": "Dextérité",
"short": "Dex"
}
},
"int": {
"valeur": {
"label": "Intelligence",
"short": "Int"
}
},
"per": {
"valeur": {
"label": "Perception",
"short": "Per"
}
},
"vol": {
"valeur": {
"label": "Volonté",
"short": "Vol"
}
}
"char": {
"label": "Charisma"
},
"ressources": {
"san": {
"valeur": {
"label": "Santé Mentale"
}
},
"oeil": {
"valeur": {
"label": "Œil"
}
},
"verbe": {
"valeur": {
"label": "Verbe"
}
},
"bourse": {
"valeur": {
"label": "Bourse"
}
},
"magie": {
"valeur": {
"label": "Magie"
}
}
"app": {
"label": "Appearance"
}
},
"Label": {
"personnage": "Personnage",
"caracteristiques": "Caractéristiques",
"ressources": "Ressources",
"description": "Description",
"langues": "Langues",
"notes": "Notes",
"details": "Détails",
"biography": "Biographie",
"biens": "Biens",
"talents": "Talents",
"attaques": "Attaques"
}
},
"Opponent": {
"FIELDS": {
"dv": {
"label": "Dé de Vie"
},
"pv": {
"value": {
"label": "Points de Vie"
},
"max": {
"label": "Points de Vie max"
}
},
"armure": {
"label": "Armure"
},
"malus": {
"label": "Malus d'adversité"
},
"actions": {
"label": "Actions"
}
},
"Skill": {
"FIELDS": {
"description": {
"label": "Description"
}
}
},
"Talent": {
"Equipment": {
"FIELDS": {
"description": {
"label": "Description"
},
"appris": {
"label": "Appris"
},
"progression": {
"label": "Progression"
},
"niveau": {
"label": "Niveau"
}
},
"details": "(Niveau {niveau})"
}
},
"Path": {
"Gift": {
"FIELDS": {
"description": {
"label": "Description"
},
"biens": {
"label": "Biens"
},
"langues": {
"label": "Langues"
},
"talents": {
"label": "Talents"
},
"voies": {
"majeure": {
"label": "Voie Majeure"
},
"mineure": {
"label": "Voie Mineure"
}
},
"dv": {
"label": "Dé de Vie"
},
"dmax": {
"label": "Dégâts max"
},
"caracteristiques": {
"rob": {
"valeur": {
"label": "Robustesse",
"short": "Rob"
}
},
"dex": {
"valeur": {
"label": "Dextérité",
"short": "Dex"
}
},
"int": {
"valeur": {
"label": "Intelligence",
"short": "Int"
}
},
"per": {
"valeur": {
"label": "Perception",
"short": "Per"
}
},
"vol": {
"valeur": {
"label": "Volonté",
"short": "Vol"
}
}
},
"ressources": {
"san": {
"valeur": {
"label": "Santé Mentale"
}
},
"oeil": {
"valeur": {
"label": "Œil"
}
},
"verbe": {
"valeur": {
"label": "Verbe"
}
},
"bourse": {
"valeur": {
"label": "Bourse"
}
},
"magie": {
"valeur": {
"label": "Magie"
}
}
}
}
},
"Weapon": {
"FIELDS": {
"categorie": {
"label": "Catégorie"
},
"degats": {
"label": "Dégâts"
"category": {
"label": "Category"
}
},
"Category": {
"main": "Mains Nues",
"improvisee": "Armes Improvisées",
"courte": "Armes courtes",
"longue": "Armes longues",
"lourde": "Armes lourdes"
}
},
"Armor": {
"FIELDS": {
"categorie": {
"label": "Catégorie"
},
"valeur": {
"label": "Valeur"
},
"malus": {
"label": "Malus"
"category": {
"label": "Category"
}
},
"Category": {
"sommaire": "Armures sommaires",
"legere": "Armures légères",
"guerre": "Armures de guerre"
},
"details": "Valeur : {valeur} - Malus : {malus}"
}
},
"Spell": {
"FIELDS": {
"description": {
"label": "Description"
},
"preparation": {
"label": "Préparation"
},
"cible": {
"label": "Cible"
},
"portee": {
"label": "Portée"
},
"duree": {
"label": "Durée"
},
"consequenceA": {
"label": "Conséquence A"
},
"consequenceB": {
"label": "Conséquence B"
}
},
"Range": {
@ -318,10 +100,17 @@
"distant": "Distant"
}
},
"Attack": {
"Vulneravility": {
"FIELDS": {
"degats": {
"label": "Dégâts"
"description": {
"label": "Description"
}
}
},
"Save": {
"FIELDS": {
"description": {
"label": "Description"
}
}
},

View File

@ -1,438 +0,0 @@
{
"TYPES": {
"Actor": {
"character": "Personnage",
"opponent": "Adversaire"
},
"Item": {
"path": "Voie",
"talent": "Talent",
"weapon": "Arme",
"armor": "Armure",
"spell": "Sortilège",
"attack": "Attaque"
}
},
"LETHALFANTASY": {
"Character": {
"FIELDS": {
"voies": {
"majeure": {
"nom": {
"label": "Voie"
}
},
"mineure": {
"nom": {
"label": "Voie Mineure"
}
}
},
"commanditaire": {
"label": "Commanditaire"
},
"dv": {
"label": "Dé de Vie"
},
"pv": {
"value": {
"label": "Points de Vie",
"short": "PV"
}
},
"dmax": {
"valeur": {
"label": "Dégâts max"
}
},
"caracteristiques": {
"rob": {
"valeur": {
"label": "Robustesse",
"short": "Rob"
}
},
"dex": {
"valeur": {
"label": "Dextérité",
"short": "Dex"
}
},
"int": {
"valeur": {
"label": "Intelligence",
"short": "Int"
}
},
"per": {
"valeur": {
"label": "Perception",
"short": "Per"
}
},
"vol": {
"valeur": {
"label": "Volonté",
"short": "Vol"
}
}
},
"ressources": {
"san": {
"valeur": {
"label": "Santé Mentale"
}
},
"oeil": {
"valeur": {
"label": "Œil"
}
},
"verbe": {
"valeur": {
"label": "Verbe"
}
},
"bourse": {
"valeur": {
"label": "Bourse"
}
},
"magie": {
"valeur": {
"label": "Magie"
}
}
}
},
"Label": {
"personnage": "Personnage",
"caracteristiques": "Caractéristiques",
"ressources": "Ressources",
"description": "Description",
"langues": "Langues",
"notes": "Notes",
"details": "Détails",
"biography": "Biographie",
"biens": "Biens",
"talents": "Talents",
"attaques": "Attaques"
}
},
"Opponent": {
"FIELDS": {
"dv": {
"label": "Dé de Vie"
},
"pv": {
"value": {
"label": "Points de Vie"
},
"max": {
"label": "Points de Vie max"
}
},
"armure": {
"label": "Armure"
},
"malus": {
"label": "Malus d'adversité"
},
"actions": {
"label": "Actions"
}
}
},
"Talent": {
"FIELDS": {
"description": {
"label": "Description"
},
"appris": {
"label": "Appris"
},
"progression": {
"label": "Progression"
},
"niveau": {
"label": "Niveau"
}
},
"details": "(Niveau {niveau})"
},
"Path": {
"FIELDS": {
"description": {
"label": "Description"
},
"biens": {
"label": "Biens"
},
"langues": {
"label": "Langues"
},
"talents": {
"label": "Talents"
},
"voies": {
"majeure": {
"label": "Voie Majeure"
},
"mineure": {
"label": "Voie Mineure"
}
},
"dv": {
"label": "Dé de Vie"
},
"dmax": {
"label": "Dégâts max"
},
"caracteristiques": {
"rob": {
"valeur": {
"label": "Robustesse",
"short": "Rob"
}
},
"dex": {
"valeur": {
"label": "Dextérité",
"short": "Dex"
}
},
"int": {
"valeur": {
"label": "Intelligence",
"short": "Int"
}
},
"per": {
"valeur": {
"label": "Perception",
"short": "Per"
}
},
"vol": {
"valeur": {
"label": "Volonté",
"short": "Vol"
}
}
},
"ressources": {
"san": {
"valeur": {
"label": "Santé Mentale"
}
},
"oeil": {
"valeur": {
"label": "Œil"
}
},
"verbe": {
"valeur": {
"label": "Verbe"
}
},
"bourse": {
"valeur": {
"label": "Bourse"
}
},
"magie": {
"valeur": {
"label": "Magie"
}
}
}
}
},
"Weapon": {
"FIELDS": {
"categorie": {
"label": "Catégorie"
},
"degats": {
"label": "Dégâts"
}
},
"Category": {
"main": "Mains Nues",
"improvisee": "Armes Improvisées",
"courte": "Armes courtes",
"longue": "Armes longues",
"lourde": "Armes lourdes"
}
},
"Armor": {
"FIELDS": {
"categorie": {
"label": "Catégorie"
},
"valeur": {
"label": "Valeur"
},
"malus": {
"label": "Malus"
}
},
"Category": {
"sommaire": "Armures sommaires",
"legere": "Armures légères",
"guerre": "Armures de guerre"
},
"details": "Valeur : {valeur} - Malus : {malus}"
},
"Spell": {
"FIELDS": {
"description": {
"label": "Description"
},
"preparation": {
"label": "Préparation"
},
"cible": {
"label": "Cible"
},
"portee": {
"label": "Portée"
},
"duree": {
"label": "Durée"
},
"consequenceA": {
"label": "Conséquence A"
},
"consequenceB": {
"label": "Conséquence B"
}
},
"Range": {
"na": "-",
"contact": "Contact",
"proche": "Proche",
"loin": "Loin",
"distant": "Distant"
}
},
"Attack": {
"FIELDS": {
"degats": {
"label": "Dégâts"
}
}
},
"Label": {
"description": "Description",
"biens": "Biens",
"langues": "Langues",
"profil": "Profil",
"details": "Détails",
"talents": "Talents",
"progressionPossible": "Progression possible",
"equipement": "Equipement",
"spells" : "Sortilèges",
"level": "Niveau",
"degats": "Dégâts",
"ressource": "Ressource",
"sauvegarde": "Sauvegarde",
"newArmor": "Nouvelle armure",
"newWeapon": "Nouvelle arme",
"armor": "Armure",
"malus": "Malus",
"jet": "Jet de ",
"progress": "Progression",
"hasProgressed": "A progressé dans la caractéristique",
"noProgress": "N'a pas progressé dans la caractéristique",
"experience": "Expérience",
"experienceDetail": "Expérience {detail}",
"maximum": "Maximum"
},
"Edit": "Editer",
"Delete": "Supprimer",
"ToggleSheet": "Changer de mode",
"Warning": {
"dejaDeuxVoies": "Vous avez déjà choisi deux voies",
"dejaVoieMajeure": "Vous avez déjà choisi cette voie comme voie majeure",
"voieMajeureAjoutee": "Voie majeure ajoutée",
"voieMineureAjoutee": "Voie mineure ajoutée",
"voieMajeureSupprimee": "Voie majeure supprimée",
"voieMineureSupprimee": "Voie mineure supprimée",
"plusDeRessource": "Vous n'avez plus de ressource {ressource}"
},
"Dialog": {
"ajoutVoieMajeure": "Ajouter une voie majeure va automatiquement remplacer les caractéristiques, les ressources, les langues et les biens. Continuer ?",
"ajoutVoieMajeureTitre": "Ajout d'une voie majeure",
"ajoutVoieMineureTitre": "Ajout d'une voie mineure",
"suppressionTalents": "Supprimer cette voie va supprimer les talents associés. Continuer ?",
"talentDansVoie": "Ce talent est présent dans la voie {path}. Voulez-vous vraiment le supprimer ?",
"titleSave": "Jet de sauvegarde",
"titleResource": "Jet de ressource",
"titleDamage": "Jet de dégâts",
"titleAttack": "Jet d'attaque",
"titleStandard": "Jet standard"
},
"Roll": {
"save": "Jet de sauvegarde <br> {save}",
"resource": "Jet de ressource <br> {resource}",
"damage": "Jet de dégâts <br> {item}",
"attack": "Jet d'attaque <br> {item}",
"roll": "Lancer",
"aide": "Aider",
"gene": "Gêner",
"adversite": "Adversité",
"avantagesDesavantages": "Avantages et désavantages",
"normal": "Normal",
"avantage": "Avec avantage",
"desavantage": "Avec désavantage",
"doubleAvantage": "Avec double avantage",
"doubleDesavantage": "Avec double désavantage",
"visibilite": "Visibilité du lancer",
"success": "Réussite",
"failure": "Echec",
"resourceLost": "Ressource perdue",
"displayArmor": "{targetName} a une armure de {targetArmor}. <br>Dégâts réels : {realDamage}"
},
"Tooltip": {
"learnedTalents": "Les talents appris sont en gras",
"saveIntroTextTooltip": "Caractéristique : {value} <br> Aide : {aide} <br> Gêne : {gene} <br> Modificateur : {modificateur}",
"addAttack": "Ajouter une attaque",
"addEquipment": "Ajouter une arme, Shift + Click pour ajouter une armure",
"addSpell": "Ajouter un sortilège"
},
"Setting": {
"displayOpponentMalus": "Afficher le malus d'adversité",
"displayOpponentMalusHint": "Affiche le malus d'adversité pour les joueurs.",
"fortune": "Roue de Fortune",
"fortuneHint": "Valeur de la roue de Fortune. Nombre de joueurs + 1 en début de partie."
},
"Chat": {
"askFortune": "{name} veut utiliser un point de Fortune !",
"askRollForAll": "Jet de {value}",
"askRollForOne": "Jet de {value} pour {name}"
},
"Fortune": {
"title": "Roue de Fortune"
},
"Manager": {
"title": "Gestionnaire de Personnages",
"player": "Utilisateur",
"character": "Personnage",
"rob": "Robustesse",
"dex": "Dextérité",
"int": "Intelligence",
"per": "Perception",
"vol": "Volonté",
"pv": "Points de Vie",
"san": "Santé Mentale",
"oeil": "Œil",
"verbe": "Verbe",
"bourse": "Bourse",
"magie": "Magie",
"roll": "Faire le jet"
}
}
}

View File

@ -12,11 +12,12 @@ import * as documents from "./module/documents/_module.mjs"
import * as applications from "./module/applications/_module.mjs"
import { handleSocketEvent } from "./module/socket.mjs"
import { configureDiceSoNice } from "./module/dice.mjs"
import { Macros } from "./module/macros.mjs"
import { initControlButtons } from "./module/control-buttons.mjs"
import { setupTextEnrichers } from "./module/enrichers.mjs"
export class ClassCounter{static printHello(){console.log("Hello")}static sendJsonPostRequest(e,s){const t={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(s)};return fetch(e,t).then((e=>{if(!e.ok)throw new Error("La requête a échoué avec le statut "+e.status);return e.json()})).catch((e=>{throw console.error("Erreur envoi de la requête:",e),e}))}static registerUsageCount(e=game.system.id,s={}){if(game.user.isGM){game.settings.register(e,"world-key",{name:"Unique world key",scope:"world",config:!1,default:"",type:String});let t=game.settings.get(e,"world-key");null!=t&&""!=t&&"NONE"!=t&&"none"!=t.toLowerCase()||(t=foundry.utils.randomID(32),game.settings.set(e,"world-key",t));let a={name:e,system:game.system.id,worldKey:t,version:game.system.version,language:game.settings.get("core","language"),remoteAddr:game.data.addresses.remote,nbInstalledModules:game.modules.size,nbActiveModules:game.modules.filter((e=>e.active)).length,nbPacks:game.world.packs.size,nbUsers:game.users.size,nbScenes:game.scenes.size,nbActors:game.actors.size,nbPlaylist:game.playlists.size,nbTables:game.tables.size,nbCards:game.cards.size,optionsData:s,foundryVersion:`${game.release.generation}.${game.release.build}`};this.sendJsonPostRequest("https://www.uberwald.me/fvtt_appcount/count_post.php",a)}}}
Hooks.once("init", function () {
console.info("Lethal Fantasy RPG | Initializing System")
console.info(SYSTEM.ASCII)
@ -39,12 +40,13 @@ Hooks.once("init", function () {
CONFIG.Item.documentClass = documents.LethalFantasyItem
CONFIG.Item.dataModels = {
path: models.LethalFantasyPath,
talent: models.LethalFantasyTalent,
skill: models.LethalFantasySkill,
gift: models.LethalFantasyGift,
weapon: models.LethalFantasyWeapon,
armor: models.LethalFantasyArmor,
spell: models.LethalFantasySpell,
attack: models.LethalFantasyAttack,
save: models.LethalFantasySave,
vulnerability: models.LethalFantasyVulnerability
}
// Register sheet application classes
@ -53,12 +55,13 @@ Hooks.once("init", function () {
Actors.registerSheet("lethalFantasy", applications.LethalFantasyOpponentSheet, { types: ["opponent"], makeDefault: true })
Items.unregisterSheet("core", ItemSheet)
Items.registerSheet("lethalFantasy", applications.LethalFantasyTalentSheet, { types: ["talent"], makeDefault: true })
Items.registerSheet("lethalFantasy", applications.LethalFantasyPathSheet, { types: ["path"], makeDefault: true })
Items.registerSheet("lethalFantasy", applications.LethalFantasySkillSheet, { types: ["skill"], makeDefault: true })
Items.registerSheet("lethalFantasy", applications.LethalFantasyGiftSheet, { types: ["gift"], makeDefault: true })
Items.registerSheet("lethalFantasy", applications.LethalFantasyVulnerabilitySheet, { types: ["vulnerability"], makeDefault: true })
Items.registerSheet("lethalFantasy", applications.LethalFantasySaveSheet, { types: ["save"], makeDefault: true })
Items.registerSheet("lethalFantasy", applications.LethalFantasyWeaponSheet, { types: ["weapon"], makeDefault: true })
Items.registerSheet("lethalFantasy", applications.LethalFantasySpellSheet, { types: ["spell"], makeDefault: true })
Items.registerSheet("lethalFantasy", applications.LethalFantasyArmorSheet, { types: ["armor"], makeDefault: true })
Items.registerSheet("lethalFantasy", applications.LethalFantasyAttackSheet, { types: ["attack"], makeDefault: true })
// Other Document Configuration
CONFIG.ChatMessage.documentClass = documents.LethalFantasyChatMessage
@ -140,9 +143,7 @@ function preLocalizeConfig() {
}
Hooks.once("ready", function () {
console.info("CTHULHU TENEBRIS | Ready")
game.system.applicationFortune = new applications.LethalFantasyFortune()
game.system.applicationFortune.render(true)
console.info("LETHAL FANTASY | Ready")
game.system.applicationManager = new applications.LethalFantasyManager()
if (game.user.isGM) {
game.system.applicationManager.render(true)
@ -159,65 +160,14 @@ Hooks.once("ready", function () {
async function _showUserGuide() {
if (game.user.isGM) {
const newVer = game.system.version
const userGuideJournalName = "Guide du système"
const userGuideCompendiumLabel = "userguide"
let currentVer = "0"
let oldUserGuide = game.journal.getName(userGuideJournalName)
if (oldUserGuide !== undefined && oldUserGuide !== null && oldUserGuide.getFlag("lethalFantasy", "UserGuideVersion") !== undefined) {
currentVer = oldUserGuide.getFlag("lethalFantasy", "UserGuideVersion")
}
if (newVer === currentVer) {
// Up to date
return
}
let newReleasePack = game.packs.find((p) => p.metadata.name === userGuideCompendiumLabel)
if (newReleasePack === null || newReleasePack === undefined) {
console.info("CTHULHU TENEBRIS | No compendium found for the system guide")
return
}
await newReleasePack.getIndex()
let newUserGuide = newReleasePack.index.find((j) => j.name === userGuideJournalName)
if (newUserGuide === undefined || newUserGuide === null) {
console.info("CTHULHU TENEBRIS | No system guide found in the compendium")
return
}
// Don't delete until we have new release Pack
if (oldUserGuide !== null && oldUserGuide !== undefined) {
await oldUserGuide.delete()
}
await game.journal.importFromCompendium(newReleasePack, newUserGuide._id)
let newReleaseJournal = game.journal.getName(newUserGuide.name)
await newReleaseJournal.setFlag("lethalFantasy", "UserGuideVersion", newVer)
// Show journal
await newReleaseJournal.sheet.render(true, { sheetMode: "text" })
}
}
})
Hooks.on("renderChatMessage", (message, html, data) => {
const typeMessage = data.message.flags.lethalFantasy?.typeMessage
// Message de fortune
if (typeMessage === "fortune") {
if (game.user.isGM && !data.message.flags.lethalFantasy?.accepted) {
html.find(".button").click((event) => applications.LethalFantasyFortune.acceptRequest(event, html, data))
} else {
html.find(".button").each((i, btn) => {
btn.style.display = "none"
})
if (game.user.isGM) {
html.find(".fortune-accepted").each((i, btn) => (btn.style.display = "flex"))
}
}
}
// Message de demande de jet de dés
else if (typeMessage === "askRoll") {
if (typeMessage === "askRoll") {
// Affichage des boutons de jet de dés uniquement pour les joueurs
if (game.user.isGM) {
html.find(".ask-roll-dice").each((i, btn) => {
@ -238,9 +188,6 @@ Hooks.on("renderChatMessage", (message, html, data) => {
})
Hooks.on("updateSetting", async (setting, update, options, id) => {
if (setting.key === "lethalFantasy.fortune") {
game.system.applicationFortune.render(true)
}
})
// Dice-so-nice Ready
@ -256,7 +203,7 @@ Hooks.once("diceSoNiceReady", (dice3d) => {
*/
Hooks.on("hotbarDrop", (bar, data, slot) => {
if (["Actor", "Item", "JournalEntry", "roll", "rollDamage", "rollAttack"].includes(data.type)) {
Macros.createLethalFantasyMacro(data, slot)
Macros.createLethalFantasyMacro(data, slot);
return false
}
})
@ -267,29 +214,6 @@ Hooks.on("hotbarDrop", (bar, data, slot) => {
*/
function registerWorldCount(registerKey) {
if (game.user.isGM) {
let worldKey = game.settings.get(registerKey, "worldKey")
if (worldKey === undefined || worldKey === "") {
worldKey = foundry.utils.randomID(32)
game.settings.set(registerKey, "worldKey", worldKey)
}
// Simple API counter
const worldData = {
register_key: registerKey,
world_key: worldKey,
foundry_version: `${game.release.generation}.${game.release.build}`,
system_name: game.system.id,
system_version: game.system.version,
}
let apiURL = "https://worlds.qawstats.info/worlds-counter"
$.ajax({
url: apiURL,
type: "POST",
data: JSON.stringify(worldData),
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
})
ClassCounter.registerUsageCount(game.system.id, {})
}
}

View File

@ -1,10 +1,11 @@
export { default as LethalFantasyCharacterSheet } from "./sheets/character-sheet.mjs"
export { default as LethalFantasyCharacterSheet } from "./sheets/character-sheet.mjs";
export { default as LethalFantasyOpponentSheet } from "./sheets/opponent-sheet.mjs"
export { default as LethalFantasyPathSheet } from "./sheets/path-sheet.mjs"
export { default as LethalFantasyTalentSheet } from "./sheets/talent-sheet.mjs"
export { default as LethalFantasyWeaponSheet } from "./sheets/weapon-sheet.mjs"
export { default as LethalFantasySkillSheet } from "./sheets/skill-sheet.mjs"
export { default as LethalFantasyGiftSheet } from "./sheets/gift-sheet.mjs"
export { default as LethalFantasyVulnerabilitySheet } from "./sheets/vulnerability-sheet.mjs"
export { default as LethalFantasySaveSheet } from "./sheets/save-sheet.mjs"
export { default as LethalFantasyArmorSheet } from "./sheets/armor-sheet.mjs"
export { default as LethalFantasySpellSheet } from "./sheets/spell-sheet.mjs"
export { default as LethalFantasyAttackSheet } from "./sheets/attack-sheet.mjs"
export { default as LethalFantasyFortune } from "./fortune.mjs"
export { default as LethalFantasyEquipmentSheet } from "./sheets/equipment-sheet.mjs"
export { default as LethalFantasyManager } from "./manager.mjs"

View File

@ -1,156 +0,0 @@
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api
import { SYSTEM } from "../config/system.mjs"
/**
* An application for configuring the permissions which are available to each User role.
* @extends ApplicationV2
* @mixes HandlebarsApplication
* @alias PermissionConfig
*/
export default class LethalFantasyFortune extends HandlebarsApplicationMixin(ApplicationV2) {
/** @inheritDoc */
static DEFAULT_OPTIONS = {
id: "tenebris-application-fortune",
tag: "form",
window: {
contentClasses: ["tenebris-fortune"],
title: "TENEBRIS.Fortune.title",
controls: [],
},
position: {
width: 200,
height: 200,
top: 80,
left: 150,
},
form: {
closeOnSubmit: true,
},
actions: {
fortune: LethalFantasyFortune.#requestFortune,
increaseFortune: LethalFantasyFortune.#increaseFortune,
decreaseFortune: LethalFantasyFortune.#decreaseFortune,
},
}
/** @override */
_getHeaderControls() {
const controls = []
if (game.user.isGM) {
controls.push(
{
action: "increaseFortune",
icon: "fa fa-plus",
label: "Augmenter",
},
{
action: "decreaseFortune",
icon: "fa fa-minus",
label: "Diminuer",
},
)
}
return controls
}
/** @override */
static PARTS = {
main: {
template: "systems/fvtt-lethal-fantasy/templates/fortune.hbs",
},
}
/* -------------------------------------------- */
/* Rendering */
/* -------------------------------------------- */
/** @override */
async _prepareContext(_options = {}) {
return {
fortune: game.settings.get("tenebris", "fortune"),
userId: game.user.id,
isGM: game.user.isGM,
}
}
/**
* Handles the request for a fortune.
*
* @param {Event} event The event that triggered the request.
* @param {Object} target The target object for the request.
* @private
*/
static #requestFortune(event, target) {
console.debug("request Fortune, event, target")
game.socket.emit(`system.${SYSTEM.id}`, {
action: "fortune",
data: {
userId: game.user.id,
},
})
}
static async #increaseFortune(event, target) {
console.log("increase Fortune", event, target)
const currentValue = game.settings.get("tenebris", "fortune")
const newValue = currentValue + 1
await game.settings.set("tenebris", "fortune", newValue)
}
static async #decreaseFortune(event, target) {
console.log("decrease Fortune", event, target)
const currentValue = game.settings.get("tenebris", "fortune")
if (currentValue > 0) {
const newValue = currentValue - 1
await game.settings.set("tenebris", "fortune", newValue)
}
}
/**
* Handles the fortune spcket event for a given user.
*
* @param {Object} [options] The options object.
* @param {string} [options.userId] The ID of the user.
* @returns {Promise<ChatMessage>} - The created chat message.
*/
static async handleSocketEvent({ userId } = {}) {
console.debug(`handleSocketEvent Fortune from ${userId} !`)
const origin = game.users.get(userId)
const chatData = {
name: origin.name,
actingCharImg: origin.character?.img,
origin: origin,
user: game.user,
isGM: game.user.isGM,
}
const content = await renderTemplate("systems/fvtt-lethal-fantasy/templates/chat-fortune.hbs", chatData)
const messageData = {
style: CONST.CHAT_MESSAGE_STYLES.OTHER,
user: origin,
speaker: { user: origin },
content: content,
flags: { tenebris: { typeMessage: "fortune", accepted: false } },
}
ChatMessage.applyRollMode(messageData, CONST.DICE_ROLL_MODES.PRIVATE)
return ChatMessage.implementation.create(messageData)
}
/**
* Handles the acceptance of a request event in the chat message by the GM
*
* @param {Event} event The event object that triggered the request.
* @param {HTMLElement} html The HTML element associated with the event.
* @param {Object} data Additional data related to the event.
* @returns {Promise<void>} A promise that resolves when the request has been processed.
*/
static async acceptRequest(event, html, data) {
console.debug("acceptRequest Fortune", event, html, data)
const currentValue = game.settings.get("tenebris", "fortune")
if (currentValue > 0) {
const newValue = currentValue - 1
await game.settings.set("tenebris", "fortune", newValue)
}
let message = game.messages.get(data.message._id)
message.update({ "flags.tenebris.accepted": true })
}
}

View File

@ -9,11 +9,11 @@ import { SYSTEM } from "../config/system.mjs"
*/
export default class LethalFantasyManager extends HandlebarsApplicationMixin(ApplicationV2) {
static DEFAULT_OPTIONS = {
id: "tenebris-application-manager",
id: "lethalfantasy-application-manager",
tag: "form",
window: {
contentClasses: ["tenebris-manager"],
title: "TENEBRIS.Manager.title",
contentClasses: ["lethalfantasy-manager"],
title: "LETHALFANTASY.Manager.title",
resizable: true,
},
position: {
@ -82,22 +82,22 @@ export default class LethalFantasyManager extends HandlebarsApplicationMixin(App
}
static async askRollForAll(type, value, title = null, avantage = null) {
let label = game.i18n.localize(`TENEBRIS.Manager.${value}`)
let text = game.i18n.format("TENEBRIS.Chat.askRollForAll", { value: label })
let label = game.i18n.localize(`LETHALFANTASY.Manager.${value}`)
let text = game.i18n.format("LETHALFANTASY.Chat.askRollForAll", { value: label })
if (avantage) {
switch (avantage) {
case "++":
text += ` ${game.i18n.localize("TENEBRIS.Roll.doubleAvantage")}`
text += ` ${game.i18n.localize("LETHALFANTASY.Roll.doubleAvantage")}`
break
case "+":
text += ` ${game.i18n.localize("TENEBRIS.Roll.avantage")}`
text += ` ${game.i18n.localize("LETHALFANTASY.Roll.avantage")}`
break
case "-":
text += ` ${game.i18n.localize("TENEBRIS.Roll.desavantage")}`
text += ` ${game.i18n.localize("LETHALFANTASY.Roll.desavantage")}`
break
case "--":
text += ` ${game.i18n.localize("TENEBRIS.Roll.doubleDesavantage")}`
text += ` ${game.i18n.localize("LETHALFANTASY.Roll.doubleDesavantage")}`
break
default:
break
@ -118,8 +118,8 @@ export default class LethalFantasyManager extends HandlebarsApplicationMixin(App
}
static async askRollForOne(type, value, recipient, name) {
let label = game.i18n.localize(`TENEBRIS.Manager.${value}`)
const text = game.i18n.format("TENEBRIS.Chat.askRollForOne", { value: label, name: name })
let label = game.i18n.localize(`LETHALFANTASY.Manager.${value}`)
const text = game.i18n.format("LETHALFANTASY.Chat.askRollForOne", { value: label, name: name })
game.socket.emit(`system.${SYSTEM.id}`, {
action: "askRoll",

View File

@ -16,7 +16,7 @@ export default class LethalFantasyActorSheet extends HandlebarsApplicationMixin(
/** @override */
static DEFAULT_OPTIONS = {
classes: ["tenebris", "actor"],
classes: ["lethalfantasy", "actor"],
position: {
width: 1400,
height: "auto",

View File

@ -16,7 +16,7 @@ export default class LethalFantasyItemSheet extends HandlebarsApplicationMixin(f
/** @override */
static DEFAULT_OPTIONS = {
classes: ["tenebris", "item"],
classes: ["lethalfantasy", "item"],
position: {
width: 600,
height: "auto",

View File

@ -1,21 +1,21 @@
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
export default class LethalFantasyAttackSheet extends LethalFantasyItemSheet {
export default class LethalFantasyEquipmentSheet extends LethalFantasyItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
classes: ["attack"],
classes: ["equipment"],
position: {
width: 600,
},
window: {
contentClasses: ["attack-content"],
contentClasses: ["equipment-content"],
},
}
/** @override */
static PARTS = {
main: {
template: "systems/fvtt-lethal-fantasy/templates/attack.hbs",
template: "systems/fvtt-lethal-fantasy/templates/equipment.hbs",
},
}

View File

@ -1,21 +1,21 @@
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
export default class LethalFantasyTalentSheet extends LethalFantasyItemSheet {
export default class LethalFantasyGiftSheet extends LethalFantasyItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
classes: ["talent"],
classes: ["gift"],
position: {
width: 600,
},
window: {
contentClasses: ["talent-content"],
contentClasses: ["gift-content"],
},
}
/** @override */
static PARTS = {
main: {
template: "systems/fvtt-lethal-fantasy/templates/talent.hbs",
template: "systems/fvtt-lethal-fantasy/templates/gift.hbs",
},
}
@ -23,7 +23,6 @@ export default class LethalFantasyTalentSheet extends LethalFantasyItemSheet {
async _prepareContext() {
const context = await super._prepareContext()
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.improvedDescription, { async: true })
context.canProgress = this.document.system.canProgress
return context
}
}

View File

@ -1,141 +0,0 @@
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
export default class LethalFantasyPathSheet extends LethalFantasyItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
classes: ["path"],
position: {
width: 1400,
},
window: {
contentClasses: ["path-content"],
},
dragDrop: [{ dragSelector: "[data-drag]", dropSelector: null }],
actions: {
edit: LethalFantasyPathSheet.#onTalentEdit,
delete: LethalFantasyPathSheet.#onTalentDelete,
},
}
/** @override */
static PARTS = {
header: {
template: "systems/fvtt-lethal-fantasy/templates/path-header.hbs",
},
tabs: {
template: "templates/generic/tab-navigation.hbs",
},
main: {
template: "systems/fvtt-lethal-fantasy/templates/path-main.hbs",
},
talents: {
template: "systems/fvtt-lethal-fantasy/templates/path-talents.hbs",
},
}
/** @override */
tabGroups = {
sheet: "main",
}
/**
* Prepare an array of form header tabs.
* @returns {Record<string, Partial<ApplicationTab>>}
*/
#getTabs() {
const tabs = {
main: { id: "main", group: "sheet", icon: "fa-solid fa-user", label: "TENEBRIS.Label.profil" },
talents: { id: "talents", group: "sheet", icon: "fa-solid fa-book", label: "TENEBRIS.Label.talents" },
}
for (const v of Object.values(tabs)) {
v.active = this.tabGroups[v.group] === v.id
v.cssClass = v.active ? "active" : ""
}
return tabs
}
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.tabs = this.#getTabs()
return context
}
/** @override */
async _preparePartContext(partId, context) {
const doc = this.document
switch (partId) {
case "main":
context.tab = context.tabs.main
context.enrichedBiens = await TextEditor.enrichHTML(this.document.system.biens, { async: true })
context.enrichedLangues = await TextEditor.enrichHTML(this.document.system.langues, { async: true })
break
case "talents":
context.tab = context.tabs.talents
const talentItems = []
for (const talent of this.item.system.talents) {
const talentItem = await fromUuid(talent)
if (talentItem) talentItems.push(talentItem)
}
context.talents = talentItems
context.talents.sort((a, b) => a.name.localeCompare(b.name, game.i18n.lang))
break
}
return context
}
/**
* Callback actions which occur when a dragged element is dropped on a target.
* Seul un item de type Talent peut être déposé sur une voie.
* @param {DragEvent} event The originating DragEvent
* @protected
*/
async _onDrop(event) {
const data = TextEditor.getDragEventData(event)
switch (data.type) {
case "Item":
if (this.isPlayMode) return
const item = await fromUuid(data.uuid)
if (item.type !== "talent") return
console.debug("dropped item", item)
const talents = this.item.toObject().system.talents
talents.push(item.uuid)
this.item.update({ "system.talents": talents })
}
}
// #region Actions
/**
* Edit an existing talent within the path item
* Use the uuid to display the talent sheet (from world or compendium)
* @param {PointerEvent} event The originating click event
* @param {HTMLElement} target the capturing HTML element which defined a [data-action]
*/
static async #onTalentEdit(event, target) {
const itemUuid = target.getAttribute("data-item-uuid")
const talent = await fromUuid(itemUuid)
talent.sheet.render(true)
}
/**
* Delete an existing talent within the path item
* Use the uuid to remove it form the array of talents
* @param {PointerEvent} event The originating click event
* @param {HTMLElement} target the capturing HTML element which defined a [data-action]
*/
static async #onTalentDelete(event, target) {
const itemUuid = target.getAttribute("data-item-uuid")
const talents = this.item.toObject().system.talents
const index = talents.indexOf(itemUuid)
talents.splice(index, 1)
this.item.update({ "system.talents": talents })
}
// #endregion
}

View File

@ -0,0 +1,28 @@
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
export default class LethalFantasyGiftSheet extends LethalFantasyItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
classes: ["save"],
position: {
width: 600,
},
window: {
contentClasses: ["save-content"],
},
}
/** @override */
static PARTS = {
main: {
template: "systems/fvtt-lethal-fantasy/templates/save.hbs",
},
}
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
return context
}
}

View File

@ -0,0 +1,28 @@
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
export default class LethalFantasySkillSheet extends LethalFantasyItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
classes: ["skill"],
position: {
width: 600,
},
window: {
contentClasses: ["skill-content"],
},
}
/** @override */
static PARTS = {
main: {
template: "systems/fvtt-lethal-fantasy/templates/skill.hbs",
},
}
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
return context
}
}

View File

@ -0,0 +1,28 @@
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
export default class LethalFantasyVulnerabilitySheet extends LethalFantasyItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
classes: ["vulnerability"],
position: {
width: 600,
},
window: {
contentClasses: ["vulnerability-content"],
},
}
/** @override */
static PARTS = {
main: {
template: "systems/fvtt-lethal-fantasy/templates/vulnerability.hbs",
},
}
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
return context
}
}

View File

@ -1,50 +1,57 @@
export const CHARACTERISTICS = Object.freeze({
rob: {
id: "rob",
label: "LETHALFANTASY.Character.rob.label",
abbreviation: "LETHALFANTASY.Character.rob.short",
},
dex: {
id: "dex",
label: "LETHALFANTASY.Character.dex.label",
abbreviation: "LETHALFANTASY.Character.dex.short",
str: {
id: "str",
label: "LETHALFANTASY.Character.str.label"
},
int: {
id: "int",
label: "LETHALFANTASY.Character.int.label",
abbreviation: "LETHALFANTASY.Character.int.short",
label: "LETHALFANTASY.Character.int.label"
},
per: {
id: "per",
label: "LETHALFANTASY.Character.per.label",
abbreviation: "LETHALFANTASY.Character.per.short",
wis: {
id: "wis",
label: "LETHALFANTASY.Character.wis.label"
},
vol: {
id: "vol",
label: "LETHALFANTASY.Character.vol.label",
abbreviation: "LETHALFANTASY.Character.vol.short",
dex: {
id: "dex",
label: "LETHALFANTASY.Character.dex.label"
},
con: {
id: "con",
label: "LETHALFANTASY.Character.con.label"
},
cha: {
id: "cha",
label: "LETHALFANTASY.Character.cha.label"
},
app: {
id: "app",
label: "LETHALFANTASY.Character.app.label"
},
})
export const RESOURCES = Object.freeze({
san: {
id: "san",
label: "LETHALFANTASY.Character.san.label",
export const SAVES = Object.freeze({
str: {
id: "str",
label: "LETHALFANTASY.Character.str.label"
},
oeil: {
id: "oeil",
label: "LETHALFANTASY.Character.oeil.label",
agility: {
id: "agility",
label: "LETHALFANTASY.Character.agility.label"
},
verbe: {
id: "verbe",
label: "LETHALFANTASY.Character.verbe.label",
dying: {
id: "dying",
label: "LETHALFANTASY.Character.dying.label"
},
bourse: {
id: "bourse",
label: "LETHALFANTASY.Character.bourse.label",
will: {
id: "will",
label: "LETHALFANTASY.Character.will.label"
},
magie: {
id: "magie",
label: "LETHALFANTASY.Character.magie.label",
dodge: {
id: "dodge",
label: "LETHALFANTASY.Character.dodge.label"
},
toughness: {
id: "toughness",
label: "LETHALFANTASY.Character.toughness.label"
}
})

22
module/config/skill.mjs Normal file
View File

@ -0,0 +1,22 @@
export const CATEGORY = Object.freeze({
layperson: {
id: "layperson",
label: "LETHALFANTASY.Skill.Category.layperson",
},
professional: {
id: "professional",
label: "LETHALFANTASY.Skill.Category.professional",
},
weapon: {
id: "weapon",
label: "LETHALFANTASY.Skill.Category.weapon",
},
armor: {
id: "armor",
label: "LETHALFANTASY.Skill.Category.armor",
},
resist: {
id: "resist",
label: "LETHALFANTASY.Skill.Category.resist",
}
})

View File

@ -2,19 +2,11 @@ import * as CHARACTER from "./character.mjs"
import * as WEAPON from "./weapon.mjs"
import * as ARMOR from "./armor.mjs"
import * as SPELL from "./spell.mjs"
import * as SKILL from "./skill.mjs"
export const SYSTEM_ID = "tenebris"
export const SYSTEM_ID = "fvtt-lethal-fantasy"
export const DEV_MODE = false
export const RESOURCE_VALUE = Object.freeze({
ZERO: "0",
D4: "d4",
D6: "d6",
D8: "d8",
D10: "d10",
D12: "d12",
})
export const DICE_VALUE = Object.freeze({
D4: "d4",
D6: "d6",
@ -32,55 +24,50 @@ export const ROLL_TYPE = Object.freeze({
ATTACK: "attack",
})
export const MINOR_PATH = Object.freeze({
epee: {
onze: "rob",
neuf: {
main: "per",
plume: "vol",
livre: "int",
},
export const MONEY = {
tinbit: {
id: "tinbit",
abbrev: "tb",
label: "LETHALFANTASY.Money.Tinbits",
valuetb: 1
},
main: {
onze: "dex",
neuf: {
chene: "rob",
plume: "vol",
livre: "int",
},
copper: {
id: "copper",
abbrev: "cp",
label: "LETHALFANTASY.Money.Coppers",
valuetb: 10
},
plume: {
onze: "int",
neuf: {
chene: "rob",
main: "per",
epee: "dex",
},
silver: {
id: "silver",
abbrev: "sp",
label: "LETHALFANTASY.Money.Silvers",
valuetb: 100
},
chene: {
onze: "per",
neuf: {
plume: "vol",
livre: "int",
epee: "dex",
},
gold: {
id: "gold",
abbrev: "gp",
label: "LETHALFANTASY.Money.Golds",
valuetb: 1000
},
livre: {
onze: "vol",
neuf: {
chene: "rob",
main: "per",
epee: "dex",
},
},
})
platinum: {
id: "platinum",
abbrev: "pp",
label: "LETHALFANTASY.Money.Platinums",
valuetb: 10000
}
}
export const ASCII = `
`
······················································································································
: :
:@@@ @@@@@@@@ @@@@@@@ @@@ @@@ @@@@@@ @@@ @@@@@@@@ @@@@@@ @@@ @@@ @@@@@@@ @@@@@@ @@@@@@ @@@ @@@ :
:@@! @@! @!! @@! @@@ @@! @@@ @@! @@! @@! @@@ @@!@!@@@ @!! @@! @@@ !@@ @@! !@@ :
:@!! @!!!:! @!! @!@!@!@! @!@!@!@! @!! @!!!:! @!@!@!@! @!@@!!@! @!! @!@!@!@! !@@!! !@!@! :
:!!: !!: !!: !!: !!! !!: !!! !!: !!: !!: !!! !!: !!! !!: !!: !!! !:! !!: :
:: ::.: : : :: :: : : : : : : : : ::.: : : : : : :: : : : : : ::.: : .: :
: :
······················································································································
`
/**
* Include all constant definitions within the SYSTEM global export
@ -90,13 +77,14 @@ export const SYSTEM = {
id: SYSTEM_ID,
CHARACTERISTICS: CHARACTER.CHARACTERISTICS,
RESOURCES: CHARACTER.RESOURCES,
RESOURCE_VALUE,
SAVES: CHARACTER.SAVES,
SKILL_CATEGORY: SKILL.CATEGORY,
WEAPON_CATEGORY: WEAPON.CATEGORY,
WEAPON_DAMAGE: WEAPON.DAMAGE,
ARMOR_CATEGORY: ARMOR.CATEGORY,
SPELL_RANGE: SPELL.RANGE,
MONEY,
ASCII,
MINOR_PATH,
ROLL_TYPE,
DEV_MODE,
}

View File

@ -15,199 +15,6 @@ export default class LethalFantasyActor extends Actor {
}
}
/**
* Adds a path to the character.
* First path added is the major path, second path added is the minor path.
* Create all talents of the path and add them to the character.
* Add the path to the character.
*
* @param {Object} item The item to add as a path.
* @returns {Promise<void>} - A promise that resolves when the path is added.
*/
async addPath(item) {
if (this.type !== "character") return
let itemData = item.toObject()
if (this.system.hasVoieMajeure && this.system.hasVoieMineure) {
ui.notifications.warn(game.i18n.localize("TENEBRIS.Warning.dejaDeuxVoies"))
return
}
// Voie mineure
if (this.system.hasVoieMajeure) {
if (this.system.voies.majeure.nom === item.name) {
ui.notifications.warn(game.i18n.localize("TENEBRIS.Warning.dejaVoieMajeure"))
return
}
// Voie de base
const isBasePath = itemData.system.key !== "" && this.system.voies.majeure.key !== ""
let dropNotification
let neufModifie
let onze
let neuf
if (isBasePath) {
onze = game.system.CONST.MINOR_PATH[itemData.system.key].onze
const labelOnze = game.i18n.localize(`TENEBRIS.Character.FIELDS.caracteristiques.${onze}.valeur.label`)
dropNotification = `La valeur de ${labelOnze} va être modifiée pour 11`
neuf = game.system.CONST.MINOR_PATH[itemData.system.key].neuf[this.system.voies.majeure.key]
if (neuf) {
neufModifie = true
const labelNeuf = game.i18n.localize(`TENEBRIS.Character.FIELDS.caracteristiques.${neuf}.valeur.label`)
dropNotification += `<br> La valeur de ${labelNeuf} va être modifiée pour 9`
}
} else {
dropNotification = "Vous devez modifier manuellement les caractéristiques selon la voie ajoutée"
}
dropNotification += `<br>Vous pouvez renoncer à des biens de la voie majeure pour ceux de la voie mineure`
dropNotification += `<br> Vous pouvez renoncer à des langues de la voie majeure pour celles de la voie mineure`
const proceed = await foundry.applications.api.DialogV2.confirm({
window: { title: game.i18n.localize("TENEBRIS.Dialog.ajoutVoieMineureTitre") },
content: dropNotification,
rejectClose: false,
modal: true,
})
if (!proceed) return
let voie
// Création de la voie
voie = await this.createEmbeddedDocuments("Item", [itemData], { renderSheet: false })
if (isBasePath) {
await this.update({
"system.voies.mineure.nom": item.name,
"system.voies.mineure.id": voie[0].id,
"system.voies.mineure.key": item.system.key,
[`system.caracteristiques.${onze}.valeur`]: 11,
"system.langues": `${this.system.langues} <br>${item.name} : ${item.system.langues}`,
"system.biens": `${this.system.biens} <br>${item.name} : ${item.system.biens}`,
})
if (neufModifie) {
await this.update({
[`system.caracteristiques.${neuf}.valeur`]: 9,
})
}
} else {
await this.update({
"system.voies.mineure.nom": item.name,
"system.voies.mineure.id": voie[0].id,
"system.voies.mineure.key": item.system.key,
"system.langues": `${this.system.langues} <br>${item.name} : ${item.system.langues}`,
"system.biens": `${this.system.biens} <br>${item.name} : ${item.system.biens}`,
})
}
// Création des talents
let newTalents = []
for (const talent of itemData.system.talents) {
const talentItem = await fromUuid(talent)
if (talentItem) {
const newTalent = await this.createEmbeddedDocuments("Item", [talentItem.toObject()])
// Modification de la voie du talent
await newTalent[0].update({ "system.path": voie[0].uuid })
newTalents.push(newTalent[0].uuid)
}
}
// Mise à jour de la voie avec les nouveaux talents
await voie[0].update({ "system.talents": newTalents })
return ui.notifications.info(game.i18n.localize("TENEBRIS.Warning.voieMineureAjoutee"))
}
// Voie majeure
else {
const proceed = await foundry.applications.api.DialogV2.confirm({
window: { title: game.i18n.localize("TENEBRIS.Dialog.ajoutVoieMajeureTitre") },
content: game.i18n.localize("TENEBRIS.Dialog.ajoutVoieMajeure"),
rejectClose: false,
modal: true,
})
if (!proceed) return
// Création de la voie
const voie = await this.createEmbeddedDocuments("Item", [itemData], { renderSheet: false })
// Création des talents
let newTalents = []
for (const talent of itemData.system.talents) {
const talentItem = await fromUuid(talent)
if (talentItem) {
const newTalent = await this.createEmbeddedDocuments("Item", [talentItem.toObject()])
// Modification de la voie du talent
await newTalent[0].update({ "system.path": voie[0].uuid })
newTalents.push(newTalent[0].uuid)
}
}
// Mise à jour de la voie avec les nouveaux talents
await voie[0].update({ "system.talents": newTalents })
await this.update({
"system.voies.majeure.id": voie[0].id,
"system.voies.majeure.nom": item.name,
"system.voies.majeure.key": item.system.key,
"system.caracteristiques.rob": item.system.caracteristiques.rob,
"system.caracteristiques.dex": item.system.caracteristiques.dex,
"system.caracteristiques.int": item.system.caracteristiques.int,
"system.caracteristiques.per": item.system.caracteristiques.per,
"system.caracteristiques.vol": item.system.caracteristiques.vol,
"system.ressources.san": item.system.ressources.san,
"system.ressources.oeil": item.system.ressources.oeil,
"system.ressources.verbe": item.system.ressources.verbe,
"system.ressources.bourse": item.system.ressources.bourse,
"system.ressources.magie": item.system.ressources.magie,
"system.dv": item.system.dv,
"system.dmax.valeur": item.system.dmax,
"system.langues": `${item.name} : ${item.system.langues}`,
"system.biens": `${item.name} : ${item.system.biens}`,
})
return ui.notifications.info(game.i18n.localize("TENEBRIS.Warning.voieMajeureAjoutee"))
}
}
/**
* Deletes a specified path and its associated talents.
*
* @param {Object} path The path object to be deleted.
* @param {boolean} isMajor Indicates if the path is a major path, elswise it is a minor path.
* @returns {Promise<void>} A promise that resolves when the deletion is complete.
* @throws {Error} Throws an error if the type is not "character".
*/
async deletePath(path, isMajor) {
if (this.type !== "character") return
// Delete all talents linked to the path
let toDelete = path.system.talents.map((talent) => foundry.utils.parseUuid(talent).id)
toDelete.push(path.id)
await this.deleteEmbeddedDocuments("Item", toDelete)
// Voie majeure
if (isMajor) {
await this.update({ "system.voies.majeure.nom": "", "system.voies.majeure.id": null, "system.voies.majeure.key": "" })
ui.notifications.info(game.i18n.localize("TENEBRIS.Warning.voieMajeureSupprimee"))
}
// Voie mineure
else {
await this.update({ "system.voies.mineure.nom": "", "system.voies.mineure.id": null, "system.voies.mineure.key": "" })
ui.notifications.info(game.i18n.localize("TENEBRIS.Warning.voieMineureSupprimee"))
}
}
/**
* Adds an attack to the actor if the actor type is "opponent".
*
* @param {Object} attack The attack object to be added.
* @returns {Promise<void>} A promise that resolves when the attack has been added.
*/
async addAttack(attack) {
if (this.type !== "opponent") return
await this.createEmbeddedDocuments("Item", [attack])
}
async rollResource(resource) {
if (this.type !== "character") return
await this.system.roll(ROLL_TYPE.RESOURCE, resource)

View File

@ -278,7 +278,7 @@ export default class LethalFantasyRoll extends Roll {
const label = game.i18n.localize("TENEBRIS.Roll.roll")
const rollContext = await foundry.applications.api.DialogV2.wait({
window: { title: title },
classes: ["tenebris"],
classes: ["lethalfantasy"],
content,
buttons: [
{

View File

@ -1,8 +1,9 @@
export { default as LethalFantasyCharacter } from "./character.mjs"
export { default as LethalFantasyOpponent } from "./opponent.mjs"
export { default as LethalFantasyPath } from "./path.mjs"
export { default as LethalFantasyTalent } from "./talent.mjs"
export { default as LethalFantasyArmor } from "./armor.mjs"
export { default as LethalFantasyWeapon } from "./weapon.mjs"
export { default as LethalFantasySpell } from "./spell.mjs"
export { default as LethalFantasyAttack } from "./attack.mjs"
export { default as LethalFantasySkill } from "./skill.mjs"
export { default as LethalFantasyArmor } from "./armor.mjs"
export { default as LethalFantasyGift } from "./gift.mjs"
export { default as LethalFantasyVulnerability } from "./vulnerability.mjs"
export { default as LethalFantasySave } from "./save.mjs"

View File

@ -1,34 +1,25 @@
import { SYSTEM } from "../config/system.mjs"
import { CATEGORY } from "../config/armor.mjs"
export default class LethalFantasyArmor extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const requiredInteger = { required: true, nullable: false, integer: true }
const schema = {}
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.categorie = new fields.StringField({ required: true, initial: "sommaire", choices: SYSTEM.ARMOR_CATEGORY })
schema.valeur = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
schema.malus = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
schema.category = new fields.StringField({ required: true, initial: "melee", choices: SYSTEM.ARMOR_CATEGORY })
schema.protection = new fields.StringField({
required: true,
initial: ""
})
schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.money = new fields.StringField({ required: true, initial: "tinbit", choices: SYSTEM.MONEY })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["TENEBRIS.Armor"]
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Armor"]
get armorCategory() {
return game.i18n.localize(CATEGORY[this.categorie].label)
}
get details() {
return game.i18n.format("TENEBRIS.Armor.details", {
valeur: this.valeur,
malus: this.malus,
})
get weaponCategory() {
return game.i18n.localize(CATEGORY[this.category].label)
}
}

View File

@ -1,18 +0,0 @@
export default class LethalFantasy extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const schema = {}
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.degats = new fields.StringField({ required: false, nullable: true, blank: true })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["TENEBRIS.Attack"]
get toolTip() {
return this.description || ""
}
}

View File

@ -9,108 +9,83 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
const schema = {}
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.langues = new fields.HTMLField({ required: true, textSearch: true })
schema.notes = new fields.HTMLField({ required: true, textSearch: true })
schema.biens = new fields.HTMLField({ required: true, textSearch: true })
// Caractéristiques
// Carac
const characteristicField = (label) => {
const schema = {
valeur: new fields.NumberField({ ...requiredInteger, initial: 10, min: 0 }),
progression: new fields.SchemaField({
experience: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
progres: new fields.BooleanField(),
}),
value: new fields.NumberField({ ...requiredInteger, initial: 3, min: 0 }),
percent: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 100 }),
attackMod: new fields.NumberField({ ...requiredInteger, initial: 0 }),
defenseMod: new fields.NumberField({ ...requiredInteger, initial: 0 })
}
return new fields.SchemaField(schema, { label })
}
schema.caracteristiques = new fields.SchemaField(
schema.characteristics = new fields.SchemaField(
Object.values(SYSTEM.CHARACTERISTICS).reduce((obj, characteristic) => {
obj[characteristic.id] = characteristicField(characteristic.label)
return obj
}, {}),
)
// Ressources
const resourceField = (label) => {
// Carac
const saveField = (label) => {
const schema = {
valeur: new fields.StringField({
required: true,
nullable: false,
initial: SYSTEM.RESOURCE_VALUE.ZERO,
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
blank: true,
}),
max: new fields.StringField({
required: true,
nullable: false,
initial: SYSTEM.RESOURCE_VALUE.ZERO,
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
blank: true,
}),
experience: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
}
return new fields.SchemaField(schema, { label })
}
schema.ressources = new fields.SchemaField(
Object.values(SYSTEM.RESOURCES).reduce((obj, resource) => {
obj[resource.id] = resourceField(resource.label)
schema.saves = new fields.SchemaField(
Object.values(SYSTEM.SAVES).reduce((obj, save) => {
obj[save.id] = saveField(save.label)
return obj
}, {}),
)
schema.commanditaire = new fields.StringField({})
schema.dv = new fields.StringField({
required: true,
nullable: false,
initial: SYSTEM.RESOURCE_VALUE.ZERO,
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
})
schema.pv = new fields.SchemaField({
schema.hp = new fields.SchemaField({
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
max: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
})
schema.dmax = new fields.SchemaField({
valeur: new fields.StringField({
required: true,
nullable: false,
initial: SYSTEM.RESOURCE_VALUE.ZERO,
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
}),
experience: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
schema.perception = new fields.SchemaField({
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
bonus: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
})
schema.voies = new fields.SchemaField({
majeure: new fields.SchemaField({
id: new fields.DocumentIdField(),
key: new fields.StringField({ required: true }),
nom: new fields.StringField({ required: true }),
}),
mineure: new fields.SchemaField({
id: new fields.DocumentIdField(),
key: new fields.StringField({ required: true }),
nom: new fields.StringField({ required: true }),
}),
schema.grit = new fields.SchemaField({
earned: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
current: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
})
schema.luck = new fields.SchemaField({
earned: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
current: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
})
schema.movement = new fields.SchemaField({
walk: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
jog: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
sprint: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
run: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
armorAdjust: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
})
schema.biodata = new fields.SchemaField({
class: new fields.StringField({ required: true, nullable: false, initial: "" }),
level: new fields.NumberField({ ...requiredInteger, initial: 1, min: 1 }),
mortal: new fields.StringField({ required: true, nullable: false, initial: "" }),
alignment: new fields.StringField({ required: true, nullable: false, initial: "" }),
age: new fields.NumberField({ ...requiredInteger, initial: 15, min: 6 }),
height: new fields.NumberField({ ...requiredInteger, initial: 170, min: 50 }),
eyes: new fields.StringField({ required: true, nullable: false, initial: "" }),
hair: new fields.StringField({ required: true, nullable: false, initial: "" })
})
schema.developmentPoints = new fields.SchemaField({
total: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
remaining: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
})
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["TENEBRIS.Character"]
get hasVoieMajeure() {
return !!this.voies.majeure.id
}
get hasVoieMineure() {
return !!this.voies.mineure.id
}
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Character"]
/**
* Rolls a dice for a character.
@ -127,9 +102,6 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
rollValue = this.caracteristiques[rollTarget].valeur
opponentTarget = game.user.targets.first()
break
case ROLL_TYPE.RESOURCE:
rollValue = this.ressources[rollTarget].valeur
break
case ROLL_TYPE.DAMAGE:
rollValue = this.parent.items.get(rollTarget).system.degats
opponentTarget = game.user.targets.first()
@ -165,12 +137,6 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
})
if (!roll) return null
// Perte de ressouces
if (rollType === ROLL_TYPE.RESOURCE && roll.resultType === "failure") {
const value = this.ressources[rollTarget].valeur
const newValue = LethalFantasyUtils.findLowerDice(value)
await this.parent.update({ [`system.ressources.${rollTarget}.valeur`]: newValue })
}
await roll.toMessage({}, { rollMode: roll.options.rollMode })
}
}

View File

@ -0,0 +1,27 @@
import { SYSTEM } from "../config/system.mjs"
import { CATEGORY } from "../config/weapon.mjs"
export default class LethalFantasyEquipment 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.category = new fields.StringField({ required: true, initial: "melee", choices: SYSTEM.WEAPON_CATEGORY })
schema.damages = new fields.StringField({
required: true,
initial: ""
})
schema.cost = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.money = new fields.StringField({ required: true, initial: "tinbit", choices: SYSTEM.MONEY })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Equipment"]
get weaponCategory() {
return game.i18n.localize(CATEGORY[this.category].label)
}
}

16
module/models/gift.mjs Normal file
View File

@ -0,0 +1,16 @@
export default class LethalFantasyGift extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const requiredInteger = { required: true, nullable: false, integer: true }
const schema = {}
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Gift"]
}

View File

@ -22,7 +22,7 @@ export default class LethalFantasyOpponent extends foundry.abstract.TypeDataMode
}
/** @override */
static LOCALIZATION_PREFIXES = ["TENEBRIS.Opponent"]
static LOCALIZATION_PREFIXES = ["LETHALFANTSY.Opponent"]
/**
* Rolls a dice attack for an opponent.

View File

@ -1,83 +0,0 @@
import { SYSTEM } from "../config/system.mjs"
export default class LethalFantasyPath extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const schema = {}
schema.key = new fields.StringField({ required: true, nullable: false, initial: "" })
// Caractéristiques
const characteristicField = (label) => {
const schema = {
valeur: new fields.NumberField({
required: true,
nullable: false,
integer: true,
initial: 10,
min: 0,
}),
}
return new fields.SchemaField(schema, { label })
}
schema.caracteristiques = new fields.SchemaField(
Object.values(SYSTEM.CHARACTERISTICS).reduce((obj, characteristic) => {
obj[characteristic.id] = characteristicField(characteristic.label)
return obj
}, {}),
)
// Ressources
const resourceField = (label) => {
const schema = {
valeur: new fields.StringField({
required: true,
initial: SYSTEM.RESOURCE_VALUE.ZERO,
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
}),
}
return new fields.SchemaField(schema, { label })
}
schema.ressources = new fields.SchemaField(
Object.values(SYSTEM.RESOURCES).reduce((obj, resource) => {
obj[resource.id] = resourceField(resource.label)
return obj
}, {}),
)
schema.dv = new fields.StringField({
required: true,
initial: SYSTEM.RESOURCE_VALUE.ZERO,
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
})
schema.dmax = new fields.StringField({
required: true,
initial: SYSTEM.RESOURCE_VALUE.ZERO,
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
})
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.biens = new fields.HTMLField({ required: true, textSearch: true })
schema.langues = new fields.HTMLField({ required: true, textSearch: true })
schema.talents = new fields.ArrayField(new fields.DocumentUUIDField())
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["TENEBRIS.Path"]
async getAllTalents() {
const talents = []
this.talents.forEach(async (element) => {
const talent = await fromUuid(element)
if (talent) talents.push(talent)
})
return talents
}
}

17
module/models/save.mjs Normal file
View File

@ -0,0 +1,17 @@
export default class LethalFantasySave extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const requiredInteger = { required: true, nullable: false, integer: true }
const schema = {}
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.cost = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.value = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Save"]
}

24
module/models/skill.mjs Normal file
View File

@ -0,0 +1,24 @@
import { SYSTEM } from "../config/system.mjs"
import { CATEGORY } from "../config/skill.mjs"
export default class LethalFantasySkill 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.category = new fields.StringField({ required: true, initial: "layperson", choices: SYSTEM.SKILL_CATEGORY })
schema.base = new fields.StringField({ required: true, initial: "WIS" })
schema.bonus = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.cost = new fields.NumberField({ ...requiredInteger,required: true, initial: 0, min: 0 })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Skill"]
get skillCategory() {
return game.i18n.localize(CATEGORY[this.category].label)
}
}

View File

@ -11,17 +11,16 @@ export default class LethalFantasySpell extends foundry.abstract.TypeDataModel {
initial: "",
textSearch: true,
})
schema.preparation = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
schema.cible = new fields.StringField({ required: true })
schema.portee = new fields.StringField({ required: true, initial: "contact", choices: SYSTEM.SPELL_RANGE })
schema.duree = new fields.StringField({ required: true })
schema.consequenceA = new fields.StringField({ required: true })
schema.consequenceB = new fields.StringField({ required: true })
schema.level = new fields.NumberField({
...requiredInteger,
initial: 1,
min: 1,
max: 20,
})
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["TENEBRIS.Spell"]
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Spell"]
}

View File

@ -1,44 +0,0 @@
export default class LethalFantasyTalent extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const requiredInteger = { required: true, nullable: false, integer: true }
const schema = {}
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.appris = new fields.BooleanField()
schema.progression = new fields.BooleanField()
schema.niveau = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 3 })
schema.path = new fields.DocumentUUIDField()
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["TENEBRIS.Talent"]
get canProgress() {
return this.progression
}
get isLearned() {
return this.appris
}
get improvedDescription() {
return this.description.replace(/#niveau\b/g, this.niveau)
}
get details() {
if (this.progression)
return game.i18n.format("TENEBRIS.Talent.details", {
niveau: this.niveau,
})
return ""
}
async getPathName() {
const path = await fromUuid(this.path)
return path ? path.name : ""
}
}

View File

@ -0,0 +1,16 @@
export default class LethalFantasyVulnerability extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const requiredInteger = { required: true, nullable: false, integer: true }
const schema = {}
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.cost = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Vulnerability"]
}

View File

@ -1,24 +1,27 @@
import { SYSTEM } from "../config/system.mjs"
import { CATEGORY } from "../config/weapon.mjs"
export default class LethalFantasyWeapon extends foundry.abstract.TypeDataModel {
export default class LethalFantasySkill 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: "mains", choices: SYSTEM.WEAPON_CATEGORY })
schema.degats = new fields.StringField({
schema.category = new fields.StringField({ required: true, initial: "melee", choices: SYSTEM.WEAPON_CATEGORY })
schema.damages = new fields.StringField({
required: true,
initial: SYSTEM.WEAPON_DAMAGE.UN,
choices: Object.fromEntries(Object.entries(SYSTEM.WEAPON_DAMAGE).map(([key, value]) => [value, { label: `${value}` }])),
initial: ""
})
schema.cost = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.money = new fields.StringField({ required: true, initial: "tinbit", choices: SYSTEM.MONEY })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["TENEBRIS.Weapon"]
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Weapon"]
get weaponCategory() {
return game.i18n.localize(CATEGORY[this.categorie].label)
return game.i18n.localize(CATEGORY[this.category].label)
}
}

View File

@ -1,4 +1,3 @@
import LethalFantasyFortune from "./applications/fortune.mjs"
/**
* Handles socket events based on the provided action.

5961
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@
"prettier": "^3.3.3"
},
"author": "LeRatierBretonnien",
"license": "UNLICENSED",
"license": "MITs",
"dependencies": {
"gulp": "^5.0.0",
"gulp-less": "^5.0.0"
@ -23,5 +23,11 @@
"scripts": {
"pushLDBtoYML": "node ./tools/pushLDBtoYML.mjs",
"pullYMLtoLDB": "node ./tools/pullYMLtoLDB.mjs"
},
"description": "<h2><em>Lethal Fantasy RPG</em> for Foundry Virtual TableTop</h2>",
"main": "gulpfile.js",
"repository": {
"type": "git",
"url": "https://www.uberwald.me/gitea/uberwald/fvtt-lethal-fantasy.git"
}
}

View File

@ -1,46 +0,0 @@
#tenebris-application-fortune {
font-family: var(--font-primary);
font-size: calc(var(--font-size-standard) * 1.2);
color: var(--color-light-1);
menu {
.rollable:hover,
.rollable:focus {
text-shadow: 0 0 8px var(--color-shadow-primary);
}
}
section {
background-image: url("../assets/background-small.webp");
background-repeat: no-repeat;
background-size: 100% 100%;
padding: 0;
}
.application-fortune {
display: flex;
flex: 1;
flex-direction: column;
align-items: center;
//align-items: center;
font-size: calc(var(--font-size-standard) * 3);
button {
color: var(--color-light-1);
font-size: calc(var(--font-size-standard) * 1.2);
margin-top: 10px;
border: none;
background-color: inherit;
}
}
.application-fortune-gm {
//padding-right: 50px;
justify-content: flex-end;
}
.application-fortune-player {
//padding-right: 20px;
justify-content: space-between
}
}

View File

@ -1,4 +1,4 @@
#tenebris-application-manager {
#lethalfantasy-application-manager {
display: flex;
font-family: var(--font-primary);
@ -8,7 +8,7 @@
background-repeat: no-repeat;
background-size: 100% 100%;
.tenebris-table {
.lethalfantasy-table {
margin: 1rem;
background: none;
padding: 0;

View File

@ -1,18 +1,18 @@
@import "global.less";
.tenebris {
.lethalfantasy {
@import "mixins.less";
@import "character.less";
@import "opponent.less";
@import "path.less";
@import "talent.less";
@import "skill.less";
@import "gift.less";
@import "weapon.less";
@import "armor.less";
@import "spell.less";
@import "attack.less";
@import "vulnerability.less";
@import "save.less";
@import "chat.less";
}
@import "roll.less";
@import "application-fortune.less";
@import "application-manager.less";

View File

@ -1,4 +1,4 @@
.path-content {
.gifts-content {
.sheet-common();
.item-sheet-common();

View File

@ -2,7 +2,7 @@
--font-size-standard: 0.8125rem;
--background-image-base: url("../assets/parchment.jpg");
--font-secondary: "Amiri", serif;
--logo-standard: url("../assets/tenebris-logo.webp");
--logo-standard: url("../assets/lethal-fantasy-logo.webp");
}
#logo {
@ -20,7 +20,7 @@
left: calc(50% - 96px);
}
i.tenebris {
i.lethalfantasy {
width: 36px;
height: 36px;
background-image: var(--logo-standard);
@ -33,7 +33,7 @@ i.tenebris {
transition: 0.3s;
}
.application.dialog.tenebris {
.application.dialog.lethalfantasy {
font-family: var(--font-primary);
font-size: calc(var(--font-size-standard) * 1.2);
background-image: var(--background-image-base);

View File

@ -1,4 +1,4 @@
.application.dialog.tenebris {
.application.dialog.lethalfantasy {
color: var(--color-dark-1);
input,
@ -9,7 +9,7 @@
}
}
.tenebris-roll-dialog {
.lethalfantasy-roll-dialog {
fieldset {
padding: 10px;
}

View File

@ -1,4 +1,4 @@
.attack-content {
.save-content {
.sheet-common();
.item-sheet-common();

View File

@ -1,4 +1,4 @@
.talent-content {
.skill-content {
.sheet-common();
.item-sheet-common();

26
styles/vulnerability.less Normal file
View File

@ -0,0 +1,26 @@
.vulnerability-content {
.sheet-common();
.item-sheet-common();
.header {
display: flex;
img {
width: 50px;
height: 50px;
}
}
input[type="checkbox"] {
font-size: var(--font-size-14);
width: 20px;
padding-top: 0;
}
input[type="checkbox"]:checked {
background-color: rgba(0, 0, 0, 0.1);
}
input[type="checkbox"]:checked::after {
color: rgba(0, 0, 0, 0.1);
}
}

View File

@ -18,26 +18,27 @@
"verified": "12"
},
"esmodules": ["lethal-fantasy.mjs"],
"styles": ["css/lethal-fantasy.css"],
"styles": ["css/fvtt-lethal-fantasy.css"],
"languages": [
{
"lang": "en",
"name": "Anglais",
"path": "lang/fr.json"
"path": "lang/en.json"
}
],
"documentTypes": {
"Actor": {
"character": { "htmlFields": ["description", "langues", "notes"] },
"character": { "htmlFields": ["description", "notes"] },
"opponent": { "htmlFields": ["description"] }
},
"Item": {
"path": { "htmlFields": ["description", "biens", "langues"] },
"talent": { "htmlFields": ["description"] },
"skill": { "htmlFields": ["description"] },
"gift": { "htmlFields": ["description"] },
"vulnerability": { "htmlFields": ["description"] },
"save": { "htmlFields": ["description"] },
"weapon": { "htmlFields": ["description"] },
"armor": { "htmlFields": ["description"] },
"spell": { "htmlFields": ["description"] },
"attack": { "htmlFields": ["description"] }
"spell": { "htmlFields": ["description"] }
}
},
"grid": {
@ -48,7 +49,5 @@
"socket": true,
"background": "systems/fvtt-lethal-fantasy/assets/background.webp",
"packs": [
{
}
]
}

View File

@ -4,7 +4,7 @@
{{formInput fields.name value=source.name}}
</div>
{{formField systemFields.categorie value=system.categorie localize=true}}
{{formField systemFields.category value=system.category localize=true}}
{{formField systemFields.valeur value=system.valeur}}
{{formField systemFields.malus value=system.malus}}
<fieldset>

17
templates/gift.hbs Normal file
View File

@ -0,0 +1,17 @@
<section>
<div class="header">
<img class="item-img" src="{{item.img}}" data-edit="img" data-action="editImage" data-tooltip="{{item.name}}" />
{{formInput fields.name value=source.name}}
</div>
{{formField systemFields.appris value=system.appris}}
{{formField systemFields.progression value=system.progression}}
{{#if canProgress}}
{{formField systemFields.niveau value=system.niveau }}
{{/if}}wwww
<fieldset>
<legend>{{localize "TENEBRIS.Label.description"}}</legend>
{{formInput systemFields.description enriched=enrichedDescription value=system.description name="system.description" toggled=true}}
</fieldset>
</section>

13
templates/skill.hbs Normal file
View File

@ -0,0 +1,13 @@
<section>
<div class="header">
<img class="item-img" src="{{item.img}}" data-edit="img" data-action="editImage" data-tooltip="{{item.name}}" />
{{formInput fields.name value=source.name}}
</div>
{{formField systemFields.bonus value=system.bonus}}
<fieldset>
<legend>{{localize "LETHALFANTASY.Label.description"}}</legend>
{{formInput systemFields.description enriched=enrichedDescription value=system.description name="system.description" toggled=true}}
</fieldset>
</section>