forked from public/foundryvtt-wh4-lang-fr-fr
		
	
		
			
				
	
	
		
			19 lines
		
	
	
		
			636 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			636 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| let skill = `Trade (${this.item.parenthesesText})`
 | |
| let currentCareer = this.actor.system.currentCareer;
 | |
| let existingSkill = this.actor.itemTypes.skill.find(i => i.name == skill);
 | |
| 
 | |
| if (!currentCareer) return
 | |
| 
 | |
| 
 | |
| let inCurrentCareer = currentCareer.system.skills.includes(skill);
 | |
| let craftsmanAdded = this.actor.getFlag("wfrp4e", "craftsmanAdded") || {};
 | |
| if (existingSkill && inCurrentCareer && !craftsmanAdded[existingSkill.name])
 | |
| {
 | |
| 	existingSkill.system.advances.costModifier = -5;
 | |
| }
 | |
| else 
 | |
| {
 | |
| 	craftsmanAdded[skill] = true;
 | |
| 	currentCareer.system.skills.push(skill);
 | |
| 	setProperty(this.actor, "flags.wfrp4e.craftsmanAdded", craftsmanAdded)
 | |
| } |