Fix range attack
This commit is contained in:
parent
08157116e8
commit
53d7e22882
@ -560,11 +560,17 @@ export class CrucibleActor extends Actor {
|
|||||||
let defender = defenderToken.actor
|
let defender = defenderToken.actor
|
||||||
|
|
||||||
// Distance management
|
// Distance management
|
||||||
if ( this.token) {
|
let token = this.token
|
||||||
const ray = new Ray(this.token.object.center, defenderToken.center)
|
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
|
rollData.tokensDistance = canvas.grid.measureDistances([{ray}], {gridSpaces:false})[0] / canvas.grid.grid.options.dimensions.distance
|
||||||
} else {
|
} else {
|
||||||
ui.notifications.info("No token connected to this actor, unable to compute distance.")
|
ui.notifications.info("No token connected to this actor, unable to compute distance.")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if (defender ) {
|
if (defender ) {
|
||||||
rollData.forceAdvantage = defender.isAttackerAdvantage()
|
rollData.forceAdvantage = defender.isAttackerAdvantage()
|
||||||
|
@ -199,7 +199,7 @@
|
|||||||
"styles": [
|
"styles": [
|
||||||
"styles/simple.css"
|
"styles/simple.css"
|
||||||
],
|
],
|
||||||
"version": "10.0.4",
|
"version": "10.0.5",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "10",
|
"minimum": "10",
|
||||||
"verified": "10.278",
|
"verified": "10.278",
|
||||||
@ -207,7 +207,7 @@
|
|||||||
},
|
},
|
||||||
"title": "Crucible RPG",
|
"title": "Crucible RPG",
|
||||||
"manifest": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/raw/master/system.json",
|
"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",
|
"url": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg",
|
||||||
"background": "images/ui/crucible_welcome_page.webp",
|
"background": "images/ui/crucible_welcome_page.webp",
|
||||||
"id": "fvtt-crucible-rpg"
|
"id": "fvtt-crucible-rpg"
|
||||||
|
Loading…
Reference in New Issue
Block a user