Fix range attack

This commit is contained in:
sladecraven 2022-08-23 08:21:20 +02:00
parent 08157116e8
commit b84f34d560
2 changed files with 10 additions and 4 deletions

View File

@ -560,11 +560,17 @@ export class CrucibleActor extends Actor {
let defender = defenderToken.actor
// Distance management
if ( this.token) {
const ray = new Ray(this.token.object.center, defenderToken.center)
let token = this.token
if ( !token) {
let tokens =this.getActiveTokens()
token = tokens[0]
}
if ( token ) {
const ray = new Ray(token.object?.center || token.center, defenderToken.center)
rollData.tokensDistance = canvas.grid.measureDistances([{ray}], {gridSpaces:false})[0] / canvas.grid.grid.options.dimensions.distance
} else {
ui.notifications.info("No token connected to this actor, unable to compute distance.")
return
}
if (defender ) {
rollData.forceAdvantage = defender.isAttackerAdvantage()

View File

@ -199,7 +199,7 @@
"styles": [
"styles/simple.css"
],
"version": "10.0.4",
"version": "10.0.5",
"compatibility": {
"minimum": "10",
"verified": "10.278",
@ -207,7 +207,7 @@
},
"title": "Crucible RPG",
"manifest": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/raw/master/system.json",
"download": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/archive/fvtt-crucible-rpg-v10.0.4.zip",
"download": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/archive/fvtt-crucible-rpg-v10.0.5.zip",
"url": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg",
"background": "images/ui/crucible_welcome_page.webp",
"id": "fvtt-crucible-rpg"