* Discard cost - added hint text in card choose dialog about discard;

This commit is contained in:
Oleg Agafonov 2020-08-01 21:07:37 +04:00
parent 610baac6ab
commit 4ba7c18d43
2 changed files with 9 additions and 5 deletions

View file

@ -1,11 +1,9 @@
package mage.abilities.costs.common;
import mage.filter.FilterCard;
import mage.target.common.TargetCardInHand;
/**
*
* @author magenoxx_at_googlemail.com
*/
public class DiscardCardCost extends DiscardTargetCost {
@ -15,7 +13,7 @@ public class DiscardCardCost extends DiscardTargetCost {
}
public DiscardCardCost(boolean randomDiscard) {
this(new FilterCard(randomDiscard ?"a card at random":"a card"), randomDiscard);
this(new FilterCard(randomDiscard ? "a card at random" : "a card"), randomDiscard);
}
public DiscardCardCost(FilterCard filter) {
@ -23,7 +21,7 @@ public class DiscardCardCost extends DiscardTargetCost {
}
public DiscardCardCost(FilterCard filter, boolean randomDiscard) {
super(new TargetCardInHand(filter), randomDiscard);
super(new TargetCardInHand(filter).withChooseHint("discard cost"), randomDiscard);
}
public DiscardCardCost(final DiscardCardCost cost) {

View file

@ -43,7 +43,7 @@ public class TargetCardInHand extends TargetCard {
public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) {
// Has to be a card in the hand of a player in range. We don't know here, from which player's hand so we have to check all possible players
// And because a card in hand is never targeted we can omitt specific targeting related checks
return game.getState().getZone(id) == Zone.HAND
return game.getState().getZone(id) == Zone.HAND
&& game.getState().getPlayersInRange(getTargetController() == null ? playerId : getTargetController(), game).contains(game.getOwnerId(id));
}
@ -92,4 +92,10 @@ public class TargetCardInHand extends TargetCard {
public String getTargetedName(Game game) {
return filter.getMessage();
}
@Override
public TargetCardInHand withChooseHint(String chooseHint) {
super.withChooseHint(chooseHint);
return this;
}
}