- Simplify source lookup

This commit is contained in:
Agetian
2023-06-12 18:56:18 +03:00
parent 4b9ff0d23f
commit 582f949791

View File

@@ -472,16 +472,14 @@ public class AiCostDecision extends CostDecisionMakerBase {
if (cost.getRevealFrom().size() == 2 && cost.getRevealFrom().containsAll(Arrays.asList(ZoneType.Hand, ZoneType.Battlefield))) { // RevealOrChoose if (cost.getRevealFrom().size() == 2 && cost.getRevealFrom().containsAll(Arrays.asList(ZoneType.Hand, ZoneType.Battlefield))) { // RevealOrChoose
String aiLogic = ability.getParamOrDefault("AILogic", ""); String aiLogic = ability.getParamOrDefault("AILogic", "");
CardCollection battlefieldOrHand = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), hand = CardLists.getValidCards(hand, type.split(";"), player, source, ability);
type.split(";"), player, source, ability);
battlefieldOrHand.addAll(CardLists.getValidCards(hand, type.split(";"), player, source, ability));
if (aiLogic.startsWith("PowerAtLeast.")) { if (aiLogic.startsWith("PowerAtLeast.")) {
int minPower = Integer.parseInt(aiLogic.substring(aiLogic.indexOf(".") + 1)); int minPower = Integer.parseInt(aiLogic.substring(aiLogic.indexOf(".") + 1));
battlefieldOrHand = CardLists.filterPower(battlefieldOrHand, minPower); hand = CardLists.filterPower(hand, minPower);
} }
return battlefieldOrHand.isEmpty() ? null : PaymentDecision.card(getBestCreatureAI(battlefieldOrHand)); return hand.isEmpty() ? null : PaymentDecision.card(getBestCreatureAI(hand));
} }
if (cost.getType().equals("SameColor")) { if (cost.getType().equals("SameColor")) {