3232 */
3333package mekhq .campaign .universe .factionStanding .enums ;
3434
35+ import static java .lang .Math .round ;
3536import static mekhq .utilities .MHQInternationalization .getFormattedTextAt ;
3637import static mekhq .utilities .MHQInternationalization .getTextAt ;
3738import static mekhq .utilities .MHQInternationalization .isResourceKeyValid ;
38- import static mekhq .utilities .ReportingUtilities .CLOSING_SPAN_TAG ;
39- import static mekhq .utilities .ReportingUtilities .getNegativeColor ;
40- import static mekhq .utilities .ReportingUtilities .getPositiveColor ;
41- import static mekhq .utilities .ReportingUtilities .getWarningColor ;
42- import static mekhq .utilities .ReportingUtilities .spanOpeningWithCustomColor ;
4339
4440import java .util .ArrayList ;
4541import java .util .List ;
4642
4743import megamek .codeUtilities .MathUtility ;
4844import megamek .logging .MMLogger ;
45+ import mekhq .campaign .CampaignOptions ;
4946import mekhq .campaign .universe .Faction ;
47+ import mekhq .gui .dialog .reportDialogs .FactionStanding .FactionStandingReport ;
5048
5149/**
5250 * Represents a standing level within the Faction Standing reputation system.
@@ -73,7 +71,7 @@ public enum FactionStandingLevel {
7371 STANDING_LEVEL_2 (2 , -40 , -25 , -2 , 0.5 , false , false , true , 1 , 0 , 1.75 , -1 , 0.8 , -1 , -2 ),
7472 STANDING_LEVEL_3 (3 , -25 , -10 , -1 , 0.75 , false , false , true , 2 , 0 , 1.5 , 0 , 0.9 , 0 , -1 ),
7573 STANDING_LEVEL_4 (4 , -10 , 10 , 0 , 1.0 , false , false , true , 3 , 0 , 1.0 , 0 , 1.0 , 0 , 0 ),
76- STANDING_LEVEL_5 (5 , 10 , 25 , 1 , 1.9 , false , false , true , 4 , 0 , 1.0 , 0 , 1.05 , 0 , 1 ),
74+ STANDING_LEVEL_5 (5 , 10 , 25 , 1 , 1.25 , false , false , true , 4 , 0 , 1.0 , 0 , 1.05 , 0 , 1 ),
7775 STANDING_LEVEL_6 (6 , 25 , 40 , 2 , 1.5 , false , false , true , 5 , 0 , 0.85 , 1 , 1.1 , 1 , 1 ),
7876 STANDING_LEVEL_7 (7 , 40 , 50 , 3 , 1.75 , true , false , true , 10 , 1 , 0.80 , 2 , 1.15 , 1 , 2 ),
7977 STANDING_LEVEL_8 (8 , 50 , Integer .MAX_VALUE , 4 , 2.0 , true , false , true , 15 , 2 , 0.75 , 3 , 1.2 , 2 , 3 );
@@ -418,6 +416,14 @@ public String getDescription(Faction relevantFaction) {
418416 return label ;
419417 }
420418
419+ /**
420+ * Use {@link #getEffectsDescription(boolean, CampaignOptions)} instead
421+ */
422+ @ Deprecated (since = "0.50.07" , forRemoval = true )
423+ public String getEffectsDescription () {
424+ return getEffectsDescription (false , new CampaignOptions ());
425+ }
426+
421427 /**
422428 * Generates a textual description of all effects based on the current faction standing modifiers.
423429 *
@@ -429,76 +435,74 @@ public String getDescription(Faction relevantFaction) {
429435 * @return a comma-separated {@link String} listing all active faction standing effects; returns
430436 * an empty string if there are no effects.
431437 */
432- public String getEffectsDescription () {
438+ public String getEffectsDescription (boolean isClan , CampaignOptions campaignOptions ) {
439+ MMLogger logger = MMLogger .create (FactionStandingReport .class );
440+ logger .info (this );
433441 List <String > effects = new ArrayList <>();
434442
435- // If we're fetching for STANDING_LEVEL_4, then we're guaranteed not to pass any of the conditionals, so exit.
436- if (this == STANDING_LEVEL_4 ) {
437- return "" ;
443+ if (hasCommandCircuitAccess && campaignOptions .isUseFactionStandingCommandCircuit ()) {
444+ effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.commandCircuit" ));
438445 }
439446
440- if (negotiationModifier != STANDING_LEVEL_4 .getNegotiationModifier ()) {
441- effects .add (getFormattedTextAt (RESOURCE_BUNDLE ,
442- "factionStandingLevel.negotiation" ,
443- getPolarityOfModifier (negotiationModifier )));
447+ if (isOutlawed && campaignOptions .isUseFactionStandingOutlawed ()) {
448+ effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.outlawed" ));
444449 }
445450
446- int resupplyPercentage = (int ) resupplyWeightModifier * 100 ;
447- effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.resupply" , resupplyPercentage ));
448-
449- if (hasCommandCircuitAccess ) {
450- effects .add (getFormattedTextAt (RESOURCE_BUNDLE ,
451- "factionStandingLevel.commandCircuit" ,
452- spanOpeningWithCustomColor (getPositiveColor ()),
453- CLOSING_SPAN_TAG ));
451+ if (isClan && !isBatchallAllowed && campaignOptions .isUseFactionStandingBatchallRestrictions ()) {
452+ effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.batchall" ));
454453 }
455454
456- if (isOutlawed ) {
455+ if (negotiationModifier != 0 && campaignOptions . isUseFactionStandingNegotiation () ) {
457456 effects .add (getFormattedTextAt (RESOURCE_BUNDLE ,
458- "factionStandingLevel.outlawed" ,
459- spanOpeningWithCustomColor (getNegativeColor ()),
460- CLOSING_SPAN_TAG ));
457+ "factionStandingLevel.negotiation" ,
458+ getPolarityOfModifier (negotiationModifier )));
461459 }
462460
463- if (! isBatchallAllowed ) {
464- effects . add ( getFormattedTextAt ( RESOURCE_BUNDLE ,
465- "factionStandingLevel.batchall" ,
466- spanOpeningWithCustomColor ( getWarningColor ()),
467- CLOSING_SPAN_TAG ));
461+ if (resupplyWeightModifier != 1.0
462+ && campaignOptions . isUseStratCon ()
463+ && campaignOptions . isUseFactionStandingResupply ()) {
464+ int resupplyPercentage = ( int ) round ( resupplyWeightModifier * 100 );
465+ effects . add ( getFormattedTextAt ( RESOURCE_BUNDLE , "factionStandingLevel.resupply" , resupplyPercentage ));
468466 }
469467
470- effects .add (getFormattedTextAt (RESOURCE_BUNDLE ,
471- "factionStandingLevel.recruitment.popularity" ,
472- getPolarityOfModifier (recruitmentTickets - STANDING_LEVEL_4 .getRecruitmentTickets ())));
473-
474- if (recruitmentRollsModifier != STANDING_LEVEL_4 .getRecruitmentRollsModifier ()) {
475- effects .add (getFormattedTextAt (RESOURCE_BUNDLE ,
476- "factionStandingLevel.recruitment.rolls" ,
477- getPolarityOfModifier (recruitmentRollsModifier )));
468+ if (campaignOptions .isUseFactionStandingRecruitment ()) {
469+ int ticketsModifier = recruitmentTickets - STANDING_LEVEL_4 .getRecruitmentTickets ();
470+ if (ticketsModifier != 0 ) {
471+ effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.recruitment.popularity" ,
472+ getPolarityOfModifier (ticketsModifier )));
473+ }
474+
475+ if (recruitmentRollsModifier != 0 ) {
476+ effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.recruitment.rolls" ,
477+ getPolarityOfModifier (recruitmentRollsModifier )));
478+ }
478479 }
479480
480- int barracksCostPercentage = (int ) barrackCostsMultiplier * 100 ;
481- effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.barracks" , barracksCostPercentage ));
481+ if (barrackCostsMultiplier != 1.0 && campaignOptions .isUseFactionStandingBarracksCosts ()) {
482+ int barracksCostPercentage = (int ) round (barrackCostsMultiplier * 100 );
483+ effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.barracks" , barracksCostPercentage ));
484+ }
482485
483- if (unitMarketRarityModifier != STANDING_LEVEL_4 .getUnitMarketRarityModifier ()) {
484- effects .add (getFormattedTextAt (RESOURCE_BUNDLE ,
485- "factionStandingLevel.unitMarket" ,
486+ if (unitMarketRarityModifier != 0 && campaignOptions .isUseFactionStandingUnitMarket ()) {
487+ effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.unitMarket" ,
486488 getPolarityOfModifier (unitMarketRarityModifier )));
487489 }
488490
489- int payPercentage = (int ) contractPayMultiplier * 100 ;
490- effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.contractPay" , payPercentage ));
491-
492- if (supportPointModifierContractStart != STANDING_LEVEL_4 .getSupportPointModifierContractStart ()) {
493- effects .add (getFormattedTextAt (RESOURCE_BUNDLE ,
494- "factionStandingLevel.supportPoints.signing" ,
495- getPolarityOfModifier (supportPointModifierContractStart )));
491+ if (contractPayMultiplier != 1.0 && campaignOptions .isUseFactionStandingContractPay ()) {
492+ int payPercentage = (int ) round (contractPayMultiplier * 100 );
493+ effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.contractPay" , payPercentage ));
496494 }
497495
498- if (supportPointModifierPeriodic != STANDING_LEVEL_4 .getSupportPointModifierPeriodic ()) {
499- effects .add (getFormattedTextAt (RESOURCE_BUNDLE ,
500- "factionStandingLevel.supportPoints.periodic" ,
501- getPolarityOfModifier (supportPointModifierContractStart )));
496+ if (campaignOptions .isUseFactionStandingSupportPoints ()) {
497+ if (supportPointModifierContractStart != 0 ) {
498+ effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.supportPoints.signing" ,
499+ getPolarityOfModifier (supportPointModifierContractStart )));
500+ }
501+
502+ if (supportPointModifierPeriodic != 0 ) {
503+ effects .add (getFormattedTextAt (RESOURCE_BUNDLE , "factionStandingLevel.supportPoints.periodic" ,
504+ getPolarityOfModifier (supportPointModifierPeriodic )));
505+ }
502506 }
503507
504508 return String .join (", " , effects );
0 commit comments