diff --git a/Mage.Sets/src/mage/cards/w/WillowduskEssenceSeer.java b/Mage.Sets/src/mage/cards/w/WillowduskEssenceSeer.java new file mode 100644 index 00000000000..c6cc1294e71 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WillowduskEssenceSeer.java @@ -0,0 +1,108 @@ +package mage.cards.w; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.ControllerGotLifeCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.hint.Hint; +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.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.target.TargetPermanent; +import mage.watchers.common.PlayerGainedLifeWatcher; +import mage.watchers.common.PlayerLostLifeWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class WillowduskEssenceSeer extends CardImpl { + + private static final FilterPermanent filter = new FilterCreaturePermanent("another creature"); + + static { + filter.add(AnotherPredicate.instance); + } + + public WillowduskEssenceSeer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{G}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.DRYAD); + this.subtype.add(SubType.DRUID); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // {1}, {T}: Choose another target creature. Put a number of +1/+1 counters on it equal to the amount of life you gained this turn or the amount of life you lost this turn, whichever is greater. Activate only as a sorcery. + Ability ability = new ActivateAsSorceryActivatedAbility(new AddCountersTargetEffect( + CounterType.P1P1.createInstance(), WillowduskEssenceSeerValue.instance + ).setText("choose another target creature. Put a number of +1/+1 counters on it " + + "equal to the amount of life you gained this turn or the amount of " + + "life you lost this turn, whichever is greater"), new GenericManaCost(1)); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetPermanent(filter)); + ability.addHint(ControllerGotLifeCount.getHint()); + ability.addHint(WillowduskEssenceSeerHint.instance); + this.addAbility(ability, new PlayerGainedLifeWatcher()); + } + + private WillowduskEssenceSeer(final WillowduskEssenceSeer card) { + super(card); + } + + @Override + public WillowduskEssenceSeer copy() { + return new WillowduskEssenceSeer(this); + } +} + +enum WillowduskEssenceSeerValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + PlayerLostLifeWatcher watcher1 = game.getState().getWatcher(PlayerLostLifeWatcher.class); + int lifeLost = watcher1 != null ? watcher1.getLifeLost(sourceAbility.getControllerId()) : 0; + PlayerGainedLifeWatcher watcher2 = game.getState().getWatcher(PlayerGainedLifeWatcher.class); + int lifeGained = watcher2 != null ? watcher2.getLifeGained(sourceAbility.getControllerId()) : 0; + return Math.max(lifeLost, lifeGained); + } + + @Override + public WillowduskEssenceSeerValue copy() { + return instance; + } + + @Override + public String getMessage() { + return ""; + } +} + +enum WillowduskEssenceSeerHint implements Hint { + instance; + + @Override + public String getText(Game game, Ability ability) { + PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class); + return "Life lost this turn: " + (watcher != null ? watcher.getLifeLost(ability.getControllerId()) : 0); + } + + @Override + public WillowduskEssenceSeerHint copy() { + return instance; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Commander2021Edition.java b/Mage.Sets/src/mage/sets/Commander2021Edition.java index 6b318aacbbe..89d7cd4d73d 100644 --- a/Mage.Sets/src/mage/sets/Commander2021Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2021Edition.java @@ -50,5 +50,6 @@ public final class Commander2021Edition extends ExpansionSet { cards.add(new SetCardInfo("Steel Overseer", 267, Rarity.RARE, mage.cards.s.SteelOverseer.class)); cards.add(new SetCardInfo("Thopter Engineer", 181, Rarity.UNCOMMON, mage.cards.t.ThopterEngineer.class)); cards.add(new SetCardInfo("Thousand-Year Elixir", 271, Rarity.RARE, mage.cards.t.ThousandYearElixir.class)); + cards.add(new SetCardInfo("Willowdusk, Essence Seer", 6, Rarity.MYTHIC, mage.cards.w.WillowduskEssenceSeer.class)); } } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ControllerGotLifeCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ControllerGotLifeCount.java index feb2cd4d1e1..091734c6ec7 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ControllerGotLifeCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ControllerGotLifeCount.java @@ -18,7 +18,7 @@ import java.util.UUID; public enum ControllerGotLifeCount implements DynamicValue { instance; - private static final Hint hint = new ValueHint("Life gained this turn:", instance); + private static final Hint hint = new ValueHint("Life gained this turn", instance); @Override public int calculate(Game game, Ability sourceAbility, Effect effect) {