2.2.0 release #38
13
module.json
13
module.json
@ -15,6 +15,7 @@
|
|||||||
"esmodules": [
|
"esmodules": [
|
||||||
"scripts/module.js"
|
"scripts/module.js"
|
||||||
],
|
],
|
||||||
|
"socket": true,
|
||||||
"packs": [
|
"packs": [
|
||||||
{
|
{
|
||||||
"name": "module-docs",
|
"name": "module-docs",
|
||||||
@ -54,22 +55,22 @@
|
|||||||
"label": "SWADE MB Helper Actors",
|
"label": "SWADE MB Helper Actors",
|
||||||
"path": "packs/helper-actors",
|
"path": "packs/helper-actors",
|
||||||
"type": "Actor",
|
"type": "Actor",
|
||||||
|
"system": "swade",
|
||||||
"ownership": {
|
"ownership": {
|
||||||
"PLAYER": "OBSERVER",
|
"PLAYER": "OBSERVER",
|
||||||
"ASSISTANT": "OWNER"
|
"ASSISTANT": "OWNER"
|
||||||
},
|
}
|
||||||
"system": "swade"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "swade-mb-gear",
|
"name": "swade-mb-gear",
|
||||||
"label": "SWADE MB Gear",
|
"label": "SWADE MB Gear",
|
||||||
"path": "packs/gear",
|
"path": "packs/gear",
|
||||||
"type": "Item",
|
"type": "Item",
|
||||||
|
"system": "swade",
|
||||||
"ownership": {
|
"ownership": {
|
||||||
"PLAYER": "OBSERVER",
|
"PLAYER": "OBSERVER",
|
||||||
"ASSISTANT": "OWNER"
|
"ASSISTANT": "OWNER"
|
||||||
},
|
}
|
||||||
"system": "swade"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packFolders": [
|
"packFolders": [
|
||||||
@ -106,6 +107,10 @@
|
|||||||
"compatibility": {
|
"compatibility": {
|
||||||
"verified": "1.16.2"
|
"verified": "1.16.2"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "socketlib",
|
||||||
|
"type": "module"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"recommends": [
|
"recommends": [
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { api } from './api.js'
|
import { api } from './api.js'
|
||||||
import { shapeChangeOnDismiss } from './powerEffects.js'
|
import { havocResult, shapeChangeOnDismiss } from './powerEffects.js'
|
||||||
import { log } from './shim.js'
|
import { log, shim } from './shim.js'
|
||||||
|
|
||||||
const moduleName = 'swade-mb-helpers'
|
const moduleName = 'swade-mb-helpers'
|
||||||
|
|
||||||
@ -17,6 +17,13 @@ Hooks.on('setup', api.registerFunctions)
|
|||||||
|
|
||||||
Hooks.on('ready', () => {
|
Hooks.on('ready', () => {
|
||||||
_checkModule('warpgate')
|
_checkModule('warpgate')
|
||||||
|
_checkModule('socketlib')
|
||||||
log('Initialized SWADE MB Helpers')
|
log('Initialized SWADE MB Helpers')
|
||||||
warpgate.event.watch(warpgate.EVENT.DISMISS, shapeChangeOnDismiss)
|
warpgate.event.watch(warpgate.EVENT.DISMISS, shapeChangeOnDismiss)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Hooks.on('socketlib.ready', () => {
|
||||||
|
const socket = socketlib.registerModule('swade-mb-helpers')
|
||||||
|
socket.register('havocResult', havocResult)
|
||||||
|
shim._socket = socket
|
||||||
|
})
|
||||||
|
|||||||
@ -545,6 +545,27 @@ class EntangleEffect extends TargetedPowerEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class HavocEffect extends TargetedPowerEffect {
|
||||||
|
get name () {
|
||||||
|
return 'Havoc'
|
||||||
|
}
|
||||||
|
|
||||||
|
get baseDurationRounds () {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepResult () {
|
||||||
|
this.raise = (this.buttons === 'raise')
|
||||||
|
}
|
||||||
|
|
||||||
|
async applyResult () {
|
||||||
|
await super.applyResult()
|
||||||
|
for (const target of this.targets) {
|
||||||
|
await havocResult(target.id, this.raise)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class IntangibilityEffect extends TargetedPowerEffect {
|
class IntangibilityEffect extends TargetedPowerEffect {
|
||||||
get name () {
|
get name () {
|
||||||
return 'Intangility'
|
return 'Intangility'
|
||||||
@ -1349,6 +1370,7 @@ const PowerClasses = {
|
|||||||
'detectconceal-aracana': DetectConcealArcanaEffect,
|
'detectconceal-aracana': DetectConcealArcanaEffect,
|
||||||
disguise: DisguiseEffect,
|
disguise: DisguiseEffect,
|
||||||
entangle: EntangleEffect,
|
entangle: EntangleEffect,
|
||||||
|
havoc: HavocEffect,
|
||||||
intangibility: IntangibilityEffect,
|
intangibility: IntangibilityEffect,
|
||||||
invisibility: InvisibilityEffect,
|
invisibility: InvisibilityEffect,
|
||||||
'lower trait': BoostLowerTraitEffect,
|
'lower trait': BoostLowerTraitEffect,
|
||||||
@ -1419,3 +1441,30 @@ export async function shapeChangeOnDismiss (data) {
|
|||||||
await token.update(update)
|
await token.update(update)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function havocResult (tokenId, isRaise) {
|
||||||
|
const token = shim.canvas.tokens.get(tokenId)
|
||||||
|
if (!token) {
|
||||||
|
log('Unable to find token with id ', tokenId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const owner = shim.warpgateUtil.firstOwner(token.document)
|
||||||
|
if (owner !== shim.user) {
|
||||||
|
shim.socket.executeAsUser(havocResult, owner.id, tokenId, isRaise)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const effect = shim.getStatus('SWADE.Distr', 'Distracted')
|
||||||
|
await shim.applyActiveEffects(token, [effect])
|
||||||
|
log(`apply ${effect.label} to ${token.document.name}, raise: ${isRaise}`)
|
||||||
|
const opts = {
|
||||||
|
flavour: 'Resist Havoc',
|
||||||
|
additionalMods: []
|
||||||
|
}
|
||||||
|
if (isRaise) {
|
||||||
|
opts.additionalMods.push({ label: 'vs. Raise', value: -2 })
|
||||||
|
}
|
||||||
|
if (token.actor.effects.find(e => e.name === 'Flying')) {
|
||||||
|
opts.additionalMods.push({ label: 'Flying', value: -2 })
|
||||||
|
}
|
||||||
|
token.actor.rollAttribute('strength', opts)
|
||||||
|
}
|
||||||
|
|||||||
@ -21,6 +21,10 @@ export class shim {
|
|||||||
return Actor
|
return Actor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get canvas () {
|
||||||
|
return game.canvas
|
||||||
|
}
|
||||||
|
|
||||||
static get folders () {
|
static get folders () {
|
||||||
return game.folders
|
return game.folders
|
||||||
}
|
}
|
||||||
@ -49,6 +53,12 @@ export class shim {
|
|||||||
return game.scenes
|
return game.scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static _socket = null
|
||||||
|
|
||||||
|
static get socket () {
|
||||||
|
return shim._socket
|
||||||
|
}
|
||||||
|
|
||||||
static mergeObject (...args) {
|
static mergeObject (...args) {
|
||||||
return mergeObject(...args)
|
return mergeObject(...args)
|
||||||
}
|
}
|
||||||
@ -114,6 +124,10 @@ export class shim {
|
|||||||
return warpgate.spawnAt(...args)
|
return warpgate.spawnAt(...args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get warpgateUtil () {
|
||||||
|
return warpgate.util
|
||||||
|
}
|
||||||
|
|
||||||
static getActorFolderByPath (path) {
|
static getActorFolderByPath (path) {
|
||||||
const names = path.split('/')
|
const names = path.split('/')
|
||||||
if (names[0] === '') {
|
if (names[0] === '') {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user