Fixed Sovereigns of Lost Alara: Allowed the player to enchant with curses and disabled targeting when the exalted creature has protection

This commit is contained in:
jendave
2011-08-06 04:40:43 +00:00
parent 4f7d13ccbc
commit b46de42c4e

View File

@@ -2235,15 +2235,45 @@ public class CombatUtil {
PlayerZone play = AllZone.getZone(Constant.Zone.Play, attacker.getController());
CardList enchantments = new CardList(library.getCards());
final String turn = attacker.getController();
enchantments = enchantments.filter(new CardListFilter() {
public boolean addCard(Card c) {
if(attacker.hasKeyword("Protection from enchantments") || (attacker.hasKeyword("Protection from everything"))) return false;
ArrayList<String> keywords = c.getKeyword();
for(String keyword:keywords) {
if(keyword.startsWith("Enchant " + "creature")) {
if(c.isEnchantment()) return true;
if(keyword.startsWith("Enchant creature")) {
if(c.isEnchantment()) {
String [] colors = new String[5];
ArrayList<String> color = CardUtil.getColors(c);
if(color.contains(Constant.Color.Black)) colors[0] = "black";
if(color.contains(Constant.Color.Blue)) colors[1] = "blue";
if(color.contains(Constant.Color.Green)) colors[2] = "green";
if(color.contains(Constant.Color.Red)) colors[3] = "red";
if(color.contains(Constant.Color.White)) colors[4] = "white";
if(color.contains(Constant.Color.Colorless))colors[5] = "colorless";
for(int i = 0; i < colors.length; i++) {
if(attacker.hasKeyword("Protection from " + colors[i]) == true) return false;
}
} return true;
}
if(turn == "Human") {
if(keyword.startsWith("Enchant Creature")) {
if(keyword.endsWith("Curse")) {
String [] colors = new String[5];
ArrayList<String> color = CardUtil.getColors(c);
if(color.contains(Constant.Color.Black)) colors[0] = "black";
if(color.contains(Constant.Color.Blue)) colors[1] = "blue";
if(color.contains(Constant.Color.Green)) colors[2] = "green";
if(color.contains(Constant.Color.Red)) colors[3] = "red";
if(color.contains(Constant.Color.White)) colors[4] = "white";
if(color.contains(Constant.Color.Colorless))colors[5] = "colorless";
for(int i = 0; i < colors.length; i++) {
if(attacker.hasKeyword("Protection from " + colors[i]) == true) return false;
}
} return true;
}
}
}
return false;
}
});