mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 12:49:39 -08:00
ARB
This commit is contained in:
parent
9b72097827
commit
9ed6145b4b
18 changed files with 1253 additions and 0 deletions
18
Mage/src/mage/abilities/condition/common/MyTurn.java
Normal file
18
Mage/src/mage/abilities/condition/common/MyTurn.java
Normal 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());
|
||||
}
|
||||
}
|
||||
18
Mage/src/mage/abilities/condition/common/NotMyTurn.java
Normal file
18
Mage/src/mage/abilities/condition/common/NotMyTurn.java
Normal 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());
|
||||
}
|
||||
}
|
||||
18
Mage/src/mage/abilities/costs/AlternativeCostImpl.java
Normal file
18
Mage/src/mage/abilities/costs/AlternativeCostImpl.java
Normal 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);
|
||||
}
|
||||
}
|
||||
69
Mage/src/mage/abilities/costs/CompositeCost.java
Normal file
69
Mage/src/mage/abilities/costs/CompositeCost.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue