mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
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:
@@ -2235,15 +2235,45 @@ public class CombatUtil {
|
|||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, attacker.getController());
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, attacker.getController());
|
||||||
|
|
||||||
CardList enchantments = new CardList(library.getCards());
|
CardList enchantments = new CardList(library.getCards());
|
||||||
|
final String turn = attacker.getController();
|
||||||
enchantments = enchantments.filter(new CardListFilter() {
|
enchantments = enchantments.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
|
if(attacker.hasKeyword("Protection from enchantments") || (attacker.hasKeyword("Protection from everything"))) return false;
|
||||||
ArrayList<String> keywords = c.getKeyword();
|
ArrayList<String> keywords = c.getKeyword();
|
||||||
for(String keyword:keywords) {
|
for(String keyword:keywords) {
|
||||||
if(keyword.startsWith("Enchant " + "creature")) {
|
if(keyword.startsWith("Enchant creature")) {
|
||||||
if(c.isEnchantment()) return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user