Fix: Activation des spécialités dans les fiches PNJ Traveller
- Correction de setSkillLevel pour créer les spécialités manquantes automatiquement - Mapping corrigé: Pilot-Spacecraft -> pilot.vaisseaux_spatiaux (pluriel) - Résout le problème où les spécialités comme 'Vaisseaux spatiaux' n'étaient pas activées Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -46,3 +46,9 @@
|
||||
2026/05/28-00:37:26.109453 7f3e6effd6c0 Delete type=2 #64
|
||||
2026/05/28-00:37:26.109722 7f3e6effd6c0 Delete type=2 #66
|
||||
2026/05/28-00:37:26.109828 7f3e6effd6c0 Delete type=2 #68
|
||||
2026/05/28-00:48:03.393850 7f3e6effd6c0 Level-0 table #71: started
|
||||
2026/05/28-00:48:03.411976 7f3e6effd6c0 Level-0 table #71: 1806724 bytes OK
|
||||
2026/05/28-00:48:03.419030 7f3e6effd6c0 Delete type=0 #67
|
||||
2026/05/28-00:52:05.605289 7f3e6effd6c0 Level-0 table #73: started
|
||||
2026/05/28-00:52:05.629208 7f3e6effd6c0 Level-0 table #73: 1856591 bytes OK
|
||||
2026/05/28-00:52:05.635297 7f3e6effd6c0 Delete type=0 #70
|
||||
|
||||
Binary file not shown.
+25
-4
@@ -112,13 +112,34 @@ export function setSkillLevel(skills, skillFqn, level) {
|
||||
if (!skillId || !skills?.[skillId]) return skills;
|
||||
|
||||
const numericLevel = Number(level ?? 0);
|
||||
const skill = foundry.utils.mergeObject(skills[skillId], { trained: numericLevel > 0 || skills[skillId].trained });
|
||||
let skill = foundry.utils.deepClone(skills[skillId]);
|
||||
|
||||
if (specialityId && skill.specialities?.[specialityId]) {
|
||||
skill.specialities[specialityId] = foundry.utils.mergeObject(skill.specialities[specialityId], {
|
||||
// Marquer la compétence comme entraînée si niveau > 0
|
||||
skill.trained = numericLevel > 0 || skill.trained;
|
||||
|
||||
if (specialityId) {
|
||||
// Créer l'objet specialities s'il n'existe pas
|
||||
if (!skill.specialities) {
|
||||
skill.specialities = {};
|
||||
}
|
||||
// Créer la spécialité si elle n'existe pas
|
||||
if (!skill.specialities[specialityId]) {
|
||||
skill.specialities[specialityId] = {
|
||||
value: 0,
|
||||
trained: false,
|
||||
default: skill.default || null
|
||||
};
|
||||
}
|
||||
// Appliquer le niveau à la spécialité
|
||||
skill.specialities[specialityId] = foundry.utils.mergeObject(
|
||||
skill.specialities[specialityId],
|
||||
{
|
||||
value: Math.max(Number(skill.specialities[specialityId].value ?? 0), numericLevel),
|
||||
});
|
||||
trained: true
|
||||
}
|
||||
);
|
||||
} else {
|
||||
// Compétence sans spécialité
|
||||
skill.value = Math.max(Number(skill.value ?? 0), numericLevel);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,8 @@ const MODULE_ID = 'mgt2-compendium-amiral-denisov';
|
||||
const SKILL_MAPPING = {
|
||||
// Pilotage - MgT2e a une compétence "pilot" (confirmé par les références)
|
||||
// Corrigé : Small Craft = Petits vaisseaux (pas Aéronef léger)
|
||||
'Pilot-Spacecraft': 'pilot.vaisseau_spatial',
|
||||
// Vaisseaux spatiaux au pluriel (correspond au nom dans mgt2e)
|
||||
'Pilot-Spacecraft': 'pilot.vaisseaux_spatiaux',
|
||||
'Pilot-Small Craft': 'pilot.petits_vaisseaux',
|
||||
'Pilot': 'pilot',
|
||||
'Flyer': 'pilot.aeronef_atmospherique',
|
||||
|
||||
Reference in New Issue
Block a user