Compare commits
No commits in common. "main" and "1.20.0-0" have entirely different histories.
1588 changed files with 73763 additions and 74158 deletions
|
@ -4,12 +4,36 @@
|
|||
|
||||
module.exports = {
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: { ecmaVersion: 2020, sourceType: "module" },
|
||||
env: { browser: true },
|
||||
extends: ["plugin:@typescript-eslint/recommended", "prettier"],
|
||||
|
||||
parserOptions: {
|
||||
ecmaVersion: 2020,
|
||||
sourceType: "module",
|
||||
},
|
||||
|
||||
env: {
|
||||
browser: true,
|
||||
},
|
||||
|
||||
extends: ["plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
|
||||
|
||||
plugins: ["@typescript-eslint"],
|
||||
|
||||
rules: {
|
||||
// Specify any specific ESLint rules.
|
||||
},
|
||||
|
||||
overrides: [
|
||||
{ files: ["./*.cjs"], rules: { "@typescript-eslint/no-var-requires": "off" } },
|
||||
{ files: ["./spec/**/*"], env: { browser: false } },
|
||||
{
|
||||
files: ["./*.cjs", "./*.js"],
|
||||
rules: {
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["./spec/**/*"],
|
||||
env: {
|
||||
browser: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
@ -8,4 +8,3 @@
|
|||
/.vscode/
|
||||
client
|
||||
common
|
||||
pnpm-lock.yaml
|
||||
|
|
11
.prettierrc.cjs
Normal file
11
.prettierrc.cjs
Normal file
|
@ -0,0 +1,11 @@
|
|||
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
module.exports = {
|
||||
semi: true,
|
||||
trailingComma: "all",
|
||||
singleQuote: false,
|
||||
printWidth: 120,
|
||||
tabWidth: 4,
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
export default {
|
||||
semi: true,
|
||||
trailingComma: "all",
|
||||
singleQuote: false,
|
||||
printWidth: 120,
|
||||
tabWidth: 2,
|
||||
};
|
6
.vscode/launch.json
vendored
6
.vscode/launch.json
vendored
|
@ -5,14 +5,12 @@
|
|||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "chrome",
|
||||
"type": "pwa-chrome",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "/usr/bin/chromium",
|
||||
"name": "Launch Chrome against localhost",
|
||||
"url": "http://localhost:30000/game",
|
||||
"pathMapping": {
|
||||
"/systems/ds4": "${workspaceFolder}/dist"
|
||||
}
|
||||
"webRoot": "${workspaceFolder}/dist"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -29,12 +29,6 @@ steps:
|
|||
commands:
|
||||
- <<: *enable_pnpm
|
||||
- pnpm lint
|
||||
formatcheck:
|
||||
group: check
|
||||
image: *node_image
|
||||
commands:
|
||||
- <<: *enable_pnpm
|
||||
- pnpm format:check
|
||||
typecheck:
|
||||
group: check
|
||||
image: *node_image
|
||||
|
@ -57,7 +51,7 @@ steps:
|
|||
image: *node_image
|
||||
commands:
|
||||
- <<: *enable_pnpm
|
||||
- git fetch origin ${CI_COMMIT_TARGET_BRANCH}
|
||||
- git fetch
|
||||
- pnpm exec commitlint --from origin/${CI_COMMIT_TARGET_BRANCH}
|
||||
when:
|
||||
event: pull_request
|
||||
|
|
|
@ -9,20 +9,6 @@ variables:
|
|||
- &enable_pnpm
|
||||
- corepack enable
|
||||
- corepack prepare pnpm@latest --activate
|
||||
- &is_latest_channel
|
||||
evaluate: CI_COMMIT_TAG matches "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+$"
|
||||
- &is_beta_channel
|
||||
evaluate: CI_COMMIT_TAG matches "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+-[0-9]+$"
|
||||
- &release_plugin woodpeckerci/plugin-gitea-release
|
||||
- &release_base_settings
|
||||
base_url: ${CI_FORGE_URL}
|
||||
title: ${CI_COMMIT_TAG}
|
||||
note: CHANGELOG.md
|
||||
files:
|
||||
- ${CI_REPO_NAME}.zip
|
||||
- ${CI_REPO_NAME}/system.json
|
||||
api_key:
|
||||
from_secret: forge_token
|
||||
|
||||
when:
|
||||
event: tag
|
||||
|
@ -65,27 +51,25 @@ steps:
|
|||
commands:
|
||||
- echo latest > .RELEASE_CHANNEL
|
||||
when:
|
||||
<<: *is_latest_channel
|
||||
evaluate: CI_COMMIT_TAG matches "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+$"
|
||||
choose-beta-channel:
|
||||
group: prepare-release
|
||||
image: alpine:latest
|
||||
commands:
|
||||
- echo beta > .RELEASE_CHANNEL
|
||||
when:
|
||||
<<: *is_beta_channel
|
||||
release-latest:
|
||||
image: *release_plugin
|
||||
evaluate: CI_COMMIT_TAG matches "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+-[0-9]+$"
|
||||
release:
|
||||
image: woodpeckerci/plugin-gitea-release
|
||||
settings:
|
||||
<<: *release_base_settings
|
||||
when:
|
||||
<<: *is_latest_channel
|
||||
release-beta:
|
||||
image: *release_plugin
|
||||
settings:
|
||||
<<: *release_base_settings
|
||||
prerelease: true
|
||||
when:
|
||||
<<: *is_beta_channel
|
||||
base_url: ${CI_FORGE_URL}
|
||||
title: ${CI_COMMIT_TAG}
|
||||
note: CHANGELOG.md
|
||||
files:
|
||||
- ${CI_REPO_NAME}.zip
|
||||
- ${CI_REPO_NAME}/system.json
|
||||
api_key:
|
||||
from_secret: forge_token
|
||||
publish-manifest:
|
||||
group: publish
|
||||
image: alpine:latest
|
||||
|
@ -111,4 +95,4 @@ steps:
|
|||
- fvtt_username
|
||||
- fvtt_password
|
||||
when:
|
||||
<<: *is_latest_channel
|
||||
evaluate: CI_COMMIT_TAG matches "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+$"
|
||||
|
|
|
@ -34,7 +34,6 @@ steps:
|
|||
- git config user.name woodpecker[bot]
|
||||
- git config user.email woodpecker[bot]@${CI_SYSTEM_HOST}
|
||||
- pnpm bump-version --release=${RELEASE_TYPE}
|
||||
- pnpm exec prettier --write package.json system.json
|
||||
- export RELEASE_VERSION=$(jq -r '.version' < package.json)
|
||||
- git --no-pager diff
|
||||
- git add package.json system.json
|
||||
|
|
66
package.json
66
package.json
|
@ -2,7 +2,7 @@
|
|||
"private": true,
|
||||
"name": "dungeonslayers4",
|
||||
"description": "An implementation of the Dungeonslayers 4 game system for Foundry Virtual Tabletop.",
|
||||
"version": "1.21.1",
|
||||
"version": "1.20.0-0",
|
||||
"license": "https://git.f3l.de/dungeonslayers/ds4#licensing",
|
||||
"homepage": "https://git.f3l.de/dungeonslayers/ds4",
|
||||
"repository": {
|
||||
|
@ -47,51 +47,51 @@
|
|||
"clean": "run-p clean:files clean:link",
|
||||
"clean:files": "rimraf dist",
|
||||
"clean:link": "node ./tools/link-package.js --clean",
|
||||
"lint": "pnpm eslint",
|
||||
"lint:fix": "pnpm eslint --fix",
|
||||
"eslint": "eslint --ext .ts,.js,.cjs,.mjs .",
|
||||
"format": "pnpm prettier --write",
|
||||
"format:check": "pnpm prettier --check",
|
||||
"prettier": "prettier './**/*.(ts|js|cjs|mjs|json|scss|yml|yaml)'",
|
||||
"lint": "eslint --ext .ts,.js,.cjs,.mjs .",
|
||||
"lint:fix": "eslint --ext .ts,.js,.cjs,.mjs --fix .",
|
||||
"format": "prettier --write \"./**/*.(ts|js|cjs|mjs|json|scss|yml)\"",
|
||||
"test": "run-p test:vitest test:typecheck",
|
||||
"test:vitest": "vitest run",
|
||||
"test:typecheck": "tsc --noEmit --project spec/tsconfig.json",
|
||||
"test:watch": "vitest",
|
||||
"test:ci": "run-p test:ci:vitest test:typecheck",
|
||||
"test:ci:vitest": "vitest run --reporter=default --reporter=junit --outputFile=junit.xml",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck:watch": "tsc --noEmit --watch",
|
||||
"bump-version": "node ./tools/bump-version.js",
|
||||
"changelog": "conventional-changelog -p conventionalcommits -o CHANGELOG.md -r 2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "19.5.0",
|
||||
"@commitlint/config-conventional": "19.5.0",
|
||||
"@commitlint/cli": "17.6.6",
|
||||
"@commitlint/config-conventional": "17.6.6",
|
||||
"@foundryvtt/foundryvtt-cli": "0.0.9",
|
||||
"@guanghechen/rollup-plugin-copy": "6.0.2",
|
||||
"@guanghechen/rollup-plugin-copy": "5.0.1",
|
||||
"@ironkinoko/rollup-plugin-styles": "4.0.3",
|
||||
"@swc/core": "1.7.39",
|
||||
"@types/fs-extra": "11.0.4",
|
||||
"@types/jquery": "3.5.31",
|
||||
"@types/node": "18.19.3",
|
||||
"@typescript-eslint/eslint-plugin": "7.18.0",
|
||||
"@typescript-eslint/parser": "7.18.0",
|
||||
"conventional-changelog-cli": "5.0.0",
|
||||
"conventional-changelog-conventionalcommits": "8.0.0",
|
||||
"eslint": "8.57.1",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"fs-extra": "11.2.0",
|
||||
"handlebars": "4.7.8",
|
||||
"@swc/core": "1.3.68",
|
||||
"@types/fs-extra": "11.0.1",
|
||||
"@types/jquery": "3.5.16",
|
||||
"@types/node": "18.16.19",
|
||||
"@typescript-eslint/eslint-plugin": "5.61.0",
|
||||
"@typescript-eslint/parser": "5.61.0",
|
||||
"conventional-changelog-cli": "3.0.0",
|
||||
"conventional-changelog-conventionalcommits": "6.1.0",
|
||||
"eslint": "8.44.0",
|
||||
"eslint-config-prettier": "8.8.0",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"fs-extra": "11.1.1",
|
||||
"handlebars": "4.7.7",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "3.3.3",
|
||||
"rimraf": "6.0.1",
|
||||
"rollup": "4.24.0",
|
||||
"rollup-plugin-swc3": "0.12.1",
|
||||
"sass": "1.80.3",
|
||||
"semver": "7.6.3",
|
||||
"tslib": "2.8.0",
|
||||
"typescript": "5.5.4",
|
||||
"vite": "4.5.5",
|
||||
"vitest": "0.34.6",
|
||||
"prettier": "2.8.8",
|
||||
"rimraf": "5.0.1",
|
||||
"rollup": "3.25.3",
|
||||
"rollup-plugin-swc3": "0.8.2",
|
||||
"sass": "1.63.6",
|
||||
"semver": "7.5.4",
|
||||
"tslib": "2.6.0",
|
||||
"typescript": "5.1.6",
|
||||
"vite": "4.4.2",
|
||||
"vitest": "0.33.0",
|
||||
"yargs": "17.7.2"
|
||||
},
|
||||
"packageManager": "pnpm@9.12.2"
|
||||
"packageManager": "pnpm@8.6.6"
|
||||
}
|
||||
|
|
7121
pnpm-lock.yaml
7121
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": ["config:base", ":automergeAll", ":automergePr", ":prHourlyLimitNone", ":prConcurrentLimitNone"],
|
||||
"extends": ["config:base", ":automergeAll", ":automergeBranch", ":prHourlyLimitNone", ":prConcurrentLimitNone"],
|
||||
"packageRules": [
|
||||
{
|
||||
"matchPackagePatterns": ["^@pixi"],
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
font-family: "Lora";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src:
|
||||
local("Lora"),
|
||||
url("../fonts/Lora/Lora.woff") format("woff");
|
||||
src: local("Lora"), url("../fonts/Lora/Lora.woff") format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
|
@ -19,9 +17,7 @@
|
|||
font-family: "Lora";
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
src:
|
||||
local("Lora"),
|
||||
url("../fonts/Lora/Lora-Bold.woff") format("woff");
|
||||
src: local("Lora"), url("../fonts/Lora/Lora-Bold.woff") format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
|
@ -29,9 +25,7 @@
|
|||
font-family: "Lora";
|
||||
font-style: italic;
|
||||
font-weight: normal;
|
||||
src:
|
||||
local("Lora"),
|
||||
url("../fonts/Lora/Lora-Italic.woff") format("woff");
|
||||
src: local("Lora"), url("../fonts/Lora/Lora-Italic.woff") format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
|
@ -39,9 +33,7 @@
|
|||
font-family: "Lora";
|
||||
font-style: italic;
|
||||
font-weight: bold;
|
||||
src:
|
||||
local("Lora"),
|
||||
url("../fonts/Lora/Lora-BoldItalic.woff") format("woff");
|
||||
src: local("Lora"), url("../fonts/Lora/Lora-BoldItalic.woff") format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
|
@ -49,9 +41,7 @@
|
|||
font-family: "Wood Stamp";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src:
|
||||
local("Wood Stamp"),
|
||||
url("../fonts/Woodstamp/Woodstamp.woff") format("woff");
|
||||
src: local("Wood Stamp"), url("../fonts/Woodstamp/Woodstamp.woff") format("woff");
|
||||
}
|
||||
|
||||
:root {
|
||||
|
|
|
@ -62,7 +62,9 @@ describe("evaluateCheck with a single die", () => {
|
|||
|
||||
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++) {
|
||||
expect(evaluateCheck([i], 0)).toEqual([{ result: i, checkTargetNumber: 0, active: false, discarded: true }]);
|
||||
expect(evaluateCheck([i], 0)).toEqual([
|
||||
{ result: i, checkTargetNumber: 0, active: false, discarded: true },
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -80,7 +82,9 @@ describe("evaluateCheck with a single die", () => {
|
|||
|
||||
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++) {
|
||||
expect(evaluateCheck([i], -1)).toEqual([{ result: i, checkTargetNumber: -1, active: false, discarded: true }]);
|
||||
expect(evaluateCheck([i], -1)).toEqual([
|
||||
{ result: i, checkTargetNumber: -1, active: false, discarded: true },
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -150,7 +150,9 @@ function buildCombinedTestCases(): CombinedTestCase[] {
|
|||
for (const sorcererTestCase of testCases.sorcerer.filter(isRelevantPermutationTestCase)) {
|
||||
for (const wizardTestCase of testCases.wizard.filter(isRelevantPermutationTestCase)) {
|
||||
const expected =
|
||||
healerTestCase.expected !== null || sorcererTestCase.expected !== null || wizardTestCase.expected !== null
|
||||
healerTestCase.expected !== null ||
|
||||
sorcererTestCase.expected !== null ||
|
||||
wizardTestCase.expected !== null
|
||||
? Math.min(
|
||||
healerTestCase.expected ?? Infinity,
|
||||
sorcererTestCase.expected ?? Infinity,
|
||||
|
|
|
@ -87,7 +87,8 @@ describe("Validator", () => {
|
|||
|
||||
it("allows a complicated valid expression", () => {
|
||||
// given
|
||||
const predicate = (identifier: string) => [...safeOperators, ...literals, "floor", "random"].includes(identifier);
|
||||
const predicate = (identifier: string) =>
|
||||
[...safeOperators, ...literals, "floor", "random"].includes(identifier);
|
||||
const validator = new Validator(predicate);
|
||||
const input = "typeof (floor(random() * 5) / 2) === 'number' ? 42 : 'foo'";
|
||||
|
||||
|
|
|
@ -74,7 +74,11 @@ export class DS4ActorSheet extends ActorSheet {
|
|||
* @protected
|
||||
*/
|
||||
addTooltipsToData(context) {
|
||||
const valueGroups = [context.data.system.attributes, context.data.system.traits, context.data.system.combatValues];
|
||||
const valueGroups = [
|
||||
context.data.system.attributes,
|
||||
context.data.system.traits,
|
||||
context.data.system.combatValues,
|
||||
];
|
||||
|
||||
valueGroups.forEach((valueGroup) => {
|
||||
Object.values(valueGroup).forEach((attribute) => {
|
||||
|
@ -345,7 +349,9 @@ export class DS4ActorSheet extends ActorSheet {
|
|||
return value;
|
||||
}
|
||||
default: {
|
||||
throw new TypeError("Binding of item property to this type of HTML element not supported; given: " + element);
|
||||
throw new TypeError(
|
||||
"Binding of item property to this type of HTML element not supported; given: " + element,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -457,6 +463,27 @@ export class DS4ActorSheet extends ActorSheet {
|
|||
|
||||
this.actor.updateEmbeddedDocuments("Item", updates);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {DragEvent} event
|
||||
* @param {object} data
|
||||
* @override
|
||||
*/
|
||||
async _onDropItem(event, data) {
|
||||
const item = await Item.implementation.fromDropData(data);
|
||||
if (item && !this.actor.canOwnItemType(item.type)) {
|
||||
notifications.warn(
|
||||
getGame().i18n.format("DS4.WarningActorCannotOwnItem", {
|
||||
actorName: this.actor.name,
|
||||
actorType: this.actor.type,
|
||||
itemName: item.name,
|
||||
itemType: item.type,
|
||||
}),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return super._onDropItem(event, data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,9 +17,10 @@ export class DS4CreatureActorSheet extends DS4ActorSheet {
|
|||
/** @override */
|
||||
async getData(options = {}) {
|
||||
const context = await super.getData(options);
|
||||
context.data.system.baseInfo.description = await TextEditor.enrichHTML(context.data.system.baseInfo.description, {
|
||||
async: true,
|
||||
});
|
||||
context.data.system.baseInfo.description = await TextEditor.enrichHTML(
|
||||
context.data.system.baseInfo.description,
|
||||
{ async: true },
|
||||
);
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,8 @@ function findIndexOfSmallestNonCoup(dice: number[], maximumCoupResult: number):
|
|||
.map((die, index): [number, number] => [die, index])
|
||||
.filter((indexedDie) => indexedDie[0] > maximumCoupResult)
|
||||
.reduce(
|
||||
(smallestIndexedDie, indexedDie) => (indexedDie[0] < smallestIndexedDie[0] ? indexedDie : smallestIndexedDie),
|
||||
(smallestIndexedDie, indexedDie) =>
|
||||
indexedDie[0] < smallestIndexedDie[0] ? indexedDie : smallestIndexedDie,
|
||||
[Infinity, -1],
|
||||
)[1];
|
||||
}
|
||||
|
|
|
@ -59,7 +59,9 @@ class CheckFactory {
|
|||
* Execute this check factory.
|
||||
* @returns {Promise<ChatMessage | undefined>} A promise that resolves to the created chat message for the roll */
|
||||
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 roll = Roll.create(formula);
|
||||
const speaker = this.#options.speaker ?? ChatMessage.getSpeaker();
|
||||
|
@ -207,9 +209,14 @@ async function askForInteractiveRollData(checkTargetNumber, options = {}, { temp
|
|||
},
|
||||
{
|
||||
activateAdditionalListeners: (html, app) => {
|
||||
const checkModifierCustomFormGroup = html.find(`#check-modifier-custom-${id}`).parent(".form-group");
|
||||
const checkModifierCustomFormGroup = html
|
||||
.find(`#check-modifier-custom-${id}`)
|
||||
.parent(".form-group");
|
||||
html.find(`#check-modifier-${id}`).on("change", (event) => {
|
||||
if (event.currentTarget.value === "custom" && checkModifierCustomFormGroup.hasClass("ds4-hidden")) {
|
||||
if (
|
||||
event.currentTarget.value === "custom" &&
|
||||
checkModifierCustomFormGroup.hasClass("ds4-hidden")
|
||||
) {
|
||||
checkModifierCustomFormGroup.removeClass("ds4-hidden");
|
||||
app.setPosition({ height: "auto" });
|
||||
} else if (!checkModifierCustomFormGroup.hasClass("ds4-hidden")) {
|
||||
|
|
|
@ -32,7 +32,9 @@ export function isTrait(value: unknown): value is Trait {
|
|||
}
|
||||
|
||||
type DS4ActorDataSourceDataCombatValues = {
|
||||
[Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints" ? ResourceData<number> : ModifiableData<number>;
|
||||
[Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints"
|
||||
? ResourceData<number>
|
||||
: ModifiableData<number>;
|
||||
};
|
||||
|
||||
type CombatValue = keyof DS4ActorDataSourceDataCombatValues;
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
|
||||
import { DS4 } from "../../config";
|
||||
import { createCheckRoll } from "../../dice/check-factory";
|
||||
import { Evaluator } from "../../expression-evaluation/evaluator";
|
||||
import { Validator } from "../../expression-evaluation/validator";
|
||||
import { mathEvaluator } from "../../expression-evaluation/evaluator";
|
||||
import { logger } from "../../utils/logger";
|
||||
import { getGame } from "../../utils/utils";
|
||||
import { DS4ActiveEffect } from "../active-effect";
|
||||
|
@ -40,7 +39,9 @@ export class DS4Actor extends Actor {
|
|||
maximumCoupResult: 1,
|
||||
};
|
||||
|
||||
Object.values(this.system.attributes).forEach((attribute) => (attribute.total = attribute.base + attribute.mod));
|
||||
Object.values(this.system.attributes).forEach(
|
||||
(attribute) => (attribute.total = attribute.base + attribute.mod),
|
||||
);
|
||||
|
||||
Object.values(this.system.traits).forEach((trait) => (trait.total = trait.base + trait.mod));
|
||||
}
|
||||
|
@ -60,7 +61,7 @@ export class DS4Actor extends Actor {
|
|||
}
|
||||
|
||||
/**
|
||||
* The effects that should be applied to this actor.
|
||||
* The effects that should be applioed to this actor.
|
||||
* @type {import("../active-effect").DS4ActiveEffect[]}
|
||||
* @protected
|
||||
*/
|
||||
|
@ -91,7 +92,7 @@ export class DS4Actor extends Actor {
|
|||
if (condition !== undefined && condition !== "") {
|
||||
try {
|
||||
const replacedCondition = DS4Actor.replaceFormulaData(condition, { item, actor: this, effect });
|
||||
return replacedCondition !== undefined ? Boolean(DS4Actor.evaluator.evaluate(replacedCondition)) : false;
|
||||
return replacedCondition !== undefined ? Boolean(mathEvaluator.evaluate(replacedCondition)) : false;
|
||||
} catch (error) {
|
||||
logger.warn(error);
|
||||
return false;
|
||||
|
@ -183,7 +184,8 @@ export class DS4Actor extends Actor {
|
|||
this,
|
||||
this.actorEffects,
|
||||
(change) =>
|
||||
!this.derivedDataProperties.includes(change.key) && !this.finalDerivedDataProperties.includes(change.key),
|
||||
!this.derivedDataProperties.includes(change.key) &&
|
||||
!this.finalDerivedDataProperties.includes(change.key),
|
||||
).forEach(this.newStatuses.add.bind(this.newStatuses));
|
||||
}
|
||||
|
||||
|
@ -358,7 +360,8 @@ export class DS4Actor extends Actor {
|
|||
disableTraps: system.attributes.mind.total + system.traits.dexterity.total,
|
||||
featOfStrength: system.attributes.body.total + system.traits.strength.total,
|
||||
flirt: system.attributes.mind.total + system.traits.aura.total,
|
||||
haggle: system.attributes.mind.total + Math.max(system.traits.intellect.total, system.traits.intellect.total),
|
||||
haggle:
|
||||
system.attributes.mind.total + Math.max(system.traits.intellect.total, system.traits.intellect.total),
|
||||
hide: system.attributes.mobility.total + system.traits.agility.total,
|
||||
identifyMagic: system.attributes.mind.total + system.traits.intellect.total,
|
||||
jump: system.attributes.mobility.total + system.traits.agility.total,
|
||||
|
@ -521,12 +524,6 @@ export class DS4Actor extends Actor {
|
|||
rejectClose: false,
|
||||
});
|
||||
}
|
||||
|
||||
static evaluator = new Evaluator({
|
||||
context: Math,
|
||||
predicate: (identifier) =>
|
||||
Validator.defaultPredicate(identifier) || ["includes", "toLowerCase", "toUpperCase"].includes(identifier),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -49,7 +49,8 @@ export class DS4Spell extends DS4Item {
|
|||
const spellType = this.system.spellType;
|
||||
const opponentDefense = this.system.opponentDefense;
|
||||
const checkTargetNumber =
|
||||
ownerSystemData.combatValues[spellType].total + (hasComplexModifier ? 0 : this.system.spellModifier.numerical);
|
||||
ownerSystemData.combatValues[spellType].total +
|
||||
(hasComplexModifier ? 0 : this.system.spellModifier.numerical);
|
||||
const speaker = ChatMessage.getSpeaker({ actor: this.actor, ...options.speaker });
|
||||
const flavor =
|
||||
opponentDefense !== undefined && opponentDefense !== 0
|
||||
|
|
|
@ -19,7 +19,7 @@ export class Evaluator<Context extends object> {
|
|||
get: (t, k) => (k === Symbol.unscopables ? undefined : t[k as keyof typeof t]),
|
||||
});
|
||||
actualPredicate = (identifier: string) =>
|
||||
predicate(identifier) || Object.getOwnPropertyNames(context).includes(identifier);
|
||||
predicate(identifier) || Object.getOwnPropertyNames(Math).includes(identifier);
|
||||
}
|
||||
this.validator = new Validator(actualPredicate);
|
||||
}
|
||||
|
|
|
@ -207,7 +207,10 @@ export class Lexer {
|
|||
only0s = endPos === pos ? true : only0s;
|
||||
}
|
||||
|
||||
if (this.input[endPos] === "_" && (this.input[endPos - 1] === "_" || this.input[endPos - 1] === "." || only0s)) {
|
||||
if (
|
||||
this.input[endPos] === "_" &&
|
||||
(this.input[endPos - 1] === "_" || this.input[endPos - 1] === "." || only0s)
|
||||
) {
|
||||
return [{ type: "invalid", pos }, pos];
|
||||
}
|
||||
|
||||
|
|
|
@ -4,14 +4,12 @@
|
|||
|
||||
import { registerForHotbarDropHook } from "./hotbar-drop";
|
||||
import { registerForInitHook } from "./init";
|
||||
import { registerForPreCreateItemHook } from "./pre-create-item";
|
||||
import { registerForReadyHook } from "./ready";
|
||||
import { registerForRenderHooks } from "./render";
|
||||
import { registerForSetupHook } from "./setup";
|
||||
|
||||
export function registerForHooks(): void {
|
||||
registerForHotbarDropHook();
|
||||
registerForPreCreateItemHook();
|
||||
registerForInitHook();
|
||||
registerForReadyHook();
|
||||
registerForRenderHooks();
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 Johannes Loher
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { notifications } from "../ui/notifications.js";
|
||||
import { getGame } from "../utils/utils.js";
|
||||
|
||||
export function registerForPreCreateItemHook() {
|
||||
Hooks.on("preCreateItem", preCreateItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('../documents/item/item.js').DS4Item} item
|
||||
* @returns {void | false}
|
||||
*/
|
||||
function preCreateItem(item) {
|
||||
if (item.parent instanceof Actor && !item.parent.canOwnItemType(item.type)) {
|
||||
notifications.warn(
|
||||
getGame().i18n.format("DS4.WarningActorCannotOwnItem", {
|
||||
actorName: item.actor.name,
|
||||
actorType: item.actor.type,
|
||||
itemName: item.name,
|
||||
itemType: item.type,
|
||||
}),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
36
system.json
36
system.json
|
@ -28,23 +28,36 @@
|
|||
"name": "Sascha Martens"
|
||||
}
|
||||
],
|
||||
"license": "https://git.f3l.de/dungeonslayers/ds4/raw/tag/1.21.1/LICENSE.md",
|
||||
"readme": "https://git.f3l.de/dungeonslayers/ds4/raw/tag/1.21.1/README.md",
|
||||
"url": "https://git.f3l.de/dungeonslayers/ds4",
|
||||
"license": "https://git.f3l.de/dungeonslayers/ds4/raw/tag/1.20.0-0/LICENSE.md",
|
||||
"readme": "https://git.f3l.de/dungeonslayers/ds4/raw/tag/1.20.0-0/README.md",
|
||||
"bugs": "https://git.f3l.de/dungeonslayers/ds4/issues",
|
||||
"changelog": "https://git.f3l.de/dungeonslayers/ds4/releases/tag/1.21.1",
|
||||
"version": "1.21.1",
|
||||
"changelog": "https://git.f3l.de/dungeonslayers/ds4/releases/tag/1.20.0-0",
|
||||
"version": "1.20.0-0",
|
||||
"flags": {
|
||||
"hotReload": {
|
||||
"extensions": ["css", "hbs", "json"],
|
||||
"paths": ["templates", "css", "lang"]
|
||||
"extensions": [
|
||||
"css",
|
||||
"hbs",
|
||||
"json"
|
||||
],
|
||||
"paths": [
|
||||
"templates",
|
||||
"css",
|
||||
"lang"
|
||||
]
|
||||
}
|
||||
},
|
||||
"compatibility": {
|
||||
"minimum": "11.305",
|
||||
"verified": "11"
|
||||
},
|
||||
"esmodules": ["ds4.js"],
|
||||
"styles": ["css/ds4.css"],
|
||||
"esmodules": [
|
||||
"ds4.js"
|
||||
],
|
||||
"styles": [
|
||||
"css/ds4.css"
|
||||
],
|
||||
"languages": [
|
||||
{
|
||||
"lang": "en",
|
||||
|
@ -115,12 +128,11 @@
|
|||
"type": "Item"
|
||||
}
|
||||
],
|
||||
"manifest": "https://git.f3l.de/api/packages/dungeonslayers/generic/ds4/latest/system.json",
|
||||
"download": "https://git.f3l.de/dungeonslayers/ds4/releases/download/1.21.1/ds4.zip",
|
||||
"manifest": "https://git.f3l.de/api/packages/dungeonslayers/generic/ds4/beta/system.json",
|
||||
"download": "https://git.f3l.de/dungeonslayers/ds4/releases/download/1.20.0-0/ds4.zip",
|
||||
"initiative": "@combatValues.initiative.total",
|
||||
"gridDistance": 1,
|
||||
"gridUnits": "m",
|
||||
"primaryTokenAttribute": "combatValues.hitPoints",
|
||||
"manifestPlusVersion": "1.2.0",
|
||||
"url": "https://git.f3l.de/dungeonslayers/ds4"
|
||||
"manifestPlusVersion": "1.2.0"
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ SPDX-License-Identifier: MIT
|
|||
!-- Render an effect list entry row.
|
||||
!-- @param effectData: The data of the item.
|
||||
--}}
|
||||
<li class="ds4-embedded-document-list__row effect" data-effect-uuid="{{effectData.uuid}}" data-effect-id="{{effectData.id}}">
|
||||
<li class="ds4-embedded-document-list__row effect" data-effect-uuid="{{effectData.uuid}}">
|
||||
{{!-- enabled --}}
|
||||
<input class="ds4-embedded-document-list__editable ds4-embedded-document-list__editable--checkbox change-effect"
|
||||
type="checkbox" {{checked (ne effectData.disabled true)}} data-dtype="Boolean" data-property="disabled"
|
||||
|
|
|
@ -15,7 +15,7 @@ SPDX-License-Identifier: MIT
|
|||
!-- @param hideDescription: A flag to disable the description column.
|
||||
!-- @param @partial-block: Custom column headers can be passed using the partial block.
|
||||
--}}
|
||||
<li class="ds4-embedded-document-list__row item" data-item-uuid="{{item.uuid}}" data-item-id="{{item.id}}">
|
||||
<li class="ds4-embedded-document-list__row item" data-item-uuid="{{item.uuid}}">
|
||||
{{!-- equipped --}}
|
||||
{{#if isEquipable}}
|
||||
<input class="ds4-embedded-document-list__editable ds4-embedded-document-list__editable--checkbox change-item"
|
||||
|
|
|
@ -10,7 +10,7 @@ import { hideBin } from "yargs/helpers";
|
|||
const packageType = "system";
|
||||
const repositoryOwner = process.env.CI_REPO_OWNER;
|
||||
const repositoryName = process.env.CI_REPO_NAME;
|
||||
const repositoryURL = process.env.CI_REPO_URL;
|
||||
const repositoryURL = process.env.CI_REPO_LINK;
|
||||
const forgeURL = process.env.CI_FORGE_URL;
|
||||
|
||||
const getManifestUrl = (channel) =>
|
||||
|
@ -81,7 +81,7 @@ function bumpVersion(release) {
|
|||
|
||||
console.log(`Bumping version number to '${targetVersion}'`);
|
||||
packageJson.version = targetVersion;
|
||||
fs.writeJSONSync("package.json", packageJson, { spaces: 2 });
|
||||
fs.writeJSONSync("package.json", packageJson, { spaces: 4 });
|
||||
manifest.version = targetVersion;
|
||||
manifest.url = repositoryURL;
|
||||
manifest.manifest = getManifestUrl(getChannel(targetVersion));
|
||||
|
@ -90,7 +90,7 @@ function bumpVersion(release) {
|
|||
manifest.changelog = getChangelogURL(targetVersion);
|
||||
manifest.readme = getReadmeURL(targetVersion);
|
||||
manifest.license = getLicenseURL(targetVersion);
|
||||
fs.writeJSONSync(manifestPath, manifest, { spaces: 2 });
|
||||
fs.writeJSONSync(manifestPath, manifest, { spaces: 4 });
|
||||
}
|
||||
|
||||
const argv = yargs(hideBin(process.argv)).usage("Usage: $0").option("release", {
|
||||
|
|
Loading…
Reference in a new issue