From b46de42c4eee4e93da61fe191ec1b99df8f1fe66 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 04:40:43 +0000 Subject: [PATCH] Fixed Sovereigns of Lost Alara: Allowed the player to enchant with curses and disabled targeting when the exalted creature has protection --- src/forge/CombatUtil.java | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/forge/CombatUtil.java b/src/forge/CombatUtil.java index 4d96ccc273c..bb32a4da3ce 100644 --- a/src/forge/CombatUtil.java +++ b/src/forge/CombatUtil.java @@ -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 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 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 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; } });