diff --git a/src/forge/card/cardFactory/CardFactory.java b/src/forge/card/cardFactory/CardFactory.java index 223e5bdfd4f..f445d26c344 100644 --- a/src/forge/card/cardFactory/CardFactory.java +++ b/src/forge/card/cardFactory/CardFactory.java @@ -139,27 +139,27 @@ public class CardFactory implements NewConstants { final public Card dynamicCopyCard(Card in) { - if(in.getType().contains("Creature")) { + if(in.isType("Creature")) { Card card2 = new Card(); card2 = CardFactory_Creatures.getCard(in, in.getName(), in.getOwner(), this); return card2; - } else if(in.getType().contains("Aura")) { + } else if(in.isType("Aura")) { Card card2 = new Card(); card2 = CardFactory_Auras.getCard(in, in.getName(), in.getOwner()); return card2; - } else if(in.getType().contains("Equipment")) { + } else if(in.isType("Equipment")) { Card card2 = new Card(); card2 = CardFactory_Equipment.getCard(in, in.getName(), in.getOwner()); return card2; - } else if(in.getType().contains("Planeswalker")) { + } else if(in.isType("Planeswalker")) { Card card2 = new Card(); card2 = CardFactory_Planeswalkers.getCard(in, in.getName(), in.getOwner()); return card2; - } else if(in.getType().contains("Land")) { + } else if(in.isType("Land")) { Card card2 = new Card(); card2 = CardFactory_Lands.getCard(in, in.getName(), in.getOwner()); @@ -416,7 +416,7 @@ public class CardFactory implements NewConstants { { Card c = clICtrl.get(i); for (int j = 0; j < types.length; j++) - if (c.getType().contains(types[j].trim())) + if (c.isType(types[j].trim())) fnd = true; } @@ -819,19 +819,19 @@ public class CardFactory implements NewConstants { //****************************************************************** //************** Link to different CardFactories ******************* Card card2 = null; - if(card.getType().contains("Creature")) { + if(card.isType("Creature")) { card2 = CardFactory_Creatures.getCard(card, cardName, owner, this); - } else if(card.getType().contains("Aura")) { + } else if(card.isType("Aura")) { card2 = CardFactory_Auras.getCard(card, cardName, owner); - } else if(card.getType().contains("Equipment")) { + } else if(card.isType("Equipment")) { card2 = CardFactory_Equipment.getCard(card, cardName, owner); - } else if(card.getType().contains("Planeswalker")) { + } else if(card.isType("Planeswalker")) { card2 = CardFactory_Planeswalkers.getCard(card, cardName, owner); - } else if(card.getType().contains("Land")) { + } else if(card.isType("Land")) { card2 = CardFactory_Lands.getCard(card, cardName, owner); - } else if (card.getType().contains("Instant")) { + } else if (card.isType("Instant")) { card2 = CardFactory_Instants.getCard(card, cardName, owner); - } else if (card.getType().contains("Sorcery")) { + } else if (card.isType("Sorcery")) { card2 = CardFactory_Sorceries.getCard(card, cardName, owner); } @@ -1443,7 +1443,7 @@ public class CardFactory implements NewConstants { CardList creatures = new CardList(); for(int i = 0; i < hand.size(); i++) { - if(hand.get(i).getType().contains("Creature") + if (hand.get(i).isType("Creature") && CardUtil.getConvertedManaCost(hand.get(i).getManaCost()) <= 3) creatures.add(hand.get(i)); } diff --git a/src/forge/card/cardFactory/CardFactory_Sorceries.java b/src/forge/card/cardFactory/CardFactory_Sorceries.java index b76909f7e80..c9207c37bc9 100644 --- a/src/forge/card/cardFactory/CardFactory_Sorceries.java +++ b/src/forge/card/cardFactory/CardFactory_Sorceries.java @@ -1097,8 +1097,10 @@ public class CardFactory_Sorceries { @Override public void selectCard(Card c, PlayerZone zone) { - if(c.isLand() && zone.is(Constant.Zone.Battlefield) && !c.getType().contains("Basic")) { - if(card.isCopiedSpell()) card.getChoiceTargets().remove(0); + if (c.isLand() + && zone.is(Constant.Zone.Battlefield) + && !c.isType("Basic")) { + if (card.isCopiedSpell()) card.getChoiceTargets().remove(0); m_land[0] = c; spell.setTargetCard(c); card.setSpellChoiceTarget(String.valueOf(c.getUniqueNumber())); @@ -1330,11 +1332,11 @@ public class CardFactory_Sorceries { land = land.filter(new CardListFilter() { public boolean addCard(Card c){ if (c.getName().contains("Dryad Arbor")) return true; - else if (!(c.getType().contains("Forest") - || c.getType().contains("Plains") - || c.getType().contains("Mountain") - || c.getType().contains("Island") - || c.getType().contains("Swamp"))) return true; + else if (!(c.isType("Forest") + || c.isType("Plains") + || c.isType("Mountain") + || c.isType("Island") + || c.isType("Swamp"))) return true; else return false; } }); @@ -1380,7 +1382,7 @@ public class CardFactory_Sorceries { if(c.isLand() && zone.is(Constant.Zone.Battlefield) && c.getController().isHuman() /*&& c.getName().equals(humanBasic.get(count))*/ - && c.getType().contains(humanBasic.get(count)) + && c.isType(humanBasic.get(count)) /*&& !saveList.contains(c) */) { //get all other basic[count] lands human player controls and add them to target CardList land = AllZoneUtil.getPlayerLandsInPlay(AllZone.HumanPlayer); @@ -1408,11 +1410,11 @@ public class CardFactory_Sorceries { land = land.filter(new CardListFilter() { public boolean addCard(Card c){ if (c.getName().contains("Dryad Arbor")) return true; - else if (!(c.getType().contains("Forest") - || c.getType().contains("Plains") - || c.getType().contains("Mountain") - || c.getType().contains("Island") - || c.getType().contains("Swamp"))) return true; + else if (!(c.isType("Forest") + || c.isType("Plains") + || c.isType("Mountain") + || c.isType("Island") + || c.isType("Swamp"))) return true; else return false; } }); @@ -1495,11 +1497,11 @@ public class CardFactory_Sorceries { c2.getController().discard(c2, null); - if(c1.getType().contains("Land")) { + if(c1.isType("Land")) { AllZone.HumanPlayer.gainLife(3, card); } - if(c2.getType().contains("Land")) { + if(c2.isType("Land")) { AllZone.HumanPlayer.gainLife(3, card); } @@ -1509,7 +1511,7 @@ public class CardFactory_Sorceries { public void computerResolve() { CardList list = AllZoneUtil.getPlayerHand(AllZone.HumanPlayer); - if(list.size() > 0) { + if (list.size() > 0) { Object o = GuiUtils.getChoiceOptional("First card to discard", list.toArray()); @@ -1518,11 +1520,11 @@ public class CardFactory_Sorceries { c.getController().discard(c, null); - if(c.getType().contains("Land")) { + if (c.isType("Land")) { AllZone.ComputerPlayer.gainLife(3, card); } - if(list.size() > 0) { + if (list.size() > 0) { Object o2 = GuiUtils.getChoiceOptional("Second card to discard", list.toArray()); Card c2 = (Card) o2; @@ -1530,7 +1532,7 @@ public class CardFactory_Sorceries { c2.getController().discard(c2, null); - if(c2.getType().contains("Land")) { + if (c2.isType("Land")) { AllZone.ComputerPlayer.gainLife(3, card); } } @@ -1594,7 +1596,7 @@ public class CardFactory_Sorceries { CardList creature = AllZoneUtil.getCreaturesInPlay(card.getController()); creature = creature.filter(new CardListFilter() { public boolean addCard(Card card) { - return (!card.getType().contains("Legendary")); + return (!card.isType("Legendary")); } }); if(creature.size() == 0) return false; @@ -1611,7 +1613,7 @@ public class CardFactory_Sorceries { CardList creature = AllZoneUtil.getCreaturesInPlay(); creature = creature.filter(new CardListFilter() { public boolean addCard(Card card) { - return (!card.getType().contains("Legendary")); + return (!card.isType("Legendary")); } }); if(creature.size() > 0) { @@ -1673,13 +1675,13 @@ public class CardFactory_Sorceries { CardList creature = AllZoneUtil.getCreaturesInPlay(card.getController()); creature = creature.filter(new CardListFilter() { public boolean addCard(Card card) { - return (!card.getType().contains("Legendary")); + return (!card.isType("Legendary")); } }); if(creature.size() == 0) return false; biggest = creature.get(0); - for(int i = 0; i < creature.size(); i++) - if(biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i); + for (int i = 0; i < creature.size(); i++) + if (biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i); setTargetCard(biggest); return biggest.getNetAttack() > 3; @@ -1690,13 +1692,13 @@ public class CardFactory_Sorceries { CardList creature = AllZoneUtil.getCreaturesInPlay(card.getController()); creature = creature.filter(new CardListFilter() { public boolean addCard(Card card) { - return (!card.getType().contains("Legendary")); + return (!card.isType("Legendary")); } }); - if(creature.size() > 0) { + if (creature.size() > 0) { Card biggest = creature.get(0); - for(int i = 0; i < creature.size(); i++) - if(biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i); + for (int i = 0; i < creature.size(); i++) + if (biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i); setTargetCard(biggest); } }