mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
Merge
This commit is contained in:
commit
f0c8bf2034
44 changed files with 326 additions and 123 deletions
|
|
@ -40,8 +40,12 @@ public interface ManaCosts<T extends ManaCost> extends List<T>, ManaCost {
|
|||
|
||||
public ManaCosts<T> getUnpaidVariableCosts();
|
||||
public List<VariableCost> getVariableCosts();
|
||||
public int getX();
|
||||
public void load(String mana);
|
||||
public List<String> getSymbols();
|
||||
|
||||
|
||||
@Override
|
||||
public Mana getMana();
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -146,6 +146,8 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
return unpaid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<VariableCost> getVariableCosts() {
|
||||
List<VariableCost> variableCosts = new ArrayList<VariableCost>();
|
||||
|
|
@ -153,13 +155,22 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
if (cost instanceof VariableCost)
|
||||
variableCosts.add((VariableCost) cost);
|
||||
}
|
||||
if (variableCosts.size() == 0) {
|
||||
// add empty cost (#Issue 210)
|
||||
variableCosts.add(new VariableManaCost());
|
||||
}
|
||||
// if (variableCosts.size() == 0) {
|
||||
// // add empty cost (#Issue 210)
|
||||
// variableCosts.add(new VariableManaCost());
|
||||
// }
|
||||
return variableCosts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
int amount = 0;
|
||||
List<VariableCost> variableCosts = getVariableCosts();
|
||||
if (!variableCosts.isEmpty())
|
||||
amount = variableCosts.get(0).getAmount();
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPayment(Mana mana) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import mage.game.Game;
|
|||
public class ManacostVariableValue implements DynamicValue {
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility) {
|
||||
return sourceAbility.getManaCostsToPay().getVariableCosts().get(0).getAmount();
|
||||
return sourceAbility.getManaCostsToPay().getX();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class DamageXTargetEffect extends OneShotEffect<DamageXTargetEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int amount = source.getManaCostsToPay().getVariableCosts().get(0).getAmount();
|
||||
int amount = source.getManaCostsToPay().getX();
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.damage(amount, source.getId(), game, true, false);
|
||||
|
|
|
|||
|
|
@ -61,14 +61,14 @@ public class BoostPowerToughnessXTargetEffect extends ContinuousEffectImpl<Boost
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int amount = source.getManaCostsToPay().getVariableCosts().get(0).getAmount();
|
||||
if (amount == 0) {
|
||||
int amountX = source.getManaCostsToPay().getX();
|
||||
if (amountX == 0) {
|
||||
return false;
|
||||
}
|
||||
Permanent target = game.getPermanent(source.getFirstTarget());
|
||||
if (target != null) {
|
||||
target.addPower(amount);
|
||||
target.addToughness(amount);
|
||||
target.addPower(amountX);
|
||||
target.addToughness(amountX);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -64,17 +64,15 @@ public class BoostPowerXSourceEffect extends ContinuousEffectImpl<BoostPowerXSou
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (source.getManaCostsToPay().getVariableCosts().size() > 0) {
|
||||
int amountX = source.getManaCostsToPay().getVariableCosts().get(0).getAmount();
|
||||
if (amountX == 0) {
|
||||
return false;
|
||||
}
|
||||
Permanent target = (Permanent) game.getPermanent(source.getSourceId());
|
||||
if (target != null) {
|
||||
target.addPower(amountX);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
int amountX = source.getManaCostsToPay().getX();
|
||||
if (amountX == 0) {
|
||||
return false;
|
||||
}
|
||||
Permanent target = (Permanent) game.getPermanent(source.getSourceId());
|
||||
if (target != null) {
|
||||
target.addPower(amountX);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import java.net.URL;
|
|||
import java.net.URLClassLoader;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarInputStream;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -132,9 +131,9 @@ public abstract class ExpansionSet implements Serializable {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Card findCard(String name, int cardNum) {
|
||||
public Card findCard(int cardNum) {
|
||||
for (Card card : cards) {
|
||||
if (cardNum == card.getCardNumber() && name.equalsIgnoreCase(card.getName())) {
|
||||
if (cardNum == card.getCardNumber()) {
|
||||
Card newCard = card.copy();
|
||||
newCard.assignNewId();
|
||||
return newCard;
|
||||
|
|
@ -158,7 +157,7 @@ public abstract class ExpansionSet implements Serializable {
|
|||
return null;
|
||||
}
|
||||
|
||||
public String findCard(int cardNum) {
|
||||
public String findCardName(int cardNum) {
|
||||
for (Card card : cards) {
|
||||
if (card.getCardNumber() == cardNum)
|
||||
return card.getClass().getCanonicalName();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue