@@ -30,6 +30,7 @@ Library Source
3030 }
3131 */
3232 var input = encounterCreature . Creature ;
33+ var inputCard = encounterCreature . Card ;
3334 try
3435 {
3536 var output = new FoundryCreatureAndErrors ( ) ;
@@ -45,26 +46,26 @@ Library Source
4546 result . abilities . wis . value = input . Wisdom . Score ;
4647 result . abilities . cha . value = input . Charisma . Score ;
4748
48- result . attributes . hp . value = input . HP ;
49- result . attributes . init . value = input . Initiative ;
49+ result . attributes . hp . value = inputCard . HP ;
50+ result . attributes . init . value = inputCard . Initiative ;
5051
51- var halfLevel = input . Level / 2 ;
52+ var halfLevel = inputCard . Level / 2 ;
5253
53- result . defences . ac . value = input . AC - halfLevel ;
54- result . defences . fort . value = input . Fortitude - halfLevel ;
55- result . defences . refValue . value = input . Reflex - halfLevel ;
56- result . defences . wil . value = input . Will - halfLevel ;
54+ result . defences . ac . value = inputCard . AC - halfLevel ;
55+ result . defences . fort . value = inputCard . Fortitude - halfLevel ;
56+ result . defences . refValue . value = inputCard . Reflex - halfLevel ;
57+ result . defences . wil . value = inputCard . Will - halfLevel ;
5758
5859 var details = result . details ;
5960 details . bloodied = input . HP / 2 ;
6061 details . surgeValue = input . HP / 4 ;
61- details . surges . value = ( Math . Max ( input . Level - 1 , 1 ) / 10 ) + 1 ;
62+ details . surges . value = ( Math . Max ( inputCard . Level - 1 , 1 ) / 10 ) + 1 ;
6263 details . origin = input . Origin . ToString ( ) . ToLowerInvariant ( ) ;
6364 details . typeValue = input . Type . ToString ( ) . ToLowerInvariant ( ) ;
64- details . level = input . Level ;
65+ details . level = inputCard . Level ;
6566 details . size = SizeToString ( input . Size ) ;
66- details . exp = encounterCreature . Card . XP ;
67-
67+ details . exp = inputCard . XP ;
68+
6869 switch ( input . Role )
6970 {
7071 case ComplexRole role :
@@ -137,7 +138,7 @@ Library Source
137138 break ;
138139 }
139140
140- var movetest = input . Movement . Split ( ',' ) . First ( ) ;
141+ var movetest = inputCard . Movement . Split ( ',' ) . First ( ) ;
141142 if ( Int32 . TryParse ( movetest . Trim ( ) , out var moveDist ) )
142143 {
143144 result . movement . baseValue . value = moveDist ;
@@ -159,27 +160,27 @@ Library Source
159160 result . movement . custom = input . Movement ;
160161 details . other = input . Keywords ;
161162 details . alignment = input . Alignment ;
162-
163- var skills = ProcessSkills ( input , errors ) ;
163+
164+ var skills = ProcessSkills ( inputCard , errors ) ;
164165 result . skills = skills ;
165166
166167 AddValueToBio ( input . Languages , "Languages" , result ) ;
167168 AddValueToBio ( input . Tactics , "Tactics" , result , monsterKnowledgeHardDescription ) ;
168169
169- if ( input . Regeneration != null )
170+ if ( inputCard . Regeneration != null )
170171 {
171172 AddValueToBio ( input . Regeneration . ToString ( ) , "Regeneration" , result , monsterKnowledgeHardDescription ) ;
172173 }
173174
174- result . senses = FoundrySensesHelper . ProcessSenses ( input . Senses ) ;
175+ result . senses = FoundrySensesHelper . ProcessSenses ( inputCard . Senses ) ;
175176
176- ProcessDamageModifiers ( input , result , monsterKnowledgeHardDescription ) ;
177+ ProcessDamageModifiers ( inputCard , result , monsterKnowledgeHardDescription ) ;
177178
178179 AddValueToBio ( input . Equipment , "Equipment" , result ) ;
179180
180181 List < FoundryPower > powers = output . Creature . Powers ;
181182 List < FoundryTrait > traits = output . Creature . Traits ;
182- foreach ( var power in input . CreaturePowers )
183+ foreach ( var power in inputCard . CreaturePowers )
183184 {
184185 if ( power . Category == CreaturePowerCategory . Trait )
185186 {
@@ -201,7 +202,7 @@ Library Source
201202 powers . Sort ( new PowerComparer ( ) ) ;
202203
203204 var auraTraitList = new List < FoundryTrait > ( ) ;
204- var auras = ProcessAuras ( input , result , errors , monsterKnowledgeHardDescription , auraTraitList ) ;
205+ var auras = ProcessAuras ( inputCard , result , errors , monsterKnowledgeHardDescription , auraTraitList ) ;
205206 traits . AddRange ( auraTraitList ) ;
206207 if ( auras != null )
207208 {
@@ -213,7 +214,7 @@ Library Source
213214 output . Creature . creature = input ;
214215 }
215216
216- GenerateMonsterKnowledgeBlocks ( output , input , monsterKnowledgeHardDescription ) ;
217+ GenerateMonsterKnowledgeBlocks ( output , inputCard , monsterKnowledgeHardDescription , input . Size ) ;
217218
218219 var usefulStuff = new FoundryTrait
219220 {
@@ -235,8 +236,8 @@ Library Source
235236 }
236237
237238 private static void GenerateMonsterKnowledgeBlocks ( FoundryCreatureAndErrors creatureAndErrors ,
238- ICreature creature ,
239- FoundryPowerDescription hardDescription )
239+ EncounterCard creature ,
240+ FoundryPowerDescription hardDescription , CreatureSize creatureSize )
240241 {
241242 var medKnowledge = new FoundryTrait
242243 {
@@ -245,11 +246,19 @@ private static void GenerateMonsterKnowledgeBlocks(FoundryCreatureAndErrors crea
245246 img = "icons/svg/book.svg"
246247
247248 } ;
249+
250+
251+
248252 var description = medKnowledge . data . description ;
249- description . value += $ "<h1>{ creatureAndErrors . Name } </h1>\n ";
253+ description . value += $ "<h1>{ creatureAndErrors . Creature . Name } </h1>\n ";
254+ var titleRemains = creature . Title . Replace ( creatureAndErrors . Creature . Name , "" ) ;
255+ if ( titleRemains . Trim ( ) != "" )
256+ {
257+ description . value += $ "<h2>{ titleRemains . Trim ( ) } </h2>\n ";
258+ }
250259 var data = creatureAndErrors . Creature . Data ;
251260 var secondaryType = data . details . role . secondary == "standard" ? "" : data . details . role . secondary ;
252- description . value += $ "<p><b>Role: </b>level { data . details . level } { creature . Size } { secondaryType } { data . details . role . primary } ";
261+ description . value += $ "<p><b>Role: </b>level { data . details . level } { creatureSize } { secondaryType } { data . details . role . primary } ";
253262 if ( data . details . role . leader )
254263 {
255264 description . value += " (leader)</p>\n " ;
@@ -281,11 +290,11 @@ private static void GenerateMonsterKnowledgeBlocks(FoundryCreatureAndErrors crea
281290 // prefix on the medium stuff
282291 hardDescription . value = medKnowledge . data . description . value + hardDescription . value ;
283292
284- hardDescription . value += $ "<h2>Powers</h2>\n <table> ";
293+ hardDescription . value += $ "<h2>Powers</h2>\n ";
285294
286295 foreach ( var power in creatureAndErrors . Creature . Powers )
287296 {
288- hardDescription . value += $ "<tr><td>< b>{ power . name } </b></td><td> { power . data . description . chat } </td></tr >\n ";
297+ hardDescription . value += $ "<p>< b>{ power . name } </b><br/> { power . data . description . chat } </p >\n ";
289298 power . data . description . chat = "" ;
290299 }
291300 hardDescription . value += $ "</table>\n ";
@@ -295,7 +304,7 @@ private static void GenerateMonsterKnowledgeBlocks(FoundryCreatureAndErrors crea
295304 hardDescription . value += $ "<h2>Traits</h2>\n <table>";
296305 foreach ( var trait in creatureAndErrors . Creature . Traits )
297306 {
298- hardDescription . value += $ "<tr><td>< b>{ trait . name } </b></td><td> { trait . data . description . value } </td></tr >\n ";
307+ hardDescription . value += $ "<p>< b>{ trait . name } </b><br/> { trait . data . description . value } </p >\n ";
299308 }
300309 hardDescription . value += $ "</table>\n ";
301310 }
@@ -350,7 +359,7 @@ private static FoundryTrait ProcessTrait(CreaturePower power, List<string> error
350359 return result ;
351360 }
352361
353- private static void ProcessDamageModifiers ( ICreature input , FoundryCreatureData result ,
362+ private static void ProcessDamageModifiers ( EncounterCard input , FoundryCreatureData result ,
354363 FoundryPowerDescription monsterKnowledgeHardDescription )
355364 {
356365 var immunities = "" ;
@@ -456,7 +465,7 @@ private static string RemoveComma(string input)
456465 return input . StartsWith ( ", " ) ? input . Substring ( 2 ) : input ;
457466 }
458467
459- private static Skills ProcessSkills ( ICreature input , List < string > errors )
468+ private static Skills ProcessSkills ( EncounterCard input , List < string > errors )
460469 {
461470 var skillArray = Regex . Split ( input . Skills , @"[\,\;]" )
462471 . Select ( x => x . Trim ( ) )
@@ -561,7 +570,7 @@ private static Skills ProcessSkills(ICreature input, List<string> errors)
561570 return skillsHolder ;
562571 }
563572
564- private static Dictionary < string , object > ProcessAuras ( ICreature input , FoundryCreatureData output ,
573+ private static Dictionary < string , object > ProcessAuras ( EncounterCard input , FoundryCreatureData output ,
565574 List < string > errors , FoundryPowerDescription hardDescription , List < FoundryTrait > auraTraits )
566575 {
567576 if ( input . Auras != null && input . Auras . Any ( ) )
0 commit comments