Skip to content

Commit f2c6f97

Browse files
tool4EvErtool4EvEr
authored andcommitted
Cherry pick AI findings for AI
1 parent 2a53bb2 commit f2c6f97

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

forge-ai/src/main/java/forge/ai/simulation/PossibleTargetSelector.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private int getCreatureScore(Card c) {
8787
if (score != null) {
8888
return score;
8989
}
90-
} else {
90+
} else {
9191
creatureScores = new HashMap<>();
9292
}
9393

@@ -108,16 +108,15 @@ private String getTypeString(Card c) {
108108

109109
public boolean shouldSkipTarget(GameObject o) {
110110
// TODO: Support non-card targets, such as spells on the stack.
111-
if (!(o instanceof Card)) {
111+
if (!(o instanceof Card c)) {
112112
return false;
113113
}
114114

115-
Card c = (Card) o;
116115
Combat combat = c.getGame().getCombat();
117116
for (Card existingTarget : validTargetsMap.get(c.getName())) {
118117
// Note: Checks are ordered from cheapest to more expensive ones. For example, type equals()
119118
// ends up calling toString() on the type object and is more expensive than the checks above it.
120-
if (c.getController() != c.getController() || c.getOwner() != existingTarget.getOwner()) {
119+
if (c.getController() != existingTarget.getController() || c.getOwner() != existingTarget.getOwner()) {
121120
continue;
122121
}
123122
if (c.getSpellAbilities().size() != existingTarget.getSpellAbilities().size()) {
@@ -148,7 +147,6 @@ public boolean shouldSkipTarget(GameObject o) {
148147
continue;
149148
}
150149
}
151-
continue;
152150
}
153151
return true;
154152
}

0 commit comments

Comments
 (0)