White Ward problem

Someone mentioned that they had a problem with the White Ward. I tracked down the code responsible in CardFactoryUtil.hasProtectionFrom(). I made a slight addition to the checks and White Ward will no longer remove itself via the protection from white that it gives to the enchanted creature:

- Code: Select all
//does "target" have protection from "card"?
public static boolean hasProtectionFrom(Card card, Card target) {
if(target == null) return false;
if(target.getKeyword() != null) {
ArrayList<String> list = target.getKeyword();
String kw = "";
for(int i = 0; i < list.size(); i++) {
kw = list.get(i);
if(kw.equals("Protection from white") && CardUtil.getColors(card).contains(Constant.Color.White) &&
!card.getName().contains("White Ward")) return true;
if(kw.equals("Protection from blue") && CardUtil.getColors(card).contains(Constant.Color.Blue) &&
!card.getName().contains("Blue Ward")) return true;
if(kw.equals("Protection from black") && CardUtil.getColors(card).contains(Constant.Color.Black) &&
!card.getName().contains("Black Ward")) return true;
if(kw.equals("Protection from red") && CardUtil.getColors(card).contains(Constant.Color.Red) &&
!card.getName().contains("Red Ward")) return true;
if(kw.equals("Protection from green") && CardUtil.getColors(card).contains(Constant.Color.Green) &&
!card.getName().contains("Green Ward")) return true;
if(kw.equals("Protection from creatures") && card.isCreature()) return true;
if(kw.equals("Protection from artifacts") && card.isArtifact() &&
!card.getName().contains("Artifact Ward")) return true;
if(kw.equals("Protection from everything")) return true;
if(kw.equals("Protection from Dragons")
&& (card.getType().contains("Dragon") || card.getKeyword().contains("Changeling"))) return true;
if(kw.equals("Protection from Demons")
&& (card.getType().contains("Demon") || card.getKeyword().contains("Changeling"))) return true;
if(kw.equals("Protection from Goblins")
&& (card.getType().contains("Goblin") || card.getKeyword().contains("Changeling"))) return true;
if(kw.equals("Protection from enchantments") && card.getType().contains("Enchantment") &&
!card.getName().contains("Tattoo Ward")) return true;
}
}
return false;
}