Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate increase and decrease to item repair #15915

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packs/equipment/crafters-eyepiece-greater.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,25 @@
"selector": "crafting",
"type": "item",
"value": 2
},
{
"key": "ActiveEffectLike",
"mode": "add",
"path": "system.crafting.repair.value",
"value": 5
},
{
"key": "Note",
"text": "PF2E.SpecificRule.CraftersEyepiece.Note",
"title": "{item|name}",
"selector": "crafting-check",
"outcome": [
"success",
"criticalSuccess"
],
"predicate": [
"action:repair"
]
}
],
"size": "med",
Expand Down
19 changes: 19 additions & 0 deletions packs/equipment/crafters-eyepiece.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,25 @@
"selector": "crafting",
"type": "item",
"value": 1
},
{
"key": "ActiveEffectLike",
"mode": "add",
"path": "system.crafting.repair.value",
"value": 5
},
{
"key": "Note",
"text": "PF2E.SpecificRule.CraftersEyepiece.Note",
"title": "{item|name}",
"selector": "crafting-check",
"outcome": [
"success",
"criticalSuccess"
],
"predicate": [
"action:repair"
]
}
],
"size": "med",
Expand Down
1 change: 1 addition & 0 deletions src/module/actor/character/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ interface VersatileWeaponOption {
interface CharacterCraftingData {
formulas: CraftingFormulaData[];
entries: Record<string, Partial<CraftingEntryData>>;
repair: { value: 5 };
}

interface CharacterResources extends CreatureResources {
Expand Down
2 changes: 1 addition & 1 deletion src/module/actor/character/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ class CharacterPF2e<TParent extends TokenDocumentPF2e | null = TokenDocumentPF2e
}

// Indicate that crafting formulas stored directly on the actor are deletable
system.crafting = fu.mergeObject({ formulas: [], entries: {} }, system.crafting ?? {});
system.crafting = fu.mergeObject({ formulas: [], entries: {}, repair: { value: 5 } }, system.crafting ?? {});
for (const formula of this.system.crafting.formulas) {
formula.deletable = true;
}
Expand Down
7 changes: 4 additions & 3 deletions src/module/system/action-macros/crafting/repair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,18 @@ async function repair(options: RepairActionOptions): Promise<void> {
callback: async (result) => {
// react to check result by posting a chat message with appropriate follow-up options
const { actor } = result;
if (item && result.message instanceof ChatMessagePF2e && actor.isOfType("creature")) {
if (item && result.message instanceof ChatMessagePF2e && actor.isOfType("character")) {
const messageSource = result.message.toObject();
const flavor = await (async () => {
const proficiencyRank = actor.skills.crafting.rank ?? 0;
const repairValue = actor.system.crafting.repair.value;
if ("criticalSuccess" === result.outcome) {
const label = "PF2E.Actions.Repair.Labels.RestoreItemHitPoints";
const restored = String(10 + proficiencyRank * 10);
const restored = String(repairValue + 5 + proficiencyRank * (repairValue + 5));
return renderRepairResult(item, "restore", label, restored);
} else if ("success" === result.outcome) {
const label = "PF2E.Actions.Repair.Labels.RestoreItemHitPoints";
const restored = String(5 + proficiencyRank * 5);
const restored = String(repairValue + proficiencyRank * repairValue);
return renderRepairResult(item, "restore", label, restored);
} else if ("criticalFailure" === result.outcome) {
const label = "PF2E.Actions.Repair.Labels.RollItemDamage";
Expand Down
3 changes: 3 additions & 0 deletions static/lang/re-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2513,6 +2513,9 @@
"Prone": "Prone",
"Standard": "Standard"
},
"CraftersEyepiece": {
"Note": "When you Repair an item, increase the Hit Points restored to 10 + 10 per proficiency rank on a success or 15 + 15 per proficiency rank on a critical success."
},
"CriticalDeck": {
"Effect": {
"Label": "Critical Effect"
Expand Down
Loading