forked from public/foundryvtt-reve-de-dragon
Support de races
L'item "race" permet de paramétrer des ajustements de caracs, des min/max de taille, et une limite de force. Ajouter une race à un acteur enlève la/les races précédentes et ajoute les modificateurs de caracs de la nouvelle race. Enlever une race enlève les modificateurs de caracs de la race aux caractéristiques
This commit is contained in:
@ -12,12 +12,13 @@ import { RdDSheetUtility } from "./rdd-sheet-utility.js";
|
||||
import { STATUSES } from "./settings/status-effects.js";
|
||||
import { MAINS_DIRECTRICES } from "./actor.js";
|
||||
import { RdDBaseActorReveSheet } from "./actor/base-actor-reve-sheet.js";
|
||||
import { RdDItem } from "./item.js";
|
||||
import { ITEM_TYPES, RdDItem } from "./item.js";
|
||||
import { RdDItemBlessure } from "./item/blessure.js";
|
||||
import { RdDEmpoignade } from "./rdd-empoignade.js";
|
||||
import { RdDBaseActorSangSheet } from "./actor/base-actor-sang-sheet.js";
|
||||
import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
||||
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js";
|
||||
import { RdDItemRace } from "./item/race.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/**
|
||||
@ -97,6 +98,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
cacheTMR: this.actor.isTMRCache()
|
||||
}
|
||||
|
||||
formData.race = actor.itemTypes[ITEM_TYPES.race].find(it => true)
|
||||
formData.subacteurs = {
|
||||
vehicules: this.actor.listeVehicules(),
|
||||
montures: this.actor.listeMontures(),
|
||||
|
@ -17,7 +17,7 @@ import { RdDItemSigneDraconique } from "./item/signedraconique.js";
|
||||
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
|
||||
import { EffetsDraconiques } from "./tmr/effets-draconiques.js";
|
||||
import { Draconique } from "./tmr/draconique.js";
|
||||
import { RdDCarac } from "./rdd-carac.js";
|
||||
import { LIST_CARAC, RdDCarac } from "./rdd-carac.js";
|
||||
import { DialogConsommer } from "./dialog-item-consommer.js";
|
||||
import { DialogFabriquerPotion } from "./dialog-fabriquer-potion.js";
|
||||
import { RollDataAjustements } from "./rolldata-ajustements.js";
|
||||
@ -41,6 +41,7 @@ import { RdDCombatManager } from "./rdd-combat.js";
|
||||
import { RdDItemTete } from "./item/tete.js";
|
||||
import { DialogSelect } from "./dialog-select.js";
|
||||
import { PAS_DE_DRACONIC, POSSESSION_SANS_DRACONIC } from "./item/base-items.js";
|
||||
import { RdDItemRace } from "./item/race.js";
|
||||
|
||||
export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
|
||||
|
||||
@ -58,7 +59,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
*/
|
||||
prepareActorData() {
|
||||
|
||||
this.system.carac.force.value = Math.min(this.system.carac.force.value, parseInt(this.system.carac.taille.value) + 4);
|
||||
RdDItemRace.applyRacialLimits(this)
|
||||
|
||||
this.system.carac.melee.value = Math.floor((this.getForce() + parseInt(this.system.carac.agilite.value)) / 2);
|
||||
this.system.carac.tir.value = Math.floor((parseInt(this.system.carac.vue.value) + parseInt(this.system.carac.dexterite.value)) / 2);
|
||||
@ -660,18 +661,16 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async updateCarac(caracName, to) {
|
||||
if (caracName == "force") {
|
||||
if (Number(to) > this.getTaille() + 4) {
|
||||
ui.notifications.warn("Votre FORCE doit être au maximum de TAILLE+4");
|
||||
return;
|
||||
}
|
||||
to = Number(to)
|
||||
if (!RdDItemRace.checkRacialMax(this, caracName, to)){
|
||||
return
|
||||
}
|
||||
if (caracName == "reve") {
|
||||
if (caracName == LIST_CARAC.reve.code) {
|
||||
if (to > Misc.toInt(this.system.reve.seuil.value)) {
|
||||
this.setPointsDeSeuil(to);
|
||||
}
|
||||
}
|
||||
if (caracName == "chance") {
|
||||
if (caracName == LIST_CARAC.chance.code) {
|
||||
if (to > Misc.toInt(this.system.compteurs.chance.value)) {
|
||||
this.setPointsDeChance(to);
|
||||
}
|
||||
@ -1531,13 +1530,12 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
isCaracMax(code) {
|
||||
if (code == 'force' && parseInt(this.system.carac.force.value) >= parseInt(this.system.carac.taille.value) + 4) {
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
return RdDItemRace.isRacialMax(this, code)
|
||||
}
|
||||
|
||||
async checkCaracXP(caracName, display = true) {
|
||||
let carac = this.findCaracByName(caracName);
|
||||
if (carac && carac.xp > 0) {
|
||||
@ -1664,10 +1662,12 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollUnSort(coord) {
|
||||
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||
if (RdDEmpoignade.checkEmpoignadeEnCours(this)) {
|
||||
return
|
||||
}
|
||||
if (EffetsDraconiques.isSortImpossible(this)) {
|
||||
ui.notifications.error("Une queue ou un souffle vous empèche de lancer de sort!");
|
||||
return;
|
||||
ui.notifications.error("Une queue ou un souffle vous empèche de lancer de sort!")
|
||||
return
|
||||
}
|
||||
// Duplication car les pts de reve sont modifiés dans le sort
|
||||
let sorts = foundry.utils.duplicate(this.$filterSortList(this.itemTypes['sort'], coord));
|
||||
@ -3033,12 +3033,14 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
async onCreateItem(item, options, id) {
|
||||
switch (item.type) {
|
||||
case 'tete':
|
||||
case 'queue':
|
||||
case 'ombre':
|
||||
case 'souffle':
|
||||
await this.onCreateOwnedDraconique(item, options, id);
|
||||
break;
|
||||
case ITEM_TYPES.tete:
|
||||
case ITEM_TYPES.queue:
|
||||
case ITEM_TYPES.ombre:
|
||||
case ITEM_TYPES.souffle:
|
||||
await this.onCreateOwnedDraconique(item, options, id)
|
||||
break
|
||||
case ITEM_TYPES.race:
|
||||
await this.onCreateOwnedRace(item, options, id)
|
||||
}
|
||||
await item.onCreateItemTemporel(this);
|
||||
await item.onCreateDecoupeComestible(this);
|
||||
@ -3046,16 +3048,19 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
async onDeleteItem(item, options, id) {
|
||||
switch (item.type) {
|
||||
case 'tete':
|
||||
case 'queue':
|
||||
case 'ombre':
|
||||
case 'souffle':
|
||||
case ITEM_TYPES.tete:
|
||||
case ITEM_TYPES.queue:
|
||||
case ITEM_TYPES.ombre:
|
||||
case ITEM_TYPES.souffle:
|
||||
await this.onDeleteOwnedDraconique(item, options, id)
|
||||
break
|
||||
case 'casetmr':
|
||||
case ITEM_TYPES.race:
|
||||
await this.onDeleteOwnedRace(item, options, id)
|
||||
break
|
||||
case ITEM_TYPES.casetmr:
|
||||
await this.onDeleteOwnedCaseTmr(item, options, id)
|
||||
break
|
||||
case 'empoignade':
|
||||
case ITEM_TYPES.empoignade:
|
||||
await RdDEmpoignade.deleteLinkedEmpoignade(this.id, item)
|
||||
break
|
||||
}
|
||||
@ -3084,6 +3089,35 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
}
|
||||
|
||||
async onCreateOwnedRace(item, options, id) {
|
||||
if (Misc.isFirstConnectedGM()) {
|
||||
const raceIds = this.itemTypes[ITEM_TYPES.race].map(it => it.id).filter(id => id != item.id)
|
||||
if (raceIds.length > 0) {
|
||||
await this.deleteEmbeddedDocuments('Item', raceIds)
|
||||
}
|
||||
await this._applyRaceCaracUpdates(item, 1)
|
||||
}
|
||||
}
|
||||
|
||||
async onDeleteOwnedRace(item, options, id) {
|
||||
if (Misc.isFirstConnectedGM()) {
|
||||
await this._applyRaceCaracUpdates(item, -1)
|
||||
}
|
||||
}
|
||||
|
||||
async _applyRaceCaracUpdates(item, sign) {
|
||||
const updates = {};
|
||||
RdDCarac.caracs(it => true).forEach(c => {
|
||||
const toAdd = Number(foundry.utils.getProperty(item, c.path)) * sign
|
||||
if (toAdd != 0) {
|
||||
updates[c.path] = Number(foundry.utils.getProperty(this, c.path)) + toAdd
|
||||
}
|
||||
})
|
||||
if (Object.keys(updates).length > 0) {
|
||||
await this.update(updates)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async onDeleteOwnedCaseTmr(item, options, id) {
|
||||
if (Misc.isFirstConnectedGM()) {
|
||||
|
@ -45,6 +45,7 @@ export const ITEM_TYPES = {
|
||||
danse: 'danse',
|
||||
chant: 'chant',
|
||||
jeu: 'jeu',
|
||||
race: 'race',
|
||||
recettecuisine: 'recettecuisine',
|
||||
oeuvre: 'oeuvre',
|
||||
recettealchimique: 'recettealchimique',
|
||||
|
@ -1,9 +1,11 @@
|
||||
import { RdDItem } from "../item.js";
|
||||
import { ITEM_TYPES, RdDItem } from "../item.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
|
||||
|
||||
export class RdDItemArmure extends RdDItem {
|
||||
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.armure }
|
||||
|
||||
static get defaultIcon() {
|
||||
return "systems/foundryvtt-reve-de-dragon/icons/armes_armures/armure_plaques.webp";
|
||||
}
|
||||
|
100
module/item/race.js
Normal file
100
module/item/race.js
Normal file
@ -0,0 +1,100 @@
|
||||
import { ITEM_TYPES, RdDItem } from "../item.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { LIST_CARAC, RdDCarac } from "../rdd-carac.js";
|
||||
|
||||
export class RdDItemRace extends RdDItem {
|
||||
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.race }
|
||||
|
||||
static get defaultIcon() {
|
||||
return "systems/foundryvtt-reve-de-dragon/icons/humanoides/humain.webp";
|
||||
}
|
||||
|
||||
static checkRacialMax(actor, code, value) {
|
||||
const race = RdDItemRace.getRace(actor)
|
||||
if (code == LIST_CARAC.force.code) {
|
||||
if (!race.isForceValid(actor, value)) {
|
||||
ui.notifications.warn(race.system.carac.force.limitmessage)
|
||||
return false
|
||||
}
|
||||
}
|
||||
const carac = RdDCarac.carac(code)
|
||||
if (race.isMax(actor, code, value - 1)) {
|
||||
ui.notifications.warn(`${value} est supérieure au maximum de ${carac.label}`)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
static applyRacialLimits(actor) {
|
||||
const race = RdDItemRace.getRace(actor)
|
||||
actor.system.carac.taille.value = race.getValidTaille(actor.getTaille())
|
||||
actor.system.carac.force.value = Math.min(
|
||||
actor.getForce(),
|
||||
race.getForceMax(actor))
|
||||
}
|
||||
|
||||
static isRacialMax(actor, code, value = undefined) {
|
||||
return RdDItemRace.getRace(actor).isMax(actor, code, value)
|
||||
}
|
||||
|
||||
static getRace(actor) {
|
||||
return actor.itemTypes[ITEM_TYPES.race].find(it => true) ?? RdDItemRace.getFallbackRace()
|
||||
}
|
||||
|
||||
static getFallbackRace() {
|
||||
if (RdDItemRace.fallback == undefined) {
|
||||
RdDItemRace.fallback = new RdDItemRace({ name: 'Humain', type: RdDItemRace.ITEM_TYPE })
|
||||
}
|
||||
return RdDItemRace.fallback
|
||||
}
|
||||
|
||||
|
||||
isMax(actor, code, value = undefined) {
|
||||
const path = RdDCarac.carac(code)?.path
|
||||
if (value == undefined) {
|
||||
value = path ? foundry.utils.getProperty(actor, path) : 0
|
||||
}
|
||||
if (code == LIST_CARAC.force.code) {
|
||||
return value >= this.getForceMax(actor)
|
||||
}
|
||||
const max = foundry.utils.getProperty(this, path) ?? -1
|
||||
return (max > 0 && value >= max)
|
||||
}
|
||||
|
||||
getValidTaille(taille) {
|
||||
const min = Math.max(this.system.carac.taille.min, 0)
|
||||
if (min > taille) {
|
||||
ui.notifications.warn("La Taille est inférieur au minimum racial")
|
||||
return min
|
||||
}
|
||||
const raceMax = this.system.carac.taille.max;
|
||||
const max = raceMax < 0 ? taille + 1 : raceMax
|
||||
if (max < taille) {
|
||||
ui.notifications.warn("La Taille est supérieure au maximum racial")
|
||||
return max
|
||||
}
|
||||
return taille
|
||||
}
|
||||
|
||||
isForceValid(actor, value) {
|
||||
return value <= this.getForceMax(actor)
|
||||
}
|
||||
|
||||
getForceMax(actor) {
|
||||
const terms = this.system.carac.force.limit.replaceAll(' ', '').split('+')
|
||||
return terms.map(
|
||||
it => {
|
||||
const term = Number.parseInt(it)
|
||||
if (Number.isInteger(term)) {
|
||||
return term
|
||||
}
|
||||
const path = RdDCarac.carac(it)?.path
|
||||
if (path) {
|
||||
return foundry.utils.getProperty(actor, path)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
).reduce(Misc.sum());
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
import { RdDBaseActorSheet } from "../actor/base-actor-sheet.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { RdDSheetUtility } from "../rdd-sheet-utility.js";
|
||||
import { RdDUtility } from "../rdd-utility.js";
|
||||
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
|
||||
|
||||
export class RdDConteneurItemSheet extends RdDItemInventaireSheet {
|
||||
|
||||
static get ITEM_TYPE() { return "conteneur" };
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.conteneur };
|
||||
|
||||
async getData() {
|
||||
const formData = await super.getData();
|
||||
|
@ -2,10 +2,11 @@ import { RdDBaseActor } from "./actor/base-actor.js";
|
||||
import { LOG_HEAD, SYSTEM_RDD } from "./constants.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { Monnaie } from "./item-monnaie.js";
|
||||
import { RdDItem, ITEM_TYPES } from "./item.js";
|
||||
import { RdDItem, ITEM_TYPES, ACTOR_TYPES } from "./item.js";
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { RdDRaretes } from "./item/raretes.js";
|
||||
import { VOIES_DRACONIC } from "./item-sort.js";
|
||||
import { SystemCompendiums } from "./settings/system-compendiums.js";
|
||||
|
||||
class Migration {
|
||||
get code() { return "sample"; }
|
||||
@ -566,6 +567,27 @@ class _12_0_26_MigrationVoieSorts extends Migration {
|
||||
}
|
||||
}
|
||||
|
||||
class _12_0_32_MigrationRaces extends Migration {
|
||||
get code() { return "migration-races" }
|
||||
get version() { return "12.0.32" }
|
||||
|
||||
async migrate() {
|
||||
const races = await SystemCompendiums.getItems("races", ITEM_TYPES.race)
|
||||
await game.actors.filter(it => it.type == ACTOR_TYPES.personnage).forEach(async actor => {
|
||||
if (actor.itemTypes[ITEM_TYPES.race].length == 0) {
|
||||
const raceName = actor.system.race ?? 'Humain'
|
||||
const race = races.find(it => Grammar.equalsInsensitive(raceName, it.name))
|
||||
if (race) {
|
||||
console.log(this.code, `Adding race ${race.name} to actor ${actor.name}`)
|
||||
actor.createEmbeddedDocuments('Item', [race])
|
||||
console.log(this.code, `Neutralizing race ${race.name} adjustments for actor ${actor.name}`)
|
||||
actor._applyRaceCaracUpdates(race, -1)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Migrations {
|
||||
static getMigrations() {
|
||||
return [
|
||||
@ -585,7 +607,8 @@ export class Migrations {
|
||||
new _10_7_19_CategorieCompetenceCreature(),
|
||||
new _10_7_19_PossessionsEntiteVictime(),
|
||||
new _11_2_20_MigrationAstrologie(),
|
||||
new _12_0_26_MigrationVoieSorts()
|
||||
new _12_0_26_MigrationVoieSorts(),
|
||||
new _12_0_32_MigrationRaces(),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,39 @@ const TABLE_CARACTERISTIQUES_DERIVEES = {
|
||||
32: { xp: 180, niveau: 11, poids: "1501-2000", poidsMin: 1501, poidsMax: 2000, plusdom: +11, sconst: 10, sust: 17 }
|
||||
};
|
||||
|
||||
export const LIST_CARAC = {
|
||||
'taille': { code: 'taille', label: 'Taille', isCarac: true, path: 'system.carac.taille.value' },
|
||||
'apparence': { code: 'apparence', label: 'Apparence', isCarac: true, path: 'system.carac.apparence.value' },
|
||||
'constitution': { code: 'constitution', label: 'Constitution', isCarac: true, path: 'system.carac.constitution.value' },
|
||||
'force': { code: 'force', label: 'Force', isCarac: true, path: 'system.carac.force.value' },
|
||||
'agilite': { code: 'agilite', label: 'Agilité', isCarac: true, path: 'system.carac.agilite.value' },
|
||||
'dexterite': { code: 'dexterite', label: 'Dextérité', isCarac: true, path: 'system.carac.dexterite.value' },
|
||||
'vue': { code: 'vue', label: 'Vue', isCarac: true, path: 'system.carac.vue.value' },
|
||||
'ouie': { code: 'ouie', label: 'Ouïe', isCarac: true, path: 'system.carac.ouie.value' },
|
||||
'odoratgout': { code: 'odoratgout', label: 'Odorat-Goût', isCarac: true, path: 'system.carac.odoratgout.value' },
|
||||
'volonte': { code: 'volonte', label: 'Volonté', isCarac: true, path: 'system.carac.volonte.value' },
|
||||
'intellect': { code: 'intellect', label: 'Intellect', isCarac: true, path: 'system.carac.intellect.value' },
|
||||
'empathie': { code: 'empathie', label: 'Empathie', isCarac: true, path: 'system.carac.empathie.value' },
|
||||
'reve': { code: 'reve', label: 'Rêve', isCarac: true, path: 'system.carac.reve.value' },
|
||||
'chance': { code: 'chance', label: 'Chance', isCarac: true, path: 'system.carac.chance.value' },
|
||||
'protection': { code: 'protection', label: 'Protection naturelle', isCarac: false, path: 'system.attributs.protection.value' },
|
||||
'beaute': { code: 'beaute', label: 'Beauté', isCarac: false, path: 'system.background.beaute.value' }
|
||||
}
|
||||
|
||||
export class RdDCarac {
|
||||
|
||||
static carac(code) {
|
||||
return LIST_CARAC[code]
|
||||
}
|
||||
|
||||
static label(code) {
|
||||
return RdDCarac.carac(code)?.label ?? '---'
|
||||
}
|
||||
|
||||
static caracs(filter = it => it.isCarac) {
|
||||
return Object.values(LIST_CARAC).filter(filter)
|
||||
}
|
||||
|
||||
static isAgiliteOuDerobee(selectedCarac) {
|
||||
return selectedCarac?.label.match(/(Agilité|Dérobée)/);
|
||||
}
|
||||
|
@ -28,9 +28,11 @@ import { Environnement } from "./environnement.js"
|
||||
|
||||
import { RdDActor } from "./actor.js"
|
||||
import { RdDBaseActor } from "./actor/base-actor.js"
|
||||
import { RdDCreature } from "./actor/creature.js"
|
||||
import { RdDCommerce } from "./actor/commerce.js"
|
||||
import { RdDEntite } from "./actor/entite.js"
|
||||
import { RdDVehicule } from "./actor/vehicule.js"
|
||||
|
||||
import { RdDActorSheet } from "./actor-sheet.js"
|
||||
import { RdDCommerceSheet } from "./actor/commerce-sheet.js"
|
||||
import { RdDCreatureSheet } from "./actor/creature-sheet.js"
|
||||
@ -38,6 +40,7 @@ import { RdDActorEntiteSheet } from "./actor/entite-sheet.js"
|
||||
import { RdDActorVehiculeSheet } from "./actor/vehicule-sheet.js"
|
||||
|
||||
import { RdDItem } from "./item.js"
|
||||
import { RdDItemArmure } from "./item/armure.js"
|
||||
import { RdDItemBlessure } from "./item/blessure.js"
|
||||
import { RdDItemService } from "./item/service.js"
|
||||
import { RdDItemMaladie } from "./item/maladie.js"
|
||||
@ -45,7 +48,11 @@ import { RdDItemPoison } from "./item/poison.js"
|
||||
import { RdDItemSigneDraconique } from "./item/signedraconique.js"
|
||||
import { RdDItemQueue } from "./item/queue.js"
|
||||
import { RdDItemOmbre } from "./item/ombre.js"
|
||||
import { RdDItemSort } from "./item-sort.js"
|
||||
import { RdDItemTete } from "./item/tete.js"
|
||||
import { RdDItemRace } from "./item/race.js"
|
||||
import { RdDItemSouffle } from "./item/souffle.js"
|
||||
|
||||
import { RdDRencontre } from "./item/rencontre.js"
|
||||
|
||||
import { RdDItemSheet } from "./item-sheet.js"
|
||||
@ -57,20 +64,17 @@ import { RdDPlanteItemSheet } from "./item/sheet-plante.js"
|
||||
import { RdDIngredientItemSheet } from "./item/sheet-ingredient.js"
|
||||
import { RdDFauneItemSheet } from "./item/sheet-faune.js"
|
||||
import { RdDConteneurItemSheet } from "./item/sheet-conteneur.js"
|
||||
import { RdDSigneDraconiqueItemSheet } from "./item/sheet-signedraconique.js"
|
||||
import { RdDItemInventaireSheet } from "./item/sheet-base-inventaire.js"
|
||||
import { RdDSigneDraconiqueItemSheet } from "./item/sheet-signedraconique.js"
|
||||
|
||||
import { AppAstrologie } from "./sommeil/app-astrologie.js"
|
||||
import { RdDItemArmure } from "./item/armure.js"
|
||||
import { AutoAdjustDarkness } from "./time/auto-adjust-darkness.js"
|
||||
import { RdDCreature } from "./actor/creature.js"
|
||||
import { RdDTMRDialog } from "./rdd-tmr-dialog.js"
|
||||
import { OptionsAvancees } from "./settings/options-avancees.js"
|
||||
import { ExportScriptarium } from "./actor/export-scriptarium/export-scriptarium.js"
|
||||
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js"
|
||||
import { RdDActorExportSheet } from "./actor/export-scriptarium/actor-encart-sheet.js"
|
||||
import { RdDStatBlockParser } from "./apps/rdd-import-stats.js"
|
||||
import { RdDItemSort } from "./item-sort.js"
|
||||
import { RdDItemTete } from "./item/tete.js"
|
||||
|
||||
/**
|
||||
* RdD system
|
||||
@ -99,6 +103,7 @@ export class SystemReveDeDragon {
|
||||
poison: RdDItemPoison,
|
||||
queue: RdDItemQueue,
|
||||
tete: RdDItemTete,
|
||||
race: RdDItemRace,
|
||||
rencontre: RdDRencontre,
|
||||
service: RdDItemService,
|
||||
signedraconique: RdDItemSigneDraconique,
|
||||
@ -201,8 +206,9 @@ export class SystemReveDeDragon {
|
||||
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {
|
||||
types: [
|
||||
"competence", "competencecreature",
|
||||
"recettealchimique", "musique", "chant", "danse", "jeu", "recettecuisine", "oeuvre",
|
||||
"meditation", "queue", "ombre", "souffle", "tete", "casetmr", "sort", "sortreserve",
|
||||
"recettealchimique", "musique", "chant", "danse", "jeu", "race",
|
||||
"recettecuisine", "oeuvre", "meditation",
|
||||
"queue", "ombre", "souffle", "tete", "casetmr", "sort", "sortreserve",
|
||||
"nombreastral", "tache", "maladie", "poison", "possession",
|
||||
"tarot", "extraitpoetique", "empoignade"
|
||||
], makeDefault: true
|
||||
|
@ -21,6 +21,7 @@ import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
||||
import { APP_ASTROLOGIE_REFRESH } from "./sommeil/app-astrologie.js";
|
||||
import { RDD_CONFIG } from "./constants.js";
|
||||
import { RdDBaseActor } from "./actor/base-actor.js";
|
||||
import { RdDCarac } from "./rdd-carac.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// This table starts at 0 -> niveau -10
|
||||
@ -298,12 +299,12 @@ export class RdDUtility {
|
||||
}
|
||||
return accum
|
||||
})
|
||||
|
||||
|
||||
// tableaux, listes
|
||||
Handlebars.registerHelper('array-includes', (array, value) => array.includes(value));
|
||||
Handlebars.registerHelper('isLastIndex', (index, list) => index + 1 >= list.length);
|
||||
Handlebars.registerHelper('trier', list => list.sort((a, b) => a.name.localeCompare(b.name)));
|
||||
|
||||
|
||||
// table de résolution
|
||||
Handlebars.registerHelper('computeResolutionScore', (row, col) => RdDResolutionTable.computePercentage(row, col));
|
||||
Handlebars.registerHelper('computeResolutionChances', (row, col) => RdDResolutionTable.computeChances(row, col));
|
||||
@ -314,12 +315,14 @@ export class RdDUtility {
|
||||
Handlebars.registerHelper('timestamp-extract', timestamp => new RdDTimestamp(timestamp).toCalendrier());
|
||||
Handlebars.registerHelper('timestamp-formulesDuree', () => RdDTimestamp.formulesDuree());
|
||||
Handlebars.registerHelper('timestamp-formulesPeriode', () => RdDTimestamp.formulesPeriode());
|
||||
|
||||
|
||||
// informations sur les acteurs
|
||||
Handlebars.registerHelper('actor-default', (actorType, ...path) => RdDBaseActor.getDefaultValue(actorType, path.slice(0, -1)));
|
||||
Handlebars.registerHelper('filtreTriCompetences', competences => RdDItemCompetence.triVisible(competences));
|
||||
Handlebars.registerHelper('experienceLog-topic', topic => ExperienceLog.labelTopic(topic));
|
||||
|
||||
|
||||
Handlebars.registerHelper('carac-label', (code) => RdDCarac.label(code))
|
||||
|
||||
// inventaire et marchands
|
||||
Handlebars.registerHelper('buildLigneInventaire', (item, options) => { return new Handlebars.SafeString(RdDUtility.buildLigneInventaire(item, options)); });
|
||||
Handlebars.registerHelper('buildInventaireConteneur', (actorId, itemId, options) => { return new Handlebars.SafeString(RdDUtility.buildInventaireConteneur(actorId, itemId, options)); });
|
||||
@ -329,7 +332,7 @@ export class RdDUtility {
|
||||
Handlebars.registerHelper('isFieldInventaireModifiable', (type, field) => RdDItem.isFieldInventaireModifiable(type, field));
|
||||
// Items
|
||||
Handlebars.registerHelper('rarete-getChamp', (rarete, field) => RdDRaretes.getChamp(rarete, field));
|
||||
|
||||
|
||||
// TMRs
|
||||
Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord));
|
||||
Handlebars.registerHelper('caseTmr-type', coord => TMRUtility.getTMRType(coord));
|
||||
@ -930,7 +933,7 @@ export class RdDUtility {
|
||||
/*-------------------------------------------- */
|
||||
static checkThanatosXP(compName) {
|
||||
if (compName.includes('Thanatos')) {
|
||||
let message = "Vous avez mis des points d'Expérience dans la Voie de Thanatos !<br>Vous devez réduire manuellement d'un même montant d'XP une autre compétence Draconique.";
|
||||
let message = "Vous avez mis des points d'Expérience en Thanatos !<br>Vous devez réduire manuellement d'un même montant d'XP une autre compétence Draconique.";
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getUserAndGMs(),
|
||||
content: message
|
||||
|
@ -168,7 +168,7 @@ export class RollDataAjustements {
|
||||
// s'assurer de la correction des infos rollData
|
||||
foundry.utils.mergeObject(rollData, { ajustements: {}, use: {} }, { overwrite: false })
|
||||
|
||||
for (var key in referenceAjustements) {
|
||||
for (let key in referenceAjustements) {
|
||||
const reference = referenceAjustements[key];
|
||||
rollData.ajustements[key] = {
|
||||
visible: reference.isVisible && reference.isVisible(rollData, actor),
|
||||
|
@ -15,6 +15,7 @@ const CONFIGURABLE_COMPENDIUMS = {
|
||||
'ombres-de-thanatos': { label: "Ombres de Thanatos", type: "Item" },
|
||||
'souffles-de-dragon': { label: "Souffles de Dragon", type: "Item" },
|
||||
'tarot-draconique': { label: "Tarots draconiques", type: "Item" },
|
||||
'races': { label: "Races", type: "Item" },
|
||||
'rencontres': { label: "Rencontres dans les TMR", type: "Item" },
|
||||
'tetes-de-dragon-pour-haut-revants': { label: "Têtes de dragons (haut-rêvant)", type: "Item" },
|
||||
'tetes-de-dragon-pour-tous-personnages': { label: "Têtes de dragons (tous)", type: "Item" },
|
||||
|
Reference in New Issue
Block a user