- Added Pretender's Claim and Unnatural Hunger

This commit is contained in:
jeffwadsworth 2020-08-11 18:13:30 -05:00
parent 3d0cd99655
commit f0149c6a19
4 changed files with 193 additions and 6 deletions

View file

@ -0,0 +1,87 @@
package mage.cards.p;
import java.util.List;
import java.util.UUID;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedAttachedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public final class PretendersClaim extends CardImpl {
public PretendersClaim(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Whenever enchanted creature becomes blocked, tap all lands defending player controls.
this.addAbility(new BecomesBlockedAttachedTriggeredAbility(new TapDefendingPlayerLandEffect(), false));
}
private PretendersClaim(final PretendersClaim card) {
super(card);
}
@Override
public PretendersClaim copy() {
return new PretendersClaim(this);
}
}
class TapDefendingPlayerLandEffect extends OneShotEffect {
public TapDefendingPlayerLandEffect() {
super(Outcome.Tap);
staticText = "tap all lands defending player controls";
}
public TapDefendingPlayerLandEffect(final TapDefendingPlayerLandEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (aura != null
&& aura.getAttachedTo() != null) {
Player defendingPlayer = game.getPlayer(game.getCombat().getDefendingPlayerId(aura.getAttachedTo(), game));
if (defendingPlayer != null) {
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, defendingPlayer.getId(), game);
for (Permanent land : permanents) {
land.tap(game);
}
return true;
}
}
return false;
}
@Override
public TapDefendingPlayerLandEffect copy() {
return new TapDefendingPlayerLandEffect(this);
}
}

View file

@ -0,0 +1,100 @@
package mage.cards.u;
import java.util.UUID;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
/**
*
* @author jeffwadsworth
*/
public final class UnnaturalHunger extends CardImpl {
public UnnaturalHunger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{B}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// At the beginning of the upkeep of enchanted creature's controller, Unnatural Hunger deals damage to that player equal to that creature's power unless they sacrifice another creature.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new UnnaturalHungerEffect(),
TargetController.CONTROLLER_ATTACHED_TO, false));
}
private UnnaturalHunger(final UnnaturalHunger card) {
super(card);
}
@Override
public UnnaturalHunger copy() {
return new UnnaturalHunger(this);
}
}
class UnnaturalHungerEffect extends OneShotEffect {
public UnnaturalHungerEffect() {
super(Outcome.Detriment);
this.staticText = "{this} deals damage to that player equal to that creature's power unless they sacrifice another creature";
}
private UnnaturalHungerEffect(UnnaturalHungerEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = game.getPermanent(source.getSourceId());
if (aura != null) {
Permanent attachedTo = game.getPermanent(aura.getAttachedTo());
if (attachedTo != null) {
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
filter.add(Predicates.not(new PermanentIdPredicate(aura.getAttachedTo()))); // not attached permanent
Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent(filter));
Player enchantedCreatureController = game.getPlayer(attachedTo.getControllerId());
if (enchantedCreatureController != null
&& cost.canPay(source, source.getSourceId(), enchantedCreatureController.getId(), game)
&& enchantedCreatureController.chooseUse(outcome, "Sacrifice another creature to prevent " + attachedTo.getPower().getValue() + " damage?", source, game)
&& cost.pay(source, game, source.getSourceId(), enchantedCreatureController.getId(), true)) {
}
if (enchantedCreatureController != null
&& !cost.isPaid()) {
enchantedCreatureController.damage(attachedTo.getPower().getValue(), source.getSourceId(), game);
}
return true;
}
}
return false;
}
@Override
public UnnaturalHungerEffect copy() {
return new UnnaturalHungerEffect(this);
}
}

View file

@ -239,6 +239,7 @@ public final class MercadianMasques extends ExpansionSet {
cards.add(new SetCardInfo("Plains", 334, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Port Inspector", 90, Rarity.COMMON, mage.cards.p.PortInspector.class));
cards.add(new SetCardInfo("Power Matrix", 309, Rarity.RARE, mage.cards.p.PowerMatrix.class));
cards.add(new SetCardInfo("Pretender's Claim", 151, Rarity.UNCOMMON, mage.cards.p.PretendersClaim.class));
cards.add(new SetCardInfo("Primeval Shambler", 152, Rarity.UNCOMMON, mage.cards.p.PrimevalShambler.class));
cards.add(new SetCardInfo("Puffer Extract", 310, Rarity.UNCOMMON, mage.cards.p.PufferExtract.class));
cards.add(new SetCardInfo("Pulverize", 207, Rarity.RARE, mage.cards.p.Pulverize.class));
@ -350,6 +351,7 @@ public final class MercadianMasques extends ExpansionSet {
cards.add(new SetCardInfo("Two-Headed Dragon", 221, Rarity.RARE, mage.cards.t.TwoHeadedDragon.class));
cards.add(new SetCardInfo("Undertaker", 167, Rarity.COMMON, mage.cards.u.Undertaker.class));
cards.add(new SetCardInfo("Unmask", 168, Rarity.RARE, mage.cards.u.Unmask.class));
cards.add(new SetCardInfo("Unnatural Hunger", 169, Rarity.RARE, mage.cards.u.UnnaturalHunger.class));
cards.add(new SetCardInfo("Uphill Battle", 222, Rarity.UNCOMMON, mage.cards.u.UphillBattle.class));
cards.add(new SetCardInfo("Vendetta", 170, Rarity.COMMON, mage.cards.v.Vendetta.class));
cards.add(new SetCardInfo("Venomous Breath", 281, Rarity.UNCOMMON, mage.cards.v.VenomousBreath.class));

View file

@ -6,7 +6,6 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -30,12 +29,11 @@ public class BecomesBlockedAttachedTriggeredAbility extends TriggeredAbilityImpl
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent equipment = game.getPermanent(sourceId);
if (equipment != null && equipment.getAttachedTo() != null) {
if (equipment != null
&& equipment.getAttachedTo() != null) {
Permanent equipped = game.getPermanent(equipment.getAttachedTo());
if (equipped.getId().equals(event.getTargetId())) {
getEffects().get(1).setTargetPointer(new FixedTarget(equipped, game));
return true;
}
return (equipped != null
&& equipped.getId().equals(event.getTargetId()));
}
return false;
}