@@ -192,11 +192,16 @@ public static String getWeaponPsWithExtra(TrooperProfile trooperProfile, Weapon
192192 }
193193
194194 public static String getWeaponSavingRollWithExtra (TrooperProfile trooperProfile , Weapon weapon ) {
195+ return getWeaponSavingRollWithExtra (trooperProfile , weapon , true );
196+ }
197+
198+
199+ public static String getWeaponSavingRollWithExtra (TrooperProfile trooperProfile , Weapon weapon , boolean applyViral ) {
195200 if (weapon == null ) {
196201 return "" ;
197202 }
198203 if (trooperProfile == null ) {
199- getSavingRoll (weapon , weapon .getProbabilityOfSurvival (), null );
204+ getSavingRoll (weapon , weapon .getProbabilityOfSurvival (), null , applyViral );
200205 }
201206 String modifiedPs = getWeaponPsWithExtra (trooperProfile , weapon );
202207 if (weapon .getProbabilityOfSurvival () == null || weapon .getProbabilityOfSurvival ().equals ("*" )) {
@@ -205,10 +210,10 @@ public static String getWeaponSavingRollWithExtra(TrooperProfile trooperProfile,
205210 if (weapon .getSaving ().equals ("-" ) || weapon .getSaving ().isEmpty ()) {
206211 return weapon .getProbabilityOfSurvival ();
207212 }
208- return getSavingRoll (weapon , null , trooperProfile ); //PARA weapons
213+ return getSavingRoll (weapon , null , trooperProfile , applyViral ); //PARA weapons
209214 }
210215
211- return getSavingRoll (weapon , modifiedPs , trooperProfile );
216+ return getSavingRoll (weapon , modifiedPs , trooperProfile , applyViral );
212217 }
213218
214219 public static String getCcRangeText (MartialArtLevel martialArtLevel ) {
@@ -218,7 +223,7 @@ public static String getCcRangeText(MartialArtLevel martialArtLevel) {
218223 return "CC [MA Att./Opp: %s/%s]" .formatted (martialArtLevel .getAttackerModi (), martialArtLevel .getOpponentModi ());
219224 }
220225
221- public static String getSavingRoll (Weapon weapon , String ps , TrooperProfile trooperProfile ) {
226+ public static String getSavingRoll (Weapon weapon , String ps , TrooperProfile trooperProfile , boolean applyViral ) {
222227 final String psOp ;
223228 if (ps == null || "-" .equals (ps )) {
224229 psOp = "" ;
@@ -244,7 +249,8 @@ public static String getSavingRoll(Weapon weapon, String ps, TrooperProfile troo
244249 if (weapon .getProperties ().contains ("Continous Damage" ) || weaponExtra .contains ("Continous Damage" )) {
245250 extraList .add ("C" );
246251 }
247- if ((weapon .getAmmunition () != null && weapon .getAmmunition ().getName ().contains ("Shock" )) || weaponExtra .contains ("Shock" ) || weapon .getProperties ().contains (VIRAL_TRAIT )) {
252+ if ((weapon .getAmmunition () != null && weapon .getAmmunition ().getName ().contains ("Shock" )) || weaponExtra .contains ("Shock" ) ||
253+ (weapon .getProperties ().contains (VIRAL_TRAIT ) && applyViral )) {
248254 extraList .add ("S" );
249255 }
250256 if ((weapon .getAmmunition () != null && weapon .getAmmunition ().getName ().contains ("E/M" ))) {
@@ -262,7 +268,7 @@ public static String getSavingRoll(Weapon weapon, String ps, TrooperProfile troo
262268 String extraString = extraList .isEmpty () ? "" : " " + Joiner .on (" " ).join (extraList );
263269
264270 final String savingNumber ;
265- if (weapon .getProperties ().contains (VIRAL_TRAIT )) {
271+ if (weapon .getProperties ().contains (VIRAL_TRAIT ) && applyViral ) {
266272 savingNumber = "2" ;
267273 } else {
268274 savingNumber = weapon .getSavingNum ();
@@ -277,13 +283,28 @@ public static String getRangeModifier(Weapon.RangeModifier rangeModifier, boolea
277283 rangeModifier .modifier ());
278284 }
279285
280- public static String getWeaponPropertiesString (Weapon weapon , boolean showSavingRollInsteadOfAmmo ) {
281- return weapon .getProperties ().stream ()
286+ public static String getAmmo (Weapon weapon ) {
287+ if (weapon == null || weapon .getAmmunition () == null ) {
288+ return "" ;
289+ }
290+ if (weapon .getProperties ().stream ().anyMatch (VIRAL_TRAIT ::equals )) {
291+ return "%s+Bio" .formatted (weapon .getAmmunition ().getName ());
292+ }
293+ return weapon .getAmmunition ().getName ();
294+ }
295+
296+ public static String getWeaponPropertiesString (TrooperProfile trooperProfile , Weapon weapon , boolean showSavingRollInsteadOfAmmo ) {
297+ List <String > traits = weapon .getProperties ().stream ()
282298 .map (PrintUtils ::stripTeardropSuffix )
283299 .filter (s -> !REMOVE_WEAPON_TRAITS .contains (s ))
284300 .filter (s -> !CC_PROPERTY .equals (s )) //shown in range
285301 .filter (s -> !VIRAL_TRAIT .equals (s ) || !showSavingRollInsteadOfAmmo )
286- .collect (Collectors .joining (", " ));
302+ .collect (Collectors .toList ());
303+
304+ if (showSavingRollInsteadOfAmmo && weapon .getProperties ().stream ().anyMatch (VIRAL_TRAIT ::equals )) {
305+ traits .add ("%s vs STR" .formatted (getWeaponSavingRollWithExtra (trooperProfile , weapon , false )));
306+ }
307+ return Joiner .on (", " ).join (traits );
287308 }
288309
289310 public static String stripTeardropSuffix (String input ) {
0 commit comments