- Some style and logic fixes.

This commit is contained in:
Agetian
2018-04-30 08:49:20 +03:00
parent 4f487f3009
commit 9a206ff338

View File

@@ -1314,17 +1314,14 @@ public class AttachAi extends SpellAbilityAi {
// Don't play if would choose a color the target is already protected from // Don't play if would choose a color the target is already protected from
if (sa.getHostCard().hasSVar("ChosenProtection")) { if (sa.getHostCard().hasSVar("ChosenProtection")) {
CardCollectionView oppAllCards = CardCollection.combine CardCollectionView oppAllCards = ai.getOpponents().getCardsIn(ZoneType.Battlefield);
(ComputerUtil.getOpponentFor(ai).getAllCards());
String cc = ComputerUtilCard.getMostProminentColor(oppAllCards); String cc = ComputerUtilCard.getMostProminentColor(oppAllCards);
if (card.hasKeyword("Protection from " + cc.toLowerCase())) { if (card.hasKeyword("Protection from " + cc.toLowerCase())) {
return false; return false;
} }
// Also don't play if it would destroy own Aura // Also don't play if it would destroy own Aura
for (Card c : card.getEnchantedBy(false)) { for (Card c : card.getEnchantedBy(false)) {
if ((c.getController().equals(ai)) if ((c.getController().equals(ai)) && (c.isOfColor(cc))) {
&& (c.isOfColor(cc))
) {
return false; return false;
} }
} }