mirror of
https://github.com/correl/mage.git
synced 2024-11-22 03:00:11 +00:00
[LTR] Implement Elrond, Master of Healing
This commit is contained in:
parent
ba22e1b680
commit
767c66251a
5 changed files with 103 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.BecomesTargetControlledPermanentTriggeredAbility;
|
||||
import mage.abilities.common.BecomesTargetOpponentAllTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.keyword.ForetellAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
|
@ -28,7 +28,7 @@ public final class BattleMammoth extends CardImpl {
|
|||
this.addAbility(TrampleAbility.getInstance());
|
||||
|
||||
// Whenever a permanent you control becomes the target of a spell or ability an opponent controls, you may draw a card.
|
||||
this.addAbility(new BecomesTargetControlledPermanentTriggeredAbility(
|
||||
this.addAbility(new BecomesTargetOpponentAllTriggeredAbility(
|
||||
new DrawCardSourceControllerEffect(1), true
|
||||
));
|
||||
|
||||
|
|
80
Mage.Sets/src/mage/cards/e/ElrondMasterOfHealing.java
Normal file
80
Mage.Sets/src/mage/cards/e/ElrondMasterOfHealing.java
Normal file
|
@ -0,0 +1,80 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesTargetOpponentAllTriggeredAbility;
|
||||
import mage.abilities.common.ScryTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ElrondMasterOfHealing extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledCreaturePermanent("a creature you control with a +1/+1 counter on it");
|
||||
|
||||
static {
|
||||
filter.add(CounterType.P1P1.getPredicate());
|
||||
}
|
||||
|
||||
public ElrondMasterOfHealing(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}");
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.ELF);
|
||||
this.subtype.add(SubType.NOBLE);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Whenever you scry, put a +1/+1 counter on each of up to X target creatures, where X is the number of cards looked at while scrying this way.
|
||||
this.addAbility(new ScryTriggeredAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance())
|
||||
.setText("put a +1/+1 counter on each of up to X target creatures, " +
|
||||
"where X is the number of cards looked at while scrying this way"))
|
||||
.setTargetAdjuster(ElrondMasterOfHealingAdjuster.instance));
|
||||
|
||||
// Whenever a creature you control with a +1/+1 counter on it becomes the target of a spell or ability an opponent controls, you may draw a card.
|
||||
this.addAbility(new BecomesTargetOpponentAllTriggeredAbility(
|
||||
new DrawCardSourceControllerEffect(1), filter, true
|
||||
));
|
||||
}
|
||||
|
||||
private ElrondMasterOfHealing(final ElrondMasterOfHealing card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElrondMasterOfHealing copy() {
|
||||
return new ElrondMasterOfHealing(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum ElrondMasterOfHealingAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int amount = ability
|
||||
.getEffects()
|
||||
.stream()
|
||||
.mapToInt(effect -> (Integer) effect.getValue("amount"))
|
||||
.findFirst()
|
||||
.orElse(0);
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanent(0, amount));
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@ package mage.cards.m;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.BecomesTargetControlledPermanentTriggeredAbility;
|
||||
import mage.abilities.common.BecomesTargetOpponentAllTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
|
@ -54,7 +54,7 @@ public final class MilaCraftyCompanion extends ModalDoubleFacedCard {
|
|||
this.getLeftHalfCard().addAbility(new MilaCraftyCompanionTriggeredAbility());
|
||||
|
||||
// Whenever a permanent you control becomes the target of a spell or ability and opponent controls, you may draw a card.
|
||||
this.getLeftHalfCard().addAbility(new BecomesTargetControlledPermanentTriggeredAbility(
|
||||
this.getLeftHalfCard().addAbility(new BecomesTargetOpponentAllTriggeredAbility(
|
||||
new DrawCardSourceControllerEffect(1), true
|
||||
));
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Easterling Vanguard", 83, Rarity.COMMON, mage.cards.e.EasterlingVanguard.class));
|
||||
cards.add(new SetCardInfo("Eastfarthing Farmer", 8, Rarity.COMMON, mage.cards.e.EastfarthingFarmer.class));
|
||||
cards.add(new SetCardInfo("Elrond, Lord of Rivendell", 49, Rarity.UNCOMMON, mage.cards.e.ElrondLordOfRivendell.class));
|
||||
cards.add(new SetCardInfo("Elrond, Master of Healing", 200, Rarity.RARE, mage.cards.e.ElrondMasterOfHealing.class));
|
||||
cards.add(new SetCardInfo("Elven Chorus", 160, Rarity.RARE, mage.cards.e.ElvenChorus.class));
|
||||
cards.add(new SetCardInfo("Elven Farsight", 161, Rarity.COMMON, mage.cards.e.ElvenFarsight.class));
|
||||
cards.add(new SetCardInfo("Elvish Mariner", 283, Rarity.RARE, mage.cards.e.ElvishMariner.class));
|
||||
|
|
|
@ -3,6 +3,8 @@ package mage.abilities.common;
|
|||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -14,20 +16,28 @@ import java.util.*;
|
|||
/**
|
||||
* @author weirddan455
|
||||
*/
|
||||
public class BecomesTargetControlledPermanentTriggeredAbility extends TriggeredAbilityImpl {
|
||||
public class BecomesTargetOpponentAllTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public BecomesTargetControlledPermanentTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
setTriggerPhrase("Whenever a permanent you control becomes the target of a spell or ability an opponent controls, ");
|
||||
private final FilterPermanent filter;
|
||||
|
||||
public BecomesTargetOpponentAllTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, StaticFilters.FILTER_CONTROLLED_A_PERMANENT, optional);
|
||||
}
|
||||
|
||||
private BecomesTargetControlledPermanentTriggeredAbility(final BecomesTargetControlledPermanentTriggeredAbility ability) {
|
||||
public BecomesTargetOpponentAllTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.filter = filter;
|
||||
setTriggerPhrase("Whenever " + filter + " becomes the target of a spell or ability an opponent controls, ");
|
||||
}
|
||||
|
||||
private BecomesTargetOpponentAllTriggeredAbility(final BecomesTargetOpponentAllTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.filter = ability.filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BecomesTargetControlledPermanentTriggeredAbility copy() {
|
||||
return new BecomesTargetControlledPermanentTriggeredAbility(this);
|
||||
public BecomesTargetOpponentAllTriggeredAbility copy() {
|
||||
return new BecomesTargetOpponentAllTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,7 +56,7 @@ public class BecomesTargetControlledPermanentTriggeredAbility extends TriggeredA
|
|||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
if (permanent == null || !permanent.isControlledBy(this.getControllerId())) {
|
||||
if (permanent == null || !filter.match(permanent, getControllerId(), this, game)) {
|
||||
return false;
|
||||
}
|
||||
// If a spell or ability an opponent controls targets a single permanent you control more than once,
|
Loading…
Reference in a new issue