Skip to content

Commit

Permalink
Add NPC skills
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphie132 committed Jan 19, 2024
1 parent dc0c21f commit 195b9c3
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/typescript/data/actor/npc/properties.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { TYPES } from "../../../constants";
import SpecialsProperties from "../common/specials/properties";
import VitalsProperties from "../common/vitals/properties";
import SkillsProperties from "./skills/properties";
import { NpcDataSourceData } from "./source";

export default interface NpcDataProperties {
Expand All @@ -11,13 +12,16 @@ export default interface NpcDataProperties {
export class NpcDataPropertiesData extends NpcDataSourceData {
constructor(source: NpcDataSourceData) {
super();
// foundry.utils.mergeObject(this, source);
foundry.utils.mergeObject(this, source);

this.specials = SpecialsProperties.from(source.specials);
this.vitals = new VitalsProperties(source.vitals);
this.skills = new SkillsProperties(source.skills);
}

specials = new SpecialsProperties();

vitals: VitalsProperties;

skills: SkillsProperties;
}
9 changes: 9 additions & 0 deletions src/main/typescript/data/actor/npc/skills/properties.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import BaseSkillsProperties from "../../common/skills/properties.js";
import type SkillsSource from "./source.js";

export default class SkillsProperties extends BaseSkillsProperties {
constructor(source: SkillsSource) {
super();
mergeObject(this, source);
}
}
38 changes: 38 additions & 0 deletions src/main/typescript/data/actor/npc/skills/source.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type { SkillName } from "../../../../constants";
import { CompositeNumber } from "../../../common";

export default class SkillsSource
implements Record<SkillName, CompositeNumber>
{
barter = new CompositeNumber();

diplomacy = new CompositeNumber();

explosives = new CompositeNumber();

firearms = new CompositeNumber();

intimidation = new CompositeNumber();

lockpick = new CompositeNumber();

magicalEnergyWeapons = new CompositeNumber();

mechanics = new CompositeNumber();

medicine = new CompositeNumber();

melee = new CompositeNumber();

science = new CompositeNumber();

sleight = new CompositeNumber();

sneak = new CompositeNumber();

survival = new CompositeNumber();

thaumaturgy = new CompositeNumber();

unarmed = new CompositeNumber();
}
4 changes: 4 additions & 0 deletions src/main/typescript/data/actor/npc/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import EquipmentSource from "../common/equipment/source.js";
import MagicSource from "../common/magic/source.js";
import SpecialsSource from "../common/specials/source.js";
import VitalsSource from "../common/vitals/source.js";
import SkillsSource from "./skills/source.js";

export default interface NpcDataSource {
type: typeof TYPES.ACTOR.NPC;
Expand All @@ -21,4 +22,7 @@ export class NpcDataSourceData {

/** The SPECIALs of the NPC */
specials = new SpecialsSource();

/** The skills of the NPC */
skills = new SkillsSource();
}

0 comments on commit 195b9c3

Please sign in to comment.