- CheckStyle.

This commit is contained in:
Chris
2012-12-14 01:34:23 +00:00
parent 78df8a5fcc
commit 5bf5bd9a30
15 changed files with 59 additions and 44 deletions

View File

@@ -600,6 +600,14 @@ public class Card extends GameEntity implements Comparable<Card> {
this.rememberedObjects.add(o); this.rememberedObjects.add(o);
} }
/**
* <p>
* removeRemembered.
* </p>
*
* @param o
* a {@link java.lang.Object} object.
*/
public final void removeRemembered(final Object o) { public final void removeRemembered(final Object o) {
this.rememberedObjects.remove(o); this.rememberedObjects.remove(o);
} }
@@ -5430,7 +5438,14 @@ public class Card extends GameEntity implements Comparable<Card> {
public final boolean isEquipment() { public final boolean isEquipment() {
return this.typeContains("Equipment"); return this.typeContains("Equipment");
} }
/**
* <p>
* isScheme.
* </p>
*
* @return a boolean.
*/
public final boolean isScheme() { public final boolean isScheme() {
return this.typeContains("Scheme"); return this.typeContains("Scheme");
} }

View File

@@ -1064,7 +1064,7 @@ public class GameAction {
} }
} }
} // if isEquipped() } // if isEquipped()
if (c.isEquipping()) { if (c.isEquipping()) {
final Card equippedCreature = c.getEquipping().get(0); final Card equippedCreature = c.getEquipping().get(0);
@@ -1178,7 +1178,7 @@ public class GameAction {
} // while it.hasNext() } // while it.hasNext()
checkAgain |= game.getTriggerHandler().runWaitingTriggers(); checkAgain |= game.getTriggerHandler().runWaitingTriggers();
if (!checkAgain) { if (!checkAgain) {
break; // do not continue the loop break; // do not continue the loop
} }

View File

@@ -455,8 +455,8 @@ public final class GameActionUtil {
int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString) int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString)
: CardFactoryUtil.xCount(source, source.getSVar(amountString)); : CardFactoryUtil.xCount(source, source.getSVar(amountString));
String plural = amount > 1 ? "s" : ""; String plural = amount > 1 ? "s" : "";
if (part.canPay(sourceAbility, source, p, cost) && if (part.canPay(sourceAbility, source, p, cost)
showYesNoDialog(source, "Do you want to remove " + amount + " " + counterType.getName() && showYesNoDialog(source, "Do you want to remove " + amount + " " + counterType.getName()
+ " counter" + plural + " from " + source + "?")) { + " counter" + plural + " from " + source + "?")) {
source.subtractCounter(counterType, amount); source.subtractCounter(counterType, amount);
} else { } else {
@@ -539,7 +539,7 @@ public final class GameActionUtil {
} }
remainingParts.remove(part); remainingParts.remove(part);
} }
else if (part instanceof CostMana && ((CostMana) part).getManaToPay().equals("0")) { else if (part instanceof CostMana && ((CostMana) part).getManaToPay().equals("0")) {
remainingParts.remove(part); remainingParts.remove(part);
} }

View File

