- 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

@@ -336,7 +336,7 @@ public class ChangeZoneEffect extends SpellEffect {
tgtCards = tgt.getTargetCards();
} else {
tgtCards = new ArrayList<Card>();
for(ZoneType o : origin) {
for (ZoneType o : origin) {
for (final Card c : sa.knownDetermineDefined(sa.getParam("Defined"))) {
tgtCards.add(c);
}

View File

@@ -21,7 +21,7 @@ public class CharmEffect extends SpellEffect {
for (final String saChoice : saChoices) {
final String ab = source.getSVar(saChoice);
final AbilityFactory charmAF = new AbilityFactory();
choices.add((AbilitySub)charmAF.getAbility(ab, source));
choices.add((AbilitySub) charmAF.getAbility(ab, source));
}
return choices;
}
@@ -52,8 +52,8 @@ public class CharmEffect extends SpellEffect {
List<AbilitySub> chosen = null;
Player activator = sa.getActivatingPlayer();
if ( activator.isHuman() )
{
if (activator.isHuman()) {
chosen = new ArrayList<AbilitySub>();
for (int i = 0; i < num; i++) {
AbilitySub a;
@@ -69,19 +69,20 @@ public class CharmEffect extends SpellEffect {
choices.remove(a);
chosen.add(a);
}
}
else
} else {
chosen = CharmAi.chooseOptionsAi(activator, true, choices, num, min);
}
chainAbilities(sa, chosen);
}
private static void chainAbilities(SpellAbility sa, List<AbilitySub> chosen) {
SpellAbility saDeepest = sa;
while( saDeepest.getSubAbility() != null)
while (saDeepest.getSubAbility() != null) {
saDeepest = saDeepest.getSubAbility();
}
for(AbilitySub sub : chosen){
for (AbilitySub sub : chosen) {
saDeepest.setSubAbility(sub);
sub.setActivatingPlayer(saDeepest.getActivatingPlayer());
sub.setParent(saDeepest);
@@ -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.gui.GuiChoose;
public class ChooseNumberEffect extends SpellEffect
{
public class ChooseNumberEffect extends SpellEffect {
/* (non-Javadoc)
* @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 {
@Override
protected String getStackDescription(SpellAbility sa) {
final StringBuilder sb = new StringBuilder();

View File

@@ -278,4 +278,4 @@ public class CloneEffect extends SpellEffect {
}
}
}

View File

@@ -80,20 +80,20 @@ public class ControlGainEffect extends SpellEffect {
List<Card> tgtCards = new ArrayList<Card>();
Card source = sa.getSourceCard();
final boolean bUntap = sa.hasParam("Untap");
final boolean bTapOnLose = sa.hasParam("TapOnLose");
final boolean bNoRegen = sa.hasParam("NoRegen");
final List<String> destroyOn = sa.hasParam("DestroyTgt") ? Arrays.asList(sa.getParam("DestroyTgt").split(",")) : null;
final List<String> kws = sa.hasParam("AddKWs") ? Arrays.asList(sa.getParam("AddKWs").split(" & ")) : null ;
final List<String> kws = sa.hasParam("AddKWs") ? Arrays.asList(sa.getParam("AddKWs").split(" & ")) : null;
final List<String> lose = sa.hasParam("LoseControl") ? Arrays.asList(sa.getParam("LoseControl").split(",")) : null;
final Target tgt = sa.getTarget();
if (sa.hasParam("AllValid")) {
tgtCards = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
tgtCards = AbilityFactory.filterListByType(tgtCards, sa.getParam("AllValid"), sa);
} else
} else {
tgtCards = getTargetCards(sa);
}
ArrayList<Player> controllers = new ArrayList<Player>();
@@ -238,7 +238,7 @@ public class ControlGainEffect extends SpellEffect {
* @return a {@link forge.Command} object.
*/
private Command getLoseControlCommand(final Card c, final Player originalController, final GameEntity newController,
final boolean bTapOnLose, final Card hostCard, final List<String> kws ) {
final boolean bTapOnLose, final Card hostCard, final List<String> kws) {
final Command loseControl = new Command() {
private static final long serialVersionUID = 878543373519872418L;

View File

@@ -19,7 +19,7 @@ public class CounterEffect extends SpellEffect {
if (sa.hasParam("AllType")) {
sas = new ArrayList<SpellAbility>();
for (int i=0; i < Singletons.getModel().getGame().getStack().size(); i++) {
for (int i = 0; i < Singletons.getModel().getGame().getStack().size(); i++) {
SpellAbility spell = Singletons.getModel().getGame().getStack().peekAbility(i);
if (sa.getParam("AllType").equals("Spell") && !spell.isSpell()) {
continue;
@@ -31,8 +31,9 @@ public class CounterEffect extends SpellEffect {
}
sas.add(spell);
}
} else
} else {
sas = getTargetSpellAbilities(sa);
}
sb.append("countering");
@@ -62,7 +63,7 @@ public class CounterEffect extends SpellEffect {
if (sa.hasParam("AllType")) {
sas = new ArrayList<SpellAbility>();
for (int i=0; i < Singletons.getModel().getGame().getStack().size(); i++) {
for (int i = 0; i < Singletons.getModel().getGame().getStack().size(); i++) {
SpellAbility spell = Singletons.getModel().getGame().getStack().peekAbility(i);
if (sa.getParam("AllType").equals("Spell") && !spell.isSpell()) {
continue;
@@ -74,8 +75,9 @@ public class CounterEffect extends SpellEffect {
}
sas.add(spell);
}
} else
} else {
sas = getTargetSpellAbilities(sa);
}
if (sa.hasParam("ForgetOtherTargets")) {
if (sa.getParam("ForgetOtherTargets").equals("True")) {

View File

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