-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathCOM_5ePack - Procedures.user
456 lines (395 loc) · 14.4 KB
/
COM_5ePack - Procedures.user
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
<?xml version="1.0" encoding="UTF-8"?>
<document signature="Hero Lab Data">
<loadonce key="COM_5ePack - Procedures"/>
<fileinfo>
<info_author>Tim Shadow
Email: [email protected]</info_author>
<info_history>January 14, 2016
-Created new to hold procedures for the new 5e Pack.</info_history>
</fileinfo>
<procedure id="5CAddProf" context="pick"><![CDATA[
~ This procedure allows for giving a central Tab to add
~ proficiencies for skills, tools, or Skill/Tool combo.
~ This is useful for allowing the Tools to display correctly
~ on the "Skills" tab.
~ Timing: Post-Level/10000
~ Parms In:
~ NumOfProf - Use this for adding additional Skills & Tools
~ NumOfTool - Use this for adding ONLY Tool choices.
~ NumOfSkill - Use this for adding ONLY Skill choices.
~ Example Use for allowing both a Skill/Tool choice
~ var NumOfProf as number
~ NumOfProf = 1
~ call 5CAddProf
~ Example Use for allowing only Skill choices
~ var NumOfProf as number
~ NumOfSkill = 1
~ call 5CAddProf
~ Example Use for allowing only Tool choices
~ var NumOfProf as number
~ NumOfTool = 1
~ call 5CAddProf
var NumOfProf as number
var NumOfSkill as number
var NumOfTool as number
~ If a combination of Tools/Skills is allowed add here
if (NumOfProf <> 0) then
hero.childfound[cfg5CProf].field[cToolMax].value += NumOfProf
hero.childfound[cfg5CProf].field[cSkillMax].value += NumOfProf
endif
~ If only skills are allowed add here
if (NumOfSkill <> 0) then
hero.childfound[cfg5CProf].field[cSkillMax2].value += NumOfSkill
endif
~ If only tools are allowed add here
if (NumOfTool <> 0) then
hero.childfound[cfg5CProf].field[cToolMax2].value += NumOfTool
endif]]></procedure>
<procedure id="5Cfoctocls" context="pick"><![CDATA[
doneif (isroot = 0)
if (root.tagis[component.Class] <> 0) then
perform root.setfocus
elseif (root.tagis[component.Configure] <> 0) then
perform root.setfocus
else
if (root.islinkage[table] <> 0) then
perform root.linkage[table].setfocus
elseif (root.islinkage[varies] <> 0) then
perform root.linkage[varies].setfocus
endif
endif
doneif (state.isfocus = 0)
~ We could also be in a table on a configureable, so stop if that is where
~ we are.
doneif (focus.tagis[component.Configure] <> 0)]]></procedure>
<procedure id="S2SeleText" context="pick"><![CDATA[
~ For adjustment use only. Select where the text is coming from.
~ Either the Duration field or the Source field.
~ 1 = Source
~ 2 = Duration
var S2Type as number
~ If the default "(duration)" text is changed then attempt to use it.
If (compare(field[pDuration].text,"(duration)") <> 0) Then
~ Make sure that we are not blank either.
If (compare(field[pDuration].text,"") <> 0) Then
S2Type = 2
Endif
Endif
~ If the default "(source)" text is changed then attempt to use it.
If (compare(field[pSource].text,"(source)") <> 0) Then
~ Make sure that we are not blank either.
If (compare(field[pSource].text,"") <> 0) Then
S2Type = 1
Endif
Endif]]></procedure>
<procedure id="S2SetName" context="pick"><![CDATA[
~Set the Custom Name and Custom Text adjustments logic into this single
~procedure. We need to allow for using the Duration field or the Source
~field for setting the name so that we are backwards compatable.
~Timing: Render/99999999
~ 1 = Source
~ 2 = Duration
var S2Type as number
~ Figure out if we are to use Duration or Source text
Call S2SeleText
~ The tag AdjShadow.Name means we are totally overwriting the live name value
If (tagis[AdjShadow.Name] <> 0) Then
~ Source field has text to use so use it
If (S2Type = 1) Then
field[pChosen].chosen.field[livename].text = field[pSource].text
field[pChosen].chosen.field[sbName].text = field[pSource].text
~ Duration field has text and Source does not so use it
ElseIf (S2Type = 2) Then
field[pChosen].chosen.field[livename].text = field[pDuration].text
field[pChosen].chosen.field[sbName].text = field[pDuration].text
Endif
~ The tag AdjShadow.Text means we are appending to the live name value
ElseIf (tagis[AdjShadow.Text] <> 0) Then
~ Source field has text to use so use it
If (S2Type = 1) Then
field[pChosen].chosen.field[livename].text &= field[pSource].text
field[pChosen].chosen.field[sbName].text &= field[pSource].text
~ Duration field has text and Source does not so use it
ElseIf (S2Type = 2) Then
field[pChosen].chosen.field[livename].text &= field[pDuration].text
field[pChosen].chosen.field[sbName].text &= field[pDuration].text
Endif
Endif]]></procedure>
<procedure id="5CSplSchSF" context="pick"><![CDATA[
~ This procedure is for "Spell School - Spell Focus" logic.
~ We are called from every spell school pick to give a 1/2
~ proficiency bonus to that school of magic.
~ If we do not have spell focus then get out now!
doneif (tagis[Broadcast.SpellFocus] = 0)
~ We need to apply "half" our proficiency bonus to this
~ school of magic.
field[schDC].value += round(hero.child[ProfBonus].field[tProfBonus].value/2,0,-1)]]></procedure>
<procedure id="5CSizeChg" context="pick"><![CDATA[
~ This procedure tries to centralize all the logic of changing
~ a characters size for the 5e Community. So far the best timing
~ appears to be First/20000
~ Example use:
~ Sizemod is the +/- change to characters's size.
~ var sizemod as number
~ sizemod = 1
~ Call 5CSizeChg
~ I have implented the DMG size change rule of dice size changing:
~ Hit Die - Page: 276
~ Tiny: d4
~ Small: d6
~ Medium: d8
~ Large: d10
~ Huge: d12
~ Gargantuan: d20
~ Sizemod is the +/- change to apply to the hero's size.
var sizemod as number
var iX as number
sizemod = field[pAdjust].value
~ If no size mode then we are done!
doneif (sizemod = 0)
~ Add to size - must come after race and template size set
herofield[tSize].value += sizemod
~ Make sure the user didn't try to adjust size greater than Gargantuan (+3), or
~ smaller than Tiny (-2)
herofield[tSize].value = maximum(herofield[tSize].value, -2)
herofield[tSize].value = minimum(herofield[tSize].value, 3)
~ Set pointer to our base race
perform hero.findchild[BaseRace].setfocus
doneif (state.isfocus = 0)
~ Based on the races final size reset the hit dice size
~ Tiny
If (herofield[tSize].value = -2) then
focus.field[rHDSides].value = 4
~ Small
ElseIf (herofield[tSize].value = -1) then
focus.field[rHDSides].value = 6
~ Medium
ElseIf (herofield[tSize].value = 0) then
focus.field[rHDSides].value = 8
~ Large
ElseIf (herofield[tSize].value = 1) then
focus.field[rHDSides].value = 10
~ Huge
ElseIf (herofield[tSize].value = 2) then
focus.field[rHDSides].value = 12
~ Gargantuan
ElseIf (herofield[tSize].value = 3) then
focus.field[rHDSides].value = 20
Endif]]></procedure>
<procedure id="5CSetSize" context="pick"><![CDATA[
~ This procedure forces a charcter to be a specific size no matter the
~ starting size of the character. In example force the character
~ to always be size large!
~ So far the best timing appears to be First/20000
~ Tiny: -2
~ Small: -1
~ Medium: 0
~ Large: 1
~ Huge: 2
~ Gargantuan: 3
~ Example use:
~ sizetarget is the new characters size
~ var sizetarget as number
~ sizemod = 3
~ Call 5CSetSize
~ sizetarget is our incoming variable - the tSize that the character will be set to
var sizetarget as number
~ sizemod is our outgoing variable - the modifier to the existing tSize
~ that's needed in order to get to that target size
var sizemod as number
~ Make sure the user didn't try to adjust size greater than Gargantuan (+3), or
~ smaller than Tiny (-2)
sizetarget = maximum(sizetarget, -2)
sizetarget = minimum(sizetarget, 3)
~ Calculate the modifier we need
sizemod = sizetarget - herofield[tSize].value
~ call the Size Change procedure
Call 5CSizeChg]]></procedure>
<procedure id="5CSkProfDo" context="pick"><![CDATA[~ procedure to grant proficiency or double if already proficient
~ Must run at Post-Levels/15500
~ called by declaring variable and then procedure
~ var v_SkillID as string
~ v_SkillID = "skPerform"
~ call 5CSkProfDo
var v_SkillID as string
~ Make a Target.? skill id to be used in the find chile
v_SkillID = "Target." & v_SkillID
~ Set focus to the skill id passed in
perform hero.findchild[BaseSkill,v_SkillID].setfocus
doneif (state.isfocus = 0)
~ If not proficient then make skill proficient
if (focus.tagis[Helper.Proficient] = 0) then
perform focus.assign[Helper.Proficient]
~..Else if already proficient make double proficient
elseif (focus.tagis[Helper.Proficient] <> 0) then
perform focus.assign[Helper.ProfDouble]
endif]]></procedure>
<procedure id="5CShowSpls" context="pick"><![CDATA[~This procedure is called to make spells display as useable by spell slots when
~They are added by something (feat, racial, etc.). They're usually usable as
~#/Long Rest and described as also castable if you have the appropriate spell slots.
~First we set each spell slot level as a variable
var i1st as number
var i2nd as number
var i3rd as number
var i4th as number
var i5th as number
var i6th as number
var i7th as number
var i8th as number
var i9th as number
~Then we test for whether they're a warlock, and adjust the variables for what they
~can cast
if (#levelcount[Warlock] >= 1) then
i1st += 1
if (#levelcount[Warlock] >= 9) then
i5th += 1
i4th += 1
i3rd += 1
i2nd += 1
elseif (#levelcount[Warlock] >= 7) then
i4th += 1
i3rd += 1
i2nd += 1
elseif (#levelcount[Warlock] >= 5) then
i3rd += 1
i2nd += 1
elseif (#levelcount[Warlock] >= 3) then
i2nd += 1
endif
endif
~Then we test standard spell slots, again adjusting for what we have available
~Since upcasting is a thing, we just need to test for the highest
if (hero.childfound[SlotHold9].field[MaxAllow].value > 0) then
i9th += 1
i8th += 1
i7th += 1
i6th += 1
i5th += 1
i4th += 1
i3rd += 1
i2nd += 1
i1st += 1
elseif (hero.childfound[SlotHold8].field[MaxAllow].value > 0) then
i8th += 1
i7th += 1
i6th += 1
i5th += 1
i4th += 1
i3rd += 1
i2nd += 1
i1st += 1
elseif (hero.childfound[SlotHold7].field[MaxAllow].value > 0) then
i7th += 1
i6th += 1
i5th += 1
i4th += 1
i3rd += 1
i2nd += 1
i1st += 1
elseif (hero.childfound[SlotHold6].field[MaxAllow].value > 0) then
i6th += 1
i5th += 1
i4th += 1
i3rd += 1
i2nd += 1
i1st += 1
elseif (hero.childfound[SlotHold5].field[MaxAllow].value > 0) then
i5th += 1
i4th += 1
i3rd += 1
i2nd += 1
i1st += 1
elseif (hero.childfound[SlotHold4].field[MaxAllow].value > 0) then
i4th += 1
i3rd += 1
i2nd += 1
i1st += 1
elseif (hero.childfound[SlotHold3].field[MaxAllow].value > 0) then
i3rd += 1
i2nd += 1
i1st += 1
elseif (hero.childfound[SlotHold2].field[MaxAllow].value > 0) then
i2nd += 1
i1st += 1
elseif (hero.childfound[SlotHold1].field[MaxAllow].value > 0) then
i1st += 1
endif
~Then we roll through the variables. If they're > 0, that means we have a spell slot
~We already added the Custom.OnlyIfCaster# when the spell was bootstrapped to the
~thing that gave the spell. We delete the [Hide.Spell] tag that was also already added
~with the bootstrap. Now the spell will show up as castable with slots.
if (i1st > 0) then
foreach pick in hero from BaseSpell where "Custom.OnlyIfCaster1"
perform eachpick.delete[Hide.Spell]
nexteach
endif
if (i2nd > 0) then
foreach pick in hero from BaseSpell where "Custom.OnlyIfCaster2"
perform eachpick.delete[Hide.Spell]
nexteach
endif
if (i3rd > 0) then
foreach pick in hero from BaseSpell where "Custom.OnlyIfCaster3"
perform eachpick.delete[Hide.Spell]
nexteach
endif
if (i4th > 0) then
foreach pick in hero from BaseSpell where "Custom.OnlyIfCaster4"
perform eachpick.delete[Hide.Spell]
nexteach
endif
if (i5th > 0) then
foreach pick in hero from BaseSpell where "Custom.OnlyIfCaster5"
perform eachpick.delete[Hide.Spell]
nexteach
endif
if (i6th > 0) then
foreach pick in hero from BaseSpell where "Custom.OnlyIfCaster6"
perform eachpick.delete[Hide.Spell]
nexteach
endif
if (i7th > 0) then
foreach pick in hero from BaseSpell where "Custom.OnlyIfCaster7"
perform eachpick.delete[Hide.Spell]
nexteach
endif
if (i8th > 0) then
foreach pick in hero from BaseSpell where "Custom.OnlyIfCaster8"
perform eachpick.delete[Hide.Spell]
nexteach
endif
if (i9th > 0) then
foreach pick in hero from BaseSpell where "Custom.OnlyIfCaster9"
perform eachpick.delete[Hide.Spell]
nexteach
endif]]></procedure>
<procedure id="5CSetName" context="pick"><![CDATA[
~Set the Custom Name and Custom Text adjustments logic into this single
~procedure. We need to allow for using the Duration field or the Source
~field for setting the name so that we are backwards compatable.
~Timing: Render/99999999
~ 1 = Source
~ 2 = Duration
var S2Type as number
~ Figure out if we are to use Duration or Source text
Call S2SeleText
~ The tag AdjShadow.Name means we are totally overwriting the live name value
If (tagis[AdjShadow.Name] <> 0) Then
~ Source field has text to use so use it
If (S2Type = 1) Then
field[pChosen].chosen.field[livename].text = field[pSource].text
~ Duration field has text and Source does not so use it
ElseIf (S2Type = 2) Then
field[pChosen].chosen.field[livename].text = field[pDuration].text
Endif
~ The tag AdjShadow.Text means we are appending to the live name value
ElseIf (tagis[AdjShadow.Text] <> 0) Then
~ Source field has text to use so use it
If (S2Type = 1) Then
field[pChosen].chosen.field[livename].text &= field[pSource].text
~ Duration field has text and Source does not so use it
ElseIf (S2Type = 2) Then
field[pChosen].chosen.field[livename].text &= field[pDuration].text
Endif
Endif]]></procedure>
</document>