diff --git a/Mage.Sets/src/mage/cards/b/BloodthirstyBlade.java b/Mage.Sets/src/mage/cards/b/BloodthirstyBlade.java index 4e944b1aed..164776fc09 100644 --- a/Mage.Sets/src/mage/cards/b/BloodthirstyBlade.java +++ b/Mage.Sets/src/mage/cards/b/BloodthirstyBlade.java @@ -2,17 +2,16 @@ package mage.cards.b; import mage.abilities.Ability; import mage.abilities.common.ActivateAsSorceryActivatedAbility; -import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.GoadAttachedAbility; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.RestrictionEffect; import mage.abilities.effects.common.AttachEffect; -import mage.abilities.effects.common.combat.AttacksIfAbleAttachedEffect; import mage.abilities.effects.common.continuous.BoostEquippedEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; -import mage.game.Game; -import mage.game.permanent.Permanent; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; import mage.target.common.TargetOpponentsCreaturePermanent; import java.util.UUID; @@ -28,16 +27,10 @@ public final class BloodthirstyBlade extends CardImpl { this.subtype.add(SubType.EQUIPMENT); // Equipped creature gets +2/+0 and is goaded. - Ability ability = new SimpleStaticAbility(new BoostEquippedEffect(2, 0)); - ability.addEffect(new AttacksIfAbleAttachedEffect( - Duration.WhileOnBattlefield, AttachmentType.EQUIPMENT) - .setText("")); - ability.addEffect(new BloodthirstyBladeAttackEffect() - .setText("goaded (It attacks each combat if able and attacks a player other than you if able.)").concatBy(" is")); - this.addAbility(ability); + this.addAbility(new GoadAttachedAbility(new BoostEquippedEffect(2, 0))); // {1}: Attach Bloodthirsty Blade to target creature an opponent controls. Active this ability only any time you could cast a sorcery. - ability = new ActivateAsSorceryActivatedAbility( + Ability ability = new ActivateAsSorceryActivatedAbility( Zone.BATTLEFIELD, new AttachEffect( Outcome.Detriment, "Attach {this} to target creature an opponent controls" @@ -56,34 +49,3 @@ public final class BloodthirstyBlade extends CardImpl { return new BloodthirstyBlade(this); } } - -class BloodthirstyBladeAttackEffect extends RestrictionEffect { - - BloodthirstyBladeAttackEffect() { - super(Duration.WhileOnBattlefield); - } - - private BloodthirstyBladeAttackEffect(final BloodthirstyBladeAttackEffect effect) { - super(effect); - } - - @Override - public BloodthirstyBladeAttackEffect copy() { - return new BloodthirstyBladeAttackEffect(this); - } - - @Override - public boolean applies(Permanent permanent, Ability source, Game game) { - Permanent attachment = game.getPermanent(source.getSourceId()); - return attachment != null && attachment.getAttachedTo() != null - && permanent.getId().equals(attachment.getAttachedTo()); - } - - @Override - public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) { - if (defenderId == null) { - return true; - } - return !defenderId.equals(source.getControllerId()); - } -} diff --git a/Mage.Sets/src/mage/cards/p/PsychicImpetus.java b/Mage.Sets/src/mage/cards/p/PsychicImpetus.java new file mode 100644 index 0000000000..8a0d6a96e8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PsychicImpetus.java @@ -0,0 +1,55 @@ +package mage.cards.p; + +import mage.abilities.Ability; +import mage.abilities.common.AttacksAttachedTriggeredAbility; +import mage.abilities.common.GoadAttachedAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.effects.keyword.ScryEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PsychicImpetus extends CardImpl { + + public PsychicImpetus(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature gets +2/+2 and is goaded. + this.addAbility(new GoadAttachedAbility(new BoostEnchantedEffect(2, 2))); + + // Whenever enchanted creature attacks, you scry 2. + this.addAbility(new AttacksAttachedTriggeredAbility( + new ScryEffect(2).setText("you scry 2"), AttachmentType.AURA, false + )); + } + + private PsychicImpetus(final PsychicImpetus card) { + super(card); + } + + @Override + public PsychicImpetus copy() { + return new PsychicImpetus(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2020Edition.java b/Mage.Sets/src/mage/sets/Commander2020Edition.java index f906fc98bd..eb44d2a17e 100644 --- a/Mage.Sets/src/mage/sets/Commander2020Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2020Edition.java @@ -97,6 +97,7 @@ public final class Commander2020Edition extends ExpansionSet { cards.add(new SetCardInfo("Obscuring Haze", 61, Rarity.RARE, mage.cards.o.ObscuringHaze.class)); cards.add(new SetCardInfo("Otrimi, the Ever-Playful", 12, Rarity.MYTHIC, mage.cards.o.OtrimiTheEverPlayful.class)); cards.add(new SetCardInfo("Path of Ancestry", 298, Rarity.COMMON, mage.cards.p.PathOfAncestry.class)); + cards.add(new SetCardInfo("Psychic Impetus", 37, Rarity.UNCOMMON, mage.cards.p.PsychicImpetus.class)); cards.add(new SetCardInfo("Rashmi, Eternities Crafter", 229, Rarity.RARE, mage.cards.r.RashmiEternitiesCrafter.class)); cards.add(new SetCardInfo("Shabraz, the Skyshark", 14, Rarity.MYTHIC, mage.cards.s.ShabrazTheSkyshark.class)); cards.add(new SetCardInfo("Shared Animosity", 158, Rarity.RARE, mage.cards.s.SharedAnimosity.class)); diff --git a/Mage/src/main/java/mage/abilities/common/GoadAttachedAbility.java b/Mage/src/main/java/mage/abilities/common/GoadAttachedAbility.java new file mode 100644 index 0000000000..6ebfd1dc90 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/common/GoadAttachedAbility.java @@ -0,0 +1,71 @@ +package mage.abilities.common; + +import mage.abilities.Ability; +import mage.abilities.StaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.combat.AttacksIfAbleAttachedEffect; +import mage.constants.AttachmentType; +import mage.constants.Duration; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public class GoadAttachedAbility extends StaticAbility { + + public GoadAttachedAbility(Effect... effects) { + super(Zone.BATTLEFIELD, null); + for (Effect effect : effects) { + this.addEffect(effect); + } + this.addEffect(new AttacksIfAbleAttachedEffect( + Duration.WhileOnBattlefield, AttachmentType.AURA + ).setText("and")); + } + + private GoadAttachedAbility(final GoadAttachedAbility ability) { + super(ability); + } + + @Override + public GoadAttachedAbility copy() { + return new GoadAttachedAbility(this); + } +} + +class GoadAttackEffect extends RestrictionEffect { + + GoadAttackEffect() { + super(Duration.WhileOnBattlefield); + staticText = "is goaded. (It attacks each combat if able and attacks a player other than you if able.)"; + } + + private GoadAttackEffect(final GoadAttackEffect effect) { + super(effect); + } + + @Override + public GoadAttackEffect copy() { + return new GoadAttackEffect(this); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + Permanent attachment = game.getPermanent(source.getSourceId()); + return attachment != null && attachment.getAttachedTo() != null + && permanent.getId().equals(attachment.getAttachedTo()); + } + + @Override + public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) { + if (defenderId == null) { + return true; + } + return !defenderId.equals(source.getControllerId()); + } +}