Compare commits

...

7 commits

Author SHA1 Message Date
3ed5e30bbb chore(deps): update dependency eslint to v8.44.0
All checks were successful
ci/woodpecker/pr/checks Pipeline was successful
2023-07-10 01:02:39 +00:00
woodpecker[bot]
65096d11b8 chore(release): 1.4.0
All checks were successful
ci/woodpecker/push/checks Pipeline was successful
ci/woodpecker/tag/checks Pipeline was successful
ci/woodpecker/tag/publish Pipeline was successful
2023-07-10 00:25:20 +00:00
3d00caa31f
chore: use correct styles path for hot reload
All checks were successful
ci/woodpecker/pr/checks Pipeline was successful
ci/woodpecker/push/checks Pipeline was successful
ci/woodpecker/manual/checks Pipeline was successful
ci/woodpecker/manual/release Pipeline was successful
2023-07-10 02:21:57 +02:00
5d8e34ce5f
chore: mark v11 compatibility 2023-07-10 02:20:57 +02:00
woodpecker[bot]
dbac03fbad chore(release): 1.3.4
All checks were successful
ci/woodpecker/tag/checks Pipeline was successful
ci/woodpecker/push/checks Pipeline was successful
ci/woodpecker/tag/publish Pipeline was successful
2023-07-10 00:20:23 +00:00
95a595773d
fix: correctly calculate tick value when stopping to wait
All checks were successful
ci/woodpecker/pr/checks Pipeline was successful
ci/woodpecker/push/checks Pipeline was successful
ci/woodpecker/manual/checks Pipeline was successful
ci/woodpecker/manual/release Pipeline was successful
2023-07-10 02:17:05 +02:00
753b934534
chore: update yarn and sdks 2023-07-10 01:24:08 +02:00
12 changed files with 246 additions and 219 deletions

View file

@ -4,5 +4,5 @@
"**/.pnp.*": true "**/.pnp.*": true
}, },
"eslint.nodePath": ".yarn/sdks", "eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.js", "prettier.prettierPath": ".yarn/sdks/prettier/index.js"
} }

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{ {
"name": "eslint", "name": "eslint",
"version": "8.28.0-sdk", "version": "8.42.0-sdk",
"main": "./lib/api.js", "main": "./lib/api.js",
"type": "commonjs" "type": "commonjs"
} }

View file

@ -11,10 +11,10 @@ const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) { if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) { if (!process.versions.pnp) {
// Setup the environment to be able to require prettier/index.js // Setup the environment to be able to require prettier
require(absPnpApiPath).setup(); require(absPnpApiPath).setup();
} }
} }
// Defer to the real prettier/index.js your application uses // Defer to the real prettier your application uses
module.exports = absRequire(`prettier/index.js`); module.exports = absRequire(`prettier`);

View file

@ -1,6 +1,6 @@
{ {
"name": "prettier", "name": "prettier",
"version": "2.8.0-sdk", "version": "2.8.8-sdk",
"main": "./index.js", "main": "./index.js",
"type": "commonjs" "type": "commonjs"
} }

View file

@ -2,6 +2,6 @@ nodeLinker: pnp
plugins: plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools' spec: "@yarnpkg/plugin-interactive-tools"
yarnPath: .yarn/releases/yarn-3.6.0.cjs yarnPath: .yarn/releases/yarn-3.6.1.cjs

View file

@ -1,7 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"module": "es2022", "module": "es2022",
"target": "ES2022" "target": "ES2022",
"strict": true
}, },
"exclude": ["node_modules", "dist"], "exclude": ["node_modules", "dist"],
"include": ["src", "client", "common"] "include": ["src", "client", "common"]

View file