@@ -212,7 +212,7 @@ public final class CardType implements Comparable<CardType> {
public boolean isVanguard() { public boolean isVanguard() {
return this.coreType.contains(CardCoreType.Vanguard); return this.coreType.contains(CardCoreType.Vanguard);
} }
/** /**
* Checks if is scheme. * Checks if is scheme.
* *
@@ -220,7 +220,7 @@ public final class CardType implements Comparable<CardType> {
*/ */
public boolean isScheme() { public boolean isScheme() {
return this.coreType.contains(CardCoreType.Scheme); return this.coreType.contains(CardCoreType.Scheme);
} }
/** /**
* Checks if is enchantment. * Checks if is enchantment.

View File

@@ -1764,22 +1764,22 @@ public class AbilityFactory {
public static CounterType getCounterType(String name, SpellAbility sa) throws Exception { public static CounterType getCounterType(String name, SpellAbility sa) throws Exception {
CounterType counterType; CounterType counterType;
try{ try {
counterType = CounterType.getType(name); counterType = CounterType.getType(name);
} catch(Exception e) { } catch (Exception e) {
String type = sa.getSVar(name); String type = sa.getSVar(name);
if (type.equals("")) { if (type.equals("")) {
type = sa.getSourceCard().getSVar(name); type = sa.getSourceCard().getSVar(name);
} }
if (type.equals("")) { if (type.equals("")) {
throw new Exception("Counter type doesn't match, nor does an SVar exist with the type name."); throw new Exception("Counter type doesn't match, nor does an SVar exist with the type name.");
} }
counterType = CounterType.getType(type); counterType = CounterType.getType(type);
} }
return counterType; return counterType;
} }
} // end class AbilityFactory } // end class AbilityFactory

View File

@@ -163,7 +163,7 @@ public class AttachAi extends SpellAiLogic {
type = stab.get("AddType"); type = stab.get("AddType");
} }
} }
if ("ChosenType".equals(type)) { if ("ChosenType".equals(type)) {
// TODO ChosenTypeEffect should have exact same logic that's here // TODO ChosenTypeEffect should have exact same logic that's here
// For now, Island is as good as any for a default value // For now, Island is as good as any for a default value
@@ -315,7 +315,7 @@ public class AttachAi extends SpellAiLogic {
return c; return c;
} }
/** /**
* Attach ai control preference. * Attach ai control preference.
* *
@@ -343,7 +343,7 @@ public class AttachAi extends SpellAiLogic {
return c; return c;
} }
/** /**
* Attach ai control preference. * Attach ai control preference.
* *
@@ -362,7 +362,7 @@ public class AttachAi extends SpellAiLogic {
// I know this isn't much better than Hardcoding, but some cards need it for now // I know this isn't much better than Hardcoding, but some cards need it for now
Player ai = sa.getActivatingPlayer(); Player ai = sa.getActivatingPlayer();
Card chosen = null; Card chosen = null;
if ("Guilty Conscience".equals(sa.getSourceCard().getName())) { if ("Guilty Conscience".equals(sa.getSourceCard().getName())) {
List<Card> aiStuffies = CardLists.filter(list, Predicates.and(CardPredicates.isController(ai), CardPredicates.nameEquals("Stuffy Doll"))); List<Card> aiStuffies = CardLists.filter(list, Predicates.and(CardPredicates.isController(ai), CardPredicates.nameEquals("Stuffy Doll")));
if (!aiStuffies.isEmpty()) { if (!aiStuffies.isEmpty()) {
chosen = aiStuffies.get(0); chosen = aiStuffies.get(0);
@@ -372,7 +372,7 @@ public class AttachAi extends SpellAiLogic {
chosen = CardFactoryUtil.getBestCreatureAI(creatures); chosen = CardFactoryUtil.getBestCreatureAI(creatures);
} }
} }
// If Mandatory (brought directly into play without casting) gotta // If Mandatory (brought directly into play without casting) gotta
// choose something // choose something
if (chosen == null && mandatory) { if (chosen == null && mandatory) {
@@ -839,7 +839,7 @@ public class AttachAi extends SpellAiLogic {
// Some ChangeType cards are beneficial, and PrefPlayer should be // Some ChangeType cards are beneficial, and PrefPlayer should be
// changed to represent that // changed to represent that
final List<Card> prefList; final List<Card> prefList;
if ("Reanimate".equals(logic) || "SpecificCard".equals(logic)) { if ("Reanimate".equals(logic) || "SpecificCard".equals(logic)) {
// Reanimate or SpecificCard aren't so restrictive // Reanimate or SpecificCard aren't so restrictive
prefList = list; prefList = list;

View File

@@ -108,7 +108,7 @@ public class DrawAi extends SpellAiLogic {
} }
if ((!Singletons.getModel().getGame().getPhaseHandler().getNextTurn().equals(ai) if ((!Singletons.getModel().getGame().getPhaseHandler().getNextTurn().equals(ai)
|| Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.END_OF_TURN)) || Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.END_OF_TURN))
&& !sa.hasParam("PlayerTurn") && !AbilityFactory.isSorcerySpeed(sa) && !sa.hasParam("PlayerTurn") && !AbilityFactory.isSorcerySpeed(sa)
&& ai.getCardsIn(ZoneType.Hand).size() > 1) { && ai.getCardsIn(ZoneType.Hand).size() > 1) {
return false; return false;
} }

View File

@@ -181,7 +181,7 @@ public abstract class PumpAiBase extends SpellAiLogic {
Predicate<Card> flyingOrReach = Predicates.or(CardPredicates.hasKeyword("Flying"), CardPredicates.hasKeyword("Reach")); Predicate<Card> flyingOrReach = Predicates.or(CardPredicates.hasKeyword("Flying"), CardPredicates.hasKeyword("Reach"));
if (ph.isPlayerTurn(opp) || !(CombatUtil.canAttack(card, opp) || card.isAttacking()) if (ph.isPlayerTurn(opp) || !(CombatUtil.canAttack(card, opp) || card.isAttacking())
|| ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|| card.getNetCombatDamage() <= 0 || card.getNetCombatDamage() <= 0
|| !Iterables.any(CardLists.filter(opp.getCreaturesInPlay(), CardPredicates.possibleBlockers(card)), || !Iterables.any(CardLists.filter(opp.getCreaturesInPlay(), CardPredicates.possibleBlockers(card)),
Predicates.not(flyingOrReach))) { Predicates.not(flyingOrReach))) {
return false; return false;

View File

@@ -83,7 +83,7 @@ public class RepeatEachAi extends SpellAiLogic {
if (list.isEmpty()) { if (list.isEmpty()) {
return false; return false;
} }
tgt.addTarget(list.get(0)); tgt.addTarget(list.get(0));
} }

View File

@@ -14,7 +14,7 @@ import forge.game.zone.ZoneType;
public class AbandonEffect extends SpellEffect { public class AbandonEffect extends SpellEffect {
private GameState game = Singletons.getModel().getGame(); private GameState game = Singletons.getModel().getGame();
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.card.abilityfactory.SpellEffect#resolve(java.util.Map, forge.card.spellability.SpellAbility) * @see forge.card.abilityfactory.SpellEffect#resolve(java.util.Map, forge.card.spellability.SpellAbility)
*/ */
@@ -22,11 +22,11 @@ public class AbandonEffect extends SpellEffect {
public void resolve(SpellAbility sa) { public void resolve(SpellAbility sa) {
Card source = sa.getSourceCard(); Card source = sa.getSourceCard();
Player controller = source.getController(); Player controller = source.getController();
game.getTriggerHandler().suppressMode(TriggerType.ChangesZone); game.getTriggerHandler().suppressMode(TriggerType.ChangesZone);
controller.getZone(ZoneType.Command).remove(source); controller.getZone(ZoneType.Command).remove(source);
game.getTriggerHandler().clearSuppression(TriggerType.ChangesZone); game.getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
controller.getSchemeDeck().add(source); controller.getSchemeDeck().add(source);
} }

View File

@@ -152,17 +152,17 @@ public class AnimateEffect extends AnimateEffectBase {
boolean clearAbilities = sa.hasParam("OverwriteAbilities"); boolean clearAbilities = sa.hasParam("OverwriteAbilities");
boolean clearSpells = sa.hasParam("OverwriteSpells"); boolean clearSpells = sa.hasParam("OverwriteSpells");
boolean removeAll = sa.hasParam("RemoveAllAbilities"); boolean removeAll = sa.hasParam("RemoveAllAbilities");
if (clearAbilities || clearSpells || removeAll) { if (clearAbilities || clearSpells || removeAll) {
for (final SpellAbility ab : c.getSpellAbilities()) { for (final SpellAbility ab : c.getSpellAbilities()) {
if (removeAll || (ab.isAbility() && clearAbilities) || if (removeAll || (ab.isAbility() && clearAbilities)
(ab.isSpell() && clearSpells)) { || (ab.isSpell() && clearSpells)) {
c.removeSpellAbility(ab); c.removeSpellAbility(ab);
removedAbilities.add(ab); removedAbilities.add(ab);
} }
} }
} }
// give abilities // give abilities
final ArrayList<SpellAbility> addedAbilities = new ArrayList<SpellAbility>(); final ArrayList<SpellAbility> addedAbilities = new ArrayList<SpellAbility>();
if (abilities.size() > 0) { if (abilities.size() > 0) {

View File

@@ -56,16 +56,16 @@ public class CountersPutEffect extends SpellEffect {
@Override @Override
public void resolve(SpellAbility sa) { public void resolve(SpellAbility sa) {
final Card card = sa.getSourceCard(); final Card card = sa.getSourceCard();
CounterType counterType; CounterType counterType;
try{ try {
counterType = AbilityFactory.getCounterType(sa.getParam("CounterType"), sa); counterType = AbilityFactory.getCounterType(sa.getParam("CounterType"), sa);
} catch(Exception e) { } catch (Exception e) {
System.out.println("Counter type doesn't match, nor does an SVar exist with the type name."); System.out.println("Counter type doesn't match, nor does an SVar exist with the type name.");
return; return;
} }
int counterAmount = AbilityFactory.calculateAmount(sa.getSourceCard(), sa.getParam("CounterNum"), sa); int counterAmount = AbilityFactory.calculateAmount(sa.getSourceCard(), sa.getParam("CounterNum"), sa);
final int max = sa.hasParam("MaxFromEffect") ? Integer.parseInt(sa.getParam("MaxFromEffect")) : -1; final int max = sa.hasParam("MaxFromEffect") ? Integer.parseInt(sa.getParam("MaxFromEffect")) : -1;

View File

@@ -22,7 +22,7 @@ public class PumpAllEffect extends SpellEffect {
String desc = ""; String desc = "";
if (sa.hasParam("PumpAllDescription")) { if (sa.hasParam("PumpAllDescription")) {
desc = sa.getParam("PumpAllDescription"); desc = sa.getParam("PumpAllDescription");
} else if (sa.hasParam("SpellDescription")){ } else if (sa.hasParam("SpellDescription")) {
desc = sa.getParam("SpellDescription").replace("CARDNAME", sa.getSourceCard().getName()); desc = sa.getParam("SpellDescription").replace("CARDNAME", sa.getSourceCard().getName());
} }

View File

@@ -77,7 +77,7 @@ public class RepeatEachEffect extends SpellEffect {
source.removeRemembered(player); source.removeRemembered(player);
} }
} }
if (sa.hasParam("RepeatCounters")) { if (sa.hasParam("RepeatCounters")) {
Card target = sa.getTargetCard(); Card target = sa.getTargetCard();
Set<CounterType> types = new HashSet<CounterType>(target.getCounters().keySet()); Set<CounterType> types = new HashSet<CounterType>(target.getCounters().keySet());

View File

@@ -21,16 +21,16 @@ public class SetInMotionEffect extends SpellEffect {
System.out.println("AF_SIM"); System.out.println("AF_SIM");
Card source = sa.getSourceCard(); Card source = sa.getSourceCard();
Player controller = source.getController(); Player controller = source.getController();
int repeats = 1; int repeats = 1;
if(sa.hasParam("RepeatNum")) if (sa.hasParam("RepeatNum")) {
{
repeats = AbilityFactory.calculateAmount(sa.getSourceCard(), sa.getParam("RepeatNum"), sa); repeats = AbilityFactory.calculateAmount(sa.getSourceCard(), sa.getParam("RepeatNum"), sa);
} }
for(int i=0;i<repeats;i++) for (int i = 0; i < repeats; i++) {
{
controller.setSchemeInMotion(); controller.setSchemeInMotion();
} }
} }