diff --git a/.gitattributes b/.gitattributes index 3cdd34a3721..6baed16fd0b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5755,6 +5755,7 @@ res/cardsfolder/k/kodamas_might.txt -text res/cardsfolder/k/kodamas_reach.txt svneol=native#text/plain res/cardsfolder/k/kokusho_the_evening_star.txt svneol=native#text/plain res/cardsfolder/k/konda_lord_of_eiganjo.txt svneol=native#text/plain +res/cardsfolder/k/kondas_banner.txt -text res/cardsfolder/k/kondas_hatamoto.txt svneol=native#text/plain res/cardsfolder/k/kongming_sleeping_dragon.txt svneol=native#text/plain res/cardsfolder/k/kongmings_contraptions.txt -text @@ -7301,6 +7302,7 @@ res/cardsfolder/n/nurturer_initiate.txt svneol=native#text/plain res/cardsfolder/n/nurturing_licid.txt -text res/cardsfolder/n/nut_collector.txt svneol=native#text/plain res/cardsfolder/n/nyxathid.txt svneol=native#text/plain +res/cardsfolder/o/o_naginata.txt -text res/cardsfolder/o/oak_street_innkeeper.txt -text res/cardsfolder/o/oaken_brawler.txt svneol=native#text/plain res/cardsfolder/o/oakenform.txt svneol=native#text/plain diff --git a/res/cardsfolder/k/kondas_banner.txt b/res/cardsfolder/k/kondas_banner.txt new file mode 100644 index 00000000000..db2794d25f3 --- /dev/null +++ b/res/cardsfolder/k/kondas_banner.txt @@ -0,0 +1,13 @@ +Name:Konda's Banner +ManaCost:2 +Types:Legendary Artifact Equipment +Text:CARDNAME can be attached only to a legendary creature. +K:CantEquip Creature.nonLegendary +K:Equip 2 +S:Mode$ Continuous | Affected$ Creature.SharesColorWith Equipped | AddPower$ 1 | AddToughness$ 1 | Description$ Creatures that share a color with equipped creature get +1/+1. +S:Mode$ Continuous | Affected$ Creature.sharesCreatureTypeWith Equipped | AddPower$ 1 | AddToughness$ 1 | Description$ Creatures that share a creature type with equipped creature get +1/+1. +SVar:RemAIDeck:True +SVar:RemRandomDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/kondas_banner.jpg +Oracle:Konda's Banner can be attached only to a legendary creature.\nCreatures that share a color with equipped creature get +1/+1.\nCreatures that share a creature type with equipped creature get +1/+1.\nEquip {2} +SetInfo:CHK Rare \ No newline at end of file diff --git a/res/cardsfolder/o/o_naginata.txt b/res/cardsfolder/o/o_naginata.txt new file mode 100644 index 00000000000..d7257c600d1 --- /dev/null +++ b/res/cardsfolder/o/o_naginata.txt @@ -0,0 +1,12 @@ +Name:O-Naginata +ManaCost:1 +Types:Artifact Equipment +Text:CARDNAME can be attached only to a creature with 3 or more power. +K:Equip 2 +K:CantEquip Creature.powerLT3 +S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddPower$ 3 | AddKeyword$ Trample | Description$ Equipped creature gets +3/+0 and has trample. +SVar:RemAIDeck:True +SVar:RemRandomDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/o_naginata.jpg +Oracle:O-Naginata can be attached only to a creature with 3 or more power.\nEquipped creature gets +3/+0 and has trample.\nEquip {2} ({2}: Attach to target creature you control. Equip only as a sorcery.) +SetInfo:SOK Uncommon \ No newline at end of file diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 6d40d6064f1..68427220fce 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -2190,7 +2190,8 @@ public class Card extends GameEntity implements Comparable { if (keyword.startsWith("Permanents don't untap during their controllers' untap steps") || keyword.startsWith("PreventAllDamageBy") || keyword.startsWith("CantBlock") - || keyword.startsWith("CantBeBlockedBy")) { + || keyword.startsWith("CantBeBlockedBy") + || keyword.startsWith("CantEquip")) { continue; } if (keyword.startsWith("CostChange")) { @@ -3701,6 +3702,17 @@ public class Card extends GameEntity implements Comparable { + " but it can't be equipped.", 2); return; } + if (this.hasStartOfKeyword("CantEquip")) { + final int keywordPosition = this.getKeywordPosition("CantEquip"); + final String parse = this.getKeyword().get(keywordPosition).toString(); + final String[] k = parse.split(" ", 2); + final String[] restrictions = k[1].split(","); + if (c.isValid(restrictions, this.getController(), this)) { + Singletons.getModel().getGame().getGameLog().add("ResolveStack", "Trying to equip " + c.getName() + + " but it can't be equipped.", 2); + return; + } + } if (this.isEquipping()) { this.unEquipCard(this.getEquipping().get(0)); } @@ -6529,6 +6541,12 @@ public class Card extends GameEntity implements Comparable { return false; } } + } else if (restriction.equals("Equipped")) { + if (!source.isEquipment() || !source.isEquipping()) { + return false; + } else if (!this.sharesColorWith(source.getEquippingCard())) { + return false; + } } else if (restriction.equals("MostProminentColor")) { for (final String color : CardUtil.getColors(this)) { if (CardFactoryUtil.isMostProminentColor(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), color)) { @@ -6594,6 +6612,11 @@ public class Card extends GameEntity implements Comparable { } } } + } if (restriction.equals("Equipped")) { + if (source.isEquipping() && this.sharesCreatureTypeWith(source.getEquippingCard())) { + return true; + } + return false; } if (restriction.equals("Remembered")) { for (final Object rem : source.getRemembered()) { if (rem instanceof Card) { @@ -8849,6 +8872,31 @@ public class Card extends GameEntity implements Comparable { } return true; } + + /** + * canBeEquippedBy. + * + * @param equip + * a Card + * @return a boolean + */ + public final boolean canBeEquippedBy(final Card equip) { + if (equip.hasStartOfKeyword("CantEquip")) { + final int keywordPosition = equip.getKeywordPosition("CantEquip"); + final String parse = equip.getKeyword().get(keywordPosition).toString(); + final String[] k = parse.split(" ", 2); + final String[] restrictions = k[1].split(","); + if (this.isValid(restrictions, equip.getController(), equip)) { + return false; + } + } + if (this.hasProtectionFrom(equip) + || this.hasKeyword("CARDNAME can't be equipped.") + || !this.isValid("Creature.YouCtrl", equip.getController(), equip)) { + return false; + } + return true; + } /** * Gets the replacement effects. diff --git a/src/main/java/forge/game/GameAction.java b/src/main/java/forge/game/GameAction.java index b96c156b628..33e88682d77 100644 --- a/src/main/java/forge/game/GameAction.java +++ b/src/main/java/forge/game/GameAction.java @@ -957,13 +957,12 @@ public class GameAction { if (c.isEquipping()) { final Card equippedCreature = c.getEquipping().get(0); - if (!equippedCreature.isCreature() || !equippedCreature.isInPlay()) { + if (!equippedCreature.isCreature() || !equippedCreature.isInPlay() + || !equippedCreature.canBeEquippedBy(c)) { c.unEquipCard(equippedCreature); checkAgain = true; } - - // make sure any equipment that has become a creature stops - // equipping + // make sure any equipment that has become a creature stops equipping if (c.isCreature()) { c.unEquipCard(equippedCreature); checkAgain = true;