|
@@ -14,7 +14,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|
|
})
|
|
|
export class SkillFieldComponent {
|
|
|
@Input() skillName: string = '';
|
|
|
- public skill: Skill = { name: '', proficiency: false };
|
|
|
+ public skill: Skill = { name: '', proficiency: false, advantage: 'none' };
|
|
|
private attribute: Attribute = { name: '', value: 0, proficiency: false };
|
|
|
public skillModifier: string = '0';
|
|
|
public skillProficiency: boolean = false;
|
|
@@ -51,6 +51,10 @@ export class SkillFieldComponent {
|
|
|
);
|
|
|
observable.subscribe((newValue: Skill) => {
|
|
|
this.skill = newValue;
|
|
|
+ // MIGRATION: Add default value for advantage
|
|
|
+ if (this.skill.advantage === undefined) {
|
|
|
+ this.skill.advantage = 'none';
|
|
|
+ }
|
|
|
this.skillProficiency = this.skill.proficiency;
|
|
|
this.skillModifier = this.calculateModifier();
|
|
|
});
|
|
@@ -67,6 +71,7 @@ export class SkillFieldComponent {
|
|
|
this.dataAccessor.updateSkill({
|
|
|
name: this.skillName,
|
|
|
proficiency: this.skillProficiency,
|
|
|
+ advantage: this.skill.advantage,
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -86,6 +91,16 @@ export class SkillFieldComponent {
|
|
|
this.detailsAccessor.openPanel(SkillDetailsComponent, {
|
|
|
skillName: this.skillName,
|
|
|
skillModifier: this.skillModifier,
|
|
|
+ advantage: this.skill.advantage,
|
|
|
});
|
|
|
+ const resultSubscription = this.detailsAccessor.result$.subscribe(
|
|
|
+ (result) => {
|
|
|
+ if (result.state === 'update') {
|
|
|
+ this.skill.advantage = result.data.advantage;
|
|
|
+ this.updateValue();
|
|
|
+ }
|
|
|
+ resultSubscription.unsubscribe();
|
|
|
+ },
|
|
|
+ );
|
|
|
}
|
|
|
}
|