forked from External/mage
[MKC] Implement Havoc Eater
This commit is contained in:
parent
d64ddc999c
commit
aaa082b4cc
2 changed files with 95 additions and 0 deletions
94
Mage.Sets/src/mage/cards/h/HavocEater.java
Normal file
94
Mage.Sets/src/mage/cards/h/HavocEater.java
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
package mage.cards.h;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.combat.GoadTargetEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.ForEachOpponentTargetsAdjuster;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class HavocEater extends CardImpl {
|
||||
|
||||
public HavocEater(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}{R}");
|
||||
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// When Havoc Eater enters the battlefield, for each opponent, goad up to one target creature that opponent controls. Put X +1/+1 counters on Havoc Eater, where X is the total power of creatures goaded this way.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(
|
||||
new GoadTargetEffect()
|
||||
.setText("for each opponent, goad up to one target creature that opponent controls")
|
||||
.setTargetPointer(new EachTargetPointer()));
|
||||
ability.addEffect(new HavocEaterEffect());
|
||||
ability.addTarget(new TargetCreaturePermanent(0, 1));
|
||||
this.addAbility(ability.setTargetAdjuster(new ForEachOpponentTargetsAdjuster()));
|
||||
}
|
||||
|
||||
private HavocEater(final HavocEater card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HavocEater copy() {
|
||||
return new HavocEater(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HavocEaterEffect extends OneShotEffect {
|
||||
|
||||
HavocEaterEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "put X +1/+1 counters on {this}, where X is the total power of creatures goaded this way";
|
||||
this.setTargetPointer(new EachTargetPointer());
|
||||
}
|
||||
|
||||
private HavocEaterEffect(final HavocEaterEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HavocEaterEffect copy() {
|
||||
return new HavocEaterEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
int amount = this
|
||||
.getTargetPointer()
|
||||
.getTargets(game, source)
|
||||
.stream()
|
||||
.map(game::getPermanent)
|
||||
.filter(Objects::nonNull)
|
||||
.map(MageObject::getPower)
|
||||
.mapToInt(MageInt::getValue)
|
||||
.sum();
|
||||
return amount > 0 && permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
|
||||
}
|
||||
}
|
||||
|
|
@ -125,6 +125,7 @@ public final class MurdersAtKarlovManorCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Graf Mole", 170, Rarity.UNCOMMON, mage.cards.g.GrafMole.class));
|
||||
cards.add(new SetCardInfo("Grave Titan", 129, Rarity.MYTHIC, mage.cards.g.GraveTitan.class));
|
||||
cards.add(new SetCardInfo("Gruul Turf", 265, Rarity.UNCOMMON, mage.cards.g.GruulTurf.class));
|
||||
cards.add(new SetCardInfo("Havoc Eater", 31, Rarity.RARE, mage.cards.h.HavocEater.class));
|
||||
cards.add(new SetCardInfo("Hidden Dragonslayer", 69, Rarity.RARE, mage.cards.h.HiddenDragonslayer.class));
|
||||
cards.add(new SetCardInfo("Hooded Hydra", 171, Rarity.MYTHIC, mage.cards.h.HoodedHydra.class));
|
||||
cards.add(new SetCardInfo("Hornet Queen", 172, Rarity.RARE, mage.cards.h.HornetQueen.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue