various Checkstyle fixes

This commit is contained in:
slapshot5
2011-08-31 04:29:03 +00:00
parent acfc57d1e7
commit 5ba1902263
5 changed files with 538 additions and 333 deletions

View File

@@ -114,8 +114,8 @@ public enum Counters {
* *
* @param name a {@link java.lang.String} object. * @param name a {@link java.lang.String} object.
*/ */
private Counters(String name) { private Counters(final String nameIn) {
this.name = name; this.name = nameIn;
} }
/** /**
@@ -133,7 +133,8 @@ public enum Counters {
* @param name a {@link java.lang.String} object. * @param name a {@link java.lang.String} object.
* @return a {@link forge.Counters} object. * @return a {@link forge.Counters} object.
*/ */
public static Counters getType(String name) { public static Counters getType(final String name) {
return Enum.valueOf(Counters.class, name.replace("/", "").replaceAll("\\+", "p").replaceAll("\\-", "m").toUpperCase()); String replacedName = name.replace("/", "").replaceAll("\\+", "p").replaceAll("\\-", "m").toUpperCase();
return Enum.valueOf(Counters.class, replacedName);
} }
} }

View File

@@ -9,7 +9,7 @@ package forge;
*/ */
public class EndOfCombat implements java.io.Serializable { public class EndOfCombat implements java.io.Serializable {
/** Constant <code>serialVersionUID=3035250030566186842L</code> */ /** Constant <code>serialVersionUID=3035250030566186842L</code>. */
private static final long serialVersionUID = 3035250030566186842L; private static final long serialVersionUID = 3035250030566186842L;
private CommandList at = new CommandList(); private CommandList at = new CommandList();
@@ -20,7 +20,7 @@ public class EndOfCombat implements java.io.Serializable {
* *
* @param c a {@link forge.Command} object. * @param c a {@link forge.Command} object.
*/ */
public void addAt(Command c) { public final void addAt(final Command c) {
at.add(c); at.add(c);
} }
@@ -29,14 +29,14 @@ public class EndOfCombat implements java.io.Serializable {
* *
* @param c a {@link forge.Command} object. * @param c a {@link forge.Command} object.
*/ */
public void addUntil(Command c) { public final void addUntil(final Command c) {
until.add(c); until.add(c);
} }
/** /**
* <p>executeAt.</p> * <p>executeAt.</p>
*/ */
public void executeAt() { public final void executeAt() {
//AllZone.getStateBasedEffects().rePopulateStateBasedList(); //AllZone.getStateBasedEffects().rePopulateStateBasedList();
execute(at); execute(at);
} //executeAt() } //executeAt()
@@ -45,7 +45,7 @@ public class EndOfCombat implements java.io.Serializable {
/** /**
* <p>executeUntil.</p> * <p>executeUntil.</p>
*/ */
public void executeUntil() { public final void executeUntil() {
execute(until); execute(until);
} }
@@ -54,7 +54,7 @@ public class EndOfCombat implements java.io.Serializable {
* *
* @return a int. * @return a int.
*/ */
public int sizeAt() { public final int sizeAt() {
return at.size(); return at.size();
} }
@@ -63,7 +63,7 @@ public class EndOfCombat implements java.io.Serializable {
* *
* @return a int. * @return a int.
*/ */
public int sizeUntil() { public final int sizeUntil() {
return until.size(); return until.size();
} }
@@ -72,10 +72,12 @@ public class EndOfCombat implements java.io.Serializable {
* *
* @param c a {@link forge.CommandList} object. * @param c a {@link forge.CommandList} object.
*/ */
private void execute(CommandList c) { private void execute(final CommandList c) {
int length = c.size(); int length = c.size();
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++) {
c.remove(0).execute(); c.remove(0).execute();
} }
} }
} //end class EndOfCombat

View File

@@ -11,7 +11,7 @@ import forge.card.spellability.SpellAbility;
* @version $Id$ * @version $Id$
*/ */
public class EndOfTurn implements java.io.Serializable { public class EndOfTurn implements java.io.Serializable {
/** Constant <code>serialVersionUID=-3656715295379727275L</code> */ /** Constant <code>serialVersionUID=-3656715295379727275L</code>. */
private static final long serialVersionUID = -3656715295379727275L; private static final long serialVersionUID = -3656715295379727275L;
private CommandList at = new CommandList(); private CommandList at = new CommandList();
@@ -23,7 +23,7 @@ public class EndOfTurn implements java.io.Serializable {
* *
* @param c a {@link forge.Command} object. * @param c a {@link forge.Command} object.
*/ */
public void addAt(Command c) { public final void addAt(final Command c) {
at.add(c); at.add(c);
} }
@@ -32,7 +32,7 @@ public class EndOfTurn implements java.io.Serializable {
* *
* @param c a {@link forge.Command} object. * @param c a {@link forge.Command} object.
*/ */
public void addUntil(Command c) { public final void addUntil(final Command c) {
until.add(c); until.add(c);
} }
@@ -41,14 +41,14 @@ public class EndOfTurn implements java.io.Serializable {
* *
* @param c a {@link forge.Command} object. * @param c a {@link forge.Command} object.
*/ */
public void addLast(Command c) { public final void addLast(final Command c) {
last.add(c); last.add(c);
} }
/** /**
* <p>executeAt.</p> * <p>executeAt.</p>
*/ */
public void executeAt() { public final void executeAt() {
//Pyrohemia and Pestilence //Pyrohemia and Pestilence
CardList all = AllZoneUtil.getCardsInPlay(); CardList all = AllZoneUtil.getCardsInPlay();
@@ -66,12 +66,15 @@ public class EndOfTurn implements java.io.Serializable {
for (Card c : all) { for (Card c : all) {
if (!c.isFaceDown() if (!c.isFaceDown()
&& c.hasKeyword("At the beginning of the end step, sacrifice CARDNAME.")) { && c.hasKeyword("At the beginning of the end step, sacrifice CARDNAME."))
{
final Card card = c; final Card card = c;
final SpellAbility sac = new Ability(card, "0") { final SpellAbility sac = new Ability(card, "0") {
@Override @Override
public void resolve() { public void resolve() {
if (AllZoneUtil.isCardInPlay(card)) AllZone.getGameAction().sacrifice(card); if (AllZoneUtil.isCardInPlay(card)) {
AllZone.getGameAction().sacrifice(card);
}
} }
}; };
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@@ -82,12 +85,15 @@ public class EndOfTurn implements java.io.Serializable {
} }
if (!c.isFaceDown() if (!c.isFaceDown()
&& c.hasKeyword("At the beginning of the end step, exile CARDNAME.")) { && c.hasKeyword("At the beginning of the end step, exile CARDNAME."))
{
final Card card = c; final Card card = c;
final SpellAbility exile = new Ability(card, "0") { final SpellAbility exile = new Ability(card, "0") {
@Override @Override
public void resolve() { public void resolve() {
if (AllZoneUtil.isCardInPlay(card)) AllZone.getGameAction().exile(card); if (AllZoneUtil.isCardInPlay(card)) {
AllZone.getGameAction().exile(card);
}
} }
}; };
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@@ -98,12 +104,15 @@ public class EndOfTurn implements java.io.Serializable {
} }
if (!c.isFaceDown() if (!c.isFaceDown()
&& c.hasKeyword("At the beginning of the end step, destroy CARDNAME.")) { && c.hasKeyword("At the beginning of the end step, destroy CARDNAME."))
{
final Card card = c; final Card card = c;
final SpellAbility destroy = new Ability(card, "0") { final SpellAbility destroy = new Ability(card, "0") {
@Override @Override
public void resolve() { public void resolve() {
if (AllZoneUtil.isCardInPlay(card)) AllZone.getGameAction().destroy(card); if (AllZoneUtil.isCardInPlay(card)) {
AllZone.getGameAction().destroy(card);
}
} }
}; };
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@@ -120,7 +129,9 @@ public class EndOfTurn implements java.io.Serializable {
final SpellAbility sac = new Ability(card, "0") { final SpellAbility sac = new Ability(card, "0") {
@Override @Override
public void resolve() { public void resolve() {
if (AllZoneUtil.isCardInPlay(card)) AllZone.getGameAction().destroy(card); if (AllZoneUtil.isCardInPlay(card)) {
AllZone.getGameAction().destroy(card);
}
} }
}; };
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@@ -140,7 +151,8 @@ public class EndOfTurn implements java.io.Serializable {
public void resolve() { public void resolve() {
if (AllZoneUtil.isCardInPlay(vale)) { if (AllZoneUtil.isCardInPlay(vale)) {
vale.addController(vale.getController().getOpponent()); vale.addController(vale.getController().getOpponent());
//AllZone.getGameAction().changeController(new CardList(vale), vale.getController(), vale.getController().getOpponent()); //AllZone.getGameAction().changeController(
// new CardList(vale), vale.getController(), vale.getController().getOpponent());
vale.removeExtrinsicKeyword("An opponent gains control of CARDNAME at the beginning of the next end step."); vale.removeExtrinsicKeyword("An opponent gains control of CARDNAME at the beginning of the next end step.");
} }
@@ -153,8 +165,9 @@ public class EndOfTurn implements java.io.Serializable {
AllZone.getStack().addSimultaneousStackEntry(change); AllZone.getStack().addSimultaneousStackEntry(change);
} }
if (c.getName().equals("Erg Raiders") && !c.getCreatureAttackedThisTurn() && if (c.getName().equals("Erg Raiders") && !c.getCreatureAttackedThisTurn()
!c.isSick() && AllZone.getPhase().isPlayerTurn(c.getController())) { && !c.isSick() && AllZone.getPhase().isPlayerTurn(c.getController()))
{
final Card raider = c; final Card raider = c;
final SpellAbility change = new Ability(raider, "0") { final SpellAbility change = new Ability(raider, "0") {
@Override @Override
@@ -174,7 +187,8 @@ public class EndOfTurn implements java.io.Serializable {
if (c.hasKeyword("At the beginning of your end step, sacrifice this creature unless it attacked this turn.") if (c.hasKeyword("At the beginning of your end step, sacrifice this creature unless it attacked this turn.")
&& !c.getCreatureAttackedThisTurn() && !c.getCreatureAttackedThisTurn()
/* && !(c.getTurnInZone() == AllZone.getPhase().getTurn())*/ /* && !(c.getTurnInZone() == AllZone.getPhase().getTurn())*/
&& AllZone.getPhase().isPlayerTurn(c.getController())) { && AllZone.getPhase().isPlayerTurn(c.getController()))
{
final Card source = c; final Card source = c;
final SpellAbility change = new Ability(source, "0") { final SpellAbility change = new Ability(source, "0") {
@Override @Override
@@ -193,7 +207,8 @@ public class EndOfTurn implements java.io.Serializable {
} }
if (c.hasKeyword("At the beginning of your end step, destroy this creature if it didn't attack this turn.") if (c.hasKeyword("At the beginning of your end step, destroy this creature if it didn't attack this turn.")
&& !c.getCreatureAttackedThisTurn() && !c.getCreatureAttackedThisTurn()
&& AllZone.getPhase().isPlayerTurn(c.getController())) { && AllZone.getPhase().isPlayerTurn(c.getController()))
{
final Card source = c; final Card source = c;
final SpellAbility change = new Ability(source, "0") { final SpellAbility change = new Ability(source, "0") {
@Override @Override
@@ -211,7 +226,8 @@ public class EndOfTurn implements java.io.Serializable {
} }
if (c.hasKeyword("At the beginning of your end step, return CARDNAME to its owner's hand.") if (c.hasKeyword("At the beginning of your end step, return CARDNAME to its owner's hand.")
&& AllZone.getPhase().isPlayerTurn(c.getController())) { && AllZone.getPhase().isPlayerTurn(c.getController()))
{
final Card source = c; final Card source = c;
final SpellAbility change = new Ability(source, "0") { final SpellAbility change = new Ability(source, "0") {
@Override @Override
@@ -237,7 +253,9 @@ public class EndOfTurn implements java.io.Serializable {
CardList all2 = AllZoneUtil.getCardsInPlay(); CardList all2 = AllZoneUtil.getCardsInPlay();
for (Card c : all2) { for (Card c : all2) {
if (c.getCreatureAttackedThisTurn()) c.setCreatureAttackedThisTurn(false); if (c.getCreatureAttackedThisTurn()) {
c.setCreatureAttackedThisTurn(false);
}
} }
} //executeAt() } //executeAt()
@@ -246,7 +264,7 @@ public class EndOfTurn implements java.io.Serializable {
/** /**
* <p>executeUntil.</p> * <p>executeUntil.</p>
*/ */
public void executeUntil() { public final void executeUntil() {
execute(until); execute(until);
execute(last); execute(last);
} }
@@ -256,7 +274,7 @@ public class EndOfTurn implements java.io.Serializable {
* *
* @return a int. * @return a int.
*/ */
public int sizeAt() { public final int sizeAt() {
return at.size(); return at.size();
} }
@@ -265,7 +283,7 @@ public class EndOfTurn implements java.io.Serializable {
* *
* @return a int. * @return a int.
*/ */
public int sizeUntil() { public final int sizeUntil() {
return until.size(); return until.size();
} }
@@ -274,7 +292,7 @@ public class EndOfTurn implements java.io.Serializable {
* *
* @return a int. * @return a int.
*/ */
public int sizeLast() { public final int sizeLast() {
return last.size(); return last.size();
} }
@@ -283,10 +301,12 @@ public class EndOfTurn implements java.io.Serializable {
* *
* @param c a {@link forge.CommandList} object. * @param c a {@link forge.CommandList} object.
*/ */
private void execute(CommandList c) { private void execute(final CommandList c) {
int length = c.size(); int length = c.size();
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++) {
c.remove(0).execute(); c.remove(0).execute();
} }
} }
} //end class EndOfTurn

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,7 @@ import forge.card.spellability.Target;
* @author Forge * @author Forge
* @version $Id$ * @version $Id$
*/ */
public class AbilityFactory_Combat { public final class AbilityFactory_Combat {
private AbilityFactory_Combat() { private AbilityFactory_Combat() {
throw new AssertionError(); throw new AssertionError();