@@ -92,6 +92,7 @@ export function initConfig() {
92
92
93
93
if ( description ) description = await TextEditor . enrichHTML ( description ) ;
94
94
let details = [ ] ;
95
+ console . log ( "target" , target , "range" , range ) ;
95
96
if ( target || range ) {
96
97
details = [
97
98
{
@@ -104,6 +105,22 @@ export function initConfig() {
104
105
} ,
105
106
] ;
106
107
}
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
+ }
107
124
108
125
const tooltipProperties = [ ] ;
109
126
if ( damageTypes ?. length ) damageTypes . forEach ( ( d ) => tooltipProperties . push ( { label : d , primary : true } ) ) ;
@@ -112,6 +129,41 @@ export function initConfig() {
112
129
return { title, description, subtitle, details, properties : tooltipProperties , footerText : materialComponents } ;
113
130
}
114
131
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
+
115
167
function getProficiencyIcon ( proficiency ) {
116
168
if ( proficiency == 0 ) return '<i style="margin-right: 1ch; pointer-events: none" class="far fa-circle"> </i>' ;
117
169
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() {
401
453
buttons . push ( new DND5eItemButton ( { item, inActionPanel : true } ) ) ;
402
454
}
403
455
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 ) ) ;
405
457
}
406
458
}
407
459
@@ -629,7 +681,7 @@ export function initConfig() {
629
681
630
682
async render ( ...args ) {
631
683
await super . render ( ...args ) ;
632
- if ( this . item ) {
684
+ if ( this . item ) {
633
685
const weapons = this . actor . items . filter ( ( item ) => item . system . consume ?. target === this . item . id ) ;
634
686
ui . ARGON . updateItemButtons ( weapons ) ;
635
687
}
@@ -645,7 +697,7 @@ export function initConfig() {
645
697
return Math . floor ( ( ammoItem . system . quantity ?? 0 ) / this . item . system . consume . amount ) ;
646
698
} else if ( consumeType === "attribute" ) {
647
699
return getProperty ( this . actor . system , this . item . system . consume . target ) ;
648
- } else if ( consumeType === "charges" ) {
700
+ } else if ( consumeType === "charges" ) {
649
701
const chargesItem = this . actor . items . get ( this . item . system . consume . target ) ;
650
702
if ( ! chargesItem ) return null ;
651
703
return Math . floor ( ( chargesItem . system . uses ?. value ?? 0 ) / this . item . system . consume . amount ) ;
0 commit comments