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

View File

@@ -1064,7 +1064,7 @@ public class GameAction {
}
}
} // if isEquipped()
if (c.isEquipping()) {
final Card equippedCreature = c.getEquipping().get(0);
@@ -1178,7 +1178,7 @@ public class GameAction {
} // while it.hasNext()
checkAgain |= game.getTriggerHandler().runWaitingTriggers();
if (!checkAgain) {
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)
: CardFactoryUtil.xCount(source, source.getSVar(amountString));
String plural = amount > 1 ? "s" : "";
if (part.canPay(sourceAbility, source, p, cost) &&
showYesNoDialog(source, "Do you want to remove " + amount + " " + counterType.getName()
if (part.canPay(sourceAbility, source, p, cost)
&& showYesNoDialog(source, "Do you want to remove " + amount + " " + counterType.getName()
+ " counter" + plural + " from " + source + "?")) {
source.subtractCounter(counterType, amount);
} else {
@@ -539,7 +539,7 @@ public final class GameActionUtil {
}
remainingParts.remove(part);
}
else if (part instanceof CostMana && ((CostMana) part).getManaToPay().equals("0")) {
remainingParts.remove(part);
}

View File

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

View File

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

View File

@@ -163,7 +163,7 @@ public class AttachAi extends SpellAiLogic {
type = stab.get("AddType");
}
}
if ("ChosenType".equals(type)) {
// TODO ChosenTypeEffect should have exact same logic that's here
// For now, Island is as good as any for a default value
@@ -315,7 +315,7 @@ public class AttachAi extends SpellAiLogic {
return c;
}
/**
* Attach ai control preference.
*
@@ -343,7 +343,7 @@ public class AttachAi extends SpellAiLogic {
return c;
}
/**
* 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
Player ai = sa.getActivatingPlayer();
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")));
if (!aiStuffies.isEmpty()) {
chosen = aiStuffies.get(0);
@@ -372,7 +372,7 @@ public class AttachAi extends SpellAiLogic {
chosen = CardFactoryUtil.getBestCreatureAI(creatures);
}
}
// If Mandatory (brought directly into play without casting) gotta
// choose something
if (chosen == null && mandatory) {
@@ -839,7 +839,7 @@ public class AttachAi extends SpellAiLogic {
// Some ChangeType cards are beneficial, and PrefPlayer should be
// changed to represent that
final List<Card> prefList;
if ("Reanimate".equals(logic) || "SpecificCard".equals(logic)) {
// Reanimate or SpecificCard aren't so restrictive
prefList = list;

View File

@@ -108,7 +108,7 @@ public class DrawAi extends SpellAiLogic {
}
if ((!Singletons.getModel().getGame().getPhaseHandler().getNextTurn().equals(ai)
|| 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) {
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"));
if (ph.isPlayerTurn(opp) || !(CombatUtil.canAttack(card, opp) || card.isAttacking())
|| ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|| card.getNetCombatDamage() <= 0
|| card.getNetCombatDamage() <= 0
|| !Iterables.any(CardLists.filter(opp.getCreaturesInPlay(), CardPredicates.possibleBlockers(card)),
Predicates.not(flyingOrReach))) {
return false;

View File

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

View File

@@ -14,7 +14,7 @@ import forge.game.zone.ZoneType;
public class AbandonEffect extends SpellEffect {
private GameState game = Singletons.getModel().getGame();
/* (non-Javadoc)
* @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) {
Card source = sa.getSourceCard();
Player controller = source.getController();
game.getTriggerHandler().suppressMode(TriggerType.ChangesZone);
controller.getZone(ZoneType.Command).remove(source);
game.getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
controller.getSchemeDeck().add(source);
}

View File

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

View File

@@ -56,16 +56,16 @@ public class CountersPutEffect extends SpellEffect {
@Override
public void resolve(SpellAbility sa) {
final Card card = sa.getSourceCard();
CounterType counterType;
try{
try {
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.");
return;
}
int counterAmount = AbilityFactory.calculateAmount(sa.getSourceCard(), sa.getParam("CounterNum"), sa);
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 = "";
if (sa.hasParam("PumpAllDescription")) {
desc = sa.getParam("PumpAllDescription");
} else if (sa.hasParam("SpellDescription")){
} else if (sa.hasParam("SpellDescription")) {
desc = sa.getParam("SpellDescription").replace("CARDNAME", sa.getSourceCard().getName());
}

View File

@@ -77,7 +77,7 @@ public class RepeatEachEffect extends SpellEffect {
source.removeRemembered(player);
}
}
if (sa.hasParam("RepeatCounters")) {
Card target = sa.getTargetCard();
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");
Card source = sa.getSourceCard();
Player controller = source.getController();
int repeats = 1;
if(sa.hasParam("RepeatNum"))
{
if (sa.hasParam("RepeatNum")) {
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();
}
}