mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2026-01-14 05:47:50 -06:00
v1.199.1
This commit is contained in:
@@ -126,7 +126,7 @@ class SpellParser extends BaseParser {
|
||||
|
||||
const statsOut = this._getFinalState(spell, options);
|
||||
|
||||
const missingProps = this._REQUIRED_PROPS.filter(prop => !statsOut[prop]);
|
||||
const missingProps = this._REQUIRED_PROPS.filter(prop => statsOut[prop] == null);
|
||||
if (missingProps.length) options.cbWarning(`${statsOut.name ? `(${statsOut.name}) ` : ""}Missing properties: ${missingProps.join(", ")}`);
|
||||
|
||||
options.cbOutput(statsOut, options.isAppend);
|
||||
@@ -303,7 +303,7 @@ class SpellParser extends BaseParser {
|
||||
}
|
||||
|
||||
static _setCleanRange (stats, line, options) {
|
||||
const getUnit = (str) => str.toLowerCase().includes("mile") ? "miles" : "feet";
|
||||
const getUnit = (str) => /\b(miles|mi\.)\b/.test(str.toLowerCase()) ? "miles" : "feet";
|
||||
|
||||
const range = ConvertUtil.cleanDashes(ConvertUtil.getStatblockLineHeaderText({reStartStr: this._RE_START_RANGE, line}));
|
||||
|
||||
@@ -316,29 +316,29 @@ class SpellParser extends BaseParser {
|
||||
|
||||
const cleanRange = range.replace(/(\d),(\d)/g, "$1$2");
|
||||
|
||||
const mFeetMiles = /^(\d+) (feet|foot|miles?)$/i.exec(cleanRange);
|
||||
if (mFeetMiles) return stats.range = {type: "point", distance: {type: getUnit(mFeetMiles[2]), amount: Number(mFeetMiles[1])}};
|
||||
const mFeetMiles = /^(?<amount>\d+) (?<unit>feet|foot|ft\.?|miles?|mi\.?)$/i.exec(cleanRange);
|
||||
if (mFeetMiles) return stats.range = {type: "point", distance: {type: getUnit(mFeetMiles.groups.unit), amount: Number(mFeetMiles.groups.amount)}};
|
||||
|
||||
const mSelfRadius = /^self \((\d+)-(foot|mile) radius\)$/i.exec(cleanRange);
|
||||
const mSelfRadius = /^self \((\d+)-(foot|ft\.?|mile|mi\.?) radius\)$/i.exec(cleanRange);
|
||||
if (mSelfRadius) return stats.range = {type: "radius", distance: {type: getUnit(mSelfRadius[2]), amount: Number(mSelfRadius[1])}};
|
||||
|
||||
const mSelfSphere = /^self \((\d+)-(foot|mile)(?:-radius)? sphere\)$/i.exec(cleanRange);
|
||||
const mSelfSphere = /^self \((\d+)-(foot|ft\.?|mile|mi\.?)(?:-radius)? sphere\)$/i.exec(cleanRange);
|
||||
if (mSelfSphere) return stats.range = {type: "sphere", distance: {type: getUnit(mSelfSphere[2]), amount: Number(mSelfSphere[1])}};
|
||||
|
||||
const mSelfCone = /^self \((\d+)-(foot|mile) cone\)$/i.exec(cleanRange);
|
||||
const mSelfCone = /^self \((\d+)-(foot|ft\.?|mile|mi\.?) cone\)$/i.exec(cleanRange);
|
||||
if (mSelfCone) return stats.range = {type: "cone", distance: {type: getUnit(mSelfCone[2]), amount: Number(mSelfCone[1])}};
|
||||
|
||||
const mSelfLine = /^self \((\d+)-(foot|mile) line\)$/i.exec(cleanRange);
|
||||
const mSelfLine = /^self \((\d+)-(foot|ft\.?|mile|mi\.?) line\)$/i.exec(cleanRange);
|
||||
if (mSelfLine) return stats.range = {type: "line", distance: {type: getUnit(mSelfLine[2]), amount: Number(mSelfLine[1])}};
|
||||
|
||||
const mSelfCube = /^self \((\d+)-(foot|mile) cube\)$/i.exec(cleanRange);
|
||||
const mSelfCube = /^self \((\d+)-(foot|ft\.?|mile|mi\.?) cube\)$/i.exec(cleanRange);
|
||||
if (mSelfCube) return stats.range = {type: "cube", distance: {type: getUnit(mSelfCube[2]), amount: Number(mSelfCube[1])}};
|
||||
|
||||
const mSelfHemisphere = /^self \((\d+)-(foot|mile)(?:-radius)? hemisphere\)$/i.exec(cleanRange);
|
||||
const mSelfHemisphere = /^self \((\d+)-(foot|ft\.?|mile|mi\.?)(?:-radius)? hemisphere\)$/i.exec(cleanRange);
|
||||
if (mSelfHemisphere) return stats.range = {type: "hemisphere", distance: {type: getUnit(mSelfHemisphere[2]), amount: Number(mSelfHemisphere[1])}};
|
||||
|
||||
// region Homebrew
|
||||
const mPointCube = /^(?<point>\d+) (?<unit>feet|foot|miles?) \((\d+)-(foot|mile) cube\)$/i.exec(cleanRange);
|
||||
const mPointCube = /^(?<point>\d+) (?<unit>feet|foot|ft\.?|miles?|mi\.?) \((\d+)-(foot|ft\.?|mile|mi\.?) cube\)$/i.exec(cleanRange);
|
||||
if (mPointCube) return stats.range = {type: "point", distance: {type: getUnit(mPointCube.groups.unit), amount: Number(mPointCube.groups.point)}};
|
||||
// endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user