Skip to content

Commit

Permalink
fix mismatched key
Browse files Browse the repository at this point in the history
  • Loading branch information
rsek committed Sep 27, 2022
1 parent 575832a commit 88c5c52
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 140 deletions.
89 changes: 0 additions & 89 deletions _master-data/schema/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,6 @@
"type": "string",
"title": "Requirement"
},
"Meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
},
"$id": {
"description": "The item's unique string ID. Any object that contains a localizable user-facing string *must* have this key.",
"pattern": "^(starforged|ironsworn)/assets/[a-z_-]+/[a-z_-]+$",
Expand Down Expand Up @@ -2083,11 +2078,6 @@
"type": "string",
"title": "Asset type"
},
"Meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
},
"_idFragment": { "type": "string", "title": "_idFragment" }
},
"defaultProperties": [],
Expand Down Expand Up @@ -2309,85 +2299,6 @@
"additionalProperties": false,
"required": ["Disables asset", "Enabled", "Impact", "Label", "Permanent"]
},
"ConditionMeter": {
"description": "Interface representing a condition meter such as health, spirit, supply.",
"title": "ConditionMeter",
"type": "object",
"properties": {
"$id": {
"description": "The item's unique string ID. Any object that contains a localizable user-facing string *must* have this key.",
"pattern": "^(starforged|ironsworn)/assets/[a-z_-]+/[a-z_-]+/condition_meter$",
"type": "string",
"title": "$id"
},
"Min": {
"description": "The minimum value of the meter. Usually this is 0. Momentum is currently the only exception to this and goes as low as -6.",
"default": 0,
"type": "integer",
"title": "Min"
},
"Max": {
"description": "The maximum value of the meter.",
"default": 5,
"type": "integer",
"title": "Max"
},
"Conditions": {
"description": "The conditions that can apply to this meter.",
"type": "array",
"items": {
"description": "Conditions (such as impacts) that can apply to asset cards with condition meters. These are typically presented as tick boxes on the asset card.",
"enum": ["battered", "cursed", "out of action", "wrecked"],
"type": "string"
},
"title": "Conditions"
},
"Aliases": {
"description": "Certain common types of asset meters, like companion health and vehicle integrity, are collectively referenced by {@link MoveTriggerOptionAction.Using}. The array will include an appropriate alias if that is the case.",
"type": "array",
"items": {
"description": "Names of non-player condition meters (for e.g. companions and vehicles) that are referenced by moves and other assets.\nIf an asset condition meter can be used in this manner, the alias is included in its Aliases array.",
"enum": [
"attached asset meter",
"command vehicle integrity",
"companion health",
"incidental vehicle integrity",
"support vehicle integrity",
"vehicle integrity"
],
"type": "string"
},
"title": "Aliases"
},
"Value": {
"description": "The initial value of the meter.",
"type": "integer",
"title": "Value"
},
"Rollable": {
"description": "Whether the meter value can be used in place of a stat in an action roll.",
"type": "boolean",
"title": "Rollable"
},
"Label": {
"description": "The user-facing text label of this item.",
"pattern": "^[a-z].+$",
"type": "string",
"title": "Label"
}
},
"defaultProperties": [],
"additionalProperties": false,
"required": [
"$id",
"Conditions",
"Label",
"Max",
"Min",
"Rollable",
"Value"
]
},
"YamlConditionMeter": {
"title": "YamlConditionMeter",
"type": "object",
Expand Down
4 changes: 2 additions & 2 deletions dataforged-tools/src/builders/assets/AssetAbilityBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export class AssetAbilityBuilder implements AssetAbility {
const fragment = moveDataClone._idFragment ?? moveDataClone.Title.Canonical;
moveDataClone.$id = formatId(fragment,this.$id).replace("/Assets/", "/Moves/Assets/");
moveDataClone.Category = `${game}/Moves/Assets`;
if (moveDataClone.Trigger.Options && parent["Meter"]?.$id) {
moveDataClone.Trigger.Options = replaceInAllStrings(moveDataClone.Trigger.Options, Replacement.AssetMeter, parent["Meter"].$id);
if (moveDataClone.Trigger.Options && parent["Condition meter"]?.$id) {
moveDataClone.Trigger.Options = replaceInAllStrings(moveDataClone.Trigger.Options, Replacement.AssetMeter, parent["Condition meter"].$id);
// console.log("asset ability move data", moveDataClone);
}
return new MoveBuilder(moveDataClone, this, game, parent.Source);
Expand Down
8 changes: 4 additions & 4 deletions dataforged-tools/src/builders/assets/AssetBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class AssetBuilder extends SourceInheritorBuilder implements Asset {
Requirement?: string | undefined;
Inputs?: Asset["Inputs"];
Abilities: [AssetAbility, AssetAbility, AssetAbility];
"Meter"?: ConditionMeter | undefined;
"Condition meter"?: ConditionMeter | undefined;
constructor(yaml: YamlAsset, game: Game, parent: AssetType, rootSource: Source) {
super(yaml.Source ?? {}, rootSource);
this["Asset type"] = parent.$id;
Expand Down Expand Up @@ -71,7 +71,7 @@ export class AssetBuilder extends SourceInheritorBuilder implements Asset {
this.States = yaml.States.map(state => new AssetStateBuilder(state, this)) ?? undefined;
}
this.Requirement = yaml.Requirement;
this["Meter"] = yaml["Condition meter"] ? new ConditionMeterBuilder(yaml["Condition meter"], formatId("Condition meter",this.$id), this["Asset type"]) : undefined;
this["Condition meter"] = yaml["Condition meter"] ? new ConditionMeterBuilder(yaml["Condition meter"], formatId("Condition meter",this.$id), this["Asset type"]) : undefined;
if (yaml.Abilities.length !== 3) {
throw badJsonError(this.constructor, yaml.Abilities, `Asset ${this.$id} doesn't have 3 abilities!`);
} else {
Expand All @@ -80,8 +80,8 @@ export class AssetBuilder extends SourceInheritorBuilder implements Asset {

_.merge(this, replaceInAllStrings(this, Replacement.Asset, this.$id));

if (this["Meter"]) {
_.merge(this, replaceInAllStrings(this, Replacement.AssetMeter, this["Meter"].$id));
if (this["Condition meter"]) {
_.merge(this, replaceInAllStrings(this, Replacement.AssetMeter, this["Condition meter"].$id));
}
}
}
Expand Down
9 changes: 2 additions & 7 deletions dataforged-tools/src/json/ironsworn/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1773,10 +1773,10 @@
"maxItems": 3,
"title": "Abilities"
},
"Meter": {
"Condition meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
"title": "Condition meter"
},
"Tags": {
"type": "array",
Expand Down Expand Up @@ -3149,11 +3149,6 @@
"description": "An optional markdown string representing the requirement text that appears at the top of some asset cards.",
"type": "string",
"title": "Requirement"
},
"Meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
}
},
"defaultProperties": [],
Expand Down
9 changes: 2 additions & 7 deletions dataforged-tools/src/json/starforged/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1116,10 +1116,10 @@
"maxItems": 3,
"title": "Abilities"
},
"Meter": {
"Condition meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
"title": "Condition meter"
},
"Tags": {
"type": "array",
Expand Down Expand Up @@ -2520,11 +2520,6 @@
"description": "An optional markdown string representing the requirement text that appears at the top of some asset cards.",
"type": "string",
"title": "Requirement"
},
"Meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
}
},
"defaultProperties": [],
Expand Down
2 changes: 1 addition & 1 deletion dataforged-tools/src/schema/json/assets/Asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface Asset extends HasId, HasDisplay, HasSource, Partial<HasAliases>
/**
* Information on this asset's condition meter, if any.
*/
"Meter"?: ConditionMeter | undefined;
"Condition meter"?: ConditionMeter | undefined;

