Skip to content

Commit

Permalink
Have Hand of the Apprentice feat enlarge focus pool (foundryvtt#3700)
Browse files Browse the repository at this point in the history
  • Loading branch information
stwlam authored Aug 31, 2022
1 parent c1bd39e commit faefe95
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 4 deletions.
9 changes: 8 additions & 1 deletion packs/data/feats.db/hand-of-the-apprentice.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@
}
]
},
"rules": [],
"rules": [
{
"key": "ActiveEffectLike",
"mode": "add",
"path": "system.resources.focus.max",
"value": 1
}
],
"source": {
"value": "Pathfinder Core Rulebook"
},
Expand Down
9 changes: 8 additions & 1 deletion packs/data/iconics.db/ezren-level-3.json
Original file line number Diff line number Diff line change
Expand Up @@ -4817,7 +4817,14 @@
}
]
},
"rules": [],
"rules": [
{
"key": "ActiveEffectLike",
"mode": "add",
"path": "system.resources.focus.max",
"value": 1
}
],
"slug": "hand-of-the-apprentice",
"source": {
"value": "Pathfinder Core Rulebook"
Expand Down
9 changes: 8 additions & 1 deletion packs/data/iconics.db/ezren-level-5.json
Original file line number Diff line number Diff line change
Expand Up @@ -4608,7 +4608,14 @@
}
]
},
"rules": [],
"rules": [
{
"key": "ActiveEffectLike",
"mode": "add",
"path": "system.resources.focus.max",
"value": 1
}
],
"slug": "hand-of-the-apprentice",
"source": {
"value": "Pathfinder Core Rulebook"
Expand Down
2 changes: 2 additions & 0 deletions packs/scripts/run-migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { Migration773ReligiousSymbolUsage } from "@module/migration/migrations/7
import { Migration774UnpersistCraftingEntries } from "@module/migration/migrations/774-unpersist-crafting-entries";
import { Migration775AgileFinesseRanged } from "@module/migration/migrations/775-agile-finesse-ranged";
import { Migration776SlugifyConditionOverrides } from "@module/migration/migrations/776-sluggify-condition-overrides";
import { Migration777HandOfTheApprentice } from "@module/migration/migrations/777-hand-of-the-apprentice";
// ^^^ don't let your IDE use the index in these imports. you need to specify the full path ^^^

const { window } = new JSDOM();
Expand Down Expand Up @@ -74,6 +75,7 @@ const migrations: MigrationBase[] = [
new Migration774UnpersistCraftingEntries(),
new Migration775AgileFinesseRanged(),
new Migration776SlugifyConditionOverrides(),
new Migration777HandOfTheApprentice(),
];

global.deepClone = <T>(original: T): T => {
Expand Down
25 changes: 25 additions & 0 deletions src/module/migration/migrations/777-hand-of-the-apprentice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ItemSourcePF2e } from "@item/data";
import { AELikeSource } from "@module/rules/rule-element/ae-like";
import { MigrationBase } from "../base";

/** Have Hand of the Apprentice feat enlarge focus pool */
export class Migration777HandOfTheApprentice extends MigrationBase {
static override version = 0.777;

override async updateItem(source: ItemSourceWithAELikes): Promise<void> {
if (source.type === "feat" && source.system.slug === "hand-of-the-apprentice") {
source.system.rules = [
{
key: "ActiveEffectLike",
mode: "add",
path: "system.resources.focus.max",
value: 1,
},
];
}
}
}

type ItemSourceWithAELikes = ItemSourcePF2e & {
system: { rules: AELikeSource[] };
};
1 change: 1 addition & 0 deletions src/module/migration/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,4 @@ export { Migration773ReligiousSymbolUsage } from "./773-religious-symbol-usage";
export { Migration774UnpersistCraftingEntries } from "./774-unpersist-crafting-entries";
export { Migration775AgileFinesseRanged } from "./775-agile-finesse-ranged";
export { Migration776SlugifyConditionOverrides } from "./776-sluggify-condition-overrides";
export { Migration777HandOfTheApprentice } from "./777-hand-of-the-apprentice";
2 changes: 1 addition & 1 deletion src/module/migration/runner/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface CollectionDiff<T extends foundry.data.ActiveEffectSource | ItemSourceP
export class MigrationRunnerBase {
migrations: MigrationBase[];

static LATEST_SCHEMA_VERSION = 0.776;
static LATEST_SCHEMA_VERSION = 0.777;

static MINIMUM_SAFE_VERSION = 0.618;

Expand Down

0 comments on commit faefe95

Please sign in to comment.