2.3.0 release #40

Merged
mike merged 9 commits from develop into main 2023-12-20 04:19:29 +00:00
30 changed files with 278 additions and 31 deletions
Showing only changes of commit 55a123759f - Show all commits

View File

@ -9,6 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Trait and Damage Roll hooks to look for and apply modifiers for target
conditions:
- Vulnerable
- Deflection
- Arcane Protection
- Arcane Resistance
- Scale
- Gang Up
- Resistences and Weaknesses
- New Macro: Set token vision - New Macro: Set token vision
- New Common Action: Illumination (for the darkness penalty effects) - New Common Action: Illumination (for the darkness penalty effects)
- New macro: Quick Damage Roll - New macro: Quick Damage Roll

View File

@ -1 +1 @@
MANIFEST-000002 MANIFEST-000014

View File

@ -1,5 +1,3 @@
2023/12/18-23:38:01.173251 7fb80df3c700 Delete type=3 #1 2023/12/19-22:11:46.585866 7f40dd7bc700 Recovering log #12
2023/12/18-23:38:01.175935 7fb80d481700 Level-0 table #5: started 2023/12/19-22:11:46.611108 7f40dd7bc700 Delete type=0 #12
2023/12/18-23:38:01.183313 7fb80d481700 Level-0 table #5: 12215 bytes OK 2023/12/19-22:11:46.611132 7f40dd7bc700 Delete type=3 #10
2023/12/18-23:38:01.192571 7fb80d481700 Delete type=0 #3
2023/12/18-23:38:01.192679 7fb80d481700 Manual compaction at level-0 from '!folders!0nDRFmMBs5DBJU9M' @ 72057594037927935 : 1 .. '!items.effects!RC1Nz6iph8wPPK1B.g9W5hJisq3MsCpZW' @ 0 : 0; will stop at (end)

View File

@ -0,0 +1,8 @@
2023/12/19-14:25:58.734016 7fb0acf3b700 Recovering log #8
2023/12/19-14:25:58.748444 7fb0acf3b700 Delete type=3 #6
2023/12/19-14:25:58.748474 7fb0acf3b700 Delete type=0 #8
2023/12/19-22:08:59.600432 7fb086400700 Level-0 table #13: started
2023/12/19-22:08:59.600452 7fb086400700 Level-0 table #13: 0 bytes OK
2023/12/19-22:08:59.612412 7fb086400700 Delete type=0 #11
2023/12/19-22:08:59.648733 7fb086400700 Manual compaction at level-0 from '!folders!0nDRFmMBs5DBJU9M' @ 72057594037927935 : 1 .. '!items.effects!RC1Nz6iph8wPPK1B.g9W5hJisq3MsCpZW' @ 0 : 0; will stop at (end)
2023/12/19-22:08:59.648868 7fb086400700 Manual compaction at level-1 from '!folders!0nDRFmMBs5DBJU9M' @ 72057594037927935 : 1 .. '!items.effects!RC1Nz6iph8wPPK1B.g9W5hJisq3MsCpZW' @ 0 : 0; will stop at (end)

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000002 MANIFEST-000014

View File

@ -1,5 +1,3 @@
2023/12/18-23:38:02.394612 7fa8daffd700 Delete type=3 #1 2023/12/19-22:11:46.716627 7f5d39ffb700 Recovering log #12
2023/12/18-23:38:02.397080 7fa8d9d82700 Level-0 table #5: started 2023/12/19-22:11:46.739685 7f5d39ffb700 Delete type=0 #12
2023/12/18-23:38:02.404288 7fa8d9d82700 Level-0 table #5: 6787 bytes OK 2023/12/19-22:11:46.739711 7f5d39ffb700 Delete type=3 #10
2023/12/18-23:38:02.413227 7fa8d9d82700 Delete type=0 #3
2023/12/18-23:38:02.413348 7fa8d9d82700 Manual compaction at level-0 from '!items!JWyBQe4tnOYljFAF' @ 72057594037927935 : 1 .. '!items!tWWSfEMmLmws6Yb1' @ 0 : 0; will stop at (end)

8
packs/gear/LOG.old Normal file
View File

