Ajout visibilité
This commit is contained in:
parent
690dd1f0a2
commit
3073670afa
@ -698,6 +698,7 @@ export class RdDCombat {
|
|||||||
else {
|
else {
|
||||||
const defenderToken = canvas.tokens.get(this.defenderTokenId);
|
const defenderToken = canvas.tokens.get(this.defenderTokenId);
|
||||||
const dist = this.distance(_token, defenderToken)
|
const dist = this.distance(_token, defenderToken)
|
||||||
|
const isVisible = this.isVisible(_token, defenderToken)
|
||||||
const portee = this._ajustementPortee(dist, rollData.arme)
|
const portee = this._ajustementPortee(dist, rollData.arme)
|
||||||
const taille = this._ajustementTaille(this.defender)
|
const taille = this._ajustementTaille(this.defender)
|
||||||
const activite = this._ajustementMouvement(this.defender)
|
const activite = this._ajustementMouvement(this.defender)
|
||||||
@ -706,6 +707,7 @@ export class RdDCombat {
|
|||||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-info-distance.html', {
|
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-info-distance.html', {
|
||||||
rollData: rollData,
|
rollData: rollData,
|
||||||
attacker: _token,
|
attacker: _token,
|
||||||
|
isVisible: isVisible,
|
||||||
defender: defenderToken,
|
defender: defenderToken,
|
||||||
distance: dist,
|
distance: dist,
|
||||||
portee: portee,
|
portee: portee,
|
||||||
@ -719,6 +721,10 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isVisible(token, defender) {
|
||||||
|
return canvas.effects.visibility.testVisibility(defender.center, { object: token })
|
||||||
|
}
|
||||||
|
|
||||||
distance(t, defenderToken) {
|
distance(t, defenderToken) {
|
||||||
return Number(canvas.grid.measureDistances([{ ray: new Ray(t.center, defenderToken.center) }], { gridSpaces: false })).toFixed(1);
|
return Number(canvas.grid.measureDistances([{ ray: new Ray(t.center, defenderToken.center) }], { gridSpaces: false })).toFixed(1);
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,10 @@
|
|||||||
],
|
],
|
||||||
"url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/",
|
"url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/",
|
||||||
"license": "LICENSE.txt",
|
"license": "LICENSE.txt",
|
||||||
"version": "10.0.25",
|
"version": "10.0.26",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "10",
|
"minimum": "10",
|
||||||
"verified": "10.286"
|
"verified": "10.287"
|
||||||
},
|
},
|
||||||
"esmodules": [
|
"esmodules": [
|
||||||
"module/rdd-main.js"
|
"module/rdd-main.js"
|
||||||
@ -333,7 +333,7 @@
|
|||||||
],
|
],
|
||||||
"socket": true,
|
"socket": true,
|
||||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
|
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
|
||||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.25.zip",
|
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.26.zip",
|
||||||
"gridDistance": 1,
|
"gridDistance": 1,
|
||||||
"gridUnits": "m",
|
"gridUnits": "m",
|
||||||
"primaryTokenAttribute": "sante.vie",
|
"primaryTokenAttribute": "sante.vie",
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
<strong>Ajustement de tir/lancer</strong> proposé de <strong>{{total}}</strong>
|
<strong>Ajustement de tir/lancer</strong> proposé de <strong>{{total}}</strong>
|
||||||
<ul>
|
<ul>
|
||||||
<li>{{defender.name}} est à une distance indicative de {{distance}} mètres.</li>
|
<li>{{defender.name}} est à une distance indicative de {{distance}} mètres.</li>
|
||||||
|
{{#if isVisible}}
|
||||||
|
<li>Selon les murs et la lumière, la cible {{defender.name}} est visible de {{attacker.name}}.</li>
|
||||||
|
{{else}}
|
||||||
|
<li>Selon les murs et la lumière, la cible {{defender.name}} n'est pas visible de {{attacker.name}}.</li>
|
||||||
|
{{/if}}
|
||||||
{{log defender}}
|
{{log defender}}
|
||||||
<li>Portée {{portee.msg}} pour l'arme {{rollData.arme.name}} : {{portee.diff}}</li>
|
<li>Portée {{portee.msg}} pour l'arme {{rollData.arme.name}} : {{portee.diff}}</li>
|
||||||
<li>De taille {{taille.msg}}: {{taille.diff}}</li>
|
<li>De taille {{taille.msg}}: {{taille.diff}}</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user