Skip to content

Commit 2a53bb2

Browse files
tool4EvErtool4EvEr
authored andcommitted
Minor cleanup
1 parent 5d48a4c commit 2a53bb2

File tree

7 files changed

+6
-38
lines changed

7 files changed

+6
-38
lines changed

forge-ai/src/main/java/forge/ai/AiController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public Combat getPredictedCombat() {
151151
AiAttackController aiAtk = new AiAttackController(player);
152152
predictedCombat = new Combat(player);
153153
aiAtk.declareAttackers(predictedCombat);
154+
// ignoring attack costs for performance
154155
}
155156
return predictedCombat;
156157
}
@@ -1321,7 +1322,6 @@ public void declareAttackers(Player attacker, Combat combat) {
13211322
AiAttackController aiAtk = new AiAttackController(attacker);
13221323
lastAttackAggression = aiAtk.declareAttackers(combat);
13231324

1324-
// Check if we can reinforce with Banding creatures
13251325
aiAtk.reinforceWithBanding(combat);
13261326

13271327
// Per CR 508.1d, the decision to pay attack costs (e.g. Propaganda)
@@ -1348,7 +1348,7 @@ public void declareAttackers(Player attacker, Combat combat) {
13481348
}
13491349

13501350
private void removeUnpayableAttackers(Combat combat) {
1351-
for (Card attacker : new ArrayList<>(combat.getAttackers())) {
1351+
for (Card attacker : combat.getAttackers().threadSafeIterable()) {
13521352
Cost attackCost = CombatUtil.getAttackCost(game, attacker, combat.getDefenderByAttacker(attacker));
13531353
if (attackCost == null) {
13541354
continue;

forge-ai/src/main/java/forge/ai/CreatureEvaluator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public int evaluateCreature(final Card c, final boolean considerPT, final boolea
4747

4848
if (considerPT) {
4949
value += addValue(power * 15, "power");
50+
// TODO factor in marked damage - but probably not always?
5051
value += addValue(toughness * 10, "toughness: " + toughness);
5152

5253
// because backside is always stronger the potential makes it better than a single faced card

forge-game/src/main/java/forge/game/card/CardFactoryUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,6 +3228,7 @@ public void resolve() {
32283228
sa.setCardState(host.getAlternateState());
32293229
sa.setAlternativeCost(AlternativeCost.MTMtE);
32303230

3231+
sa.putParam("Secondary", "True");
32313232
sa.putParam("PrecostDesc", n[0] + " ");
32323233
sa.putParam("CostDesc", convertCost.toString());
32333234
sa.putParam("AfterDescription", "(Converted)");

forge-game/src/main/java/forge/game/phase/PhaseHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,6 @@ private void declareAttackersTurnBasedAction() {
597597
}
598598
}
599599
}
600-
601600
} while (!success);
602601

603602
CardCollection tapped = new CardCollection();

forge-gui/src/main/java/forge/gamemodes/net/NetConnectUtil.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,13 @@ public static ChatMessage join(final String url, final IOnlineLobby onlineLobby,
131131
int port;
132132

133133
URLValidator.HostPort hostPort = parseURL(url);
134-
if(hostPort == null) {
134+
if (hostPort == null) {
135135
return new ChatMessage(null, ForgeConstants.INVALID_HOST_COMMAND);
136136
}
137137

138138
hostname = hostPort.host();
139139
port = hostPort.port();
140-
if(port == -1) port = ForgeConstants.DEFAULT_SERVER_CONNECTION_PORT;
141-
140+
if (port == -1) port = Integer.valueOf(ForgeNetPreferences.FNetPref.NET_PORT.getDefault());
142141

143142
final FGameClient client = new FGameClient(FModel.getPreferences().getPref(FPref.PLAYER_NAME), "0", gui, hostname, port);
144143
onlineLobby.setClient(client);

forge-gui/src/main/java/forge/localinstance/properties/ForgeConstants.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public final class ForgeConstants {
3636
public static final String ASSETS_DIR = GuiBase.getInterface().getAssetsDir();
3737
public static final String PROFILE_FILE = ASSETS_DIR + "forge.profile.properties";
3838
public static final String PROFILE_TEMPLATE_FILE = PROFILE_FILE + ".example";
39-
public static final Integer DEFAULT_SERVER_CONNECTION_PORT = 36743;
4039

4140
public static final String RES_DIR = ASSETS_DIR + "res" + PATH_SEPARATOR;
4241
public static final String ADVENTURE_DIR = RES_DIR + "adventure" + PATH_SEPARATOR;

forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -371,37 +371,6 @@ private static String defaultCustomLogTypes() {
371371
/** Instantiates a ForgePreferences object. */
372372
public ForgePreferences() {
373373
super(ForgeConstants.MAIN_PREFS_FILE, FPref.class);
374-
migrateLogVerbosity();
375-
}
376-
377-
/** Migrate old GameLogEntryType values to GameLogVerbosity presets. */
378-
private void migrateLogVerbosity() {
379-
final String stored = getPref(FPref.DEV_LOG_ENTRY_TYPE);
380-
try {
381-
GameLogVerbosity.valueOf(stored); // strict check for enum name
382-
return; // already a valid verbosity preset
383-
} catch (IllegalArgumentException ignored) {}
384-
// Also accept caption format ("High" etc.) from combobox storage
385-
for (GameLogVerbosity v : GameLogVerbosity.values()) {
386-
if (v.toString().equals(stored)) {
387-
setPref(FPref.DEV_LOG_ENTRY_TYPE, v.name());
388-
save();
389-
return;
390-
}
391-
}
392-
// Old value is a GameLogEntryType name — map to a preset
393-
try {
394-
int ordinal = GameLogEntryType.valueOf(stored).ordinal();
395-
String mapped = ordinal <= 8 ? GameLogVerbosity.LOW.name()
396-
: ordinal <= 14 ? GameLogVerbosity.MEDIUM.name()
397-
: GameLogVerbosity.HIGH.name();
398-
setPref(FPref.DEV_LOG_ENTRY_TYPE, mapped);
399-
save();
400-
} catch (IllegalArgumentException ignored) {
401-
// Unrecognized value — reset to default
402-
setPref(FPref.DEV_LOG_ENTRY_TYPE, FPref.DEV_LOG_ENTRY_TYPE.getDefault());
403-
save();
404-
}
405374
}
406375

407376
/** Parse the custom log types preference into a Set. */

0 commit comments

Comments
 (0)