Update magie

This commit is contained in:
2025-09-15 21:09:09 +02:00
parent cc7de0e53c
commit c993a9a5b1
80 changed files with 728 additions and 540 deletions

View File

@@ -171,18 +171,53 @@ export class HeritiersActor extends Actor {
magie.rang = Math.round(item.system.niveau / 2);
magie.rangGenericName = game.system.lesheritiers.config.rangName[magie.rang];
console.log("Magie", item.name, item.system.niveau, magie.rang, magie.rangGenericName)
magie.rangSpecificName = game.system.lesheritiers.config.rangNameSpecific[item.name][magie.rangGenericName];
magie.sorts = {
1: { nomNiveau: magie.competence.system.nomniveau["1"], sorts: [] },
2: { nomNiveau: magie.competence.system.nomniveau["2"], sorts: [] },
3: { nomNiveau: magie.competence.system.nomniveau["3"], sorts: [] },
4: { nomNiveau: magie.competence.system.nomniveau["4"], sorts: [] }
}
for (let sort of this.items) {
if (sort.type == "sort" && sort.system.competence == item.name) {
let sortObj = foundry.utils.duplicate(sort)
sortObj.sdValue = HeritiersUtility.getSDSortValue(Number(sort.system.niveau))
magie.sorts[Number(sort.system.niveau)].sorts.push(sortObj)
//magie.rangSpecificName = game.system.lesheritiers.config.rangNameSpecific[item.name][magie.rangGenericName];
magie.sorts = {}
if (item.name == "Magie du Clan") {
magie.sorts = {
"soufflecombat": {
1: { nomNiveau: magie.competence.system.nomniveausouffle.soufflecombat["1"], sorts: [] },
2: { nomNiveau: magie.competence.system.nomniveausouffle.soufflecombat["2"], sorts: [] },
3: { nomNiveau: magie.competence.system.nomniveausouffle.soufflecombat["3"], sorts: [] },
4: { nomNiveau: magie.competence.system.nomniveausouffle.soufflecombat["4"], sorts: [] }
},
"soufflemouvement": {
1: { nomNiveau: magie.competence.system.nomniveausouffle.soufflemouvement["1"], sorts: [] },
2: { nomNiveau: magie.competence.system.nomniveausouffle.soufflemouvement["2"], sorts: [] },
3: { nomNiveau: magie.competence.system.nomniveausouffle.soufflemouvement["3"], sorts: [] },
4: { nomNiveau: magie.competence.system.nomniveausouffle.soufflemouvement["4"], sorts: [] }
},
"souffleesprit": {
1: { nomNiveau: magie.competence.system.nomniveausouffle.souffleesprit["1"], sorts: [] },
2: { nomNiveau: magie.competence.system.nomniveausouffle.souffleesprit["2"], sorts: [] },
3: { nomNiveau: magie.competence.system.nomniveausouffle.souffleesprit["3"], sorts: [] },
4: { nomNiveau: magie.competence.system.nomniveausouffle.souffleesprit["4"], sorts: [] }
}
}
for (let sort of this.items) {
if (sort.type == "sort" && sort.system.competence == item.name) {
let sortObj = foundry.utils.duplicate(sort)
sortObj.sdValue = HeritiersUtility.getSDSortValue(Number(sort.system.niveau))
if (!magie.sorts[sort.system?.souffle]) {
console.warn("Sort with unknown souffle ", sort.system.souffle, sort)
continue
}
magie.sorts[sort.system.souffle][Number(sort.system.niveau)].sorts.push(sortObj)
}
}
} else {
magie.sorts = {
1: { nomNiveau: magie.competence.system.nomniveau["1"], sorts: [] },
2: { nomNiveau: magie.competence.system.nomniveau["2"], sorts: [] },
3: { nomNiveau: magie.competence.system.nomniveau["3"], sorts: [] },
4: { nomNiveau: magie.competence.system.nomniveau["4"], sorts: [] }
}
for (let sort of this.items) {
if (sort.type == "sort" && sort.system.competence == item.name) {
let sortObj = foundry.utils.duplicate(sort)
sortObj.sdValue = HeritiersUtility.getSDSortValue(Number(sort.system.niveau))
magie.sorts[Number(sort.system.niveau)].sorts.push(sortObj)
}
}
}
magieList.push(magie)
@@ -742,6 +777,10 @@ export class HeritiersActor extends Actor {
ui.notifications.warn("Compétence de magie associée non trouvée !")
return
}
if (sort.system.informatif) {
ui.notifications.info("Ce sort est uniquement informatif et ne peut pas être lancé.")
return
}
let rollData = this.getCommonRollData(comp.id)
rollData.mode = "sort"

View File

@@ -260,24 +260,6 @@ export const HERITIERS_CONFIG = {
"Maître": "Maître",
"Grand Maître": "Éminence"
},
"Magie du Clan - Souffle du Combat": {
"Novice": "Apprenti",
"Adepte": "Disciple",
"Maître": "Maître",
"Grand Maître": "Éminence"
},
"Magie du Clan - Souffle du Mouvement": {
"Novice": "Apprenti",
"Adepte": "Disciple",
"Maître": "Maître",
"Grand Maître": "Éminence"
},
"Magie du Clan - Souffle de l'Esprit": {
"Novice": "Apprenti",
"Adepte": "Disciple",
"Maître": "Maître",
"Grand Maître": "Éminence"
},
"Théurgie": {
"Novice": "Frère",
"Adepte": "Père",
@@ -292,9 +274,9 @@ export const HERITIERS_CONFIG = {
}
},
soufflesMagieDuClan: {
"Souffle du Combat": "Souffle du Combat",
"Souffle du Mouvement": "Souffle du Mouvement",
"Souffle de l'Esprit": "Souffle de l'Esprit"
"soufflecombat": "Souffle du Combat",
"soufflemouvement": "Souffle du Mouvement",
"souffleesprit": "Souffle de l'Esprit"
}
}

View File

@@ -15,7 +15,7 @@ export class HeritiersItemSheet extends foundry.appv1.sheets.ItemSheet {
dragDrop: [{ dragSelector: null, dropSelector: null }],
width: 620,
height: 550,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}]
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }]
});
}
@@ -63,7 +63,7 @@ export class HeritiersItemSheet extends foundry.appv1.sheets.ItemSheet {
owner: this.document.isOwner,
config: game.system.lesheritiers.config,
isArmeMelee: HeritiersUtility.isArmeMelee(this.object),
description: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.description, {async: true}),
description: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.description, { async: true }),
mr: (this.object.type == 'specialisation'),
isGM: game.user.isGM,
usageMax: -1
@@ -76,7 +76,7 @@ export class HeritiersItemSheet extends foundry.appv1.sheets.ItemSheet {
this.object.system.pointsusagecourant = formData.usageMax
}
}
if (this.object.type == 'sort' ) {
if (this.object.type == 'sort') {
formData.competencesMagie = HeritiersUtility.getCompetencesMagie()
}
@@ -143,15 +143,15 @@ export class HeritiersItemSheet extends foundry.appv1.sheets.ItemSheet {
html.find('#add-specialite').click(ev => {
let spec = foundry.utils.duplicate(this.object.system.specialites)
spec.push( { name: "Nouvelle Spécialité", id: foundry.utils.randomID(16), used: false })
this.object.update( { 'system.specialites': spec })
spec.push({ name: "Nouvelle Spécialité", id: foundry.utils.randomID(16), used: false })
this.object.update({ 'system.specialites': spec })
})
html.find('.delete-specialite').click(ev => {
const li = $(ev.currentTarget).parents(".specialite-item")
let index = li.data("specialite-index")
let spec = foundry.utils.duplicate(this.object.system.specialites)
spec.splice(index,1)
this.object.update( { 'system.specialites': spec })
spec.splice(index, 1)
this.object.update({ 'system.specialites': spec })
})
html.find('.edit-specialite').change(ev => {
const li = $(ev.currentTarget).parents(".specialite-item")
@@ -159,7 +159,7 @@ export class HeritiersItemSheet extends foundry.appv1.sheets.ItemSheet {
let spec = foundry.utils.duplicate(this.object.system.specialites)
spec[index].name = ev.currentTarget.value
spec[index].id = spec[index].id || foundry.utils.randomID(16)
this.object.update( { 'system.specialites': spec })
this.object.update({ 'system.specialites': spec })
})
html.find('.edit-specialite-description').change(ev => {
const li = $(ev.currentTarget).parents(".specialite-item")
@@ -167,20 +167,20 @@ export class HeritiersItemSheet extends foundry.appv1.sheets.ItemSheet {
let spec = foundry.utils.duplicate(this.object.system.specialites)
spec[index].description = ev.currentTarget.value
spec[index].id = spec[index].id || foundry.utils.randomID(16)
this.object.update( { 'system.specialites': spec })
this.object.update({ 'system.specialites': spec })
})
html.find('#add-automation').click(ev => {
let autom = foundry.utils.duplicate(this.object.system.automations)
autom.push( { eventtype: "on-drop", name: "Automatisation 1", competence: "", minLevel: 0, id: foundry.utils.randomID(16) })
this.object.update( { 'system.automations': autom })
autom.push({ eventtype: "on-drop", name: "Automatisation 1", competence: "", minLevel: 0, id: foundry.utils.randomID(16) })
this.object.update({ 'system.automations': autom })
})
html.find('.delete-automation').click(ev => {
const li = $(ev.currentTarget).parents(".automation-item")
let index = li.data("automation-index")
let autom = foundry.utils.duplicate(this.object.system.automations)
autom.splice(index,1)
this.object.update( { 'system.automations': autom })
autom.splice(index, 1)
this.object.update({ 'system.automations': autom })
})
html.find('.automation-edit-field').change(ev => {
let index = $(ev.currentTarget).data("automation-index")
@@ -188,7 +188,7 @@ export class HeritiersItemSheet extends foundry.appv1.sheets.ItemSheet {
let auto = foundry.utils.duplicate(this.object.system.automations)
auto[index][field] = ev.currentTarget.value
auto[index].id = auto[index].id || foundry.utils.randomID(16)
this.object.update( { 'system.automations': auto })
this.object.update({ 'system.automations': auto })
})
// Update Inventory Item

View File

@@ -583,7 +583,7 @@ export class HeritiersUtility {
// Gestion sort et points d'âme
if (rollData.mode == "sort") {
if (rollData.spendEsprit) {
actor.inDecCarac("esp", rollData.totalEsprit)
actor.inDecCarac("esp", -rollData.totalEsprit)
} else {
actor.incDecPointsAme(-rollData.sortPointsAme)
if (rollData.sort.system.competence == "Magie du Clan") {