foundryvtt-wh4-lang-fr-fr/scripts/HrOBAXsEX073ReKl.js

22 lines
761 B
JavaScript
Raw Normal View History

2024-10-08 20:52:09 +02:00
let skill = `${game.i18n.localize("NAME.Entertain")} (${game.i18n.localize("SPEC.Singing")})`;
2024-05-16 17:57:51 +02:00
let currentCareer = this.actor.system.currentCareer;
let existingSkill = this.actor.itemTypes.skill.find(i => i.name == skill);
if (!currentCareer) return
2024-10-08 20:52:09 +02:00
let inCurrentCareer = currentCareer.system.skills.concat(currentCareer.system.addedSkills).includes(skill);
2024-06-06 21:09:27 +02:00
let perfectPitchAdded = this.actor.getFlag("wfrp4e", "perfectPitchAdded") || {};
if (existingSkill && inCurrentCareer && !perfectPitchAdded[existingSkill.name])
2024-05-16 17:57:51 +02:00
{
existingSkill.system.advances.costModifier = -5;
}
else
{
2024-06-06 21:09:27 +02:00
perfectPitchAdded[skill] = true;
2024-10-08 20:52:09 +02:00
currentCareer.system.addedSkills.push(skill);
foundry.utils.setProperty(this.actor, "flags.wfrp4e.perfectPitchAdded", perfectPitchAdded)
2024-05-16 17:57:51 +02:00
}