diff --git a/Mage.Sets/src/mage/cards/p/PassionateArchaeologist.java b/Mage.Sets/src/mage/cards/p/PassionateArchaeologist.java new file mode 100644 index 0000000000..9b042c0d47 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PassionateArchaeologist.java @@ -0,0 +1,88 @@ +package mage.cards.p; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterSpell; +import mage.filter.StaticFilters; +import mage.filter.predicate.card.CastFromZonePredicate; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.target.common.TargetOpponent; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PassionateArchaeologist extends CardImpl { + + private static final FilterSpell filter = new FilterSpell("a spell from exile"); + + static { + filter.add(new CastFromZonePredicate(Zone.EXILED)); + } + + public PassionateArchaeologist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.BACKGROUND); + + // Commander creatures you own have "Whenever you cast a spell from exile, this creature deals damage equal to that spell's mana value to target opponent." + Ability ability = new SpellCastControllerTriggeredAbility(new DamageTargetEffect( + PassionateArchaeologistValue.instance, "this creature" + ), filter, false); + ability.addTarget(new TargetOpponent()); + this.addAbility(new SimpleStaticAbility(new GainAbilityAllEffect( + ability, Duration.WhileOnBattlefield, + StaticFilters.FILTER_CREATURES_OWNED_COMMANDER + ))); + } + + private PassionateArchaeologist(final PassionateArchaeologist card) { + super(card); + } + + @Override + public PassionateArchaeologist copy() { + return new PassionateArchaeologist(this); + } +} + +enum PassionateArchaeologistValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return Optional + .of(effect.getValue("spellCast")) + .filter(Spell.class::isInstance) + .map(Spell.class::cast) + .map(Spell::getManaValue) + .orElse(0); + } + + @Override + public PassionateArchaeologistValue copy() { + return this; + } + + @Override + public String getMessage() { + return "that spell's mana value"; + } + + @Override + public String toString() { + return "1"; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index b4ceec88e8..2e21b38879 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -421,6 +421,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Pack Attack", 190, Rarity.COMMON, mage.cards.p.PackAttack.class)); cards.add(new SetCardInfo("Parasitic Impetus", 140, Rarity.COMMON, mage.cards.p.ParasiticImpetus.class)); cards.add(new SetCardInfo("Passageway Seer", 141, Rarity.UNCOMMON, mage.cards.p.PassagewaySeer.class)); + cards.add(new SetCardInfo("Passionate Archaeologist", 656, Rarity.MYTHIC, mage.cards.p.PassionateArchaeologist.class)); cards.add(new SetCardInfo("Path of Ancestry", 907, Rarity.COMMON, mage.cards.p.PathOfAncestry.class)); cards.add(new SetCardInfo("Patriar's Seal", 332, Rarity.UNCOMMON, mage.cards.p.PatriarsSeal.class)); cards.add(new SetCardInfo("Patron of the Arts", 191, Rarity.COMMON, mage.cards.p.PatronOfTheArts.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java index e929327f0e..9403b65755 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java @@ -188,7 +188,7 @@ public class DamageTargetEffect extends OneShotEffect { if (message.equals("1")) { sb.append(" equal to the number of "); } else { - if (message.startsWith("the") || message.startsWith("twice")) { + if (message.startsWith("the") || message.startsWith("that") || message.startsWith("twice")) { sb.append(" equal to "); } else { sb.append(" for each ");