fix: use correct tick value for combatants joining later #4
5 changed files with 100 additions and 103 deletions
|
@ -20,12 +20,8 @@
|
|||
"minimum": "10.290",
|
||||
"verified": "10"
|
||||
},
|
||||
"esmodules": [
|
||||
"tickwerk.js"
|
||||
],
|
||||
"styles": [
|
||||
"styles/tickwerk.css"
|
||||
],
|
||||
"esmodules": ["tickwerk.js"],
|
||||
"styles": ["styles/tickwerk.css"],
|
||||
"languages": [
|
||||
{
|
||||
"lang": "en",
|
||||
|
|
|
@ -42,7 +42,7 @@ const CombatantMixin = (BaseCombatant) => {
|
|||
*/
|
||||
toggleWaiting() {
|
||||
const update = { [`flags.${packageId}.waiting`]: !this.waiting };
|
||||
if (this.parent?.started && this.waiting) update.initiative = this.parent?.round;
|
||||
if (this.parent?.started && this.waiting) update.initiative = this.parent?.tickValue;
|
||||
return this.update(update);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,8 @@ const CombatantMixin = (BaseCombatant) => {
|
|||
}
|
||||
|
||||
await this.update({ initiative: this.initiative + ticks });
|
||||
const advanceTime = ticks * CONFIG.time.roundTime;
|
||||
const tickTime = CONFIG.tickwerk?.tickTime;
|
||||
const advanceTime = tickTime !== undefined ? ticks * tickTime : undefined;
|
||||
if (advanceTime !== 0) {
|
||||
await this.combat?.update(undefined, { diff: false, advanceTime });
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import { getGame } from '../helpers';
|
|||
|
||||
export const registerDS4SpecificFunctionality = () => {
|
||||
if (CONFIG.tickwerk === undefined) CONFIG.tickwerk = {};
|
||||
foundry.utils.mergeObject(CONFIG.tickwerk, { getTiebreaker, getInitiativeFormula });
|
||||
foundry.utils.mergeObject(CONFIG.tickwerk, { getTiebreaker, getInitiativeFormula, tickTime: 0.5 });
|
||||
|
||||
registerRollItemSetting();
|
||||
Hooks.on('ds4.rollItem', onRollItem);
|
||||
|
@ -71,7 +71,7 @@ const getTiebreaker = async (combatant, combatants) => {
|
|||
const getInitiativeFormula = (combatant) => {
|
||||
const started = combatant.combat?.started ?? false;
|
||||
if (!started) return '-@combatValues.initiative.total';
|
||||
const tickValue = combatant.combat?.round ?? 0;
|
||||
const tickValue = combatant.combat?.tickValue ?? 0;
|
||||
return `max(${tickValue} + 10 - @combatValues.initiative.total, ${tickValue})`;
|
||||
};
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ function bumpVersion(release) {
|
|||
|
||||
console.log(`Bumping version number to '${targetVersion}'`);
|
||||
packageJson.version = targetVersion;
|
||||
fs.writeJSONSync('package.json', packageJson, { spaces: 4 });
|
||||
fs.writeJSONSync('package.json', packageJson, { spaces: 2 });
|
||||
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: 4 });
|
||||
fs.writeJSONSync(manifestPath, manifest, { spaces: 2 });
|
||||
}
|
||||
|
||||
const argv = yargs(hideBin(process.argv)).usage('Usage: $0').option('release', {
|
||||
|
|
Loading…
Reference in a new issue