[IKO] Heartless Act - fixed wrong ability and missing text;

This commit is contained in:
Oleg Agafonov 2020-04-19 22:49:59 +04:00
parent ccd95cdd71
commit e61c7c22d3

View file

@ -10,7 +10,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.CounterAnyPredicate;
@ -27,11 +26,11 @@ import java.util.UUID;
*/
public final class HeartlessAct extends CardImpl {
private static final FilterPermanent filter
private static final FilterCreaturePermanent filterWithoutCounters
= new FilterCreaturePermanent("creature with no counters on it");
static {
filter.add(Predicates.not(CounterAnyPredicate.instance));
filterWithoutCounters.add(Predicates.not(CounterAnyPredicate.instance));
}
public HeartlessAct(UUID ownerId, CardSetInfo setInfo) {
@ -40,7 +39,7 @@ public final class HeartlessAct extends CardImpl {
// Choose one
// Destroy target creature with no counters on it.
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addTarget(new TargetPermanent(filterWithoutCounters));
// Remove up to three counters from target creature.
Mode mode = new Mode(new HeartlessActEffect());
@ -61,8 +60,8 @@ public final class HeartlessAct extends CardImpl {
class HeartlessActEffect extends OneShotEffect {
HeartlessActEffect() {
super(Outcome.Benefit);
staticText = "";
super(Outcome.AIDontUseIt);
staticText = "Remove up to three counters from target creature";
}
private HeartlessActEffect(final HeartlessActEffect effect) {
@ -87,7 +86,7 @@ class HeartlessActEffect extends OneShotEffect {
String[] counterNames = permanent.getCounters(game).keySet().toArray(new String[0]);
for (String counterName : counterNames) {
if (controller.chooseUse(Outcome.Neutral, "Do you want to remove " + counterName + " counters?", source, game)) {
if (permanent.getCounters(game).get(counterName).getCount() == 1 || toRemove == 1) {
if (permanent.getCounters(game).get(counterName).getCount() == 1 || (toRemove - removed == 1)) {
permanent.removeCounters(counterName, 1, game);
removed++;
} else {
@ -105,31 +104,6 @@ class HeartlessActEffect extends OneShotEffect {
game.addEffect(new BoostSourceEffect(removed, 0, Duration.EndOfTurn), source);
return true;
}
Player player = game.getPlayer(source.getFirstTarget());
if (player == null) {
return false;
}
int toRemove = 3;
int removed = 0;
String[] counterNames = player.getCounters().keySet().toArray(new String[0]);
for (String counterName : counterNames) {
if (controller.chooseUse(Outcome.Neutral, "Do you want to remove " + counterName + " counters?", source, game)) {
if (player.getCounters().get(counterName).getCount() == 1 || toRemove == 1) {
player.removeCounters(counterName, 1, source, game);
removed++;
} else {
int amount = controller.getAmount(1, Math.min(player.getCounters().get(counterName).getCount(), toRemove - removed), "How many?", game);
if (amount > 0) {
removed += amount;
player.removeCounters(counterName, amount, source, game);
}
}
}
if (removed >= toRemove) {
break;
}
}
game.addEffect(new BoostSourceEffect(removed, 0, Duration.EndOfTurn), source);
return true;
}
}