chore: reformat with 2 spaces
This commit is contained in:
parent
d659e4bed9
commit
7670d7f808
1577 changed files with 70010 additions and 70042 deletions
|
@ -1,11 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
semi: true,
|
|
||||||
trailingComma: "all",
|
|
||||||
singleQuote: false,
|
|
||||||
printWidth: 120,
|
|
||||||
tabWidth: 4,
|
|
||||||
};
|
|
11
.prettierrc.js
Normal file
11
.prettierrc.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
export default {
|
||||||
|
semi: true,
|
||||||
|
trailingComma: "all",
|
||||||
|
singleQuote: false,
|
||||||
|
printWidth: 120,
|
||||||
|
tabWidth: 2,
|
||||||
|
};
|
|
@ -62,9 +62,7 @@ describe("evaluateCheck with a single die", () => {
|
||||||
|
|
||||||
it("should roll a die even when the checkTargetNumber is 0 and fail on values > 1 and < 20", () => {
|
it("should roll a die even when the checkTargetNumber is 0 and fail on values > 1 and < 20", () => {
|
||||||
for (let i = 2; i < 20; i++) {
|
for (let i = 2; i < 20; i++) {
|
||||||
expect(evaluateCheck([i], 0)).toEqual([
|
expect(evaluateCheck([i], 0)).toEqual([{ result: i, checkTargetNumber: 0, active: false, discarded: true }]);
|
||||||
{ result: i, checkTargetNumber: 0, active: false, discarded: true },
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -82,9 +80,7 @@ describe("evaluateCheck with a single die", () => {
|
||||||
|
|
||||||
it("should roll a die even when the checkTargetNumber is < 0 and fail on values > 1 and < 20", () => {
|
it("should roll a die even when the checkTargetNumber is < 0 and fail on values > 1 and < 20", () => {
|
||||||
for (let i = 2; i < 20; i++) {
|
for (let i = 2; i < 20; i++) {
|
||||||
expect(evaluateCheck([i], -1)).toEqual([
|
expect(evaluateCheck([i], -1)).toEqual([{ result: i, checkTargetNumber: -1, active: false, discarded: true }]);
|
||||||
{ result: i, checkTargetNumber: -1, active: false, discarded: true },
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -150,9 +150,7 @@ function buildCombinedTestCases(): CombinedTestCase[] {
|
||||||
for (const sorcererTestCase of testCases.sorcerer.filter(isRelevantPermutationTestCase)) {
|
for (const sorcererTestCase of testCases.sorcerer.filter(isRelevantPermutationTestCase)) {
|
||||||
for (const wizardTestCase of testCases.wizard.filter(isRelevantPermutationTestCase)) {
|
for (const wizardTestCase of testCases.wizard.filter(isRelevantPermutationTestCase)) {
|
||||||
const expected =
|
const expected =
|
||||||
healerTestCase.expected !== null ||
|
healerTestCase.expected !== null || sorcererTestCase.expected !== null || wizardTestCase.expected !== null
|
||||||
sorcererTestCase.expected !== null ||
|
|
||||||
wizardTestCase.expected !== null
|
|
||||||
? Math.min(
|
? Math.min(
|
||||||
healerTestCase.expected ?? Infinity,
|
healerTestCase.expected ?? Infinity,
|
||||||
sorcererTestCase.expected ?? Infinity,
|
sorcererTestCase.expected ?? Infinity,
|
||||||
|
|
|
@ -87,8 +87,7 @@ describe("Validator", () => {
|
||||||
|
|
||||||
it("allows a complicated valid expression", () => {
|
it("allows a complicated valid expression", () => {
|
||||||
// given
|
// given
|
||||||
const predicate = (identifier: string) =>
|
const predicate = (identifier: string) => [...safeOperators, ...literals, "floor", "random"].includes(identifier);
|
||||||
[...safeOperators, ...literals, "floor", "random"].includes(identifier);
|
|
||||||
const validator = new Validator(predicate);
|
const validator = new Validator(predicate);
|
||||||
const input = "typeof (floor(random() * 5) / 2) === 'number' ? 42 : 'foo'";
|
const input = "typeof (floor(random() * 5) / 2) === 'number' ? 42 : 'foo'";
|
||||||
|
|
||||||
|
|
|
@ -74,11 +74,7 @@ export class DS4ActorSheet extends ActorSheet {
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
addTooltipsToData(context) {
|
addTooltipsToData(context) {
|
||||||
const valueGroups = [
|
const valueGroups = [context.data.system.attributes, context.data.system.traits, context.data.system.combatValues];
|
||||||
context.data.system.attributes,
|
|
||||||
context.data.system.traits,
|
|
||||||
context.data.system.combatValues,
|
|
||||||
];
|
|
||||||
|
|
||||||
valueGroups.forEach((valueGroup) => {
|
valueGroups.forEach((valueGroup) => {
|
||||||
Object.values(valueGroup).forEach((attribute) => {
|
Object.values(valueGroup).forEach((attribute) => {
|
||||||
|
@ -349,9 +345,7 @@ export class DS4ActorSheet extends ActorSheet {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new TypeError(
|
throw new TypeError("Binding of item property to this type of HTML element not supported; given: " + element);
|
||||||
"Binding of item property to this type of HTML element not supported; given: " + element,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,9 @@ export class DS4CreatureActorSheet extends DS4ActorSheet {
|
||||||
/** @override */
|
/** @override */
|
||||||
async getData(options = {}) {
|
async getData(options = {}) {
|
||||||
const context = await super.getData(options);
|
const context = await super.getData(options);
|
||||||
context.data.system.baseInfo.description = await TextEditor.enrichHTML(
|
context.data.system.baseInfo.description = await TextEditor.enrichHTML(context.data.system.baseInfo.description, {
|
||||||
context.data.system.baseInfo.description,
|
async: true,
|
||||||
{ async: true },
|
});
|
||||||
);
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,7 @@ function findIndexOfSmallestNonCoup(dice: number[], maximumCoupResult: number):
|
||||||
.map((die, index): [number, number] => [die, index])
|
.map((die, index): [number, number] => [die, index])
|
||||||
.filter((indexedDie) => indexedDie[0] > maximumCoupResult)
|
.filter((indexedDie) => indexedDie[0] > maximumCoupResult)
|
||||||
.reduce(
|
.reduce(
|
||||||
(smallestIndexedDie, indexedDie) =>
|
(smallestIndexedDie, indexedDie) => (indexedDie[0] < smallestIndexedDie[0] ? indexedDie : smallestIndexedDie),
|
||||||
indexedDie[0] < smallestIndexedDie[0] ? indexedDie : smallestIndexedDie,
|
|
||||||
[Infinity, -1],
|
[Infinity, -1],
|
||||||
)[1];
|
)[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,7 @@ class CheckFactory {
|
||||||
* Execute this check factory.
|
* Execute this check factory.
|
||||||
* @returns {Promise<ChatMessage | undefined>} A promise that resolves to the created chat message for the roll */
|
* @returns {Promise<ChatMessage | undefined>} A promise that resolves to the created chat message for the roll */
|
||||||
async execute() {
|
async execute() {
|
||||||
const innerFormula = ["ds", this.createCheckTargetNumberModifier(), this.createCoupFumbleModifier()].filterJoin(
|
const innerFormula = ["ds", this.createCheckTargetNumberModifier(), this.createCoupFumbleModifier()].filterJoin("");
|
||||||
"",
|
|
||||||
);
|
|
||||||
const formula = this.#options.useSlayingDice ? `{${innerFormula}}x` : innerFormula;
|
const formula = this.#options.useSlayingDice ? `{${innerFormula}}x` : innerFormula;
|
||||||
const roll = Roll.create(formula);
|
const roll = Roll.create(formula);
|
||||||
const speaker = this.#options.speaker ?? ChatMessage.getSpeaker();
|
const speaker = this.#options.speaker ?? ChatMessage.getSpeaker();
|
||||||
|
@ -209,14 +207,9 @@ async function askForInteractiveRollData(checkTargetNumber, options = {}, { temp
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
activateAdditionalListeners: (html, app) => {
|
activateAdditionalListeners: (html, app) => {
|
||||||
const checkModifierCustomFormGroup = html
|
const checkModifierCustomFormGroup = html.find(`#check-modifier-custom-${id}`).parent(".form-group");
|
||||||
.find(`#check-modifier-custom-${id}`)
|
|
||||||
.parent(".form-group");
|
|
||||||
html.find(`#check-modifier-${id}`).on("change", (event) => {
|
html.find(`#check-modifier-${id}`).on("change", (event) => {
|
||||||
if (
|
if (event.currentTarget.value === "custom" && checkModifierCustomFormGroup.hasClass("ds4-hidden")) {
|
||||||
event.currentTarget.value === "custom" &&
|
|
||||||
checkModifierCustomFormGroup.hasClass("ds4-hidden")
|
|
||||||
) {
|
|
||||||
checkModifierCustomFormGroup.removeClass("ds4-hidden");
|
checkModifierCustomFormGroup.removeClass("ds4-hidden");
|
||||||
app.setPosition({ height: "auto" });
|
app.setPosition({ height: "auto" });
|
||||||
} else if (!checkModifierCustomFormGroup.hasClass("ds4-hidden")) {
|
} else if (!checkModifierCustomFormGroup.hasClass("ds4-hidden")) {
|
||||||
|
|
|
@ -32,9 +32,7 @@ export function isTrait(value: unknown): value is Trait {
|
||||||
}
|
}
|
||||||
|
|
||||||
type DS4ActorDataSourceDataCombatValues = {
|
type DS4ActorDataSourceDataCombatValues = {
|
||||||
[Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints"
|
[Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints" ? ResourceData<number> : ModifiableData<number>;
|
||||||
? ResourceData<number>
|
|
||||||
: ModifiableData<number>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type CombatValue = keyof DS4ActorDataSourceDataCombatValues;
|
type CombatValue = keyof DS4ActorDataSourceDataCombatValues;
|
||||||
|
|
|
@ -39,9 +39,7 @@ export class DS4Actor extends Actor {
|
||||||
maximumCoupResult: 1,
|
maximumCoupResult: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.values(this.system.attributes).forEach(
|
Object.values(this.system.attributes).forEach((attribute) => (attribute.total = attribute.base + attribute.mod));
|
||||||
(attribute) => (attribute.total = attribute.base + attribute.mod),
|
|
||||||
);
|
|
||||||
|
|
||||||
Object.values(this.system.traits).forEach((trait) => (trait.total = trait.base + trait.mod));
|
Object.values(this.system.traits).forEach((trait) => (trait.total = trait.base + trait.mod));
|
||||||
}
|
}
|
||||||
|
@ -184,8 +182,7 @@ export class DS4Actor extends Actor {
|
||||||
this,
|
this,
|
||||||
this.actorEffects,
|
this.actorEffects,
|
||||||
(change) =>
|
(change) =>
|
||||||
!this.derivedDataProperties.includes(change.key) &&
|
!this.derivedDataProperties.includes(change.key) && !this.finalDerivedDataProperties.includes(change.key),
|
||||||
!this.finalDerivedDataProperties.includes(change.key),
|
|
||||||
).forEach(this.newStatuses.add.bind(this.newStatuses));
|
).forEach(this.newStatuses.add.bind(this.newStatuses));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,8 +357,7 @@ export class DS4Actor extends Actor {
|
||||||
disableTraps: system.attributes.mind.total + system.traits.dexterity.total,
|
disableTraps: system.attributes.mind.total + system.traits.dexterity.total,
|
||||||
featOfStrength: system.attributes.body.total + system.traits.strength.total,
|
featOfStrength: system.attributes.body.total + system.traits.strength.total,
|
||||||
flirt: system.attributes.mind.total + system.traits.aura.total,
|
flirt: system.attributes.mind.total + system.traits.aura.total,
|
||||||
haggle:
|
haggle: system.attributes.mind.total + Math.max(system.traits.intellect.total, system.traits.intellect.total),
|
||||||
system.attributes.mind.total + Math.max(system.traits.intellect.total, system.traits.intellect.total),
|
|
||||||
hide: system.attributes.mobility.total + system.traits.agility.total,
|
hide: system.attributes.mobility.total + system.traits.agility.total,
|
||||||
identifyMagic: system.attributes.mind.total + system.traits.intellect.total,
|
identifyMagic: system.attributes.mind.total + system.traits.intellect.total,
|
||||||
jump: system.attributes.mobility.total + system.traits.agility.total,
|
jump: system.attributes.mobility.total + system.traits.agility.total,
|
||||||
|
|
|
@ -49,8 +49,7 @@ export class DS4Spell extends DS4Item {
|
||||||
const spellType = this.system.spellType;
|
const spellType = this.system.spellType;
|
||||||
const opponentDefense = this.system.opponentDefense;
|
const opponentDefense = this.system.opponentDefense;
|
||||||
const checkTargetNumber =
|
const checkTargetNumber =
|
||||||
ownerSystemData.combatValues[spellType].total +
|
ownerSystemData.combatValues[spellType].total + (hasComplexModifier ? 0 : this.system.spellModifier.numerical);
|
||||||
(hasComplexModifier ? 0 : this.system.spellModifier.numerical);
|
|
||||||
const speaker = ChatMessage.getSpeaker({ actor: this.actor, ...options.speaker });
|
const speaker = ChatMessage.getSpeaker({ actor: this.actor, ...options.speaker });
|
||||||
const flavor =
|
const flavor =
|
||||||
opponentDefense !== undefined && opponentDefense !== 0
|
opponentDefense !== undefined && opponentDefense !== 0
|
||||||
|
|
|
@ -207,10 +207,7 @@ export class Lexer {
|
||||||
only0s = endPos === pos ? true : only0s;
|
only0s = endPos === pos ? true : only0s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (this.input[endPos] === "_" && (this.input[endPos - 1] === "_" || this.input[endPos - 1] === "." || only0s)) {
|
||||||
this.input[endPos] === "_" &&
|
|
||||||
(this.input[endPos - 1] === "_" || this.input[endPos - 1] === "." || only0s)
|
|
||||||
) {
|
|
||||||
return [{ type: "invalid", pos }, pos];
|
return [{ type: "invalid", pos }, pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ function bumpVersion(release) {
|
||||||
|
|
||||||
console.log(`Bumping version number to '${targetVersion}'`);
|
console.log(`Bumping version number to '${targetVersion}'`);
|
||||||
packageJson.version = targetVersion;
|
packageJson.version = targetVersion;
|
||||||
fs.writeJSONSync("package.json", packageJson, { spaces: 4 });
|
fs.writeJSONSync("package.json", packageJson, { spaces: 2 });
|
||||||
manifest.version = targetVersion;
|
manifest.version = targetVersion;
|
||||||
manifest.url = repositoryURL;
|
manifest.url = repositoryURL;
|
||||||
manifest.manifest = getManifestUrl(getChannel(targetVersion));
|
manifest.manifest = getManifestUrl(getChannel(targetVersion));
|
||||||
|
@ -90,7 +90,7 @@ function bumpVersion(release) {
|
||||||
manifest.changelog = getChangelogURL(targetVersion);
|
manifest.changelog = getChangelogURL(targetVersion);
|
||||||
manifest.readme = getReadmeURL(targetVersion);
|
manifest.readme = getReadmeURL(targetVersion);
|
||||||
manifest.license = getLicenseURL(targetVersion);
|
manifest.license = getLicenseURL(targetVersion);
|
||||||
fs.writeJSONSync(manifestPath, manifest, { spaces: 4 });
|
fs.writeJSONSync(manifestPath, manifest, { spaces: 2 });
|
||||||
}
|
}
|
||||||
|
|
||||||
const argv = yargs(hideBin(process.argv)).usage("Usage: $0").option("release", {
|
const argv = yargs(hideBin(process.argv)).usage("Usage: $0").option("release", {
|
||||||
|
|
Loading…
Reference in a new issue