@@ -7,6 +7,16 @@ import { CARDS_DRAW_KEEP_STATES, MODULE_ID, STATUS_EFFECTS } from './constants.j
7
7
*/
8
8
export const YZEC = { } ;
9
9
10
+ function singleActionCondition ( combat , combatant , index ) {
11
+ const tokenId = combat . combatants . get ( combatant . id ) . tokenId ;
12
+ let action = 0 ;
13
+ for ( const turn of combat . turns ) {
14
+ if ( turn . tokenId === tokenId ) action ++ ;
15
+ if ( turn . id === combatant . id ) break ;
16
+ }
17
+ return action === index ;
18
+ }
19
+
10
20
YZEC . CombatTracker = {
11
21
src : `modules/${ MODULE_ID } /sidebar/combat-tracker.config.json` ,
12
22
// config: undefined,
@@ -31,12 +41,85 @@ YZEC.CombatTracker = {
31
41
] ,
32
42
singleAction : [
33
43
{
34
- eventName : 'single-action-button-clicked' ,
44
+ eventName : 'single-action-button-1-clicked' ,
45
+ icon : 'fa-play' ,
46
+ id : 'single-action-button-1' ,
47
+ property : 'action1' ,
48
+ label : 'YZEC.CombatTracker.SingleAction' ,
49
+ visibility : 'owner' ,
50
+ condition : ( combat , combatant ) => singleActionCondition ( combat , combatant , 1 ) ,
51
+ } ,
52
+ {
53
+ eventName : 'single-action-button-2-clicked' ,
54
+ icon : 'fa-play' ,
55
+ id : 'single-action-button-2' ,
56
+ property : 'action2' ,
57
+ label : 'YZEC.CombatTracker.SingleAction' ,
58
+ visibility : 'owner' ,
59
+ condition : ( combat , combatant ) => singleActionCondition ( combat , combatant , 2 ) ,
60
+ } ,
61
+ {
62
+ eventName : 'single-action-button-3-clicked' ,
63
+ icon : 'fa-play' ,
64
+ id : 'single-action-button-3' ,
65
+ property : 'action3' ,
66
+ label : 'YZEC.CombatTracker.SingleAction' ,
67
+ visibility : 'owner' ,
68
+ condition : ( combat , combatant ) => singleActionCondition ( combat , combatant , 3 ) ,
69
+ } ,
70
+ {
71
+ eventName : 'single-action-button-4-clicked' ,
72
+ icon : 'fa-play' ,
73
+ id : 'single-action-button-4' ,
74
+ property : 'action4' ,
75
+ label : 'YZEC.CombatTracker.SingleAction' ,
76
+ visibility : 'owner' ,
77
+ condition : ( combat , combatant ) => singleActionCondition ( combat , combatant , 4 ) ,
78
+ } ,
79
+ {
80
+ eventName : 'single-action-button-5-clicked' ,
81
+ icon : 'fa-play' ,
82
+ id : 'single-action-button-5' ,
83
+ property : 'action5' ,
84
+ label : 'YZEC.CombatTracker.SingleAction' ,
85
+ visibility : 'owner' ,
86
+ condition : ( combat , combatant ) => singleActionCondition ( combat , combatant , 5 ) ,
87
+ } ,
88
+ {
89
+ eventName : 'single-action-button-6-clicked' ,
90
+ icon : 'fa-play' ,
91
+ id : 'single-action-button-6' ,
92
+ property : 'action6' ,
93
+ label : 'YZEC.CombatTracker.SingleAction' ,
94
+ visibility : 'owner' ,
95
+ condition : ( combat , combatant ) => singleActionCondition ( combat , combatant , 6 ) ,
96
+ } ,
97
+ {
98
+ eventName : 'single-action-button-7-clicked' ,
99
+ icon : 'fa-play' ,
100
+ id : 'single-action-button-7' ,
101
+ property : 'action7' ,
102
+ label : 'YZEC.CombatTracker.SingleAction' ,
103
+ visibility : 'owner' ,
104
+ condition : ( combat , combatant ) => singleActionCondition ( combat , combatant , 7 ) ,
105
+ } ,
106
+ {
107
+ eventName : 'single-action-button-8-clicked' ,
35
108
icon : 'fa-play' ,
36
- id : 'single-action-button' ,
37
- property : 'action ' ,
109
+ id : 'single-action-button-8 ' ,
110
+ property : 'action8 ' ,
38
111
label : 'YZEC.CombatTracker.SingleAction' ,
39
112
visibility : 'owner' ,
113
+ condition : ( combat , combatant ) => singleActionCondition ( combat , combatant , 8 ) ,
114
+ } ,
115
+ {
116
+ eventName : 'single-action-button-9-clicked' ,
117
+ icon : 'fa-play' ,
118
+ id : 'single-action-button-9' ,
119
+ property : 'action9' ,
120
+ label : 'YZEC.CombatTracker.SingleAction' ,
121
+ visibility : 'owner' ,
122
+ condition : ( combat , combatant ) => singleActionCondition ( combat , combatant , 9 ) ,
40
123
} ,
41
124
] ,
42
125
lockInitiative : [
@@ -85,12 +168,62 @@ YZEC.StatusEffects = {
85
168
statuses : [ 'slowAction' ] ,
86
169
} ,
87
170
] ,
88
- singleAction : {
89
- id : STATUS_EFFECTS . SINGLE_ACTION ,
90
- label : 'YZEC.CombatTracker.SingleAction' ,
91
- icon : `modules/${ MODULE_ID } /assets/icons/slow-action.svg` ,
92
- statuses : [ 'action' ] ,
93
- } ,
171
+ singleAction : [
172
+ {
173
+ id : STATUS_EFFECTS . SINGLE_ACTION_1 ,
174
+ label : 'YZEC.CombatTracker.SingleAction' ,
175
+ icon : `modules/${ MODULE_ID } /assets/icons/slow-action.svg` ,
176
+ statuses : [ 'action1' ] ,
177
+ } ,
178
+ {
179
+ id : STATUS_EFFECTS . SINGLE_ACTION_2 ,
180
+ label : 'YZEC.CombatTracker.SingleAction' ,
181
+ icon : `modules/${ MODULE_ID } /assets/icons/slow-action.svg` ,
182
+ statuses : [ 'action2' ] ,
183
+ } ,
184
+ {
185
+ id : STATUS_EFFECTS . SINGLE_ACTION_3 ,
186
+ label : 'YZEC.CombatTracker.SingleAction' ,
187
+ icon : `modules/${ MODULE_ID } /assets/icons/slow-action.svg` ,
188
+ statuses : [ 'action3' ] ,
189
+ } ,
190
+ {
191
+ id : STATUS_EFFECTS . SINGLE_ACTION_4 ,
192
+ label : 'YZEC.CombatTracker.SingleAction' ,
193
+ icon : `modules/${ MODULE_ID } /assets/icons/slow-action.svg` ,
194
+ statuses : [ 'action4' ] ,
195
+ } ,
196
+ {
197
+ id : STATUS_EFFECTS . SINGLE_ACTION_5 ,
198
+ label : 'YZEC.CombatTracker.SingleAction' ,
199
+ icon : `modules/${ MODULE_ID } /assets/icons/slow-action.svg` ,
200
+ statuses : [ 'action5' ] ,
201
+ } ,
202
+ {
203
+ id : STATUS_EFFECTS . SINGLE_ACTION_6 ,
204
+ label : 'YZEC.CombatTracker.SingleAction' ,
205
+ icon : `modules/${ MODULE_ID } /assets/icons/slow-action.svg` ,
206
+ statuses : [ 'action6' ] ,
207
+ } ,
208
+ {
209
+ id : STATUS_EFFECTS . SINGLE_ACTION_7 ,
210
+ label : 'YZEC.CombatTracker.SingleAction' ,
211
+ icon : `modules/${ MODULE_ID } /assets/icons/slow-action.svg` ,
212
+ statuses : [ 'action7' ] ,
213
+ } ,
214
+ {
215
+ id : STATUS_EFFECTS . SINGLE_ACTION_8 ,
216
+ label : 'YZEC.CombatTracker.SingleAction' ,
217
+ icon : `modules/${ MODULE_ID } /assets/icons/slow-action.svg` ,
218
+ statuses : [ 'action8' ] ,
219
+ } ,
220
+ {
221
+ id : STATUS_EFFECTS . SINGLE_ACTION_9 ,
222
+ label : 'YZEC.CombatTracker.SingleAction' ,
223
+ icon : `modules/${ MODULE_ID } /assets/icons/slow-action.svg` ,
224
+ statuses : [ 'action9' ] ,
225
+ } ,
226
+ ] ,
94
227
} ;
95
228
96
229
/* ------------------------------------------ */
0 commit comments