-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexploit.js
More file actions
72 lines (63 loc) · 4.62 KB
/
exploit.js
File metadata and controls
72 lines (63 loc) · 4.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const target = game.user.targets.first();
if (!(actor && target?.actor)) {
return ui.notifications.warn("You must have an actor selected and one token targeted");
}
const skill = actor.system.skills["esoteric-lore"];
if (!skill) {
return ui.notifications.warn("Skill not found");
}
const dc = {
"-1": 13,
...Object.fromEntries(Object.entries([14, 15, 16, 18, 19, 20, 22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36, 38, 39, 40, 42, 44, 46, 48, 50])),
}[target.actor.level];
if (!dc) {
return ui.notifications.warn("No matching DC for target");
}
const rollOptions = actor.getRollOptions(["skill-check", skill.slug]);
const outcomes = {
criticalSuccess: "You remember the creature's weaknesses, and as you empower your esoterica, you have a flash of insight that grants even more knowledge about the creature. You learn all of the creature's resistances, weaknesses, and immunities, including the amounts of the resistances and weaknesses and any unusual weaknesses or vulnerabilities, such as what spells will pass through a golem's antimagic. You can exploit either the creature's mortal weakness or personal antithesis (see below). Your unarmed and weapon Strikes against the creature also become magical if they weren't already. <BR><strong>Apply:</strong> @UUID[Item.ofI3LMCgUooABhYb]{Mortal Weakness}<br>or<br><strong>Apply:</strong>@UUID[Item.vfCHmFV9tFtnguhv]{Personal Antithesis} ",
success: "You recall an important fact about the creature, learning its highest weakness (or one of its highest weaknesses, if it has multiple with the same value) but not its other weaknesses, resistances, or immunities. You can exploit either the creature's mortal weakness or personal antithesis. Your unarmed and weapon Strikes against the creature also become magical if they weren't already.<BR><strong>Apply:</strong> @UUID[Item.ofI3LMCgUooABhYb]{Mortal Weakness}<br>or<br><strong>Apply:</strong>@UUID[Item.vfCHmFV9tFtnguhv]{Personal Antithesis}",
failure: "Failing to recall a salient weakness about the creature, you instead attempt to exploit a more personal vulnerability. You can exploit only the creature's personal antithesis. Your unarmed and weapon Strikes against the creature also become magical if they weren't already.<br><strong>Apply:</strong>@UUID[Item.vfCHmFV9tFtnguhv]{Personal Antithesis}",
criticalFailure: "You couldn't remember the right object to use and become distracted while you rummage through your esoterica. You become flat-footed until the beginning of your next turn."
};
const notes = Object.entries(outcomes).map(([outcome, text]) => ({
title: game.i18n.localize("PF2E.Check.Result.Degree.Check." + outcome),
text,
outcome: [outcome],
}));
const hasDiverseLore = actor.items.some((i) => i.slug === "diverse-lore");
if (hasDiverseLore) {
// todo: put npc identify data in the document and then show secret text for it.
const dc = target.actor.system.details.identification?.skill.dc;
const diverseLoreDC = dc ? `<br/><span data-visibility="gm">Recall Knowledge DC ${dc}</span>` : "";
notes.push({
title: "Diverse Lore",
text: `When you succeed at your check to Exploit a Vulnerability, compare the result of your Esoteric Lore check to the DC to Recall Knowledge for that creature; if that number would be a success or a critical success, you gain information as if you had succeeded at the Recall Knowledge check. ${diverseLoreDC}`,
outcome: ["success", "criticalSuccess"],
});
}
const flavor = `Exploit Vulnerability: ${skill.label}`;
const checkModifier = new game.pf2e.CheckModifier(flavor, skill);
const traits = ["esoterica", "manipulate", "thaumaturge"];
game.pf2e.Check.roll(checkModifier, {
actor: token.actor,
target: {
actor: target.actor,
token: target.document,
},
type: 'skill-check',
options: rollOptions,
notes,
dc: { value: dc },
traits: traits.map((t) => ({
name: t,
label: CONFIG.PF2E.actionTraits[t] ?? t,
description: CONFIG.PF2E.traitsDescriptions[t],
})),
flavor: `
<strong>Frequency</strong> once per round<br/>
<strong>Requirements</strong> You are holding your implement<br/>
<hr/>
<p>You scour your experiences and learning to identify something that might repel your foe. You retrieve an object from your esoterica with the appropriate supernatural qualities, then use your implement to stoke the remnants of its power into a blaze. Select a creature you can see and attempt an Esoteric Lore check against a standard DC for its level, as you retrieve the right object from your esoterica and use your implement to empower it. You gain the following effects until you Exploit Vulnerabilities again.</p>
`,
}, event);