@ -0,0 +1,8 @@
2023/12/19-14:25:58.761898 7fb0acf3b700 Recovering log #8
2023/12/19-14:25:58.781218 7fb0acf3b700 Delete type=3 #6
2023/12/19-14:25:58.781255 7fb0acf3b700 Delete type=0 #8
2023/12/19-22:08:59.648947 7fb086400700 Level-0 table #13: started
2023/12/19-22:08:59.648972 7fb086400700 Level-0 table #13: 0 bytes OK
2023/12/19-22:08:59.658595 7fb086400700 Delete type=0 #11
2023/12/19-22:08:59.677223 7fb086400700 Manual compaction at level-0 from '!items!JWyBQe4tnOYljFAF' @ 72057594037927935 : 1 .. '!items!tWWSfEMmLmws6Yb1' @ 0 : 0; will stop at (end)
2023/12/19-22:08:59.677310 7fb086400700 Manual compaction at level-1 from '!items!JWyBQe4tnOYljFAF' @ 72057594037927935 : 1 .. '!items!tWWSfEMmLmws6Yb1' @ 0 : 0; will stop at (end)

Binary file not shown.

BIN
packs/gear/MANIFEST-000014 Normal file

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000002 MANIFEST-000014

View File

@ -1,5 +1,3 @@
2023/12/18-23:38:03.189021 7f306ffff700 Delete type=3 #1 2023/12/19-22:11:46.843641 7ff2615a2700 Recovering log #12
2023/12/18-23:38:03.191864 7f306e7fc700 Level-0 table #5: started 2023/12/19-22:11:46.864924 7ff2615a2700 Delete type=0 #12
2023/12/18-23:38:03.198720 7f306e7fc700 Level-0 table #5: 1751 bytes OK 2023/12/19-22:11:46.864950 7ff2615a2700 Delete type=3 #10
2023/12/18-23:38:03.207506 7f306e7fc700 Delete type=0 #3
2023/12/18-23:38:03.207610 7f306e7fc700 Manual compaction at level-0 from '!actors!U5v4gFHquo0Y1SAq' @ 72057594037927935 : 1 .. '!actors!U5v4gFHquo0Y1SAq' @ 0 : 0; will stop at (end)

View File

@ -0,0 +1,8 @@
2023/12/19-14:25:58.750811 7fb087fff700 Recovering log #8
2023/12/19-14:25:58.759586 7fb087fff700 Delete type=3 #6
2023/12/19-14:25:58.759616 7fb087fff700 Delete type=0 #8
2023/12/19-22:08:59.612497 7fb086400700 Level-0 table #13: started
2023/12/19-22:08:59.612518 7fb086400700 Level-0 table #13: 0 bytes OK
2023/12/19-22:08:59.622048 7fb086400700 Delete type=0 #11
2023/12/19-22:08:59.648768 7fb086400700 Manual compaction at level-0 from '!actors!U5v4gFHquo0Y1SAq' @ 72057594037927935 : 1 .. '!actors!U5v4gFHquo0Y1SAq' @ 0 : 0; will stop at (end)
2023/12/19-22:08:59.648884 7fb086400700 Manual compaction at level-1 from '!actors!U5v4gFHquo0Y1SAq' @ 72057594037927935 : 1 .. '!actors!U5v4gFHquo0Y1SAq' @ 0 : 0; will stop at (end)

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000002 MANIFEST-000014

View File

@ -1,5 +1,3 @@
2023/12/18-23:38:03.938107 7f566efbe700 Delete type=3 #1 2023/12/19-22:11:46.967222 7fb6ee7bf700 Recovering log #12
2023/12/18-23:38:03.940484 7f566d542700 Level-0 table #5: started 2023/12/19-22:11:46.993517 7fb6ee7bf700 Delete type=0 #12
2023/12/18-23:38:03.948092 7f566d542700 Level-0 table #5: 12050 bytes OK 2023/12/19-22:11:46.993540 7fb6ee7bf700 Delete type=3 #10
2023/12/18-23:38:03.956941 7f566d542700 Delete type=0 #3
2023/12/18-23:38:03.957060 7f566d542700 Manual compaction at level-0 from '!folders!hIbrWxg1nDutCSwt' @ 72057594037927935 : 1 .. '!macros!wU2mAUnw3RW9qMT8' @ 0 : 0; will stop at (end)

