Ajout affichage distance
This commit is contained in:
parent
fd6fbba9cb
commit
5382fb5df3
@ -688,10 +688,22 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
verifierDistance( competence, arme) {
|
verifierDistance( rollData ) {
|
||||||
if ( competence.system.categorie == "tir" ) {
|
if ( rollData.competence.system.categorie == "tir" ||
|
||||||
// TODO - ONGOING
|
rollData.competence.system.categorie == "lancer" ) {
|
||||||
|
const defenderToken = canvas.tokens.get(this.defenderTokenId)
|
||||||
|
let dist = canvas.grid.measureDistances([{ ray: new Ray(_token.center, defenderToken.center) }], { gridSpaces: false })
|
||||||
|
dist = Number(dist).toPrecision(5)
|
||||||
|
//let ray = new Ray( {x: _token.x, y: _token.y}, {x: defenderToken.x, y:defenderToken.y} )
|
||||||
|
let msgPortee = "portée est courte (0)"
|
||||||
|
if (dist > rollData.arme.system.portee_courte && dist <= rollData.arme.system.portee_moyenne) {
|
||||||
|
msgPortee = "portée est moyenne (-3)"
|
||||||
|
} else if (dist > rollData.arme.system.portee_moyenne && dist <= rollData.arme.system.portee_extreme) {
|
||||||
|
msgPortee = "portée est extrême (-5)"
|
||||||
|
} else if ( dist > rollData.arme.system.portee_extreme) {
|
||||||
|
msgPortee = "cible est inateignable"
|
||||||
|
}
|
||||||
|
ChatMessage.create( { content: `<strong>Indication MJ</strong> : La cible est à une distance indicative de : ${dist} mètres. Pour l'arme ${rollData.arme.name}, la ${msgPortee}.`, whisper: ChatMessage.getWhisperRecipients("GM") } )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,7 +729,7 @@ export class RdDCombat {
|
|||||||
if (arme) {
|
if (arme) {
|
||||||
this.attacker.verifierForceMin(arme);
|
this.attacker.verifierForceMin(arme);
|
||||||
}
|
}
|
||||||
this.verifierDistance(competence, arme)
|
this.verifierDistance(rollData)
|
||||||
|
|
||||||
const dialog = await RdDRoll.create(this.attacker, rollData,
|
const dialog = await RdDRoll.create(this.attacker, rollData,
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
],
|
],
|
||||||
"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.24",
|
"version": "10.0.25",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "10",
|
"minimum": "10",
|
||||||
"verified": "10.286"
|
"verified": "10.286"
|
||||||
@ -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.24.zip",
|
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.25.zip",
|
||||||
"gridDistance": 1,
|
"gridDistance": 1,
|
||||||
"gridUnits": "m",
|
"gridUnits": "m",
|
||||||
"primaryTokenAttribute": "sante.vie",
|
"primaryTokenAttribute": "sante.vie",
|
||||||
|
Loading…
Reference in New Issue
Block a user