[CLB] Implemented Passionate Archaeologist

This commit is contained in:
Evan Kranzler 2022-06-05 17:27:43 -04:00
parent cd847932c2
commit 8bc4061e9b
3 changed files with 90 additions and 1 deletions

View file

@ -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";
}
}

View file

@ -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));

View file

@ -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 ");