mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user