@ -11,14 +11,28 @@
} }
], ],
"url": "https://git.f3l.de/dungeonslayers/tickwerk", "url": "https://git.f3l.de/dungeonslayers/tickwerk",
"license": "https://git.f3l.de/dungeonslayers/tickwerk/raw/tag/1.3.3/LICENSE.md", "license": "https://git.f3l.de/dungeonslayers/tickwerk/raw/tag/1.4.0/LICENSE.md",
"readme": "https://git.f3l.de/dungeonslayers/tickwerk/raw/tag/1.3.3/README.md", "readme": "https://git.f3l.de/dungeonslayers/tickwerk/raw/tag/1.4.0/README.md",
"bugs": "https://git.f3l.de/dungeonslayers/tickwerk/issues", "bugs": "https://git.f3l.de/dungeonslayers/tickwerk/issues",
"changelog": "https://git.f3l.de/dungeonslayers/tickwerk/releases/tag/1.3.3", "changelog": "https://git.f3l.de/dungeonslayers/tickwerk/releases/tag/1.4.0",
"version": "1.3.3", "version": "1.4.0",
"flags": {
"hotReload": {
"extensions": [
"css",
"hbs",
"json"
],
"paths": [
"templates",
"styles",
"lang"
]
}
},
"compatibility": { "compatibility": {
"minimum": "10.290", "minimum": "10.290",
"verified": "10" "verified": "11"
}, },
"esmodules": [ "esmodules": [
"tickwerk.js" "tickwerk.js"
@ -39,6 +53,6 @@
} }
], ],
"manifest": "https://git.f3l.de/api/packages/dungeonslayers/generic/tickwerk/latest/module.json", "manifest": "https://git.f3l.de/api/packages/dungeonslayers/generic/tickwerk/latest/module.json",
"download": "https://git.f3l.de/dungeonslayers/tickwerk/releases/download/1.3.3/tickwerk.zip", "download": "https://git.f3l.de/dungeonslayers/tickwerk/releases/download/1.4.0/tickwerk.zip",
"manifestPlusVersion": "1.2.0" "manifestPlusVersion": "1.2.0"
} }

View file

@ -2,7 +2,7 @@
"private": true, "private": true,
"name": "tickwerk", "name": "tickwerk",
"description": "A tick based combat system for Foundry Virtual Tabletop", "description": "A tick based combat system for Foundry Virtual Tabletop",
"version": "1.3.3", "version": "1.4.0",
"license": "https://git.f3l.de/dungeonslayers/tickwerk#licensing", "license": "https://git.f3l.de/dungeonslayers/tickwerk#licensing",
"homepage": "https://git.f3l.de/dungeonslayers/tickwerk", "homepage": "https://git.f3l.de/dungeonslayers/tickwerk",
"repository": { "repository": {
@ -40,7 +40,7 @@
"@swc/core": "1.3.62", "@swc/core": "1.3.62",
"conventional-changelog-cli": "2.2.2", "conventional-changelog-cli": "2.2.2",
"conventional-changelog-conventionalcommits": "5.0.0", "conventional-changelog-conventionalcommits": "5.0.0",
"eslint": "8.42.0", "eslint": "8.44.0",
"eslint-config-prettier": "8.8.0", "eslint-config-prettier": "8.8.0",
"eslint-plugin-prettier": "4.2.1", "eslint-plugin-prettier": "4.2.1",
"fs-extra": "11.1.1", "fs-extra": "11.1.1",
@ -54,5 +54,5 @@
"semver": "7.5.1", "semver": "7.5.1",
"yargs": "17.7.2" "yargs": "17.7.2"
}, },
"packageManager": "yarn@3.6.0" "packageManager": "yarn@3.6.1"
} }

View file

