From d48d44dd56781dfefc39461ad73bb61fbf597332 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 18 Feb 2014 17:36:10 +0100 Subject: [PATCH] Minor formatting. --- .../src/mage/deck/Modern.java | 5 +- .../src/mage/sets/commander/Invigorate.java | 5 +- .../mage/sets/dissension/UtopiaSprawl.java | 27 ++-- Mage/src/mage/ObjectColor.java | 134 +++++++++++------- 4 files changed, 104 insertions(+), 67 deletions(-) diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Modern.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Modern.java index 80632b2539..d13e4a5734 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Modern.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Modern.java @@ -28,11 +28,12 @@ package mage.deck; import java.util.Date; +import java.util.GregorianCalendar; import mage.cards.ExpansionSet; import mage.cards.Sets; import mage.cards.decks.Constructed; import mage.constants.SetType; -import mage.sets.EighthEdition; + /** * @@ -44,7 +45,7 @@ public class Modern extends Constructed { public Modern() { super("Constructed - Modern"); - Date cutoff = EighthEdition.getInstance().getReleaseDate(); // 2003 / 07 / 28 + Date cutoff = new GregorianCalendar(2003, 7, 28).getTime(); // Eight edition release date for (ExpansionSet set: Sets.getInstance().values()) { if ((set.getReleaseDate().after(cutoff) || set.getReleaseDate().equals(cutoff)) && set.getSetType() != SetType.REPRINT) { setCodes.add(set.getCode()); diff --git a/Mage.Sets/src/mage/sets/commander/Invigorate.java b/Mage.Sets/src/mage/sets/commander/Invigorate.java index 627c93b614..2425ec8571 100644 --- a/Mage.Sets/src/mage/sets/commander/Invigorate.java +++ b/Mage.Sets/src/mage/sets/commander/Invigorate.java @@ -30,8 +30,7 @@ package mage.sets.commander; import java.util.UUID; import mage.abilities.condition.common.ControlsPermanentCondition; import mage.abilities.costs.AlternativeCostSourceAbility; -import mage.abilities.costs.common.GainLiveOpponentCost; -import mage.abilities.costs.common.GainLivePlayersCost; +import mage.abilities.costs.common.GainLifeOpponentCost; import mage.abilities.effects.common.continious.BoostTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; @@ -60,7 +59,7 @@ public class Invigorate extends CardImpl { this.color.setGreen(true); // If you control a Forest, rather than pay Invigorate's mana cost, you may have an opponent gain 3 life. - this.addAbility(new AlternativeCostSourceAbility(new GainLiveOpponentCost(3), new ControlsPermanentCondition(filter))); + this.addAbility(new AlternativeCostSourceAbility(new GainLifeOpponentCost(3), new ControlsPermanentCondition(filter))); // Target creature gets +4/+4 until end of turn. this.getSpellAbility().addEffect(new BoostTargetEffect(4,4,Duration.EndOfTurn)); this.getSpellAbility().addTarget(new TargetCreaturePermanent(true)); diff --git a/Mage.Sets/src/mage/sets/dissension/UtopiaSprawl.java b/Mage.Sets/src/mage/sets/dissension/UtopiaSprawl.java index d6e6db3ff4..e529cdea68 100644 --- a/Mage.Sets/src/mage/sets/dissension/UtopiaSprawl.java +++ b/Mage.Sets/src/mage/sets/dissension/UtopiaSprawl.java @@ -180,16 +180,23 @@ class UtopiaSprawlEffect extends ManaEffect { Player player = game.getPlayer(land.getControllerId()); if (player != null) { ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color"); - if (color.isBlack()) - player.getManaPool().addMana(Mana.BlackMana, game, source); - else if (color.isBlue()) - player.getManaPool().addMana(Mana.BlueMana, game, source); - else if (color.isRed()) - player.getManaPool().addMana(Mana.RedMana, game, source); - else if (color.isGreen()) - player.getManaPool().addMana(Mana.GreenMana, game, source); - else if (color.isWhite()) - player.getManaPool().addMana(Mana.WhiteMana, game, source); + switch(color.toString()) { + case "W": + player.getManaPool().addMana(Mana.WhiteMana, game, source); + break; + case "B": + player.getManaPool().addMana(Mana.BlackMana, game, source); + break; + case "U": + player.getManaPool().addMana(Mana.BlueMana, game, source); + break; + case "G": + player.getManaPool().addMana(Mana.GreenMana, game, source); + break; + case "R": + player.getManaPool().addMana(Mana.RedMana, game, source); + break; + } return true; } } diff --git a/Mage/src/mage/ObjectColor.java b/Mage/src/mage/ObjectColor.java index b370472f23..d1631141f9 100644 --- a/Mage/src/mage/ObjectColor.java +++ b/Mage/src/mage/ObjectColor.java @@ -79,11 +79,21 @@ public class ObjectColor implements Serializable, Copyable, Compara public int getColorCount() { int count = 0; - if (white) count++; - if (blue) count++; - if (black) count++; - if (green) count++; - if (red) count++; + if (white) { + count++; + } + if (blue) { + count++; + } + if (black) { + count++; + } + if (green) { + count++; + } + if (red) { + count++; + } return count; } @@ -104,17 +114,19 @@ public class ObjectColor implements Serializable, Copyable, Compara } public boolean isMulticolored() { - if (isColorless()) + if (isColorless()) { return false; - if (white && (blue | black | red | green)) + } + if (white && (blue | black | red | green)) { return true; - if (blue && (black | red | green)) + } + if (blue && (black | red | green)) { return true; - if (black && (red | green)) + } + if (black && (red | green)) { return true; - if (red && green) - return true; - return false; + } + return red && green; } public boolean isWhite() { @@ -151,16 +163,21 @@ public class ObjectColor implements Serializable, Copyable, Compara @Override public String toString() { StringBuilder sb = new StringBuilder(); - if (white) + if (white) { sb.append("W"); - if (blue) + } + if (blue) { sb.append("U"); - if (black) + } + if (black) { sb.append("B"); - if (red) + } + if (red) { sb.append("R"); - if (green) + } + if (green) { sb.append("G"); + } return sb.toString(); } @@ -169,38 +186,47 @@ public class ObjectColor implements Serializable, Copyable, Compara if (getColorCount() > 1) { return "multicolored"; } else { - if (white) - return "white"; - if (blue) - return "blue"; - if (black) - return "black"; - if (red) - return "red"; - if (green) - return "green"; + if (white) { + return "white"; + } + if (blue) { + return "blue"; + } + if (black) { + return "black"; + } + if (red) { + return "red"; + } + if (green) { + return "green"; + } } return "colorless"; } @Override public boolean equals(Object color) { - if (this == color) + if (this == color) { return true; - if (!(color instanceof ObjectColor)) + } + if (!(color instanceof ObjectColor)) { return false; + } ObjectColor test = (ObjectColor) color; - if (test.white != this.white) + if (test.white != this.white) { return false; - if (test.blue != this.blue) + } + if (test.blue != this.blue) { return false; - if (test.black != this.black) + } + if (test.black != this.black) { return false; - if (test.red != this.red) + } + if (test.red != this.red) { return false; - if (test.green != this.green) - return false; - return true; + } + return test.green == this.green; } @Override @@ -231,10 +257,12 @@ public class ObjectColor implements Serializable, Copyable, Compara } public boolean shares(ObjectColor color) { - if (this == color) + if (this == color) { return true; - if (!hasColor() && !color.hasColor()) + } + if (!hasColor() && !color.hasColor()) { return true; + } return color.white && white || color.blue && blue || color.black && black || color.red && red || color.green && green; } @@ -269,34 +297,36 @@ public class ObjectColor implements Serializable, Copyable, Compara int o1 = 0; int o2 = 0; - if (this.isMulticolored()) + if (this.isMulticolored()) { o1 = 6; - else if(this.isColorless()) + } else if(this.isColorless()) { o1 = 0; - else if(this.isBlack()) + } else if(this.isBlack()) { o1 = 1; - else if(this.isBlue()) + } else if(this.isBlue()) { o1 = 2; - else if(this.isGreen()) + } else if(this.isGreen()) { o1 = 3; - else if(this.isRed()) + } else if(this.isRed()) { o1 = 4; - else if(this.isWhite()) + } else if(this.isWhite()) { o1 = 5; - if (o.isMulticolored()) + } + if (o.isMulticolored()) { o2 = 6; - else if(o.isColorless()) + } else if(o.isColorless()) { o2 = 0; - else if(o.isBlack()) + } else if(o.isBlack()) { o2 = 1; - else if(o.isBlue()) + } else if(o.isBlue()) { o2 = 2; - else if(o.isGreen()) + } else if(o.isGreen()) { o2 = 3; - else if(o.isRed()) + } else if(o.isRed()) { o2 = 4; - else if(o.isWhite()) + } else if(o.isWhite()) { o2 = 5; + } return o1 - o2; }