View File

@ -0,0 +1,8 @@
2023/12/19-14:25:58.719315 7fb087fff700 Recovering log #8
2023/12/19-14:25:58.732527 7fb087fff700 Delete type=3 #6
2023/12/19-14:25:58.732555 7fb087fff700 Delete type=0 #8
2023/12/19-22:08:59.638378 7fb086400700 Level-0 table #13: started
2023/12/19-22:08:59.638400 7fb086400700 Level-0 table #13: 0 bytes OK
2023/12/19-22:08:59.648647 7fb086400700 Delete type=0 #11
2023/12/19-22:08:59.648837 7fb086400700 Manual compaction at level-0 from '!folders!hIbrWxg1nDutCSwt' @ 72057594037927935 : 1 .. '!macros!wU2mAUnw3RW9qMT8' @ 0 : 0; will stop at (end)
2023/12/19-22:08:59.677175 7fb086400700 Manual compaction at level-1 from '!folders!hIbrWxg1nDutCSwt' @ 72057594037927935 : 1 .. '!macros!wU2mAUnw3RW9qMT8' @ 0 : 0; will stop at (end)

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000002 MANIFEST-000015

View File

@ -1,5 +1,3 @@
2023/12/18-23:38:04.812110 7f4d227be700 Delete type=3 #1 2023/12/19-22:11:47.107915 7f81967fc700 Recovering log #12
2023/12/18-23:38:04.814586 7f4d20fbb700 Level-0 table #5: started 2023/12/19-22:11:47.129799 7f81967fc700 Delete type=0 #12
2023/12/18-23:38:04.821794 7f4d20fbb700 Level-0 table #5: 10624 bytes OK 2023/12/19-22:11:47.129819 7f81967fc700 Delete type=3 #10
2023/12/18-23:38:04.830506 7f4d20fbb700 Delete type=0 #3
2023/12/18-23:38:04.830630 7f4d20fbb700 Manual compaction at level-0 from '!journal!HbtPlHNFO1L6RVj0' @ 72057594037927935 : 1 .. '!journal.pages!YSuk1v59tLaL9XUK.BlDoYgdTxhyCBP3Y' @ 0 : 0; will stop at (end)

15
packs/module-docs/LOG.old Normal file
View File

