Merge branch 'countersMove' into 'master'

CountersMoveAI: Improve logic for Ozolith

See merge request core-developers/forge!4568
This commit is contained in:
Michael Kamensky
2021-04-22 05:03:54 +00:00

View File

@@ -372,6 +372,10 @@ public class CountersMoveAi extends SpellAbilityAi {
} }
} }
Card lki = CardUtil.getLKICopy(src);
lki.clearCounters();
// go for opponent when value implies debuff
if (ComputerUtilCard.evaluateCreature(src) > ComputerUtilCard.evaluateCreature(lki)) {
List<Card> aiList = CardLists.filterControlledBy(tgtCards, ai); List<Card> aiList = CardLists.filterControlledBy(tgtCards, ai);
if (!aiList.isEmpty()) { if (!aiList.isEmpty()) {
List<Card> best = CardLists.filter(aiList, new Predicate<Card>() { List<Card> best = CardLists.filter(aiList, new Predicate<Card>() {
@@ -392,7 +396,7 @@ public class CountersMoveAi extends SpellAbilityAi {
if (cType.is(CounterEnumType.P1P1) && card.hasKeyword(Keyword.UNDYING)) { if (cType.is(CounterEnumType.P1P1) && card.hasKeyword(Keyword.UNDYING)) {
return false; return false;
} }
if (cType.is(CounterEnumType.M1M1) && card.hasKeyword(Keyword.PERSIST)) { if (cType.is(CounterEnumType.M1M1)) {
return false; return false;
} }
@@ -415,11 +419,10 @@ public class CountersMoveAi extends SpellAbilityAi {
return true; return true;
} }
} }
}
// move counter to opponents creature but only if you can not steal // move counter to opponents creature but only if you can not steal them
// them // try to move to something useless or something that would leave play
// try to move to something useless or something that would leave
// play
List<Card> oppList = CardLists.filterControlledBy(tgtCards, ai.getOpponents()); List<Card> oppList = CardLists.filterControlledBy(tgtCards, ai.getOpponents());
if (!oppList.isEmpty()) { if (!oppList.isEmpty()) {
List<Card> best = CardLists.filter(oppList, new Predicate<Card>() { List<Card> best = CardLists.filter(oppList, new Predicate<Card>() {
@@ -441,7 +444,7 @@ public class CountersMoveAi extends SpellAbilityAi {
}); });
if (best.isEmpty()) { if (best.isEmpty()) {
best = aiList; best = oppList;
} }
Card card = ComputerUtilCard.getBestCreatureAI(best); Card card = ComputerUtilCard.getBestCreatureAI(best);
@@ -455,7 +458,7 @@ public class CountersMoveAi extends SpellAbilityAi {
} }
} }
// used for multiple sources -> defied // used for multiple sources -> defined
// or for source -> multiple defined // or for source -> multiple defined
@Override @Override
protected Card chooseSingleCard(Player ai, SpellAbility sa, Iterable<Card> options, boolean isOptional, protected Card chooseSingleCard(Player ai, SpellAbility sa, Iterable<Card> options, boolean isOptional,