Update arts obscurs
This commit is contained in:
@@ -160,6 +160,7 @@ export class HeritiersActor extends Actor {
|
||||
HeritiersUtility.sortArrayObjectsByName(comp)
|
||||
return comp
|
||||
}
|
||||
|
||||
prepareMagie() {
|
||||
let magieList = []
|
||||
for (let item of this.items) {
|
||||
@@ -167,6 +168,10 @@ export class HeritiersActor extends Actor {
|
||||
let magie = {}
|
||||
magie.name = item.name
|
||||
magie.competence = foundry.utils.duplicate(item)
|
||||
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 = []
|
||||
for (let sort of this.items) {
|
||||
if (sort.type == "sort" && sort.system.competence == item.name) {
|
||||
@@ -477,6 +482,7 @@ export class HeritiersActor extends Actor {
|
||||
adversite[adv] = Math.max(adversite[adv], 0)
|
||||
this.update({ 'system.adversite': adversite })
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async incDecQuantity(objetId, incDec = 0) {
|
||||
let objetQ = this.items.get(objetId)
|
||||
@@ -707,6 +713,20 @@ export class HeritiersActor extends Actor {
|
||||
rollDialog.render(true)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
inDecCarac(key, incDec) {
|
||||
let carac = this.system.caracteristiques[key]
|
||||
carac.value += incDec
|
||||
if (carac.value < 0 || carac.value > carac.max) {
|
||||
ui.notifications.warn("Pas assez de points dans cette caractéristique !")
|
||||
return false
|
||||
}
|
||||
carac.value = Math.max(carac.value, 0)
|
||||
carac.value = Math.min(carac.value, carac.max)
|
||||
this.update({ [`system.caracteristiques.${key}`]: carac })
|
||||
return true
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollSort(sortId) {
|
||||
let sort = this.items.get(sortId)
|
||||
@@ -719,8 +739,19 @@ export class HeritiersActor extends Actor {
|
||||
let rollData = this.getCommonRollData(comp.id)
|
||||
rollData.mode = "sort"
|
||||
rollData.sort = foundry.utils.duplicate(sort)
|
||||
rollData.sdValue = HeritiersUtility.getSDSortValue(sort.system.niveau)
|
||||
rollData.sortPointsAme = sort.system.niveau
|
||||
rollData.sdValue = HeritiersUtility.getSDSortValue(Number(sort.system.niveau))
|
||||
rollData.sortPointsAme = Number(sort.system.niveau)
|
||||
if (rollData.sortPointsAme > this.system.magie.pointsame.value) {
|
||||
// Vérifier si au moins 1 point d'Esprit est disponible
|
||||
if (this.system.caracteristiques.esp.value < 1) {
|
||||
ui.notifications.warn("Pas assez de Points d'Esprit ni de Points d'Ame pour lancer ce sort (requis: 1, disponible: " + this.system.caracteristiques.esp.value + ")")
|
||||
return
|
||||
} else {
|
||||
rollData.spendEsprit = true
|
||||
ui.notifications.warn(`Vous n'avez pas assez de Points d'Ame pour lancer ce sort (requis: ${rollData.sortPointsAme}, disponible: ${this.system.magie.pointsame.value}). Un Point d'Esprit sera utilisé à la place si vous effectuez le lancer.`)
|
||||
}
|
||||
}
|
||||
|
||||
if (sort.system.carac2 != "none") {
|
||||
// get the best carac between carac1 and carac2
|
||||
if (this.system.caracteristiques[sort.system.carac1].value > this.system.caracteristiques[sort.system.carac2].value) {
|
||||
@@ -729,6 +760,8 @@ export class HeritiersActor extends Actor {
|
||||
rollData.caracKey = sort.system.carac2
|
||||
}
|
||||
rollData.caracMessage = "Ce sort peut être lancé avec " + game.system.lesheritiers.config.caracList[sort.system.carac1] + " ou " + game.system.lesheritiers.config.caracList[sort.system.carac2] + ". La meilleure caractéristique a été selectionnée."
|
||||
} else {
|
||||
rollData.caracKey = sort.system.carac1
|
||||
}
|
||||
console.log("RollData", rollData)
|
||||
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
||||
@@ -913,6 +946,23 @@ export class HeritiersActor extends Actor {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
incDecPointsAme(value) {
|
||||
let newValue = this.system.magie.pointsame.value + value
|
||||
newValue = Math.max(newValue, 0)
|
||||
newValue = Math.min(newValue, this.system.magie.pointsame.max)
|
||||
this.update({ 'system.magie.pointsame.value': newValue })
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
incDecPV(value) {
|
||||
let newValue = this.system.pv.value + value
|
||||
newValue = Math.max(newValue, 0)
|
||||
newValue = Math.min(newValue, this.system.pv.max)
|
||||
this.update({ 'system.pv.value': newValue })
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
incDecPointsUsage(pouvoirId, value) {
|
||||
let pouvoir = this.items.get(pouvoirId)
|
||||
|
@@ -12,26 +12,26 @@ export const HERITIERS_CONFIG = {
|
||||
"san": "Sang-Froid"
|
||||
},
|
||||
|
||||
competenceCategorie : {
|
||||
competenceCategorie: {
|
||||
"utile": "Utile",
|
||||
"futile": "Futile"
|
||||
},
|
||||
|
||||
|
||||
contactType: {
|
||||
contact: "Contact",
|
||||
contact: "Contact",
|
||||
allie: "Allié",
|
||||
ennemi: "Ennemi",
|
||||
interet: "Personne d'interêt"
|
||||
},
|
||||
|
||||
competenceProfil : {
|
||||
"aventurier": {kind: "physical", name: "Aventurier"},
|
||||
"roublard": {kind: "physical",name: "Roublard"},
|
||||
"combattant": {kind: "physical",name:"Combattant"},
|
||||
"erudit": {kind: "mental",name:"Erudit"},
|
||||
"savant": {kind: "mental",name:"Savant"},
|
||||
"gentleman": {kind: "mental",name:"Gentleman"},
|
||||
"magie": {kind: "magical", name: "Magie"},
|
||||
competenceProfil: {
|
||||
"aventurier": { kind: "physical", name: "Aventurier" },
|
||||
"roublard": { kind: "physical", name: "Roublard" },
|
||||
"combattant": { kind: "physical", name: "Combattant" },
|
||||
"erudit": { kind: "mental", name: "Erudit" },
|
||||
"savant": { kind: "mental", name: "Savant" },
|
||||
"gentleman": { kind: "mental", name: "Gentleman" },
|
||||
"magie": { kind: "magical", name: "Magie" },
|
||||
},
|
||||
baseTestPouvoir: {
|
||||
"feerie": "Féerie",
|
||||
@@ -53,7 +53,7 @@ export const HERITIERS_CONFIG = {
|
||||
},
|
||||
statutMasque: {
|
||||
"masque": "Masqué",
|
||||
"demasque":"Démasqué"
|
||||
"demasque": "Démasqué"
|
||||
},
|
||||
niveauPouvoir: {
|
||||
"normal": "Normal",
|
||||
@@ -100,8 +100,8 @@ export const HERITIERS_CONFIG = {
|
||||
"main": "Main",
|
||||
"tete": "Tête/Coeur"
|
||||
},
|
||||
|
||||
categorieArme : {
|
||||
|
||||
categorieArme: {
|
||||
"trait": "Arme de trait",
|
||||
"poing": "Arme de poing",
|
||||
"epaule": "Arme d'épaule",
|
||||
@@ -109,7 +109,7 @@ export const HERITIERS_CONFIG = {
|
||||
"blanche": "Arme blanche",
|
||||
"improvise": "Arme improvisée",
|
||||
"explosif": "Explosif"
|
||||
},
|
||||
},
|
||||
typeArme: {
|
||||
"naturelle": "Arme naturelle",
|
||||
"trait": "Trait",
|
||||
@@ -131,13 +131,13 @@ export const HERITIERS_CONFIG = {
|
||||
"controlee": "Contrôlée (C)",
|
||||
"prohibee": "Prohibée (P)"
|
||||
},
|
||||
armeDissimulation :{
|
||||
armeDissimulation: {
|
||||
"tresfacile": "Très facile (TF)",
|
||||
"facile": "Facile (F)",
|
||||
"difficile": "Difficile (D)",
|
||||
"impossible": "Impossible (I)"
|
||||
},
|
||||
typeProtection : {
|
||||
typeProtection: {
|
||||
"balle": "Protège ds balles",
|
||||
"melee": "Protège en mélée",
|
||||
"tout": "Tout type de dégats"
|
||||
@@ -146,7 +146,7 @@ export const HERITIERS_CONFIG = {
|
||||
"traditionnelle": "Traditionnelle",
|
||||
"moderne": "Moderne",
|
||||
"orientale": "Orientale"
|
||||
},
|
||||
},
|
||||
typeContact: {
|
||||
"contact": "Contact",
|
||||
"allie": "Allié",
|
||||
@@ -164,41 +164,41 @@ export const HERITIERS_CONFIG = {
|
||||
"3": "3",
|
||||
"4": "4",
|
||||
},
|
||||
attaquePlusieursList : {
|
||||
attaquePlusieursList: {
|
||||
"0": "0",
|
||||
"1": "+1",
|
||||
"2": "+2",
|
||||
},
|
||||
attaque2ArmesListe: [
|
||||
{value: "0", label: "Aucun"},
|
||||
{value: "-4", label: "Deux armes à 1 main"},
|
||||
{value: "-2", label: "Deux armes naturelles"},
|
||||
{value: "-2", label: "Avec spécialisation \"Mauvaise Main\""}
|
||||
{ value: "0", label: "Aucun" },
|
||||
{ value: "-4", label: "Deux armes à 1 main" },
|
||||
{ value: "-2", label: "Deux armes naturelles" },
|
||||
{ value: "-2", label: "Avec spécialisation \"Mauvaise Main\"" }
|
||||
],
|
||||
typeProfil: {
|
||||
"mineur": "Mineur",
|
||||
"majeur": "Majeur",
|
||||
},
|
||||
bonusMalusContext: [
|
||||
{value: "-6", label: "-6"},
|
||||
{value: "-5", label: "-5"},
|
||||
{value: "-4", label: "-4"},
|
||||
{value: "-3", label: "-3"},
|
||||
{value: "-2", label: "-2"},
|
||||
{value: "-1", label: "-1"},
|
||||
{value: "0", label: "0"},
|
||||
{value: "1", label: "+1"},
|
||||
{value: "2", label: "+2"},
|
||||
{value: "3", label: "+3"},
|
||||
{value: "4", label: "+4"},
|
||||
{value: "5", label: "+5"},
|
||||
{value: "6", label: "+6"}
|
||||
bonusMalusContext: [
|
||||
{ value: "-6", label: "-6" },
|
||||
{ value: "-5", label: "-5" },
|
||||
{ value: "-4", label: "-4" },
|
||||
{ value: "-3", label: "-3" },
|
||||
{ value: "-2", label: "-2" },
|
||||
{ value: "-1", label: "-1" },
|
||||
{ value: "0", label: "0" },
|
||||
{ value: "1", label: "+1" },
|
||||
{ value: "2", label: "+2" },
|
||||
{ value: "3", label: "+3" },
|
||||
{ value: "4", label: "+4" },
|
||||
{ value: "5", label: "+5" },
|
||||
{ value: "6", label: "+6" }
|
||||
],
|
||||
listNiveauSort: {
|
||||
"1" : "1",
|
||||
"2" : "2",
|
||||
"3" : "3",
|
||||
"4" : "4"
|
||||
"1": "1",
|
||||
"2": "2",
|
||||
"3": "3",
|
||||
"4": "4"
|
||||
},
|
||||
listNiveau: {
|
||||
"0": "0",
|
||||
@@ -213,5 +213,55 @@ export const HERITIERS_CONFIG = {
|
||||
"9": "9",
|
||||
"10": "10"
|
||||
},
|
||||
rangName: [
|
||||
"Novice",
|
||||
"Novice",
|
||||
"Adepte",
|
||||
"Maître",
|
||||
"Grand Maître"
|
||||
],
|
||||
rangNameSpecific: {
|
||||
"Druidisme": {
|
||||
"Novice": "Eubage",
|
||||
"Adepte": "Saronide",
|
||||
"Maître": "Ovate",
|
||||
"Grand Maître": "Archidruide"
|
||||
},
|
||||
"Faëomancie": {
|
||||
"Novice": "Marmiton",
|
||||
"Adepte": "Queux",
|
||||
"Maître": "Chef",
|
||||
"Grand Maître": "Maître-queux"
|
||||
},
|
||||
"Nécromancie": {
|
||||
"Novice": "Inexpertus",
|
||||
"Adepte": "Discipulus",
|
||||
"Maître": "Dominus",
|
||||
"Grand Maître": "Magister"
|
||||
},
|
||||
"Magie du Clan": {
|
||||
"Novice": "Apprenti",
|
||||
"Adepte": "Disciple",
|
||||
"Maître": "Maître",
|
||||
"Grand Maître": "Éminence"
|
||||
},
|
||||
"Théurgie": {
|
||||
"Novice": "Frère",
|
||||
"Adepte": "Père",
|
||||
"Maître": "Saint",
|
||||
"Grand Maître": "Apôtre"
|
||||
},
|
||||
"Grand Langage": {
|
||||
"Novice": "Éveillé",
|
||||
"Adepte": "Initié",
|
||||
"Maître": "Sage",
|
||||
"Grand Maître": "Docteur"
|
||||
}
|
||||
},
|
||||
soufflesMagieDuClan: {
|
||||
"Souffle du Combat": "Souffle du Combat",
|
||||
"Souffle du Mouvement": "Souffle du Mouvement",
|
||||
"Souffle de l'Esprit": "Souffle de l'Esprit"
|
||||
}
|
||||
|
||||
}
|
@@ -118,9 +118,10 @@ export class HeritiersUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getSDSortValue(niveau) {
|
||||
if (niveau <= 2) return 12;
|
||||
if (niveau <= 4) return 14;
|
||||
if (niveau <= 6) return 16;
|
||||
if (niveau <= 1) return 12;
|
||||
if (niveau == 2) return 14;
|
||||
if (niveau == 3) return 16;
|
||||
if (niveau > 3) return 18;
|
||||
return 18;
|
||||
}
|
||||
|
||||
@@ -129,6 +130,18 @@ export class HeritiersUtility {
|
||||
return this.competencesMagie
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static buildCompetencesMagie() {
|
||||
let competences = foundry.utils.duplicate(this.getCompetencesMagie())
|
||||
for (let comp of competences) {
|
||||
// Calcul du rang
|
||||
let rang = Math.round(comp.system.niveau / 2);
|
||||
competences.system.rang = rang;
|
||||
competences.system.rangGenericName = game.system.lesheritiers.config.rangName[rang];
|
||||
competences.system.rangSpecificName = game.system.lesheritiers.config.rangNameSpecific[comp.Name][competences.system.rangGenericName];
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async loadCompendiumData(compendium) {
|
||||
const pack = game.packs.get(compendium);
|
||||
@@ -567,6 +580,17 @@ export class HeritiersUtility {
|
||||
if (rollData.mode == "pouvoir" || rollData.mode == "pouvoirpassif") {
|
||||
actor.incDecPointsUsage(rollData.pouvoir._id, -rollData.pouvoirPointsUsage)
|
||||
}
|
||||
// Gestion sort et points d'âme
|
||||
if (rollData.mode == "sort") {
|
||||
if (rollData.spendEsprit) {
|
||||
actor.inDecCarac("esp", -1)
|
||||
} else {
|
||||
actor.incDecPointsAme(-rollData.sortPointsAme)
|
||||
if (rollData.sort.system.competence == "Magie du Clan") {
|
||||
actor.incDecPV(-2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.createChatWithRollMode(rollData.alias, {
|
||||
content: await foundry.applications.handlebars.renderTemplate(`systems/fvtt-les-heritiers/templates/chat-generic-result.html`, rollData)
|
||||
|
Reference in New Issue
Block a user