Some minor changes to tooltip generation.

This commit is contained in:
LevelX2 2014-11-16 09:16:37 +01:00
parent 2c6c3e0311
commit a75dda1464
8 changed files with 72 additions and 27 deletions

View file

@ -68,29 +68,26 @@ public class DiscardTargetCost extends CostImpl {
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
this.cards.clear();
Player player = game.getPlayer(controllerId);
if (randomDiscard) {
int amount = this.getTargets().get(0).getMaxNumberOfTargets();
int maxAmount = Math.min(amount, player.getHand().size());
for (int i = 0; i < maxAmount; i++) {
Card card = player.getHand().getRandom(game);
if (card != null) {
paid |= player.discard(card, null, game);
}
}
if (player == null) {
return false;
}
int amount = this.getTargets().get(0).getNumberOfTargets();
if (randomDiscard) {
this.cards.addAll(player.discard(amount, true, ability, game).getCards(game));
} else {
if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) {
if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) {
for (UUID targetId: targets.get(0).getTargets()) {
Card card = player.getHand().get(targetId, game);
if (card == null) {
return false;
}
this.cards.add(card.copy());
paid |= player.discard(card, ability, game);
}
}
}
paid = cards.size() >= amount;
return paid;
}

View file

@ -81,7 +81,7 @@ public class ExileCardFromOwnGraveyardControllerEffect extends OneShotEffect {
}
private String setText() {
StringBuilder sb = new StringBuilder("Exile ");
StringBuilder sb = new StringBuilder("exile ");
if (amount == 1) {
sb.append(" a card ");
} else {

View file

@ -73,6 +73,9 @@ public class PreventDamageToTargetEffect extends PreventionEffectImpl {
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder();
if (amountToPrevent == Integer.MAX_VALUE) {
sb.append("Prevent all damage that would be dealt to target ");