@@ -153,13 +153,11 @@ export class CombatHUD extends Application {
153
153
data . cssClasses = this . options . classes . join ( ' ' ) ;
154
154
data . cssId = this . options . id ;
155
155
data . isCompact = game . settings . get ( SYSTEM , SETTINGS . optionCombatHudCompact ) ;
156
- data . isGM = game . user . isGM ;
157
156
158
157
const opacity = game . settings . get ( SYSTEM , SETTINGS . optionCombatHudOpacity ) / 100 ;
159
158
data . additionalStyle = this . _getAdditionalStyle ( opacity ) ;
160
159
161
160
const ordering = game . settings . get ( SYSTEM , SETTINGS . optionCombatHudActorOrdering ) ;
162
-
163
161
data . npcs = [ ] ;
164
162
data . characters = [ ] ;
165
163
@@ -185,14 +183,9 @@ export class CombatHUD extends Application {
185
183
186
184
const NPCTurnsLeftMode = game . settings . get ( SYSTEM , SETTINGS . optionCombatHudShowNPCTurnsLeftMode ) ;
187
185
188
- const currentTurn = game . combat . getCurrentTurn ( ) ;
189
- const turnsLeft = ui . combat . countTurnsLeft ( game . combat ) ;
190
- // const round = game.combat.round;
191
-
192
186
/** @type FUCombat **/
193
187
const combat = game . combat ;
194
- data . turnStarted = combat . isTurnStarted ;
195
- data . hasCombatStarted = game . combat . started ;
188
+ combat . populateData ( data ) ;
196
189
197
190
for ( const combatant of game . combat . combatants ) {
198
191
if ( ! combatant . actor || ! combatant . token ) continue ;
@@ -202,7 +195,10 @@ export class CombatHUD extends Application {
202
195
id : combatant . id ,
203
196
name : combatant . name ,
204
197
actor : combatant . actor ,
198
+ isOwner : combatant . isOwner ,
199
+ totalTurns : combatant . totalTurns ,
205
200
token : combatant . token ,
201
+ faction : combatant . faction ,
206
202
effects : activeEffects ,
207
203
// token._source should contain the most current version of the token's texture.
208
204
img : game . settings . get ( SYSTEM , SETTINGS . optionCombatHudPortrait ) === 'token' ? combatant . token . _source . texture . src : combatant . actor . img ,
@@ -247,7 +243,6 @@ export class CombatHUD extends Application {
247
243
248
244
// Ensure shouldEffectsMarquee is false if effectsMarqueeDuration is over 9000
249
245
actorData . shouldEffectsMarquee = actorData . effects . length > maxEffectsBeforeMarquee && effectsMarqueeDuration < 9000 ;
250
-
251
246
actorData . effectsMarqueeDuration = effectsMarqueeDuration ;
252
247
253
248
const marqueeDirection = game . settings . get ( SYSTEM , SETTINGS . optionCombatHudEffectsMarqueeMode ) ;
@@ -271,29 +266,19 @@ export class CombatHUD extends Application {
271
266
} ) ;
272
267
}
273
268
274
- actorData . isOwner = combatant . isOwner ;
275
269
actorData . order = order ;
276
270
277
- actorData . totalTurns = combatant . totalTurns ;
278
271
if ( NPCTurnsLeftMode === 'never' ) {
279
272
actorData . totalTurns = 1 ;
280
273
} else if ( NPCTurnsLeftMode === 'only-studied' && ! this . _isNPCStudied ( combatant . token ) ) {
281
274
actorData . totalTurns = 1 ;
282
275
}
283
276
284
- actorData . turnsLeft = turnsLeft [ combatant . id ] ?? 0 ;
285
-
286
277
if ( combatant . token . disposition === foundry . CONST . TOKEN_DISPOSITIONS . FRIENDLY ) {
287
- actorData . isCurrentTurn = currentTurn === 'friendly' ;
288
278
data . characters . push ( actorData ) ;
289
279
} else {
290
- actorData . isCurrentTurn = currentTurn === 'hostile' ;
291
280
data . npcs . push ( actorData ) ;
292
281
}
293
-
294
- // Decides whether combatant can (start turn | take turn)
295
- actorData . isCurrentCombatant = combat . isCurrentCombatant ( combatant ) ;
296
- actorData . hasTurns = turnsLeft [ combatant . id ] && actorData . isCurrentTurn ;
297
282
}
298
283
299
284
data . characters . sort ( ( a , b ) => a . order - b . order ) ;
@@ -361,6 +346,7 @@ export class CombatHUD extends Application {
361
346
362
347
html . find ( 'a[data-action=start-turn]' ) . click ( ( event ) => ui . combat . handleStartTurn ( event ) ) ;
363
348
html . find ( 'a[data-action=end-turn]' ) . click ( ( event ) => ui . combat . handleEndTurn ( event ) ) ;
349
+ html . find ( 'a[data-action=take-turn-out-of-turn]' ) . click ( ( event ) => ui . combat . handleTakeTurnOutOfTurn ( event ) ) ;
364
350
}
365
351
366
352
_doHudDragStart ( event ) {
@@ -861,6 +847,8 @@ export class CombatHUD extends Application {
861
847
activeEffect . parent . parent ?. documentName === 'Actor' &&
862
848
foundry . utils . hasProperty ( changes , 'transfer' ) &&
863
849
game . combat ?. combatants . some ( ( c ) => c . actor . uuid === activeEffect . parent . parent . uuid )
850
+ ! ( activeEffect . target && game . combat ?. combatants . some ( ( c ) => c . actor . uuid === activeEffect . target . uuid ) ) &&
851
+ game . combat ?. combatants . some ( ( c ) => c . actor . uuid === activeEffect . parent . parent . uuid )
864
852
)
865
853
) {
866
854
return ;
0 commit comments