@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { if (!valueChecked) { lockedInValue = basicDynamicValue.calculate(game, sourceAbility, effect); valueChecked = true; } return lockedInValue; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = value.calculate(game, sourceAbility, effect); if (amount >= 0 || canBePositive) { return -1 * amount; } else { return 0; } }
public int getAmount() { if (amount instanceof StaticValue) { return amount.calculate(null, null, this); } else { return 0; } }
@Override public boolean apply(Game game, Ability source) { DynamicValue value = MultikickerCount.instance; int damage = value.calculate(game, source, this) * 2; return new DamageTargetEffect(damage).apply(game, source); }
@Override public boolean apply(Game game, Ability source) { for (UUID target : targetPointer.getTargets(game, source)) { Player player = game.getPlayer(target); if (player != null) { player.drawCards(amount.calculate(game, source, this), game); } } return true; }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { int lifeToPayAmount = amount.calculate(game, ability, null); return game.getPlayer(game.getActivePlayerId()).getLife() >= lifeToPayAmount; }
@Override public boolean apply(Game game, Ability source) { int value = amount.calculate(game, source, this); if (value > 0) { return token.putOntoBattlefield(value, game, source.getSourceId(), targetPointer.getFirst(game, source), tapped, attacking); } return true; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.setLife(amount.calculate(game, source, this), game, source); return true; } return false; }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller == null) { return false; } int convertedCost = amount.calculate(game, ability, null); Cost cost = new GenericManaCost(convertedCost); return cost.canPay(ability, sourceId, controllerId, game); }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { player.loseLife(amount.calculate(game, source, this), game, false); return true; } return false; }
@Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); int convertedCost = amount.calculate(game, ability, null); Cost cost = new GenericManaCost(convertedCost); if (controller != null) { paid = cost.pay(ability, game, sourceId, controllerId, noMana); } return paid; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { player.setLife(amount.calculate(game, source, this), game, source); return true; } return false; }
@Override public boolean apply(Game game, Ability source, Ability abilityToModify) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { DynamicValue reductionAmount = new YouGainLifeCount(); CardUtil.reduceCost(abilityToModify, reductionAmount.calculate(game, source, this)); return true; } return false; }
@Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { int lifeToPayAmount = amount.calculate(game, ability, null); this.paid = game.getPlayer(controllerId).loseLife(lifeToPayAmount, game, false) == lifeToPayAmount; if (paid) { game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIFE_PAID, controllerId, sourceId, controllerId, lifeToPayAmount)); } return paid; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { player.moveCards(player.getLibrary().getTopCards(game, amount.calculate(game, source, this)), Zone.GRAVEYARD, source, game); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { int value = amount.calculate(game, source, this); token.putOntoBattlefield(value, game, source.getSourceId(), source.getControllerId(), tapped, attacking); this.lastAddedTokenId = token.getLastAddedToken(); this.lastAddedTokenIds = token.getLastAddedTokenIds(); return true; }
@Override public boolean apply(Game game, Ability source) { for (UUID playerId: game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { player.loseLife(amount.calculate(game, source, this), game, false); } } return true; }
@Override public boolean apply(Game game, Ability source) { List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { permanent.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); } return true; }
@Override public boolean apply(Game game, Ability source) { DynamicValue amount = new CountersSourceCount(CounterType.CHARGE); for (UUID playerId : game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(playerId); if (player != null) { player.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); } } return true; }
@Override public void trigger(Game game, UUID controllerId) { this.getTargets().clear(); int intValue = amount.calculate(game, this, null); FilterCard filter = new FilterCard("Spirit card with converted mana cost " + intValue + " or less from your graveyard"); filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, intValue + 1)); filter.add(new SubtypePredicate(SubType.SPIRIT)); this.addTarget(new TargetCardInYourGraveyard(filter)); super.trigger(game, controllerId); //To change body of generated methods, choose Tools | Templates. }