Tags?: string[] | undefined;
}
9 changes: 2 additions & 7 deletions dist/ironsworn/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1773,10 +1773,10 @@
"maxItems": 3,
"title": "Abilities"
},
"Meter": {
"Condition meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
"title": "Condition meter"
},
"Tags": {
"type": "array",
Expand Down Expand Up @@ -3149,11 +3149,6 @@
"description": "An optional markdown string representing the requirement text that appears at the top of some asset cards.",
"type": "string",
"title": "Requirement"
},
"Meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
}
},
"defaultProperties": [],
Expand Down
9 changes: 2 additions & 7 deletions dist/starforged/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1116,10 +1116,10 @@
"maxItems": 3,
"title": "Abilities"
},
"Meter": {
"Condition meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
"title": "Condition meter"
},
"Tags": {
"type": "array",
Expand Down Expand Up @@ -2520,11 +2520,6 @@
"description": "An optional markdown string representing the requirement text that appears at the top of some asset cards.",
"type": "string",
"title": "Requirement"
},
"Meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
}
},
"defaultProperties": [],
Expand Down
2 changes: 1 addition & 1 deletion dist/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export declare interface Asset extends HasId, HasDisplay, HasSource, Partial<Has
/**
* Information on this asset's condition meter, if any.
*/
"Meter"?: ConditionMeter | undefined;
"Condition meter"?: ConditionMeter | undefined;
Tags?: string[] | undefined;
}

Expand Down
9 changes: 2 additions & 7 deletions src/ironsworn/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1773,10 +1773,10 @@
"maxItems": 3,
"title": "Abilities"
},
"Meter": {
"Condition meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
"title": "Condition meter"
},
"Tags": {
"type": "array",
Expand Down Expand Up @@ -3149,11 +3149,6 @@
"description": "An optional markdown string representing the requirement text that appears at the top of some asset cards.",
"type": "string",
"title": "Requirement"
},
"Meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
}
},
"defaultProperties": [],
Expand Down
9 changes: 2 additions & 7 deletions src/starforged/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1116,10 +1116,10 @@
"maxItems": 3,
"title": "Abilities"
},
"Meter": {
"Condition meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
"title": "Condition meter"
},
"Tags": {
"type": "array",
Expand Down Expand Up @@ -2520,11 +2520,6 @@
"description": "An optional markdown string representing the requirement text that appears at the top of some asset cards.",
"type": "string",
"title": "Requirement"
},
"Meter": {
"description": "Information on this asset's condition meter, if any.",
"$ref": "#/definitions/ConditionMeter",
"title": "Meter"
}
},
"defaultProperties": [],
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export declare interface Asset extends HasId, HasDisplay, HasSource, Partial<Has
/**
* Information on this asset's condition meter, if any.
*/
"Meter"?: ConditionMeter | undefined;
"Condition meter"?: ConditionMeter | undefined;
Tags?: string[] | undefined;
}

Expand Down

0 comments on commit 88c5c52

Please sign in to comment.