This commit is contained in:
Loki 2010-12-25 23:24:38 +02:00
parent 9b72097827
commit 9ed6145b4b
18 changed files with 1253 additions and 0 deletions

View file

@ -0,0 +1,18 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
public class MyTurn implements Condition {
private static MyTurn fInstance = new MyTurn();
public static Condition getInstance() {
return fInstance;
}
@Override
public boolean apply(Game game, Ability source) {
return game.getActivePlayerId().equals(source.getControllerId());
}
}

View file

@ -0,0 +1,18 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
public class NotMyTurn implements Condition {
private static NotMyTurn fInstance = new NotMyTurn();
public static Condition getInstance() {
return fInstance;
}
@Override
public boolean apply(Game game, Ability source) {
return !game.getActivePlayerId().equals(source.getControllerId());
}
}

View file

@ -0,0 +1,18 @@
package mage.abilities.costs;
public class AlternativeCostImpl extends AlternativeCost<AlternativeCostImpl> {
public AlternativeCostImpl(String name, Cost cost) {
super(name);
this.add(cost);
}
public AlternativeCostImpl(final AlternativeCostImpl cost) {
super(cost);
}
@Override
public AlternativeCostImpl copy() {
return new AlternativeCostImpl(this);
}
}

View file

@ -0,0 +1,69 @@
package mage.abilities.costs;
import mage.game.Game;
import mage.target.Targets;
import java.util.UUID;
public class CompositeCost implements Cost {
private Cost firstCost;
private Cost secondCost;
private String description;
public CompositeCost(Cost firstCost, Cost secondCost, String description) {
this.firstCost = firstCost;
this.secondCost = secondCost;
this.description = description;
}
public CompositeCost(final CompositeCost cost) {
this.firstCost = cost.firstCost.copy();
this.secondCost = cost.secondCost.copy();
this.description = cost.description;
}
@Override
public String getText() {
return description;
}
@Override
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
return firstCost.canPay(sourceId, controllerId, game) && secondCost.canPay(sourceId, controllerId, game);
}
@Override
public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) {
return firstCost.pay(game, sourceId, controllerId, noMana) && secondCost.pay(game, sourceId, controllerId, noMana);
}
@Override
public boolean isPaid() {
return firstCost.isPaid() && secondCost.isPaid();
}
@Override
public void clearPaid() {
firstCost.clearPaid();
secondCost.clearPaid();
}
@Override
public void setPaid() {
firstCost.setPaid();
secondCost.setPaid();
}
@Override
public Targets getTargets() {
Targets result = new Targets();
result.addAll(firstCost.getTargets());
result.addAll(secondCost.getTargets());
return result;
}
@Override
public Cost copy() {
return new CompositeCost(this);
}
}