wrapped long lines

master
melvin 2011-07-01 11:32:42 +08:00
parent 5e2dcc9c98
commit a7b96f922a
1 changed files with 2 additions and 10 deletions

View File

@ -14,17 +14,14 @@ public class MagicSourceManaActivation {
public MagicManaType manaType=null;
public MagicSourceManaActivation(final MagicGame game,final MagicPermanent permanent) {
this.permanent=permanent;
activations=new MagicManaActivation[MagicManaType.NR_OF_TYPES];
available=false;
for (final MagicManaActivation activation: permanent.getCardDefinition().getManaActivations()) {
if (activation.canPlay(game,permanent)) {
available=true;
for (final MagicManaType manaType : activation.getManaTypes()) {
activations[manaType.ordinal()]=activation;
}
}
@ -32,10 +29,8 @@ public class MagicSourceManaActivation {
}
public MagicManaType canProduce(final MagicCostManaType costManaType) {
if (available) {
for (final MagicManaType manaType : costManaType.getTypes()) {
if (activations[manaType.ordinal()]!=null) {
return manaType;
}
@ -45,10 +40,8 @@ public class MagicSourceManaActivation {
}
public void produce(final MagicGame game,final MagicCostManaType costManaType) {
MagicManaActivation bestManaActivation=null;
for (final MagicManaType manaType : costManaType.getTypes()) {
final MagicManaActivation manaActivation=activations[manaType.ordinal()];
if (manaActivation!=null&&(bestManaActivation==null||bestManaActivation.getWeight()>manaActivation.getWeight())) {
bestManaActivation=manaActivation;
@ -58,17 +51,16 @@ public class MagicSourceManaActivation {
if (bestManaActivation==null) {
throw new IllegalStateException("This mana source cannot produce "+costManaType.getText()+".");
}
final MagicSourceManaActivationResult bestSourceManaActivation=new MagicSourceManaActivationResult(permanent,bestManaActivation);
final MagicSourceManaActivationResult bestSourceManaActivation=
new MagicSourceManaActivationResult(permanent,bestManaActivation);
bestSourceManaActivation.doActivation(game);
}
public int getWeight() {
return activations[manaType.ordinal()].getWeight();
}
public MagicSourceManaActivationResult getResult() {
return new MagicSourceManaActivationResult(permanent,activations[manaType.ordinal()]);
}
}