mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 17:58:01 +00:00
Fix ManifestAi
This commit is contained in:
@@ -106,7 +106,7 @@ public class ManifestAi extends SpellAbilityAi {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card.mayPlayerLook(ai)) {
|
if (card.getView().canBeShownTo(ai.getView())) {
|
||||||
// try to avoid manifest a non Permanent
|
// try to avoid manifest a non Permanent
|
||||||
if (!card.isPermanent())
|
if (!card.isPermanent())
|
||||||
return false;
|
return false;
|
||||||
@@ -115,7 +115,7 @@ public class ManifestAi extends SpellAbilityAi {
|
|||||||
if (card.getManaCost().countX() > 0)
|
if (card.getManaCost().countX() > 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// try to avoid manifesting a creature with zero or less thoughness
|
// try to avoid manifesting a creature with zero or less toughness
|
||||||
if (card.isCreature() && card.getNetToughness() <= 0)
|
if (card.isCreature() && card.getNetToughness() <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -177,21 +177,21 @@ public class ManifestAi extends SpellAbilityAi {
|
|||||||
return MyRandom.getRandom().nextFloat() < .8;
|
return MyRandom.getRandom().nextFloat() < .8;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Card chooseSingleCard(final Player ai, final SpellAbility sa, Iterable<Card> options, boolean isOptional, Player targetedPlayer) {
|
@Override
|
||||||
if (Iterables.size(options) <= 1) {
|
protected Card chooseSingleCard(final Player ai, final SpellAbility sa, Iterable<Card> options, boolean isOptional, Player targetedPlayer, Map<String, Object> params) {
|
||||||
return Iterables.getFirst(options, null);
|
if (Iterables.size(options) > 1 || isOptional) {
|
||||||
}
|
CardCollection filtered = CardLists.filter(options, new Predicate<Card>() {
|
||||||
CardCollection filtered = CardLists.filter(options, new Predicate<Card>() {
|
@Override
|
||||||
@Override
|
public boolean apply(Card input) {
|
||||||
public boolean apply(Card input) {
|
return shouldManyfest(input, ai, sa);
|
||||||
return !shouldManyfest(input, ai, sa);
|
}
|
||||||
|
});
|
||||||
|
if (!filtered.isEmpty()) {
|
||||||
|
return ComputerUtilCard.getBestAI(filtered);
|
||||||
|
}
|
||||||
|
if (isOptional) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
if (!filtered.isEmpty()) {
|
|
||||||
return ComputerUtilCard.getBestAI(filtered);
|
|
||||||
}
|
|
||||||
if (isOptional) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
return Iterables.getFirst(options, null);
|
return Iterables.getFirst(options, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1069,7 +1069,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
public final Card getEncodingCard() {
|
public final Card getEncodingCard() {
|
||||||
return encoding;
|
return encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setEncodingCard(final Card e) {
|
public final void setEncodingCard(final Card e) {
|
||||||
encoding = e;
|
encoding = e;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -486,7 +486,7 @@ public class CardView extends GameEntityView {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canBeShownTo(final PlayerView viewer) {
|
public boolean canBeShownTo(final PlayerView viewer) {
|
||||||
if (viewer == null) { return false; }
|
if (viewer == null) { return false; }
|
||||||
|
|
||||||
ZoneType zone = getZone();
|
ZoneType zone = getZone();
|
||||||
|
|||||||
Reference in New Issue
Block a user