-
Notifications
You must be signed in to change notification settings - Fork 748
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added Pretender's Claim and Unnatural Hunger
- Loading branch information
1 parent
3d0cd99
commit f0149c6
Showing
4 changed files
with
193 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters