Skip to content

Commit

Permalink
Improve spell touch creature detection
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPrimate committed Apr 7, 2024
1 parent d2188a4 commit aab71b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Next Up

- On character import update name choice was not respected on prototype token.
- Fix for somme touch spells not setting target correctly to 1 creature, e.g. Gift of Alacrity.

# 5.1.7

Expand Down
8 changes: 5 additions & 3 deletions src/parser/spells/target.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import DICTIONARY from "../../dictionary.js";
* @param {*} data
*/
let doesTargetCreature = (data) => {
const creature = /You touch a creature|a creature you|creature( that)? you can see|interrupt a creature|would strike a creature|creature of your choice|creature or object within range|cause a creature|creature must be within range/gi;
const creature = /You touch a creature|You touch a willing creature|creature you touch|a creature you|creature( that)? you can see|interrupt a creature|would strike a creature|creature of your choice|creature or object within range|cause a creature|creature must be within range/gi;
const creaturesRange = /(humanoid|monster|creature|target)(s)? (or loose object )?(of your choice )?(that )?(you can see )?within range/gi;
return data.definition.description.match(creature) || data.definition.description.match(creaturesRange);
};
Expand Down Expand Up @@ -63,8 +63,10 @@ export function getTarget(data) {

switch (data.definition.range.origin) {
case "Touch":
result.units = "touch";
if (creatures) result.type = "creature";
if (creatures) {
result.units = "1";
result.type = "creature";
}
break;
case "Self": {
const dmgSpell = data.definition.modifiers.some((mod) => mod.type === "damage");
Expand Down

0 comments on commit aab71b8

Please sign in to comment.