Added Tetravus (to enable it I had to add a YChoice svar and ChosenY value. Only added to CostExile, not the other cost types)

This commit is contained in:
moomarc
2012-02-13 13:59:57 +00:00
parent afb02ec4e1
commit 49dea33497
5 changed files with 43 additions and 7 deletions

View File

@@ -470,7 +470,7 @@ public class Card extends GameEntity implements Comparable<Card> {
private final ArrayList<Command> untapCommandList = new ArrayList<Command>();
private final ArrayList<Command> changeControllerCommandList = new ArrayList<Command>();
private static String[] storableSVars = { "ChosenX" };
private static String[] storableSVars = { "ChosenX", "ChosenY" };
private final ArrayList<Card> hauntedBy = new ArrayList<Card>();
private Card haunting = null;

View File

@@ -760,9 +760,9 @@ public class AbilityFactory {
spellAbility = AbilityFactoryEffect.createDrawbackEffect(this);
}
}
else if (this.api.equals("EndTurn")) {
if(this.isAb) {
if (this.isAb) {
spellAbility = AbilityFactoryTurns.createAbilityEndTurn(this);
} else if (this.isSp) {
spellAbility = AbilityFactoryTurns.createSpellEndTurn(this);
@@ -1673,7 +1673,7 @@ public class AbilityFactory {
return 0;
}
}
if (amount.equals("ChosenX")) {
if (amount.equals("ChosenX") || amount.equals("ChosenY")) {
// isn't made yet
return 0;
}

View File

@@ -189,7 +189,11 @@ public class CostExile extends CostPartWithList {
// Generalize this
if (sVar.equals("XChoice")) {
c = CostUtil.chooseXValue(source, list.size());
} else {
}
if (sVar.equals("YChoice")) {
c = CostUtil.chooseYValue(source, list.size());
}
else {
c = AbilityFactory.calculateAmount(source, amount, ability);
}
}
@@ -226,6 +230,10 @@ public class CostExile extends CostPartWithList {
return false;
}
if (sVar.equals("YChoice")) {
return false;
}
c = AbilityFactory.calculateAmount(source, this.getAmount(), ability);
}

View File

@@ -248,6 +248,8 @@ public class CostUtil {
// Generalize this
if (sVar.equals("XChoice")) {
c = CostUtil.chooseXValue(source, maxChoice);
} if (sVar.equals("YChoice")) {
c = CostUtil.chooseYValue(source, maxChoice);
} else {
c = AbilityFactory.calculateAmount(source, amount, ability);
}
@@ -281,6 +283,32 @@ public class CostUtil {
return chosenX;
}
/**
* Choose x value (for ChosenY).
*
* @param card
* the card
* @param maxValue
* the max value
* @return the int
*/
public static int chooseYValue(final Card card, final int maxValue) {
final String chosen = card.getSVar("ChosenY");
if (chosen.length() > 0) {
return AbilityFactory.calculateAmount(card, "ChosenY", null);
}
final Integer[] choiceArray = new Integer[maxValue + 1];
for (int i = 0; i < choiceArray.length; i++) {
choiceArray[i] = i;
}
final Object o = GuiUtils.getChoice(card.toString() + " - Choose a Value for Y", choiceArray);
final int chosenY = (Integer) o;
card.setSVar("ChosenY", "Number$" + Integer.toString(chosenY));
return chosenY;
}
/**
* <p>
* setInput.