Ajout visibilité
This commit is contained in:
parent
690dd1f0a2
commit
3073670afa
@ -698,6 +698,7 @@ export class RdDCombat {
|
||||
else {
|
||||
const defenderToken = canvas.tokens.get(this.defenderTokenId);
|
||||
const dist = this.distance(_token, defenderToken)
|
||||
const isVisible = this.isVisible(_token, defenderToken)
|
||||
const portee = this._ajustementPortee(dist, rollData.arme)
|
||||
const taille = this._ajustementTaille(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', {
|
||||
rollData: rollData,
|
||||
attacker: _token,
|
||||
isVisible: isVisible,
|
||||
defender: defenderToken,
|
||||
distance: dist,
|
||||
portee: portee,
|
||||
@ -719,6 +721,10 @@ export class RdDCombat {
|
||||
}
|
||||
}
|
||||
|
||||
isVisible(token, defender) {
|
||||
return canvas.effects.visibility.testVisibility(defender.center, { object: token })
|
||||
}
|
||||
|
||||
distance(t, defenderToken) {
|
||||
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/",
|
||||
"license": "LICENSE.txt",
|
||||
"version": "10.0.25",
|
||||
"version": "10.0.26",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
"verified": "10.286"
|
||||
"verified": "10.287"
|
||||
},
|
||||
"esmodules": [
|
||||
"module/rdd-main.js"
|
||||
@ -333,7 +333,7 @@
|
||||
],
|
||||
"socket": true,
|
||||
"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,
|
||||
"gridUnits": "m",
|
||||
"primaryTokenAttribute": "sante.vie",
|
||||
|
@ -2,6 +2,11 @@
|
||||
<strong>Ajustement de tir/lancer</strong> proposé de <strong>{{total}}</strong>
|
||||
<ul>
|
||||
<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}}
|
||||
<li>Portée {{portee.msg}} pour l'arme {{rollData.arme.name}} : {{portee.diff}}</li>
|
||||
<li>De taille {{taille.msg}}: {{taille.diff}}</li>
|
||||
|
Loading…
Reference in New Issue
Block a user