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

@@ -496,6 +496,16 @@ 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

@@ -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);
}
@@ -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;
}
@@ -8092,6 +8091,12 @@ 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

@@ -409,6 +409,12 @@ public abstract class GameEntity extends MyObservable {
}
}
/**
*
* hasProtectionFrom.
* @param source Card
* @return boolean
*/
public boolean hasProtectionFrom(Card source) {
return false;
}

View File

@@ -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,8 +929,7 @@ 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;
}
@@ -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

@@ -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)) {
@@ -1387,8 +1387,9 @@ 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

@@ -2958,7 +2958,7 @@ 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);

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;
/**
@@ -46,9 +45,11 @@ public class Trigger_Attacks extends Trigger {
}
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.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);