mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 22:46:12 +01:00
Initial commit
This commit is contained in:
commit
aa4021d1a2
163 changed files with 26530 additions and 0 deletions
29
module/ui/ruler.mjs
Normal file
29
module/ui/ruler.mjs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
export default class DhpRuler extends foundry.canvas.interaction.Ruler {
|
||||
_getSegmentLabel(segment, totalDistance) {
|
||||
const range = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.General.RangeMeasurement);
|
||||
if(!range.enabled) return super._getSegmentLabel(segment, totalDistance);
|
||||
|
||||
const segmentDistance = Math.round(segment.distance * 100) / 100;
|
||||
const totalDistanceValue = Math.round(totalDistance * 100) / 100;
|
||||
|
||||
return `${this.#getRangeLabel(segmentDistance, range)} [${this.#getRangeLabel(totalDistanceValue, range)}]`;
|
||||
}
|
||||
|
||||
#getRangeLabel(distance, settings){
|
||||
if(distance <= settings.melee){
|
||||
return game.i18n.localize("DAGGERHEART.Range.Melee.Name");
|
||||
}
|
||||
if(distance <= settings.veryClose){
|
||||
return game.i18n.localize("DAGGERHEART.Range.VeryClose.Name");
|
||||
}
|
||||
if(distance <= settings.close){
|
||||
return game.i18n.localize("DAGGERHEART.Range.Close.Name");
|
||||
}
|
||||
if(distance <= settings.far){
|
||||
return game.i18n.localize("DAGGERHEART.Range.Far.Name");
|
||||
}
|
||||
if(distance <= settings.veryFar){
|
||||
return game.i18n.localize("DAGGERHEART.Range.VeryFar.Name");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue