mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Some AI support for CantSearchLibrary / Ashiok effect.
This commit is contained in:
@@ -316,6 +316,11 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
for (final Player p : pDefined) {
|
||||
CardCollectionView list = p.getCardsIn(origin);
|
||||
|
||||
// remove cards that won't be seen if library can't be searched
|
||||
if (ai.hasKeyword("CantSearchLibrary") || (ai.hasKeyword("Spells and abilities you control can't cause you to search your library.") && !ai.canSearchOwnLibraryWith(sa, p))) {
|
||||
list = CardLists.filter(list, Predicates.not(CardPredicates.inZone(ZoneType.Library)));
|
||||
}
|
||||
|
||||
if (type != null && p == ai) {
|
||||
// AI only "knows" about his information
|
||||
list = CardLists.getValidCards(list, type, source.getController(), source);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package forge.ai.ability;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import forge.ai.*;
|
||||
@@ -57,6 +58,11 @@ public class ChangeZoneAllAi extends SpellAbilityAi {
|
||||
CardCollectionView oppType = CardLists.filterControlledBy(game.getCardsIn(origin), ai.getOpponents());
|
||||
CardCollectionView computerType = ai.getCardsIn(origin);
|
||||
|
||||
// remove cards that won't be seen in AI's own library if it can't be searched
|
||||
if (ai.hasKeyword("CantSearchLibrary") || (ai.hasKeyword("Spells and abilities you control can't cause you to search your library.") && !ai.canSearchOwnLibraryWith(sa, ai))) {
|
||||
computerType = CardLists.filter(computerType, Predicates.not(CardPredicates.inZone(ZoneType.Library)));
|
||||
}
|
||||
|
||||
// Ugin check need to be done before filterListByType because of ChosenX
|
||||
// Ugin AI: always try to sweep before considering +1
|
||||
if (sourceName.equals("Ugin, the Spirit Dragon")) {
|
||||
|
||||
Reference in New Issue
Block a user