With compendiums + talent management

This commit is contained in:
2022-11-05 10:03:23 +01:00
parent 6551a93791
commit 3718749519
17 changed files with 629 additions and 285 deletions

View File

@@ -236,6 +236,17 @@ export class HawkmoonActor extends Actor {
return {isValid: false, warningMessage: `Prérequis insuffisant : la compétence ${compName} doit être de niveau ${minLevel} au minimum`}
}
/* -------------------------------------------- */
addCompetenceBonus(compName, bonus, baCost) {
let comp = this.items.find(i => i.type == "competence" && i.name.toLowerCase() == compName.toLowerCase())
if ( comp) {
comp = duplicate(comp)
comp.system.bonus = bonus
comp.system.baCost = baCost
return {isValid: true, item: comp }
}
return {isValid: false, warningMessage: `Compétence ${compName} non trouvée`}
}
/* -------------------------------------------- */
checkIfCompetence( compName ) {
let comp = this.items.find(i => i.type == "competence" && i.name.toLowerCase() == compName.toLowerCase())
if ( comp) {
@@ -247,7 +258,10 @@ export class HawkmoonActor extends Actor {
getBonneAventure() {
return this.system.bonneaventure.actuelle
}
/* -------------------------------------------- */
checkBonneAventure(cost) {
return (this.system.bonneaventure.actuelle >= cost)
}
/* -------------------------------------------- */
changeBonneAventure(value) {
let newBA = this.system.bonneaventure.actuelle
@@ -375,9 +389,12 @@ export class HawkmoonActor extends Actor {
for( let talent of this.items) {
if (talent.type == "talent" && talent.system.isautomated && talent.system.automations.length > 0) {
for (let auto of talent.system.automations) {
if (auto.eventtype === "associated-competence") {
if (auto.script.toLowerCase() == competence.name.toLowerCase() ) {
talents.push( talent)
if (auto.eventtype === "prepare-roll") {
if (auto.competence.toLowerCase() == competence.name.toLowerCase() ) {
talent = duplicate(talent)
talent.system.bonus = auto.bonus
talent.system.baCost = auto.baCost
talents.push( talent )
}
}
}