@ -0,0 +1,15 @@
2023/12/19-14:25:58.704299 7fb0acf3b700 Recovering log #8
2023/12/19-14:25:58.717166 7fb0acf3b700 Delete type=3 #6
2023/12/19-14:25:58.717190 7fb0acf3b700 Delete type=0 #8
2023/12/19-22:08:59.583949 7fb086400700 Level-0 table #13: started
2023/12/19-22:08:59.590634 7fb086400700 Level-0 table #13: 7975 bytes OK
2023/12/19-22:08:59.600142 7fb086400700 Delete type=0 #11
2023/12/19-22:08:59.600341 7fb086400700 Manual compaction at level-0 from '!journal!HbtPlHNFO1L6RVj0' @ 72057594037927935 : 1 .. '!journal.pages!YSuk1v59tLaL9XUK.BxFgDb91dqbkO9h4' @ 0 : 0; will stop at (end)
2023/12/19-22:08:59.622125 7fb086400700 Manual compaction at level-1 from '!journal!HbtPlHNFO1L6RVj0' @ 72057594037927935 : 1 .. '!journal.pages!YSuk1v59tLaL9XUK.BxFgDb91dqbkO9h4' @ 0 : 0; will stop at '!journal.pages!YSuk1v59tLaL9XUK.BxFgDb91dqbkO9h4' @ 17 : 1
2023/12/19-22:08:59.622154 7fb086400700 Compacting 1@1 + 1@2 files
2023/12/19-22:08:59.629116 7fb086400700 Generated table #14@1: 17 keys, 11373 bytes
2023/12/19-22:08:59.629154 7fb086400700 Compacted 1@1 + 1@2 files => 11373 bytes
2023/12/19-22:08:59.638172 7fb086400700 compacted to: files[ 0 0 1 0 0 0 0 ]
2023/12/19-22:08:59.638243 7fb086400700 Delete type=2 #5
2023/12/19-22:08:59.638324 7fb086400700 Delete type=2 #13
2023/12/19-22:08:59.648805 7fb086400700 Manual compaction at level-1 from '!journal.pages!YSuk1v59tLaL9XUK.BxFgDb91dqbkO9h4' @ 17 : 1 .. '!journal.pages!YSuk1v59tLaL9XUK.BxFgDb91dqbkO9h4' @ 0 : 0; will stop at (end)

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
import { api } from './api.js' import { api } from './api.js'
import { requestTokenRoll } from './helpers.js' import { requestTokenRoll } from './helpers.js'
import { preDamageRollModifiers, preTraitRollModifiers } from './rollHelpers.js'
import { shapeChangeOnDismiss } from './powerEffects.js' import { shapeChangeOnDismiss } from './powerEffects.js'
import { log, shim } from './shim.js' import { log, shim } from './shim.js'
@ -71,6 +72,10 @@ Hooks.on('init', () => {
}) })
}) })
Hooks.on('swadePreRollAttribute', preTraitRollModifiers)
Hooks.on('swadePreRollSkill', preTraitRollModifiers)
Hooks.on('swadeRollDamage', preDamageRollModifiers)
Hooks.on('ready', () => { Hooks.on('ready', () => {
_checkModule('warpgate') _checkModule('warpgate')
_checkModule('socketlib') _checkModule('socketlib')

161
scripts/rollHelpers.js Normal file
View File

@ -0,0 +1,161 @@
import { log, shim } from './shim.js'
export async function preTraitRollModifiers (actor, trait, roll, modifiers, options) {
const targets = Array.from(shim.targets)
const token = shim.canvas.tokens.controlled.length > 0 ? shim.canvas.tokens.controlled[0] : null
// log('ACTOR', actor)
// log('TOKEN', token)
// log('TRAIT', trait)
// log('ROLL', roll)
// log('MODIFIERS', modifiers)
// log('OPTIONS', options)
// log('TARGET', targets)
if (targets.some(target => target.actor.system.status.isVulnerable)) {
modifiers.push({ label: 'Target is Vulnerable', value: '+2', ignore: false })
}
if (targets.some(
target => target.actor.effects.filter(
e => !e.disabled && e.name.toLowerCase().includes('deflection')).length > 0)
) {
modifiers.push({ label: 'Target has Deflection', value: '-2', ignore: false })
}
if (targets.length === 1 && token) {
const target = targets[0]
_addArcaneModifiers(target, modifiers)
const scaleMod = calcScaleMod(token, target)
if (scaleMod !== 0) {
modifiers.push({ label: 'Scale', value: scaleMod, ignore: false })
}
if (trait?.type === 'skill' && trait?.system?.swid === 'fighting') {
const gangUpBonus = calcGangup(token, target)
if (gangUpBonus > 0) {
modifiers.push({ label: 'Gang Up', value: gangUpBonus, ignore: false })
}
}
}
}
export async function preDamageRollModifiers (actor, item, roll, modifiers, options) {
const targets = Array.from(shim.targets)
const token = shim.canvas.tokens.controlled.length > 0 ? shim.canvas.tokens.controlled[0] : null
// log('ACTOR', actor)
// log('TOKEN', token)
// log('ITEM', item)
// log('ROLL', roll)
// log('MODIFIERS', modifiers)
// log('OPTIONS', options)
// log('TARGET', targets)
if (targets.length === 1 && token) {
const target = targets[0]
_addArcaneModifiers(target, modifiers)
const weaknesses = target.actor.items.filter(
i => i.type === 'ability' && i.system.swid.toLowerCase().includes('weakness'))
if (weaknesses.length > 0) {
modifiers.push(...weaknesses.map(i => { return { label: i.name, value: '+4', ignore: true } }))
}
const resistances = target.actor.items.filter(
i => i.type === 'ability' && i.system.swid.toLowerCase().includes('resistance'))
if (resistances.length > 0) {
modifiers.push(...resistances.map(i => { return { label: i.name, value: '-4', ignore: true } }))
}
if (_findItem(token.actor, 'ability', 'pack-tactics')) {
const gangupBonus = calcGangup(token, target)
if (gangupBonus > 0) {
modifiers.push({ label: 'Gang Up (Pack Tactics)', value: gangupBonus, ignore: false })
}
}
}
}
function _addArcaneModifiers (target, modifiers) {
if (_findItem(target.actor, 'edge', 'improved-arcane-resistance')) {
modifiers.push({ label: 'Arcane Resistance', value: '-4', ignore: true })
} else if (_findItem(target.actor, 'edge', 'arcane-resistance')) {
modifiers.push({ label: 'Arcane Resistance', value: '-2', ignore: true })
}
const effect = target.actor.effects.find(
e => !e.disabled && e.name.toLowerCase().includes('arcane protection'))
if (effect) {
const effectName = effect.name.toLowerCase()
const effectMod = (
-2 +
(effectName.includes('major') ? -2 : 0) +
(effectName.includes('greater') ? -2 : 0)
)
modifiers.push({ label: 'Target Arcane Protection', value: effectMod, ignore: true })
}
}
function withinRange (origin, target, range) {
const ray = new Ray(origin, target)
const distance = shim.canvas.grid.measureDistances([{ ray }], { gridSpaces: true })[0]
const originScale = origin.actor.system.stats.scale
const targetScale = target.actor.system.stats.scale
range += (originScale > 0 ? originScale / 2 : 0) + (targetScale > 0 ? targetScale / 2 : 0)
return range >= distance
}
function _findItem (actor, type, swid) {
return actor.items.find(i => i.type === type && i.system.swid === swid)
}
function calcScaleMod (attacker, target) {
const attackerScale = attacker.actor.system.stats.scale
const targetScale = target.actor.system.stats.scale
const attackerHasSwat = !!_findItem(attacker.actor, 'ability', 'swat')
let modifier = targetScale - attackerScale
if (attackerHasSwat && modifier < 0) {
modifier = Math.min(modifier + 4, 0)
}
return modifier
}
function calcGangup (attacker, target, debug) {
debug = (typeof debug === 'undefined') ? false : debug
const range = 1.2
let modifier = 0
if (_findItem(target.actor, 'edge', 'improved-block')) {
modifier = -2
} else if (_findItem(target.actor, 'edge', 'block')) {
modifier = -1
}
const attackerHasFormationFighter = !!(_findItem(attacker.actor, 'edge', 'formation-fighter'))
const withinRangeOfToken = shim.canvas.tokens.placeables.filter(t =>
t.id !== attacker.id &&
t.id !== target.id &&
t.actor.system.status.isStunned === false &&
t.visible &&
withinRange(target, t, range)
)
const attackerAllies = withinRangeOfToken.filter(
t => t.document.disposition === attacker.document.disposition)
const targetAllies = withinRangeOfToken.filter(
t => t.document.disposition === target.document.disposition &&
withinRange(attacker, t, range)
)
const attackersWithFormationFighter = attackerAllies.filter(
t => !!_findItem(t.actor, 'edge', 'formation-fighter'))
const attackerCount = attackerAllies.length
const attackerFormationBonus = (
(attackerCount > 0 && attackerHasFormationFighter ? 1 : 0) +
attackersWithFormationFighter.length
)
const defenderCount = targetAllies.length
const gangUp = Math.max(
0,
Math.min(
4,
attackerCount + attackerFormationBonus - defenderCount + modifier))
if (debug) {
log('GANG UP | Attacker:', attacker)
log('GANG UP | Target:', target)
log('GANG UP | Others within range:', withinRangeOfToken)
log('GANG UP | Attacker Allies:', attackerCount)
log('GANG UP | Attacker Formation Bonus:', attackerFormationBonus)
log('GANG UP | Effective Defender Allies:', defenderCount)
log('GANG UP | Target Block Modifier:', modifier)
log('GANG UP | Total Bonus:', gangUp)
}
return gangUp
}