@ -112,14 +112,16 @@ const CombatantMixin = (BaseCombatant) => {
* @param {object} data The data of the creation / update * @param {object} data The data of the creation / update
*/ */
async #updateTiebreakerData(data) { async #updateTiebreakerData(data) {
if ('initiative' in data) { const waiting = data.flags?.[packageId]?.waiting;
if ('initiative' in data || waiting !== undefined) {
const newInitiative = data.initiative ?? this.initiative;
const combatantsWithSameTickValue = const combatantsWithSameTickValue =
this.parent?.combatants.filter((combatant) => { this.parent?.combatants.filter((combatant) => {
const otherInitiative = const otherInitiative =
combatant._newInitiative !== undefined ? combatant._newInitiative : combatant.initiative; combatant._newInitiative !== undefined ? combatant._newInitiative : combatant.initiative;
return otherInitiative === data.initiative; return otherInitiative === newInitiative && combatant !== this;
}) ?? []; }) ?? [];
const tiebreaker = await this.#getTiebreaker(combatantsWithSameTickValue); const tiebreaker = await this.#getTiebreaker(combatantsWithSameTickValue, waiting);
foundry.utils.setProperty(data, `flags.${packageId}.tiebreaker`, tiebreaker); foundry.utils.setProperty(data, `flags.${packageId}.tiebreaker`, tiebreaker);
this._newInitiative = data.initiative; this._newInitiative = data.initiative;
this._newTiebreaker = tiebreaker; this._newTiebreaker = tiebreaker;
@ -129,11 +131,12 @@ const CombatantMixin = (BaseCombatant) => {
/** /**
* Get a tiebreaker between this combatant and the given other combatants. * Get a tiebreaker between this combatant and the given other combatants.
* @param {TickwerkCombatant[]} combatants The other combatants among which to find a tiebreaker * @param {TickwerkCombatant[]} combatants The other combatants among which to find a tiebreaker
* @param {boolean | undefined} waiting The change of the waiting state of the combatanmt
* @returns {Promise<number>} A promise that resolves to the tiebreaker * @returns {Promise<number>} A promise that resolves to the tiebreaker
*/ */
async #getTiebreaker(combatants) { async #getTiebreaker(combatants, waiting) {
const getTiebreaker = CONFIG.tickwerk?.getTiebreaker ?? defaultGetTiebreaker; const getTiebreaker = CONFIG.tickwerk?.getTiebreaker ?? defaultGetTiebreaker;
return getTiebreaker(this, combatants); return getTiebreaker(this, combatants, waiting);
} }
/** @override */ /** @override */
@ -179,14 +182,14 @@ const CombatantMixin = (BaseCombatant) => {
/** /**
* A function to get a tiebreaker for a combatant * A function to get a tiebreaker for a combatant
* @typedef {(combatant: TickwerkCombatant, combatants: TickwerkCombatant[]) => Promise<number>} GetTiebreaker * @typedef {(combatant: TickwerkCombatant, combatants: TickwerkCombatant[], waiting: boolean | undefined) => Promise<number>} GetTiebreaker
*/ */
/** /**
* Default implementation to get a tiebreaker for a combatant. * Default implementation to get a tiebreaker for a combatant.
* @type {GetTiebreaker} * @type {GetTiebreaker}
*/ */
const defaultGetTiebreaker = async (combatant, combatants) => { export const defaultGetTiebreaker = async (combatant, combatants) => {
if (combatants.length === 0) return 0; if (combatants.length === 0) return 0;
const tiebreakers = combatants.map((combatant) => { const tiebreakers = combatants.map((combatant) => {
return ( return (

View file

@ -14,7 +14,7 @@ export const registerDS4SpecificFunctionality = () => {
}; };
/** @type {import("../data/documents/combatant").GetTiebreaker} */ /** @type {import("../data/documents/combatant").GetTiebreaker} */
const getTiebreaker = async (combatant, combatants) => { const getTiebreaker = async (combatant, combatants, waiting) => {
if (combatants.length === 0) return 0; if (combatants.length === 0) return 0;
/** @type {number[]} */ /** @type {number[]} */
@ -26,7 +26,7 @@ const getTiebreaker = async (combatant, combatants) => {
for (const other of combatants) { for (const other of combatants) {
const tiebreaker = other._newTiebreaker ?? other.getFlag(packageId, 'tiebreaker') ?? 0; const tiebreaker = other._newTiebreaker ?? other.getFlag(packageId, 'tiebreaker') ?? 0;
if (getInitiative(other) > getInitiative(combatant)) { if (getInitiative(other) > getInitiative(combatant) || waiting === false) {
lowerBounds.push(tiebreaker); lowerBounds.push(tiebreaker);
} else if (getInitiative(other) < getInitiative(combatant)) { } else if (getInitiative(other) < getInitiative(combatant)) {
upperBounds.push(tiebreaker); upperBounds.push(tiebreaker);

View file

@ -5,6 +5,13 @@ __metadata:
version: 6 version: 6
cacheKey: 8 cacheKey: 8
"@aashutoshrathi/word-wrap@npm:^1.2.3":
version: 1.2.6
resolution: "@aashutoshrathi/word-wrap@npm:1.2.6"
checksum: ada901b9e7c680d190f1d012c84217ce0063d8f5c5a7725bb91ec3c5ed99bb7572680eb2d2938a531ccbaec39a95422fcd8a6b4a13110c7d98dd75402f66a0cd
languageName: node
linkType: hard
"@babel/code-frame@npm:^7.0.0": "@babel/code-frame@npm:^7.0.0":
version: 7.21.4 version: 7.21.4
resolution: "@babel/code-frame@npm:7.21.4" resolution: "@babel/code-frame@npm:7.21.4"
@ -256,27 +263,27 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@eslint/eslintrc@npm:^2.0.3": "@eslint/eslintrc@npm:^2.1.0":
version: 2.0.3 version: 2.1.0
resolution: "@eslint/eslintrc@npm:2.0.3" resolution: "@eslint/eslintrc@npm:2.1.0"
dependencies: dependencies:
ajv: ^6.12.4 ajv: ^6.12.4
debug: ^4.3.2 debug: ^4.3.2
espree: ^9.5.2 espree: ^9.6.0
globals: ^13.19.0 globals: ^13.19.0
ignore: ^5.2.0 ignore: ^5.2.0
import-fresh: ^3.2.1 import-fresh: ^3.2.1
js-yaml: ^4.1.0 js-yaml: ^4.1.0
minimatch: ^3.1.2 minimatch: ^3.1.2
strip-json-comments: ^3.1.1 strip-json-comments: ^3.1.1
checksum: ddc51f25f8524d8231db9c9bf03177e503d941a332e8d5ce3b10b09241be4d5584a378a529a27a527586bfbccf3031ae539eb891352033c340b012b4d0c81d92 checksum: d5ed0adbe23f6571d8c9bb0ca6edf7618dc6aed4046aa56df7139f65ae7b578874e0d9c796df784c25bda648ceb754b6320277d828c8b004876d7443b8dc018c
languageName: node languageName: node
linkType: hard linkType: hard
"@eslint/js@npm:8.42.0": "@eslint/js@npm:8.44.0":
version: 8.42.0 version: 8.44.0
resolution: "@eslint/js@npm:8.42.0" resolution: "@eslint/js@npm:8.44.0"
checksum: 750558843ac458f7da666122083ee05306fc087ecc1e5b21e7e14e23885775af6c55bcc92283dff1862b7b0d8863ec676c0f18c7faf1219c722fe91a8ece56b6 checksum: fc539583226a28f5677356e9f00d2789c34253f076643d2e32888250e509a4e13aafe0880cb2425139051de0f3a48d25bfc5afa96b7304f203b706c17340e3cf
languageName: node languageName: node
linkType: hard linkType: hard
@ -704,7 +711,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"acorn@npm:^8.4.1, acorn@npm:^8.8.0": "acorn@npm:^8.4.1":
version: 8.8.2 version: 8.8.2
resolution: "acorn@npm:8.8.2" resolution: "acorn@npm:8.8.2"
bin: bin:
@ -713,6 +720,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"acorn@npm:^8.9.0":
version: 8.10.0
resolution: "acorn@npm:8.10.0"
bin:
acorn: bin/acorn
checksum: 538ba38af0cc9e5ef983aee196c4b8b4d87c0c94532334fa7e065b2c8a1f85863467bb774231aae91613fcda5e68740c15d97b1967ae3394d20faddddd8af61d
languageName: node
linkType: hard
"add-stream@npm:^1.0.0": "add-stream@npm:^1.0.0":
version: 1.0.0 version: 1.0.0
resolution: "add-stream@npm:1.0.0" resolution: "add-stream@npm:1.0.0"
@ -1935,14 +1951,14 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"eslint@npm:8.42.0": "eslint@npm:8.44.0":
version: 8.42.0 version: 8.44.0
resolution: "eslint@npm:8.42.0" resolution: "eslint@npm:8.44.0"
dependencies: dependencies:
"@eslint-community/eslint-utils": ^4.2.0 "@eslint-community/eslint-utils": ^4.2.0
"@eslint-community/regexpp": ^4.4.0 "@eslint-community/regexpp": ^4.4.0
"@eslint/eslintrc": ^2.0.3 "@eslint/eslintrc": ^2.1.0
"@eslint/js": 8.42.0 "@eslint/js": 8.44.0
"@humanwhocodes/config-array": ^0.11.10 "@humanwhocodes/config-array": ^0.11.10
"@humanwhocodes/module-importer": ^1.0.1 "@humanwhocodes/module-importer": ^1.0.1
"@nodelib/fs.walk": ^1.2.8 "@nodelib/fs.walk": ^1.2.8
@ -1954,7 +1970,7 @@ __metadata:
escape-string-regexp: ^4.0.0 escape-string-regexp: ^4.0.0
eslint-scope: ^7.2.0 eslint-scope: ^7.2.0
eslint-visitor-keys: ^3.4.1 eslint-visitor-keys: ^3.4.1
espree: ^9.5.2 espree: ^9.6.0
esquery: ^1.4.2 esquery: ^1.4.2
esutils: ^2.0.2 esutils: ^2.0.2
fast-deep-equal: ^3.1.3 fast-deep-equal: ^3.1.3
@ -1974,24 +1990,24 @@ __metadata:
lodash.merge: ^4.6.2 lodash.merge: ^4.6.2
minimatch: ^3.1.2 minimatch: ^3.1.2
natural-compare: ^1.4.0 natural-compare: ^1.4.0
optionator: ^0.9.1 optionator: ^0.9.3
strip-ansi: ^6.0.1 strip-ansi: ^6.0.1
strip-json-comments: ^3.1.0 strip-json-comments: ^3.1.0
text-table: ^0.2.0 text-table: ^0.2.0
bin: bin:
eslint: bin/eslint.js eslint: bin/eslint.js
checksum: 07105397b5f2ff4064b983b8971e8c379ec04b1dfcc9d918976b3e00377189000161dac991d82ba14f8759e466091b8c71146f602930ca810c290ee3fcb3faf0 checksum: d06309ce4aafb9d27d558c8e5e5aa5cba3bbec3ce8ceccbc7d4b7a35f2b67fd40189159155553270e2e6febeb69bd8a3b60d6241c8f5ddc2ef1702ccbd328501
languageName: node languageName: node
linkType: hard linkType: hard
"espree@npm:^9.5.2": "espree@npm:^9.6.0":
version: 9.5.2 version: 9.6.0
resolution: "espree@npm:9.5.2" resolution: "espree@npm:9.6.0"
dependencies: dependencies:
acorn: ^8.8.0 acorn: ^8.9.0
acorn-jsx: ^5.3.2 acorn-jsx: ^5.3.2
eslint-visitor-keys: ^3.4.1 eslint-visitor-keys: ^3.4.1
checksum: 6506289d6eb26471c0b383ee24fee5c8ae9d61ad540be956b3127be5ce3bf687d2ba6538ee5a86769812c7c552a9d8239e8c4d150f9ea056c6d5cbe8399c03c1 checksum: 1287979510efb052a6a97c73067ea5d0a40701b29adde87bbe2d3eb1667e39ca55e8129e20e2517fed3da570150e7ef470585228459a8f3e3755f45007a1c662
languageName: node languageName: node
linkType: hard linkType: hard
@ -3793,17 +3809,17 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"optionator@npm:^0.9.1": "optionator@npm:^0.9.3":
version: 0.9.1 version: 0.9.3
resolution: "optionator@npm:0.9.1" resolution: "optionator@npm:0.9.3"
dependencies: dependencies:
"@aashutoshrathi/word-wrap": ^1.2.3
deep-is: ^0.1.3 deep-is: ^0.1.3
fast-levenshtein: ^2.0.6 fast-levenshtein: ^2.0.6
levn: ^0.4.1 levn: ^0.4.1
prelude-ls: ^1.2.1 prelude-ls: ^1.2.1
type-check: ^0.4.0 type-check: ^0.4.0
word-wrap: ^1.2.3 checksum: 09281999441f2fe9c33a5eeab76700795365a061563d66b098923eb719251a42bdbe432790d35064d0816ead9296dbeb1ad51a733edf4167c96bd5d0882e428a
checksum: dbc6fa065604b24ea57d734261914e697bd73b69eff7f18e967e8912aa2a40a19a9f599a507fa805be6c13c24c4eae8c71306c239d517d42d4c041c942f508a0
languageName: node languageName: node
linkType: hard linkType: hard
@ -5330,7 +5346,7 @@ __metadata:
"@swc/core": 1.3.62 "@swc/core": 1.3.62
conventional-changelog-cli: 2.2.2 conventional-changelog-cli: 2.2.2
conventional-changelog-conventionalcommits: 5.0.0 conventional-changelog-conventionalcommits: 5.0.0
eslint: 8.42.0 eslint: 8.44.0
eslint-config-prettier: 8.8.0 eslint-config-prettier: 8.8.0
eslint-plugin-prettier: 4.2.1 eslint-plugin-prettier: 4.2.1
fs-extra: 11.1.1 fs-extra: 11.1.1
@ -5635,13 +5651,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"word-wrap@npm:^1.2.3":
version: 1.2.3
resolution: "word-wrap@npm:1.2.3"
checksum: 30b48f91fcf12106ed3186ae4fa86a6a1842416df425be7b60485de14bec665a54a68e4b5156647dec3a70f25e84d270ca8bc8cd23182ed095f5c7206a938c1f
languageName: node
linkType: hard
"wordwrap@npm:^1.0.0": "wordwrap@npm:^1.0.0":
version: 1.0.0 version: 1.0.0
resolution: "wordwrap@npm:1.0.0" resolution: "wordwrap@npm:1.0.0"