- Little improvements in AttachAI.

This commit is contained in:
Sloth
2013-03-16 10:25:48 +00:00
parent 4acffc60cd
commit ea78324d15
3 changed files with 16 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
Name=Elrond 2 Name=Elrond 2
Title=Elrond Title=Elrond
Difficulty=medium Difficulty=medium
Description=RGW Aura deck with Rabid Wombat Description=RGW Aura deck with Aura Gnarlid and Rabid Wombat
Icon=Elrond.jpg Icon=Elrond.jpg
Deck Type=constructed Deck Type=constructed
[main] [main]

View File

@@ -3,7 +3,7 @@
Name=Elrond 3 Name=Elrond 3
Title=Elrond Title=Elrond
Difficulty=hard Difficulty=hard
Description=RGW Aura deck with Kor Spiritdancer Description=RGW Aura deck with Aura Gnarlid, Uril, the Miststalker and Kor Spiritdancer
Icon=Elrond.jpg Icon=Elrond.jpg
Deck Type=constructed Deck Type=constructed
[main] [main]

View File

@@ -805,18 +805,25 @@ public class AttachAi extends SpellAbilityAi {
if (attachSource.isAura() && !attachSource.getName().equals("Daybreak Coronet")) { if (attachSource.isAura() && !attachSource.getName().equals("Daybreak Coronet")) {
// TODO For Auras like Rancor, that aren't as likely to lead to // TODO For Auras like Rancor, that aren't as likely to lead to
// card disadvantage, this check should be skipped // card disadvantage, this check should be skipped
prefList = CardLists.filter(prefList, Predicates.not(Presets.ENCHANTED));
}
if (!grantingAbilities && keywords.isEmpty()) {
// Probably prefer to Enchant Creatures that Can Attack
// Filter out creatures that can't Attack or have Defender
prefList = CardLists.filter(prefList, new Predicate<Card>() { prefList = CardLists.filter(prefList, new Predicate<Card>() {
@Override @Override
public boolean apply(final Card c) { public boolean apply(final Card c) {
return !c.isCreature() || CombatUtil.canAttackNextTurn(c); return !c.isEnchanted() || c.hasKeyword("Hexproof");
} }
}); });
}
if (!grantingAbilities) {
// Probably prefer to Enchant Creatures that Can Attack
// Filter out creatures that can't Attack or have Defender
if (keywords.isEmpty()) {
prefList = CardLists.filter(prefList, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return !c.isCreature() || CombatUtil.canAttackNextTurn(c);
}
});
}
c = ComputerUtilCard.getBestAI(prefList); c = ComputerUtilCard.getBestAI(prefList);
} else { } else {
// If we grant abilities, we may want to put it on something Weak? // If we grant abilities, we may want to put it on something Weak?