Compare commits

...

7 commits

Author SHA1 Message Date
8f7236a835 chore(deps): update dependency semver to v7.5.4
All checks were successful
ci/woodpecker/pr/checks Pipeline was successful
2023-07-10 01:02:34 +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 217 additions and 188 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": {
@ -51,8 +51,8 @@
"rollup-plugin-styles": "4.0.0", "rollup-plugin-styles": "4.0.0",
"rollup-plugin-swc3": "0.8.2", "rollup-plugin-swc3": "0.8.2",
"sass": "1.62.1", "sass": "1.62.1",
"semver": "7.5.1", "semver": "7.5.4",
"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

@ -4841,14 +4841,14 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"semver@npm:7.5.1, semver@npm:^7.3.4, semver@npm:^7.3.5": "semver@npm:7.5.4":
version: 7.5.1 version: 7.5.4
resolution: "semver@npm:7.5.1" resolution: "semver@npm:7.5.4"
dependencies: dependencies:
lru-cache: ^6.0.0 lru-cache: ^6.0.0
bin: bin:
semver: bin/semver.js semver: bin/semver.js
checksum: d16dbedad53c65b086f79524b9ef766bf38670b2395bdad5c957f824dcc566b624988013564f4812bcace3f9d405355c3635e2007396a39d1bffc71cfec4a2fc checksum: 12d8ad952fa353b0995bf180cdac205a4068b759a140e5d3c608317098b3575ac2f1e09182206bf2eb26120e1c0ed8fb92c48c592f6099680de56bb071423ca3
languageName: node languageName: node
linkType: hard linkType: hard
@ -4861,6 +4861,17 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"semver@npm:^7.3.4, semver@npm:^7.3.5":
version: 7.5.1
resolution: "semver@npm:7.5.1"
dependencies:
lru-cache: ^6.0.0
bin:
semver: bin/semver.js
checksum: d16dbedad53c65b086f79524b9ef766bf38670b2395bdad5c957f824dcc566b624988013564f4812bcace3f9d405355c3635e2007396a39d1bffc71cfec4a2fc
languageName: node
linkType: hard
"set-blocking@npm:^2.0.0": "set-blocking@npm:^2.0.0":
version: 2.0.0 version: 2.0.0
resolution: "set-blocking@npm:2.0.0" resolution: "set-blocking@npm:2.0.0"
@ -5341,7 +5352,7 @@ __metadata:
rollup-plugin-styles: 4.0.0 rollup-plugin-styles: 4.0.0
rollup-plugin-swc3: 0.8.2 rollup-plugin-swc3: 0.8.2
sass: 1.62.1 sass: 1.62.1
semver: 7.5.1 semver: 7.5.4
yargs: 17.7.2 yargs: 17.7.2
languageName: unknown languageName: unknown
linkType: soft linkType: soft