-- Added Konda's Banner and O-Naginata

This commit is contained in:
swordshine
2013-03-28 04:47:58 +00:00
parent 04e461f275
commit d048f06c7c
5 changed files with 79 additions and 5 deletions

View File

@@ -2190,7 +2190,8 @@ public class Card extends GameEntity implements Comparable<Card> {
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<Card> {
+ " 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<Card> {
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<Card> {
}
}
}
} 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<Card> {
}
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.

View File

@@ -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;