Skip to content

Commit

Permalink
Release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosFdez committed Jan 15, 2023
1 parent b095f07 commit ba04184
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 443 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# PF2E Persistent Damage
![Foundry Core Compatible Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2FCarlosFdez%2Fpf2e-persistent-damage%2Fmaster%2Fsrc%2Fmodule.json&label=Foundry%20Version&query=$.compatibleCoreVersion&colorB=orange)

Small module to keep track of persistent damage for pathfinder 2E using the effects system. Accessed via macros in the compendium, dragging and dropping certain inline rolls, and the condition hud. If certain settings are enabled, they will be automatically calculated and/or removed when the actor's turn has finished.

Derived from the condition setter macro from mothringer. If you're feeling generous, you can send something through [Paypal](https://paypal.me/carlosfernandez1779?locale.x=en_US) if you want.
Small module that kept track of Persistent Damage before the feature was built into the core system. Unless you're running an older version of the Pathfinder system, this module can now be removed.

## How to Install

Expand Down
32 changes: 3 additions & 29 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "Supe"
}
],
"version": "0.11.2",
"version": "1.0.0",
"compatibility": {
"minimum": "10",
"verified": "10.291"
Expand All @@ -18,39 +18,13 @@
{
"id": "pf2e",
"compatibility": {
"minimum": "4.6.0"
"minimum": "4.6.6"
}
}
]
},
"esmodules": ["./index.js"],
"styles": ["./styles/styles.css"],
"languages": [
{
"lang": "en",
"name": "English",
"path": "lang/en.json"
}
],
"packs": [
{
"name": "pf2e-persistent-damage-macros",
"label": "PF2E Persistent Damage Macros",
"system": "pf2e",
"path": "packs/pf2e-pd-macros.db",
"type": "Macro",
"module": "pf2e-persistent-damage"
},
{
"name": "pf2e-persistent-damage-effects",
"label": "PF2E Persistent Damage Effects",
"system": "pf2e",
"path": "packs/pf2e-pd-effects.db",
"type": "Item",
"module": "pf2e-persistent-damage"
}
],
"url": "https://github.com/CarlosFdez/pf2e-persistent-damage",
"manifest": "https://github.com/CarlosFdez/pf2e-persistent-damage/releases/latest/download/module.json",
"download": "https://github.com/CarlosFdez/pf2e-persistent-damage/releases/download/v0.11.2/module.zip"
"download": "https://github.com/CarlosFdez/pf2e-persistent-damage/releases/download/v1.0.0/module.zip"
}
54 changes: 4 additions & 50 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,51 +1,5 @@
import { ChatMessagePF2e } from "@module/chat-message";
import { DamageType } from "@module/system/damage";
import { PersistentDamagePF2e } from "./module/pf2e-persistent-damage";
import { registerSettings } from "./module/settings";

// will be extracted by webpack
import "./styles/styles.scss";

Hooks.on("init", () => {
registerSettings();
window.PF2EPersistentDamage = new PersistentDamagePF2e();
});

Hooks.on("renderChatMessage", async (message: ChatMessagePF2e, $html: JQuery<HTMLElement>) => {
const roll: any = message.rolls[0];
if (!roll) return;

if ("evaluatePersistent" in roll.options) {
const damageType = roll.instances[0].type as DamageType;
const template = await renderTemplate(
"modules/pf2e-persistent-damage/templates/chat/recover-persistent-button.html",
{},
);

$html.find(".message-content").append(template);
$html
.find(".pf2e-pd-card button[data-action=check][data-check=flat]")
.on("click", (evt) => {
evt.preventDefault();

// Get the Actor from a synthetic Token
const actorOrToken = message.token ?? message.actor;
if (actorOrToken) {
PF2EPersistentDamage.rollRecoveryCheck(actorOrToken, damageType);
}
});
} else if ("instances" in roll && roll.instances.some((i) => i.persistent)) {
const template = await renderTemplate("modules/pf2e-persistent-damage/templates/chat/apply-persistent-button.html");
$html.find(".message-content").append(template);

$html.find(".pf2e-pd-card button").on("click", (evt) => {
evt.preventDefault();
const conditions = PF2EPersistentDamage.getPersistentDamageFromMessage(message);

const tokens = canvas.tokens.controlled.filter((token) => token.actor);
for (const token of tokens) {
token.actor?.createEmbeddedDocuments("Item", conditions);
}
})
}
Hooks.on("ready", () => {
ui.notifications.error("pf2e Persistent Damage is now built into the system and the module can be now removed", {
permanent: true,
});
});
33 changes: 0 additions & 33 deletions src/lang/en.json

This file was deleted.

152 changes: 0 additions & 152 deletions src/module/pf2e-persistent-damage.ts

This file was deleted.

68 changes: 0 additions & 68 deletions src/module/settings.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/module/utils.ts

This file was deleted.

Loading

0 comments on commit ba04184

Please sign in to comment.