mirror of
https://github.com/correl/mage.git
synced 2024-12-27 03:00:13 +00:00
Implemented Heartless Act
This commit is contained in:
parent
ecbd82aa2a
commit
f9f69e0ffc
2 changed files with 136 additions and 0 deletions
135
Mage.Sets/src/mage/cards/h/HeartlessAct.java
Normal file
135
Mage.Sets/src/mage/cards/h/HeartlessAct.java
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
package mage.cards.h;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.Mode;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
|
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
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;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetPermanent;
|
||||||
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class HeartlessAct extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterPermanent filter
|
||||||
|
= new FilterCreaturePermanent("creature with no counters on it");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(Predicates.not(CounterAnyPredicate.instance));
|
||||||
|
}
|
||||||
|
|
||||||
|
public HeartlessAct(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}");
|
||||||
|
|
||||||
|
// Choose one —
|
||||||
|
// • Destroy target creature with no counters on it.
|
||||||
|
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||||
|
this.getSpellAbility().addTarget(new TargetPermanent(filter));
|
||||||
|
|
||||||
|
// • Remove up to three counters from target creature.
|
||||||
|
Mode mode = new Mode(new HeartlessActEffect());
|
||||||
|
mode.addTarget(new TargetCreaturePermanent());
|
||||||
|
this.getSpellAbility().addMode(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private HeartlessAct(final HeartlessAct card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HeartlessAct copy() {
|
||||||
|
return new HeartlessAct(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class HeartlessActEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
HeartlessActEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private HeartlessActEffect(final HeartlessActEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HeartlessActEffect copy() {
|
||||||
|
return new HeartlessActEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||||
|
if (permanent != null) {
|
||||||
|
int toRemove = 3;
|
||||||
|
int removed = 0;
|
||||||
|
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) {
|
||||||
|
permanent.removeCounters(counterName, 1, game);
|
||||||
|
removed++;
|
||||||
|
} else {
|
||||||
|
int amount = controller.getAmount(1, Math.min(permanent.getCounters(game).get(counterName).getCount(), toRemove - removed), "How many?", game);
|
||||||
|
if (amount > 0) {
|
||||||
|
removed += amount;
|
||||||
|
permanent.removeCounters(counterName, amount, game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (removed >= toRemove) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -119,6 +119,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Glowstone Recluse", 156, Rarity.UNCOMMON, mage.cards.g.GlowstoneRecluse.class));
|
cards.add(new SetCardInfo("Glowstone Recluse", 156, Rarity.UNCOMMON, mage.cards.g.GlowstoneRecluse.class));
|
||||||
cards.add(new SetCardInfo("Go for Blood", 122, Rarity.COMMON, mage.cards.g.GoForBlood.class));
|
cards.add(new SetCardInfo("Go for Blood", 122, Rarity.COMMON, mage.cards.g.GoForBlood.class));
|
||||||
cards.add(new SetCardInfo("Grimdancer", 90, Rarity.UNCOMMON, mage.cards.g.Grimdancer.class));
|
cards.add(new SetCardInfo("Grimdancer", 90, Rarity.UNCOMMON, mage.cards.g.Grimdancer.class));
|
||||||
|
cards.add(new SetCardInfo("Heartless Act", 91, Rarity.UNCOMMON, mage.cards.h.HeartlessAct.class));
|
||||||
cards.add(new SetCardInfo("Helica Glider", 15, Rarity.COMMON, mage.cards.h.HelicaGlider.class));
|
cards.add(new SetCardInfo("Helica Glider", 15, Rarity.COMMON, mage.cards.h.HelicaGlider.class));
|
||||||
cards.add(new SetCardInfo("Hornbash Mentor", 159, Rarity.UNCOMMON, mage.cards.h.HornbashMentor.class));
|
cards.add(new SetCardInfo("Hornbash Mentor", 159, Rarity.UNCOMMON, mage.cards.h.HornbashMentor.class));
|
||||||
cards.add(new SetCardInfo("Huntmaster Liger", 16, Rarity.UNCOMMON, mage.cards.h.HuntmasterLiger.class));
|
cards.add(new SetCardInfo("Huntmaster Liger", 16, Rarity.UNCOMMON, mage.cards.h.HuntmasterLiger.class));
|
||||||
|
|
Loading…
Reference in a new issue