- CheckStyle.

This commit is contained in:
Chris
2012-11-20 14:01:22 +00:00
parent 9fe78f441e
commit b9742e42eb
21 changed files with 174 additions and 171 deletions

View File

@@ -52,8 +52,8 @@ public class CharmEffect extends SpellEffect {
List<AbilitySub> chosen = null; List<AbilitySub> chosen = null;
Player activator = sa.getActivatingPlayer(); Player activator = sa.getActivatingPlayer();
if ( activator.isHuman() ) if (activator.isHuman()) {
{
chosen = new ArrayList<AbilitySub>(); chosen = new ArrayList<AbilitySub>();
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
AbilitySub a; AbilitySub a;
@@ -69,17 +69,18 @@ public class CharmEffect extends SpellEffect {
choices.remove(a); choices.remove(a);
chosen.add(a); chosen.add(a);
} }
} } else {
else
chosen = CharmAi.chooseOptionsAi(activator, true, choices, num, min); chosen = CharmAi.chooseOptionsAi(activator, true, choices, num, min);
}
chainAbilities(sa, chosen); chainAbilities(sa, chosen);
} }
private static void chainAbilities(SpellAbility sa, List<AbilitySub> chosen) { private static void chainAbilities(SpellAbility sa, List<AbilitySub> chosen) {
SpellAbility saDeepest = sa; SpellAbility saDeepest = sa;
while( saDeepest.getSubAbility() != null) while (saDeepest.getSubAbility() != null) {
saDeepest = saDeepest.getSubAbility(); saDeepest = saDeepest.getSubAbility();
}
for (AbilitySub sub : chosen) { for (AbilitySub sub : chosen) {
saDeepest.setSubAbility(sub); saDeepest.setSubAbility(sub);
@@ -92,5 +93,4 @@ public class CharmEffect extends SpellEffect {
} }
} }

View File

@@ -13,8 +13,7 @@ import forge.card.spellability.Target;
import forge.game.player.Player; import forge.game.player.Player;
import forge.gui.GuiChoose; import forge.gui.GuiChoose;
public class ChooseNumberEffect extends SpellEffect public class ChooseNumberEffect extends SpellEffect {
{
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.card.abilityfactory.SpellEffect#getStackDescription(java.util.Map, forge.card.spellability.SpellAbility) * @see forge.card.abilityfactory.SpellEffect#getStackDescription(java.util.Map, forge.card.spellability.SpellAbility)

View File

@@ -19,7 +19,6 @@ import forge.gui.GuiChoose;
public class ChooseTypeEffect extends SpellEffect { public class ChooseTypeEffect extends SpellEffect {
@Override @Override
protected String getStackDescription(SpellAbility sa) { protected String getStackDescription(SpellAbility sa) {
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();

View File

@@ -80,7 +80,6 @@ public class ControlGainEffect extends SpellEffect {
List<Card> tgtCards = new ArrayList<Card>(); List<Card> tgtCards = new ArrayList<Card>();
Card source = sa.getSourceCard(); Card source = sa.getSourceCard();
final boolean bUntap = sa.hasParam("Untap"); final boolean bUntap = sa.hasParam("Untap");
final boolean bTapOnLose = sa.hasParam("TapOnLose"); final boolean bTapOnLose = sa.hasParam("TapOnLose");
final boolean bNoRegen = sa.hasParam("NoRegen"); final boolean bNoRegen = sa.hasParam("NoRegen");
@@ -92,8 +91,9 @@ public class ControlGainEffect extends SpellEffect {
if (sa.hasParam("AllValid")) { if (sa.hasParam("AllValid")) {
tgtCards = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield); tgtCards = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
tgtCards = AbilityFactory.filterListByType(tgtCards, sa.getParam("AllValid"), sa); tgtCards = AbilityFactory.filterListByType(tgtCards, sa.getParam("AllValid"), sa);
} else } else {
tgtCards = getTargetCards(sa); tgtCards = getTargetCards(sa);
}
ArrayList<Player> controllers = new ArrayList<Player>(); ArrayList<Player> controllers = new ArrayList<Player>();

View File

@@ -31,8 +31,9 @@ public class CounterEffect extends SpellEffect {
} }
sas.add(spell); sas.add(spell);
} }
} else } else {
sas = getTargetSpellAbilities(sa); sas = getTargetSpellAbilities(sa);
}
sb.append("countering"); sb.append("countering");
@@ -74,8 +75,9 @@ public class CounterEffect extends SpellEffect {
} }
sas.add(spell); sas.add(spell);
} }
} else } else {
sas = getTargetSpellAbilities(sa); sas = getTargetSpellAbilities(sa);
}
if (sa.hasParam("ForgetOtherTargets")) { if (sa.hasParam("ForgetOtherTargets")) {
if (sa.getParam("ForgetOtherTargets").equals("True")) { if (sa.getParam("ForgetOtherTargets").equals("True")) {

View File

@@ -35,11 +35,12 @@ public class CountersProliferateEffect extends SpellEffect {
@Override @Override
public void resolve(SpellAbility sa) { public void resolve(SpellAbility sa) {
Player controller = sa.getSourceCard().getController(); Player controller = sa.getSourceCard().getController();
if (controller.isHuman()) if (controller.isHuman()) {
resolveHuman(sa); resolveHuman(sa);
else } else {
resolveAI(controller, sa); resolveAI(controller, sa);
} }
}
private static void resolveHuman(final SpellAbility sa) { private static void resolveHuman(final SpellAbility sa) {
final List<Card> unchosen = Lists.newArrayList(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)); final List<Card> unchosen = Lists.newArrayList(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield));
@@ -84,8 +85,8 @@ public class CountersProliferateEffect extends SpellEffect {
@Override @Override
public void selectPlayer(final Player player) { public void selectPlayer(final Player player) {
if (players.indexOf(player) >= 0) if (players.indexOf(player) >= 0) {
{
players.remove(player); // no second selection players.remove(player); // no second selection
if (player.getPoisonCounters() > 0) { if (player.getPoisonCounters() > 0) {
player.addPoisonCounters(1, sa.getSourceCard()); player.addPoisonCounters(1, sa.getSourceCard());
@@ -96,7 +97,6 @@ public class CountersProliferateEffect extends SpellEffect {
} }
private static void resolveAI(final Player ai, final SpellAbility sa) { private static void resolveAI(final Player ai, final SpellAbility sa) {
final List<Player> allies = ai.getAllies(); final List<Player> allies = ai.getAllies();
allies.add(ai); allies.add(ai);
@@ -105,11 +105,13 @@ public class CountersProliferateEffect extends SpellEffect {
@Override @Override
public boolean apply(Card crd) { public boolean apply(Card crd) {
for (final Entry<Counters, Integer> c1 : crd.getCounters().entrySet()) { for (final Entry<Counters, Integer> c1 : crd.getCounters().entrySet()) {
if ( CardFactoryUtil.isNegativeCounter(c1.getKey()) && enemies.contains(crd.getController())) if (CardFactoryUtil.isNegativeCounter(c1.getKey()) && enemies.contains(crd.getController())) {
return true; return true;
if ( !CardFactoryUtil.isNegativeCounter(c1.getKey()) && allies.contains(crd.getController())) }
if (!CardFactoryUtil.isNegativeCounter(c1.getKey()) && allies.contains(crd.getController())) {
return true; return true;
} }
}
return false; return false;
} }
}; };
@@ -117,9 +119,10 @@ public class CountersProliferateEffect extends SpellEffect {
List<Card> cardsToProliferate = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), predProliferate); List<Card> cardsToProliferate = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), predProliferate);
List<Player> playersToPoison = new ArrayList<Player>(); List<Player> playersToPoison = new ArrayList<Player>();
for (Player e : enemies) { for (Player e : enemies) {
if ( e.getPoisonCounters() > 0 ) if (e.getPoisonCounters() > 0) {
playersToPoison.add(e); playersToPoison.add(e);
} }
}
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
sb.append("<html>Proliferate. Computer selects:<br>"); sb.append("<html>Proliferate. Computer selects:<br>");