forked from External/mage
parent
1a3d5923de
commit
7233061ae3
133 changed files with 590 additions and 676 deletions
|
|
@ -8,13 +8,15 @@ import mage.filter.StaticFilters;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author North
|
||||
*/
|
||||
public class CardsInControllerGraveyardCount implements DynamicValue {
|
||||
|
||||
private final FilterCard filter;
|
||||
private final Integer amount;
|
||||
private final Integer multiplier;
|
||||
|
||||
public CardsInControllerGraveyardCount() {
|
||||
this(StaticFilters.FILTER_CARD, 1);
|
||||
|
|
@ -24,25 +26,28 @@ public class CardsInControllerGraveyardCount implements DynamicValue {
|
|||
this(filter, 1);
|
||||
}
|
||||
|
||||
public CardsInControllerGraveyardCount(FilterCard filter, Integer amount) {
|
||||
public CardsInControllerGraveyardCount(FilterCard filter, Integer multiplier) {
|
||||
this.filter = filter;
|
||||
this.amount = amount;
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
|
||||
public CardsInControllerGraveyardCount(final CardsInControllerGraveyardCount dynamicValue) {
|
||||
this.filter = dynamicValue.filter;
|
||||
this.amount = dynamicValue.amount;
|
||||
this.multiplier = dynamicValue.multiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Player player = game.getPlayer(sourceAbility.getControllerId());
|
||||
if (player != null) {
|
||||
return amount * player.getGraveyard().count(
|
||||
filter, sourceAbility.getControllerId(), sourceAbility, game
|
||||
);
|
||||
UUID playerId = sourceAbility.getControllerId();
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player == null) {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
int value = player.getGraveyard().count(filter, playerId, sourceAbility, game);
|
||||
if (multiplier != null) {
|
||||
value *= multiplier;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -52,11 +57,16 @@ public class CardsInControllerGraveyardCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return amount.toString();
|
||||
return multiplier == null ? "X" : multiplier.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return filter.getMessage() + " in your graveyard";
|
||||
return (multiplier == null ? "the number of " : "") + filter.getMessage() + " in your graveyard";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSign() {
|
||||
return multiplier == null ? 1 : multiplier;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue