Skip to content

Commit 3ef5913

Browse files
committed
a
1 parent 9f5ec8a commit 3ef5913

File tree

4 files changed

+60
-6
lines changed

4 files changed

+60
-6
lines changed

index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

languages/en.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,7 @@
7070
"enhancedcombathud-dnd5e.abilities.cha.tooltip": "<p>Charisma measures your ability to interact effectively with others. It includes such factors as confidence and eloquence, and it can represent a charming or commanding personality.</p><p><strong>Other Charisma Checks</strong><br/>The DM might call for a Charisma check when you try to accomplish tasks like the following:<ul><li>Find the best person to talk to for news, rumors, and gossip</li><li>Blend into a crowd to get the sense of key topics of conversation</li></ul></p>",
7171
"enhancedcombathud-dnd5e.tooltip.target.name" : "Target",
7272
"enhancedcombathud-dnd5e.tooltip.range.name" : "Range",
73-
"enhancedcombathud-dnd5e.tooltip.properties.name" : "Properties"
73+
"enhancedcombathud-dnd5e.tooltip.properties.name" : "Properties",
74+
"enhancedcombathud-dnd5e.tooltip.toHit.name": "To Hit",
75+
"enhancedcombathud-dnd5e.tooltip.damage.name": "Damage"
7476
}

scripts/config.js

+55-3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export function initConfig() {
9292

9393
if (description) description = await TextEditor.enrichHTML(description);
9494
let details = [];
95+
console.log("target", target, "range", range);
9596
if (target || range) {
9697
details = [
9798
{
@@ -104,6 +105,22 @@ export function initConfig() {
104105
},
105106
];
106107
}
108+
if (item.labels.toHit) {
109+
details.push({
110+
label: "enhancedcombathud-dnd5e.tooltip.toHit.name",
111+
value: item.labels.toHit,
112+
});
113+
}
114+
if (item.labels.derivedDamage?.length) {
115+
let dmgString = "";
116+
item.labels.derivedDamage.forEach((dDmg) => {
117+
dmgString += dDmg.formula + " " + getDamageTypeIcon(dDmg.damageType) + " ";
118+
});
119+
details.push({
120+
label: "enhancedcombathud-dnd5e.tooltip.damage.name",
121+
value: dmgString,
122+
});
123+
}
107124

108125
const tooltipProperties = [];
109126
if (damageTypes?.length) damageTypes.forEach((d) => tooltipProperties.push({ label: d, primary: true }));
@@ -112,6 +129,41 @@ export function initConfig() {
112129
return { title, description, subtitle, details, properties: tooltipProperties, footerText: materialComponents };
113130
}
114131

132+
function getDamageTypeIcon(damageType) {
133+
switch (damageType.toLowerCase()) {
134+
case "acid":
135+
return '<i class="fas fa-flask"></i>';
136+
case "bludgeoning":
137+
return '<i class="fas fa-hammer"></i>';
138+
case "cold":
139+
return '<i class="fas fa-snowflake"></i>';
140+
case "fire":
141+
return '<i class="fas fa-fire"></i>';
142+
case "force":
143+
return '<i class="fas fa-hand-sparkles"></i>';
144+
case "lightning":
145+
return '<i class="fas fa-bolt"></i>';
146+
case "necrotic":
147+
return '<i class="fas fa-skull"></i>';
148+
case "piercing":
149+
return '<i class="fas fa-crosshairs"></i>';
150+
case "poison":
151+
return '<i class="fas fa-skull-crossbones"></i>';
152+
case "psychic":
153+
return '<i class="fas fa-brain"></i>';
154+
case "radiant":
155+
return '<i class="fas fa-sun"></i>';
156+
case "slashing":
157+
return '<i class="fas fa-cut"></i>';
158+
case "thunder":
159+
return '<i class="fas fa-bell"></i>';
160+
case "healing":
161+
return '<i class="fas fa-heart"></i>';
162+
default:
163+
return "";
164+
}
165+
}
166+
115167
function getProficiencyIcon(proficiency) {
116168
if (proficiency == 0) return '<i style="margin-right: 1ch; pointer-events: none" class="far fa-circle"> </i>';
117169
else if (proficiency == 1) return '<i style="margin-right: 1ch; pointer-events: none" class="fas fa-check"> </i>';
@@ -401,7 +453,7 @@ export function initConfig() {
401453
buttons.push(new DND5eItemButton({ item, inActionPanel: true }));
402454
}
403455

404-
return buttons.filter((button) => button.items == undefined || button.items.length).filter(button => showSpecialActions || !(button instanceof ARGON.MAIN.BUTTONS.SplitButton));
456+
return buttons.filter((button) => button.items == undefined || button.items.length).filter((button) => showSpecialActions || !(button instanceof ARGON.MAIN.BUTTONS.SplitButton));
405457
}
406458
}
407459

@@ -629,7 +681,7 @@ export function initConfig() {
629681

630682
async render(...args) {
631683
await super.render(...args);
632-
if (this.item) {
684+
if (this.item) {
633685
const weapons = this.actor.items.filter((item) => item.system.consume?.target === this.item.id);
634686
ui.ARGON.updateItemButtons(weapons);
635687
}
@@ -645,7 +697,7 @@ export function initConfig() {
645697
return Math.floor((ammoItem.system.quantity ?? 0) / this.item.system.consume.amount);
646698
} else if (consumeType === "attribute") {
647699
return getProperty(this.actor.system, this.item.system.consume.target);
648-
} else if (consumeType === "charges") {
700+
} else if (consumeType === "charges") {
649701
const chargesItem = this.actor.items.get(this.item.system.consume.target);
650702
if (!chargesItem) return null;
651703
return Math.floor((chargesItem.system.uses?.value ?? 0) / this.item.system.consume.amount);

0 commit comments

Comments
 (0)