checkstyle

This commit is contained in:
jendave
2011-11-01 19:29:55 +00:00
parent f562d07256
commit 93a35c8c36
12 changed files with 76 additions and 54 deletions

View File

@@ -495,7 +495,17 @@ public final class AllZone implements NewConstants {
return null;
}
/**
*
* isCardInZone.
*
* @param c
* Card
* @param zone
* Constant.Zone
* @return boolean
*/
public static boolean isCardInZone(final Card c, Constant.Zone zone) {
final FGameState gameState = Singletons.getModel().getGameState();
if (gameState == null) {
@@ -506,9 +516,11 @@ public final class AllZone implements NewConstants {
return true;
}
else for (Player p : gameState.getPlayers()) {
if(p.getZone(zone).contains(c)) {
return true;
else {
for (Player p : gameState.getPlayers()) {
if (p.getZone(zone).contains(c)) {
return true;
}
}
}

View File

@@ -49,7 +49,7 @@ public class Card extends GameEntity implements Comparable<Card> {
/**
* Gets the characteristics.
*
*
* @return the characteristics
*/
public CardCharacteristics getCharacteristics() {
@@ -4491,8 +4491,7 @@ public class Card extends GameEntity implements Comparable<Card> {
+ getCounters(Counters.P1P2)
+ getCounters(Counters.P1P0)
- getCounters(Counters.M1M1)
+ (2 * getCounters(Counters.P2P2) - (2 * getCounters(Counters.M2M1))
- (2 * getCounters(Counters.M2M2)) - getCounters(Counters.M1M0));
+ (2 * getCounters(Counters.P2P2) - (2 * getCounters(Counters.M2M1)) - (2 * getCounters(Counters.M2M2)) - getCounters(Counters.M1M0));
return total;
}
@@ -6253,8 +6252,7 @@ public class Card extends GameEntity implements Comparable<Card> {
cardType = toMixedCase(cardType);
if (typeContains(cardType)
|| ((isCreature() || isTribal()) && CardUtil.isACreatureType(cardType)
&& typeContains("AllCreatureTypes"))) {
|| ((isCreature() || isTribal()) && CardUtil.isACreatureType(cardType) && typeContains("AllCreatureTypes"))) {
return true;
}
return false;
@@ -7463,7 +7461,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
if (this.hasKeyword("If damage would be dealt to CARDNAME, "
+ "prevent that damage. Remove a +1/+1 counter from CARDNAME.")) {
+ "prevent that damage. Remove a +1/+1 counter from CARDNAME.")) {
restDamage = 0;
this.subtractCounter(Counters.P1P1, 1);
}
@@ -8007,7 +8005,7 @@ public class Card extends GameEntity implements Comparable<Card> {
public final void setCardColorsOverridden(final boolean cardColorsOverridden0) {
getCharacteristics().setCardColorsOverridden(cardColorsOverridden0);
}
@Override
public boolean hasProtectionFrom(Card source) {
if (source == null) {
@@ -8059,7 +8057,8 @@ public class Card extends GameEntity implements Comparable<Card> {
}
if (kw.equals("Protection from colored spells")
&& (source.isInstant() || source.isSorcery() || source.isAura()) && CardFactoryUtil.isColored(source)) {
&& (source.isInstant() || source.isSorcery() || source.isAura())
&& CardFactoryUtil.isColored(source)) {
return true;
}
@@ -8091,7 +8090,13 @@ public class Card extends GameEntity implements Comparable<Card> {
}
return false;
}
/**
*
* is In Zone.
* @param zone Constant.Zone
* @return boolean
*/
public boolean isInZone(final Constant.Zone zone) {
return AllZone.isCardInZone(this, zone);
}

View File

@@ -408,7 +408,13 @@ public abstract class GameEntity extends MyObservable {
enchantedBy.get(i).unEnchantEntity(this);
}
}
/**
*
* hasProtectionFrom.
* @param source Card
* @return boolean
*/
public boolean hasProtectionFrom(Card source) {
return false;
}

View File

@@ -532,7 +532,7 @@ public abstract class Player extends GameEntity {
if (AllZoneUtil.isCardInPlay("Leyline of Punishment")) {
return damage;
}
if (hasProtectionFrom(source)) {
return 0;
}
@@ -912,7 +912,8 @@ public abstract class Player extends GameEntity {
* @see forge.GameEntity#hasKeyword(java.lang.String)
*/
/**
* @param keyword String
* @param keyword
* String
* @return boolean
*/
public final boolean hasKeyword(final String keyword) {
@@ -928,15 +929,14 @@ public abstract class Player extends GameEntity {
*/
@Override
public final boolean canTarget(final SpellAbility sa) {
if (hasKeyword("Shroud")
|| (!this.isPlayer(sa.getActivatingPlayer()) && hasKeyword("Hexproof"))
if (hasKeyword("Shroud") || (!this.isPlayer(sa.getActivatingPlayer()) && hasKeyword("Hexproof"))
|| hasProtectionFrom(sa.getSourceCard())) {
return false;
}
return true;
}
@Override
public boolean hasProtectionFrom(Card source) {
if (getKeywords() != null) {
@@ -1397,8 +1397,7 @@ public abstract class Player extends GameEntity {
sa.getSourceCard().getController().loseLife(5, c);
}
};
ability.setStackDescription(c.getName() + " - "
+ sa.getSourceCard().getController() + " loses 5 life.");
ability.setStackDescription(c.getName() + " - " + sa.getSourceCard().getController() + " loses 5 life.");
AllZone.getStack().add(ability);
}
}
@@ -1406,15 +1405,14 @@ public abstract class Player extends GameEntity {
AllZone.getGameAction().discard_madness(c);
if ((c.hasKeyword("If a spell or ability an opponent controls causes "
+ "you to discard CARDNAME, put it onto the battlefield instead of putting it into your graveyard.")
|| c.hasKeyword("If a spell or ability an opponent controls causes "
+ "you to discard CARDNAME, put it onto the battlefield with two +1/+1 "
+ "counters on it instead of putting it into your graveyard."))
+ "you to discard CARDNAME, put it onto the battlefield instead of putting it into your graveyard.") || c
.hasKeyword("If a spell or ability an opponent controls causes "
+ "you to discard CARDNAME, put it onto the battlefield with two +1/+1 "
+ "counters on it instead of putting it into your graveyard."))
&& null != sa && !c.getController().equals(sa.getSourceCard().getController())) {
AllZone.getGameAction().discard_PutIntoPlayInstead(c);
} else if (c
.hasKeyword("If a spell or ability an opponent controls "
+ "causes you to discard CARDNAME, return it to your hand.")) {
} else if (c.hasKeyword("If a spell or ability an opponent controls "
+ "causes you to discard CARDNAME, return it to your hand.")) {
} else {
AllZone.getGameAction().moveToGraveyard(c);
}
@@ -1613,7 +1611,7 @@ public abstract class Player extends GameEntity {
AllZone.getTriggerHandler().runTrigger("Shuffled", runParams);
} // shuffle
// //////////////////////////////
// //////////////////////////////
// //////////////////////////////
/**

View File

@@ -834,7 +834,7 @@ public final class AbilityFactory_ChangeZone {
if (params.containsKey("GainControl")) {
c.addController(af.getHostCard());
}
if (params.containsKey("Attacking")) {
AllZone.getCombat().addAttacker(c);
}
@@ -947,9 +947,9 @@ public final class AbilityFactory_ChangeZone {
c = AbilityFactory_ChangeZone.basicManaFixing(fetchList, type);
} else if (fetchList.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.getBestCreatureAI(fetchList); // if only
// creatures
// take the
// best
// creatures
// take the
// best
} else if (Zone.Battlefield.equals(destination) || Zone.Graveyard.equals(destination)) {
c = CardFactoryUtil.getMostExpensivePermanentAI(fetchList, af.getHostCard(), false);
} else if (Zone.Exile.equals(destination)) {
@@ -991,7 +991,7 @@ public final class AbilityFactory_ChangeZone {
if (params.containsKey("GainControl")) {
c.addController(af.getHostCard());
}
if (params.containsKey("Attacking")) {
AllZone.getCombat().addAttacker(c);
}
@@ -1386,9 +1386,10 @@ public final class AbilityFactory_ChangeZone {
// Exile and bounce opponents stuff
if (destination.equals(Zone.Exile) || origin.equals(Zone.Battlefield)) {
//don't rush bouncing stuff when not going to attack
if(AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer())
// don't rush bouncing stuff when not going to attack
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2)
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer())
&& AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()).isEmpty()) {
return false;
}

View File

@@ -2957,12 +2957,12 @@ public class CardFactoryUtil {
}
return CardFactoryUtil.doXMath(n, m, c);
}
//Count$ColoredCreatures *a DOMAIN for creatures*
// Count$ColoredCreatures *a DOMAIN for creatures*
if (sq[0].contains("ColoredCreatures")) {
someCards.addAll(cardController.getCardsIn(Zone.Battlefield));
someCards = someCards.filter(CardListFilter.CREATURES);
final String[] colors = { "green", "white", "red", "blue", "black" };
for (int i = 0; i < colors.length; i++) {

View File

@@ -351,7 +351,7 @@ public class Target_Selection {
return;
}
if (((tgt.canTgtPlayer() && !tgt.canOnlyTgtOpponent())
if (((tgt.canTgtPlayer() && !tgt.canOnlyTgtOpponent())
|| (tgt.canOnlyTgtOpponent() && player.equals(sa.getActivatingPlayer()
.getOpponent()))) && player.canTarget(sa)) {
tgt.addTarget(player);

View File

@@ -932,11 +932,11 @@ public class TriggerHandler {
// //////////////////////////////////////
@Override
public void resolve() {
if (!(regtrig instanceof Trigger_Always)) // State triggers
// don't do the whole
// "Intervening If"
// thing.
{
if (!(regtrig instanceof Trigger_Always)) {
// State triggers
// don't do the whole
// "Intervening If"
// thing.
if (!regtrig.requirementsCheck()) {
return;
}

View File

@@ -7,7 +7,6 @@ import org.apache.commons.lang3.StringUtils;
import forge.Card;
import forge.CardList;
import forge.Player;
import forge.card.spellability.SpellAbility;
/**
@@ -44,11 +43,13 @@ public class Trigger_Attacks extends Trigger {
return false;
}
}
if (mapParams.containsKey("Attacked")) {
if (mapParams.get("Attacked").equals("Player") && StringUtils.isNumeric(runParams2.get("Attacked").toString())
&& Integer.parseInt(runParams2.get("Attacked").toString()) > 0)
if (mapParams.containsKey("Attacked")) {
if (mapParams.get("Attacked").equals("Player")
&& StringUtils.isNumeric(runParams2.get("Attacked").toString())
&& Integer.parseInt(runParams2.get("Attacked").toString()) > 0) {
return false;
}
}
if (mapParams.containsKey("Alone")) {

View File

@@ -1,3 +1,3 @@
/** Forge Card Game */
/** Forge Card Game. */
package forge.game.limited;

View File

@@ -297,7 +297,6 @@ public final class TableModel<T extends InventoryItem> extends AbstractTableMode
* the component's addColumnListener method. When the column event occurs,
* that object's appropriate method is invoked.
*
* @see ColumnEvent
*/
class ColumnListener extends MouseAdapter {

View File

@@ -319,7 +319,7 @@ public class TreeProperties implements Iterable<PropertyElement> {
*
* @param key
* a {@link java.lang.String} object.
* @return a {@link treeProperties.TreeProperties} object.
* @return a {@link tree.properties.TreeProperties} object.
*/
public final TreeProperties getChildProperties(final String key) {
return (TreeProperties) getProperty(key, "--" + CHILD, true);