mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- AttachAI shouldn't assume it targets
This commit is contained in:
@@ -659,7 +659,7 @@ public class AttachAi extends SpellAbilityAi {
|
|||||||
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 ComputerUtilCombat.canAttackNextTurn(c) && c.getNetPower() > 0;
|
return ComputerUtilCombat.canAttackNextTurn(c) && c.getNetPower() > 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -998,7 +998,7 @@ public class AttachAi extends SpellAbilityAi {
|
|||||||
if (!c.isCreature()) {
|
if (!c.isCreature()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ComputerUtilCombat.canAttackNextTurn(c) && powerBonus + c.getNetPower() > 0;
|
return ComputerUtilCombat.canAttackNextTurn(c) && powerBonus + c.getNetPower() > 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1047,16 +1047,20 @@ public class AttachAi extends SpellAbilityAi {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
CardCollection list = CardLists.getValidCards(aiPlayer.getGame().getCardsIn(tgt.getZone()), tgt.getValidTgts(), sa.getActivatingPlayer(), attachSource);
|
CardCollection list = null;
|
||||||
|
if (tgt == null) {
|
||||||
// TODO If Attaching without casting, don't need to actually target.
|
list = AbilityUtils.getDefinedCards(sa.getHostCard(), sa.getParam("Defined"), sa);
|
||||||
// I believe this is the only case where mandatory will be true, so just
|
|
||||||
// check that when starting that work
|
|
||||||
// But we shouldn't attach to things with Protection
|
|
||||||
if (!mandatory) {
|
|
||||||
list = CardLists.getTargetableCards(list, sa);
|
|
||||||
} else {
|
} else {
|
||||||
list = CardLists.filter(list, Predicates.not(CardPredicates.isProtectedFrom(attachSource)));
|
list = CardLists.getValidCards(aiPlayer.getGame().getCardsIn(tgt.getZone()), tgt.getValidTgts(), sa.getActivatingPlayer(), attachSource);
|
||||||
|
// TODO If Attaching without casting, don't need to actually target.
|
||||||
|
// I believe this is the only case where mandatory will be true, so just
|
||||||
|
// check that when starting that work
|
||||||
|
// But we shouldn't attach to things with Protection
|
||||||
|
if (!mandatory) {
|
||||||
|
list = CardLists.getTargetableCards(list, sa);
|
||||||
|
} else {
|
||||||
|
list = CardLists.filter(list, Predicates.not(CardPredicates.isProtectedFrom(attachSource)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user