Compare commits
7 commits
e5d9b25566
...
81600fd52d
Author | SHA1 | Date | |
---|---|---|---|
81600fd52d | |||
|
65096d11b8 | ||
3d00caa31f | |||
5d8e34ce5f | |||
|
dbac03fbad | ||
95a595773d | |||
753b934534 |
12 changed files with 246 additions and 228 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -4,5 +4,5 @@
|
|||
"**/.pnp.*": true
|
||||
},
|
||||
"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
2
.yarn/sdks/eslint/package.json
vendored
2
.yarn/sdks/eslint/package.json
vendored
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "eslint",
|
||||
"version": "8.28.0-sdk",
|
||||
"version": "8.42.0-sdk",
|
||||
"main": "./lib/api.js",
|
||||
"type": "commonjs"
|
||||
}
|
||||
|
|
6
.yarn/sdks/prettier/index.js
vendored
6
.yarn/sdks/prettier/index.js
vendored
|
@ -11,10 +11,10 @@ const absRequire = createRequire(absPnpApiPath);
|
|||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
// Defer to the real prettier/index.js your application uses
|
||||
module.exports = absRequire(`prettier/index.js`);
|
||||
// Defer to the real prettier your application uses
|
||||
module.exports = absRequire(`prettier`);
|
||||
|
|
2
.yarn/sdks/prettier/package.json
vendored
2
.yarn/sdks/prettier/package.json
vendored
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "prettier",
|
||||
"version": "2.8.0-sdk",
|
||||
"version": "2.8.8-sdk",
|
||||
"main": "./index.js",
|
||||
"type": "commonjs"
|
||||
}
|
||||
|
|
|
@ -2,6 +2,6 @@ nodeLinker: pnp
|
|||
|
||||
plugins:
|
||||
- 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
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "es2022",
|
||||
"target": "ES2022"
|
||||
"target": "ES2022",
|
||||
"strict": true
|
||||
},
|
||||
"exclude": ["node_modules", "dist"],
|
||||
"include": ["src", "client", "common"]
|
||||
|
|
26
module.json
26
module.json
|
@ -11,14 +11,28 @@
|
|||
}
|
||||
],
|
||||
"url": "https://git.f3l.de/dungeonslayers/tickwerk",
|
||||
"license": "https://git.f3l.de/dungeonslayers/tickwerk/raw/tag/1.3.3/LICENSE.md",
|
||||
"readme": "https://git.f3l.de/dungeonslayers/tickwerk/raw/tag/1.3.3/README.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.4.0/README.md",
|
||||
"bugs": "https://git.f3l.de/dungeonslayers/tickwerk/issues",
|
||||
"changelog": "https://git.f3l.de/dungeonslayers/tickwerk/releases/tag/1.3.3",
|
||||
"version": "1.3.3",
|
||||
"changelog": "https://git.f3l.de/dungeonslayers/tickwerk/releases/tag/1.4.0",
|
||||
"version": "1.4.0",
|
||||
"flags": {
|
||||
"hotReload": {
|
||||
"extensions": [
|
||||
"css",
|
||||
"hbs",
|
||||
"json"
|
||||
],
|
||||
"paths": [
|
||||
"templates",
|
||||
"styles",
|
||||
"lang"
|
||||
]
|
||||
}
|
||||
},
|
||||
"compatibility": {
|
||||
"minimum": "10.290",
|
||||
"verified": "10"
|
||||
"verified": "11"
|
||||
},
|
||||
"esmodules": [
|
||||
"tickwerk.js"
|
||||
|
@ -39,6 +53,6 @@
|
|||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"private": true,
|
||||
"name": "tickwerk",
|
||||
"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",
|
||||
"homepage": "https://git.f3l.de/dungeonslayers/tickwerk",
|
||||
"repository": {
|
||||
|
@ -37,7 +37,7 @@
|
|||
"@commitlint/cli": "17.6.5",
|
||||
"@commitlint/config-conventional": "17.6.5",
|
||||
"@guanghechen/rollup-plugin-copy": "5.0.1",
|
||||
"@swc/core": "1.3.62",
|
||||
"@swc/core": "1.3.68",
|
||||
"conventional-changelog-cli": "2.2.2",
|
||||
"conventional-changelog-conventionalcommits": "5.0.0",
|
||||
"eslint": "8.42.0",
|
||||
|
@ -54,5 +54,5 @@
|
|||
"semver": "7.5.1",
|
||||
"yargs": "17.7.2"
|
||||
},
|
||||
"packageManager": "yarn@3.6.0"
|
||||
"packageManager": "yarn@3.6.1"
|
||||
}
|
||||
|
|
|
@ -112,14 +112,16 @@ const CombatantMixin = (BaseCombatant) => {
|
|||
* @param {object} data The data of the creation / update
|
||||
*/
|
||||
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 =
|
||||
this.parent?.combatants.filter((combatant) => {
|
||||
const otherInitiative =
|
||||
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);
|
||||
this._newInitiative = data.initiative;
|
||||
this._newTiebreaker = tiebreaker;
|
||||
|
@ -129,11 +131,12 @@ const CombatantMixin = (BaseCombatant) => {
|
|||
/**
|
||||
* Get a tiebreaker between this combatant and the given other combatants.
|
||||
* @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
|
||||
*/
|
||||
async #getTiebreaker(combatants) {
|
||||
async #getTiebreaker(combatants, waiting) {
|
||||
const getTiebreaker = CONFIG.tickwerk?.getTiebreaker ?? defaultGetTiebreaker;
|
||||
return getTiebreaker(this, combatants);
|
||||
return getTiebreaker(this, combatants, waiting);
|
||||
}
|
||||
|
||||
/** @override */
|
||||
|
@ -179,14 +182,14 @@ const CombatantMixin = (BaseCombatant) => {
|
|||
|
||||
/**
|
||||
* 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.
|
||||
* @type {GetTiebreaker}
|
||||
*/
|
||||
const defaultGetTiebreaker = async (combatant, combatants) => {
|
||||
export const defaultGetTiebreaker = async (combatant, combatants) => {
|
||||
if (combatants.length === 0) return 0;
|
||||
const tiebreakers = combatants.map((combatant) => {
|
||||
return (
|
||||
|
|
|
@ -14,7 +14,7 @@ export const registerDS4SpecificFunctionality = () => {
|
|||
};
|
||||
|
||||
/** @type {import("../data/documents/combatant").GetTiebreaker} */
|
||||
const getTiebreaker = async (combatant, combatants) => {
|
||||
const getTiebreaker = async (combatant, combatants, waiting) => {
|
||||
if (combatants.length === 0) return 0;
|
||||
|
||||
/** @type {number[]} */
|
||||
|
@ -26,7 +26,7 @@ const getTiebreaker = async (combatant, combatants) => {
|
|||
|
||||
for (const other of combatants) {
|
||||
const tiebreaker = other._newTiebreaker ?? other.getFlag(packageId, 'tiebreaker') ?? 0;
|
||||
if (getInitiative(other) > getInitiative(combatant)) {
|
||||
if (getInitiative(other) > getInitiative(combatant) || waiting === false) {
|
||||
lowerBounds.push(tiebreaker);
|
||||
} else if (getInitiative(other) < getInitiative(combatant)) {
|
||||
upperBounds.push(tiebreaker);
|
||||
|
|
90
yarn.lock
90
yarn.lock
|
@ -476,90 +476,90 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@swc/core-darwin-arm64@npm:1.3.62":
|
||||
version: 1.3.62
|
||||
resolution: "@swc/core-darwin-arm64@npm:1.3.62"
|
||||
"@swc/core-darwin-arm64@npm:1.3.68":
|
||||
version: 1.3.68
|
||||
resolution: "@swc/core-darwin-arm64@npm:1.3.68"
|
||||
conditions: os=darwin & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@swc/core-darwin-x64@npm:1.3.62":
|
||||
version: 1.3.62
|
||||
resolution: "@swc/core-darwin-x64@npm:1.3.62"
|
||||
"@swc/core-darwin-x64@npm:1.3.68":
|
||||
version: 1.3.68
|
||||
resolution: "@swc/core-darwin-x64@npm:1.3.68"
|
||||
conditions: os=darwin & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@swc/core-linux-arm-gnueabihf@npm:1.3.62":
|
||||
version: 1.3.62
|
||||
resolution: "@swc/core-linux-arm-gnueabihf@npm:1.3.62"
|
||||
"@swc/core-linux-arm-gnueabihf@npm:1.3.68":
|
||||
version: 1.3.68
|
||||
resolution: "@swc/core-linux-arm-gnueabihf@npm:1.3.68"
|
||||
conditions: os=linux & cpu=arm
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@swc/core-linux-arm64-gnu@npm:1.3.62":
|
||||
version: 1.3.62
|
||||
resolution: "@swc/core-linux-arm64-gnu@npm:1.3.62"
|
||||
"@swc/core-linux-arm64-gnu@npm:1.3.68":
|
||||
version: 1.3.68
|
||||
resolution: "@swc/core-linux-arm64-gnu@npm:1.3.68"
|
||||
conditions: os=linux & cpu=arm64 & libc=glibc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@swc/core-linux-arm64-musl@npm:1.3.62":
|
||||
version: 1.3.62
|
||||
resolution: "@swc/core-linux-arm64-musl@npm:1.3.62"
|
||||
"@swc/core-linux-arm64-musl@npm:1.3.68":
|
||||
version: 1.3.68
|
||||
resolution: "@swc/core-linux-arm64-musl@npm:1.3.68"
|
||||
conditions: os=linux & cpu=arm64 & libc=musl
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@swc/core-linux-x64-gnu@npm:1.3.62":
|
||||
version: 1.3.62
|
||||
resolution: "@swc/core-linux-x64-gnu@npm:1.3.62"
|
||||
"@swc/core-linux-x64-gnu@npm:1.3.68":
|
||||
version: 1.3.68
|
||||
resolution: "@swc/core-linux-x64-gnu@npm:1.3.68"
|
||||
conditions: os=linux & cpu=x64 & libc=glibc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@swc/core-linux-x64-musl@npm:1.3.62":
|
||||
version: 1.3.62
|
||||
resolution: "@swc/core-linux-x64-musl@npm:1.3.62"
|
||||
"@swc/core-linux-x64-musl@npm:1.3.68":
|
||||
version: 1.3.68
|
||||
resolution: "@swc/core-linux-x64-musl@npm:1.3.68"
|
||||
conditions: os=linux & cpu=x64 & libc=musl
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@swc/core-win32-arm64-msvc@npm:1.3.62":
|
||||
version: 1.3.62
|
||||
resolution: "@swc/core-win32-arm64-msvc@npm:1.3.62"
|
||||
"@swc/core-win32-arm64-msvc@npm:1.3.68":
|
||||
version: 1.3.68
|
||||
resolution: "@swc/core-win32-arm64-msvc@npm:1.3.68"
|
||||
conditions: os=win32 & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@swc/core-win32-ia32-msvc@npm:1.3.62":
|
||||
version: 1.3.62
|
||||
resolution: "@swc/core-win32-ia32-msvc@npm:1.3.62"
|
||||
"@swc/core-win32-ia32-msvc@npm:1.3.68":
|
||||
version: 1.3.68
|
||||
resolution: "@swc/core-win32-ia32-msvc@npm:1.3.68"
|
||||
conditions: os=win32 & cpu=ia32
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@swc/core-win32-x64-msvc@npm:1.3.62":
|
||||
version: 1.3.62
|
||||
resolution: "@swc/core-win32-x64-msvc@npm:1.3.62"
|
||||
"@swc/core-win32-x64-msvc@npm:1.3.68":
|
||||
version: 1.3.68
|
||||
resolution: "@swc/core-win32-x64-msvc@npm:1.3.68"
|
||||
conditions: os=win32 & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@swc/core@npm:1.3.62":
|
||||
version: 1.3.62
|
||||
resolution: "@swc/core@npm:1.3.62"
|
||||
"@swc/core@npm:1.3.68":
|
||||
version: 1.3.68
|
||||
resolution: "@swc/core@npm:1.3.68"
|
||||
dependencies:
|
||||
"@swc/core-darwin-arm64": 1.3.62
|
||||
"@swc/core-darwin-x64": 1.3.62
|
||||
"@swc/core-linux-arm-gnueabihf": 1.3.62
|
||||
"@swc/core-linux-arm64-gnu": 1.3.62
|
||||
"@swc/core-linux-arm64-musl": 1.3.62
|
||||
"@swc/core-linux-x64-gnu": 1.3.62
|
||||
"@swc/core-linux-x64-musl": 1.3.62
|
||||
"@swc/core-win32-arm64-msvc": 1.3.62
|
||||
"@swc/core-win32-ia32-msvc": 1.3.62
|
||||
"@swc/core-win32-x64-msvc": 1.3.62
|
||||
"@swc/core-darwin-arm64": 1.3.68
|
||||
"@swc/core-darwin-x64": 1.3.68
|
||||
"@swc/core-linux-arm-gnueabihf": 1.3.68
|
||||
"@swc/core-linux-arm64-gnu": 1.3.68
|
||||
"@swc/core-linux-arm64-musl": 1.3.68
|
||||
"@swc/core-linux-x64-gnu": 1.3.68
|
||||
"@swc/core-linux-x64-musl": 1.3.68
|
||||
"@swc/core-win32-arm64-msvc": 1.3.68
|
||||
"@swc/core-win32-ia32-msvc": 1.3.68
|
||||
"@swc/core-win32-x64-msvc": 1.3.68
|
||||
peerDependencies:
|
||||
"@swc/helpers": ^0.5.0
|
||||
dependenciesMeta:
|
||||
|
@ -586,7 +586,7 @@ __metadata:
|
|||
peerDependenciesMeta:
|
||||
"@swc/helpers":
|
||||
optional: true
|
||||
checksum: a7a0d9ffdb8a2b0050e0ff89fdb86fe189d9bcb7f91cb6847f1bfe3e2b520a87ea2e83692dfd80b6d541fb5addb2194769484516b8ca6d3c62ad80f1c79a9368
|
||||
checksum: f56ad1d4cb91f7cc1cb5d4b9894bbb528da0b2eabc98984581f5b3f3187cf2c0d512003880f6ff7a3f6d215b7a3dcbf5a9c45e8a428ac2d711941027c0151d89
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
@ -5327,7 +5327,7 @@ __metadata:
|
|||
"@commitlint/cli": 17.6.5
|
||||
"@commitlint/config-conventional": 17.6.5
|
||||
"@guanghechen/rollup-plugin-copy": 5.0.1
|
||||
"@swc/core": 1.3.62
|
||||
"@swc/core": 1.3.68
|
||||
conventional-changelog-cli: 2.2.2
|
||||
conventional-changelog-conventionalcommits: 5.0.0
|
||||
eslint: 8.42.0
|
||||
|
|
Loading…
Reference in a new issue