@@ -55,6 +55,7 @@ public class MercenaryAuction {
55
55
private static final String RESOURCE_BUNDLE = "mekhq.resources." + MercenaryAuctionDialog .class .getSimpleName ();
56
56
57
57
private static final int AUCTION_TIER_SUCCESS_PERCENT = 20 ;
58
+ private static final int DECLINE_AUCTION_OPTION = 0 ;
58
59
59
60
/**
60
61
* Creates and processes a mercenary auction.
@@ -67,7 +68,7 @@ public class MercenaryAuction {
67
68
* @param unitType The type of unit being auctioned (e.g., `MECH`, `VEHICLE`).
68
69
*/
69
70
public MercenaryAuction (Campaign campaign , int requiredCombatTeams , StratconCampaignState campaignState ,
70
- int unitType ) {
71
+ int unitType ) {
71
72
String faction = campaign .getFaction ().getShortName ();
72
73
73
74
Entity entity = getEntity (faction ,
@@ -127,42 +128,44 @@ public MercenaryAuction(Campaign campaign, int requiredCombatTeams, StratconCamp
127
128
max (requiredCombatTeams , 1 ));
128
129
int finalBid = (mercenaryAuctionDialog .getSpinnerValue () / minimumBid ) * AUCTION_TIER_SUCCESS_PERCENT ;
129
130
130
- // If the player confirmed the auction (option 0) then check whether they were successful,
131
+ // If the player confirmed the auction, then check whether they were successful,
131
132
// deliver the unit, and deduct funds.
132
- if (mercenaryAuctionDialog .getDialogChoice () == 0 ) {
133
- // The use of <= is important here as it ensures that even if the user bids 50 %, they can
134
- // still win.
135
- if (randomInt (100 ) <= finalBid ) {
136
- campaignState .changeSupportPoints (finalBid );
137
-
138
- // The delivery time is so that the unit addition is picked up by the 'mothball'
139
- // campaign option. It also makes sense the unit wouldn't magically materialize in your
140
- // hangar and has to get there.
141
- int deliveryTime = d6 ();
142
- // The +1 here is to account for this being an end of day event, so we automatically
143
- // eat the first day.
144
- campaign .addNewUnit (entity , false , deliveryTime + 1 );
145
-
146
- // This dialog informs the player their bid was successful
147
- new ImmersiveDialogSimple (campaign ,
148
- campaign .getSeniorAdminPerson (TRANSPORT ),
149
- null ,
150
- getFormattedTextAt (RESOURCE_BUNDLE , "auction.successful" , entity .getChassis (), deliveryTime ),
151
- null ,
152
- null ,
153
- null ,
154
- true );
155
- } else {
156
- // This dialog informs the player their bid was unsuccessful
157
- new ImmersiveDialogSimple (campaign ,
158
- campaign .getSeniorAdminPerson (TRANSPORT ),
159
- null ,
160
- getFormattedTextAt (RESOURCE_BUNDLE , "auction.failure" , entity .getChassis ()),
161
- null ,
162
- null ,
163
- null ,
164
- true );
165
- }
133
+ if (mercenaryAuctionDialog .getDialogChoice () == DECLINE_AUCTION_OPTION ) {
134
+ return ;
135
+ }
136
+
137
+ // The use of <= is important here as it ensures that even if the user bids 50 %, they can
138
+ // still win.
139
+ if (randomInt (100 ) <= finalBid ) {
140
+ campaignState .changeSupportPoints (finalBid );
141
+
142
+ // The delivery time is so that the unit addition is picked up by the 'mothball'
143
+ // campaign option. It also makes sense the unit wouldn't magically materialize in your
144
+ // hangar and has to get there.
145
+ int deliveryTime = d6 ();
146
+ // The +1 here is to account for this being an end of day event, so we automatically
147
+ // eat the first day.
148
+ campaign .addNewUnit (entity , false , deliveryTime + 1 );
149
+
150
+ // This dialog informs the player their bid was successful
151
+ new ImmersiveDialogSimple (campaign ,
152
+ campaign .getSeniorAdminPerson (TRANSPORT ),
153
+ null ,
154
+ getFormattedTextAt (RESOURCE_BUNDLE , "auction.successful" , entity .getChassis (), deliveryTime ),
155
+ null ,
156
+ null ,
157
+ null ,
158
+ true );
159
+ } else {
160
+ // This dialog informs the player their bid was unsuccessful
161
+ new ImmersiveDialogSimple (campaign ,
162
+ campaign .getSeniorAdminPerson (TRANSPORT ),
163
+ null ,
164
+ getFormattedTextAt (RESOURCE_BUNDLE , "auction.failure" , entity .getChassis ()),
165
+ null ,
166
+ null ,
167
+ null ,
168
+ true );
166
169
}
167
170
}
168
171
}
0 commit comments