@@ -303,7 +303,7 @@ class Statblock {
303303 } else return '>> NO MECH SELECTED <<'
304304 }
305305
306- public static GenerateNPC ( npc : Unit , includeNarrative : boolean ) : string {
306+ public static GenerateNPC ( npc : Unit , includeNarrative : boolean , includeFeatures = false ) : string {
307307 let output = `// ${ npc . Name } //\n`
308308 if ( npc . NpcTemplateController . Templates )
309309 output += `${ npc . NpcTemplateController . Templates . map ( t => t . Name ) . join ( ' ' ) } `
@@ -345,9 +345,9 @@ class Statblock {
345345 ( item , index ) => `${ item . Name } ${ linebreak ( index , npc . NpcFeatureController . Features . length ) } `
346346 ) . join ( '' )
347347
348- if ( includeNarrative ) {
349- output += this . generateNarrativeBlock ( npc )
350- }
348+ if ( includeNarrative ) output += this . generateNarrativeBlock ( npc )
349+
350+ if ( includeFeatures ) output += this . getFeatures ( npc , true )
351351
352352 return output
353353 }
@@ -379,10 +379,16 @@ class Statblock {
379379 'SensorRange'
380380 ) } | TECH_ATK: ${ npc . StatController . getMax ( 'Tech Attack' ) } | SIZE: ${ npc . StatController . getMax ( 'Size' ) } \n\n`
381381
382- output += '[ FEATURES ]\n'
383- if ( includeFeatures ) {
382+ output += this . getFeatures ( npc , includeFeatures )
383+
384+ return output
385+ }
386+
387+ private static getFeatures ( npc : Unit , showFeatureDetails = false ) : string {
388+ let output = '[ FEATURES ]\n'
389+ if ( showFeatureDetails ) {
384390 output += npc . NpcFeatureController . Features . map (
385- ( item , index ) =>
391+ item =>
386392 `${ item . Name } \n ${ ( item . Description || item . EffectByTier ( npc . Tier ) || '' ) ?. replace ( / < [ ^ > ] * > / gi, '' ) || '' } ${ item . Actions ? mapNpcActions ( item . Actions , npc . Tier ) : '' } ${ mapNpcWeaponStats ( item as NpcWeapon , npc . Tier ) } `
387393 ) . join ( '\n' )
388394 } else {
@@ -391,7 +397,6 @@ class Statblock {
391397 ( item , index ) => `${ item . Name } ${ linebreak ( index , npc . NpcFeatureController . Features . length ) } `
392398 ) . join ( '\n' )
393399 }
394-
395400 return output
396401 }
397402
0 commit comments