mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Added possibility to set a minimum for VariableManaCosts (does only work for humans).
This commit is contained in:
parent
90e4c74a4d
commit
9f5857b0ed
2 changed files with 20 additions and 8 deletions
|
@ -198,20 +198,20 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
|
||||||
// its mana cost; see rule 107.3), the player announces the value of that variable.
|
// its mana cost; see rule 107.3), the player announces the value of that variable.
|
||||||
if (game.getPlayer(this.controllerId).isHuman()) {
|
if (game.getPlayer(this.controllerId).isHuman()) {
|
||||||
// AI can't handle this yet. Uses old way of playXMana
|
// AI can't handle this yet. Uses old way of playXMana
|
||||||
VariableManaCost manaX = null;
|
VariableManaCost variableManaCost = null;
|
||||||
for (ManaCost cost: manaCostsToPay) {
|
for (ManaCost cost: manaCostsToPay) {
|
||||||
if (cost instanceof VariableManaCost && !cost.isPaid()) {
|
if (cost instanceof VariableManaCost && !cost.isPaid()) {
|
||||||
manaX = (VariableManaCost) cost;
|
variableManaCost = (VariableManaCost) cost;
|
||||||
break; // only one VariableManCost per spell (or is it possible to have more?)
|
break; // only one VariableManCost per spell (or is it possible to have more?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (manaX != null) {
|
if (variableManaCost != null) {
|
||||||
int amount = game.getPlayer(this.controllerId).getAmount(0, Integer.MAX_VALUE, "Announce the value for " + manaX.getText(), game);
|
int amount = game.getPlayer(this.controllerId).getAmount(variableManaCost.getMinX(), Integer.MAX_VALUE, "Announce the value for " + variableManaCost.getText(), game);
|
||||||
game.informPlayers(new StringBuilder(game.getPlayer(this.controllerId).getName()).append(" announced a value of ").append(amount).append(" for ").append(manaX.getText()).toString());
|
game.informPlayers(new StringBuilder(game.getPlayer(this.controllerId).getName()).append(" announced a value of ").append(amount).append(" for ").append(variableManaCost.getText()).toString());
|
||||||
amount *= manaX.getMultiplier();
|
amount *= variableManaCost.getMultiplier();
|
||||||
manaCostsToPay.add(new ManaCostsImpl(new StringBuilder("{").append(amount).append("}").toString()));
|
manaCostsToPay.add(new ManaCostsImpl(new StringBuilder("{").append(amount).append("}").toString()));
|
||||||
manaCostsToPay.setX(amount);
|
manaCostsToPay.setX(amount);
|
||||||
manaX.setPaid();
|
variableManaCost.setPaid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class VariableManaCost extends ManaCostImpl<VariableManaCost> implements
|
||||||
|
|
||||||
protected int multiplier;
|
protected int multiplier;
|
||||||
protected FilterMana filter;
|
protected FilterMana filter;
|
||||||
|
protected int minX = 0;
|
||||||
|
|
||||||
public VariableManaCost() {
|
public VariableManaCost() {
|
||||||
this(1);
|
this(1);
|
||||||
|
@ -57,7 +58,10 @@ public class VariableManaCost extends ManaCostImpl<VariableManaCost> implements
|
||||||
public VariableManaCost(VariableManaCost manaCost) {
|
public VariableManaCost(VariableManaCost manaCost) {
|
||||||
super(manaCost);
|
super(manaCost);
|
||||||
this.multiplier = manaCost.multiplier;
|
this.multiplier = manaCost.multiplier;
|
||||||
if (manaCost.filter != null) this.filter = manaCost.filter.copy();
|
if (manaCost.filter != null) {
|
||||||
|
this.filter = manaCost.filter.copy();
|
||||||
|
}
|
||||||
|
this.minX = manaCost.minX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -119,4 +123,12 @@ public class VariableManaCost extends ManaCostImpl<VariableManaCost> implements
|
||||||
public int getMultiplier() {
|
public int getMultiplier() {
|
||||||
return multiplier;
|
return multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMinX() {
|
||||||
|
return minX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinX(int minX) {
|
||||||
|
this.minX = minX;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue