4343import static mekhq .utilities .ReportingUtilities .CLOSING_SPAN_TAG ;
4444import static mekhq .utilities .ReportingUtilities .spanOpeningWithCustomColor ;
4545
46+ import java .time .LocalDate ;
4647import java .util .List ;
4748
4849import megamek .common .TargetRoll ;
@@ -92,6 +93,27 @@ public class SkillCheckUtility {
9293 private int roll ;
9394 private boolean usedEdge ;
9495
96+ /**
97+ * Use
98+ * {@link SkillCheckUtility#SkillCheckUtility(Person, String, List, int, boolean, boolean, boolean, boolean,
99+ * LocalDate)} instead
100+ */
101+ @ Deprecated (since = "0.50.07" , forRemoval = true )
102+ public SkillCheckUtility (final Person person , final String skillName ,
103+ @ Nullable List <TargetRollModifier > externalModifiers , final int miscModifier , final boolean useEdge ,
104+ final boolean includeMarginsOfSuccessText ) {
105+ this .person = person ;
106+ this .skillName = skillName ;
107+ SkillCheckUtility proxy = new SkillCheckUtility (person , skillName , externalModifiers , miscModifier , useEdge ,
108+ includeMarginsOfSuccessText ,
109+ false , false , LocalDate .of (3151 , 1 , 1 ));
110+ marginOfSuccess = proxy .getMarginOfSuccess ();
111+ resultsText = proxy .getResultsText ();
112+ targetNumber = proxy .getTargetNumber ();
113+ roll = proxy .getRoll ();
114+ usedEdge = proxy .isUsedEdge ();
115+ }
116+
95117 /**
96118 * Executes a skill check for the specified person and skill type.
97119 *
@@ -105,7 +127,8 @@ public class SkillCheckUtility {
105127 * include margins of success text as part of the results, if desired.</p>
106128 *
107129 * <p><b>Usage:</b> This constructor offers detailed control over the skill check process.
108- * For simpler use-cases, the {@link #performQuickSkillCheck(Person, String, List, int)} method
130+ * For simpler use-cases, the
131+ * {@link #performQuickSkillCheck(Person, String, List, int, boolean, boolean, LocalDate)} method
109132 * provides a more streamlined approach.</p>
110133 *
111134 * @param person the {@link Person} performing the skill check
@@ -125,13 +148,17 @@ public class SkillCheckUtility {
125148 * attempt fails
126149 * @param includeMarginsOfSuccessText whether to include detailed margins of success information
127150 * in the results
151+ * @param isUseAgingEffects if {@code true}, considers aging effects during the check
152+ * @param isClanCampaign if {@code true}, applies rules specific to clan campaigns
153+ * @param today the current date, used for time-dependent logic
128154 *
129155 * @author Illiani
130156 * @since 0.50.05
131157 */
132158 public SkillCheckUtility (final Person person , final String skillName ,
133159 @ Nullable List <TargetRollModifier > externalModifiers , final int miscModifier , final boolean useEdge ,
134- final boolean includeMarginsOfSuccessText ) {
160+ final boolean includeMarginsOfSuccessText , boolean isUseAgingEffects , boolean isClanCampaign ,
161+ LocalDate today ) {
135162 this .person = person ;
136163 this .skillName = skillName ;
137164
@@ -141,7 +168,7 @@ public SkillCheckUtility(final Person person, final String skillName,
141168
142169 final SkillType skillType = SkillType .getType (skillName );
143170 isCountUp = skillType .isCountUp ();
144- targetNumber = determineTargetNumber (person , skillType , miscModifier );
171+ targetNumber = determineTargetNumber (person , skillType , miscModifier , isUseAgingEffects , isClanCampaign , today );
145172
146173 if (externalModifiers != null ) {
147174 for (TargetRollModifier modifier : externalModifiers ) {
@@ -152,6 +179,16 @@ public SkillCheckUtility(final Person person, final String skillName,
152179 performCheck (useEdge , includeMarginsOfSuccessText );
153180 }
154181
182+ /**
183+ * Use {@link #performQuickSkillCheck(Person, String, List, int, boolean, boolean, LocalDate)} instead
184+ */
185+ @ Deprecated (since = "0.50.07" , forRemoval = true )
186+ public static boolean performQuickSkillCheck (final Person person , final String skillName ,
187+ final @ Nullable List <TargetRollModifier > externalModifiers , final int miscModifier ) {
188+ return performQuickSkillCheck (person , skillName , externalModifiers , miscModifier , false , false ,
189+ LocalDate .of (3151 , 1 , 1 ));
190+ }
191+
155192 /**
156193 * Performs a quick and simple skill check for a person based on the specified skill name.
157194 *
@@ -175,6 +212,9 @@ public SkillCheckUtility(final Person person, final String skillName,
175212 * <li>For non-'count up' skills, this value is added to the target number
176213 * (i.e., positive values are penalties).</li>
177214 * </ul>
215+ * @param isUseAgingEffects if {@code true}, considers aging effects during the check
216+ * @param isClanCampaign if {@code true}, applies rules specific to clan campaigns
217+ * @param today the current date, used for time-dependent logic
178218 *
179219 * @return {@code true} if the skill check succeeds, {@code false} otherwise
180220 *
@@ -184,9 +224,10 @@ public SkillCheckUtility(final Person person, final String skillName,
184224 * @since 0.50.05
185225 */
186226 public static boolean performQuickSkillCheck (final Person person , final String skillName ,
187- final @ Nullable List <TargetRollModifier > externalModifiers , final int miscModifier ) {
227+ final @ Nullable List <TargetRollModifier > externalModifiers , final int miscModifier ,
228+ boolean isUseAgingEffects , boolean isClanCampaign , LocalDate today ) {
188229 SkillCheckUtility skillCheck = new SkillCheckUtility (person , skillName , externalModifiers , miscModifier ,
189- false , false );
230+ false , false , isUseAgingEffects , isClanCampaign , today );
190231 return skillCheck .isSuccess ();
191232 }
192233
@@ -398,6 +439,14 @@ public boolean isUsedEdge() {
398439 return usedEdge ;
399440 }
400441
442+ /**
443+ * Use {@link #determineTargetNumber(Person, SkillType, int, boolean, boolean, LocalDate)} instead
444+ */
445+ @ Deprecated (since = "0.50.07" , forRemoval = true )
446+ public static TargetRoll determineTargetNumber (Person person , SkillType skillType , int miscModifier ) {
447+ return determineTargetNumber (person , skillType , miscModifier , false , false , LocalDate .of (3151 , 1 , 1 ));
448+ }
449+
401450 /**
402451 * Determines the target number for a skill check based on the person's attributes, skill type, and whether they are
403452 * trained in the skill.
@@ -412,11 +461,15 @@ public boolean isUsedEdge() {
412461 * target number. This means negative values are bonuses, positive values are penalties.
413462 *
414463 * @return the target number for the skill check
464+ * @param isUseAgingEffects if {@code true}, considers aging effects during the check
465+ * @param isClanCampaign if {@code true}, applies rules specific to clan campaigns
466+ * @param today the current date, used for time-dependent logic
415467 *
416468 * @author Illiani
417469 * @since 0.50.05
418470 */
419- public static TargetRoll determineTargetNumber (Person person , SkillType skillType , int miscModifier ) {
471+ public static TargetRoll determineTargetNumber (Person person , SkillType skillType , int miscModifier ,
472+ boolean isUseAgingEffects , boolean isClanCampaign , LocalDate today ) {
420473 final String skillName = skillType .getName ();
421474 final Attributes characterAttributes = person .getATOWAttributes ();
422475
@@ -441,7 +494,7 @@ public static TargetRoll determineTargetNumber(Person person, SkillType skillTyp
441494 Skill skill = person .getSkill (skillName );
442495 int skillValue = skill .getFinalSkillValue (person .getOptions (),
443496 person .getATOWAttributes (),
444- person .getReputation ( ));
497+ person .getAdjustedReputation ( isUseAgingEffects , isClanCampaign , today , person . getRankNumeric () ));
445498 targetNumber .addModifier (skillValue , skillName );
446499 }
447500
0 commit comments