Implemented Bloodthirsty Blade

This commit is contained in:
Evan Kranzler 2019-08-12 20:17:07 -04:00
parent a234e244d6
commit 33276eb55e
2 changed files with 116 additions and 0 deletions

View file

@ -0,0 +1,115 @@
package mage.cards.b;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.RestrictionEffect;
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.target.common.TargetOpponentsCreaturePermanent;
import java.util.UUID;
import static mage.constants.Outcome.Benefit;
/**
* @author TheElk801
*/
public final class BloodthirstyBlade extends CardImpl {
public BloodthirstyBlade(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
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("and is"));
ability.addEffect(new BloodthirstyBladeAttackEffect());
this.addAbility(ability);
// {1}: Attach Bloodthirsty Blade to target creature an opponent controls. Active this ability only any time you could cast a sorcery.
ability = new ActivateAsSorceryActivatedAbility(
Zone.BATTLEFIELD, new BloodthirstyBladeEffect(), new GenericManaCost(1)
);
ability.addTarget(new TargetOpponentsCreaturePermanent());
this.addAbility(ability);
}
private BloodthirstyBlade(final BloodthirstyBlade card) {
super(card);
}
@Override
public BloodthirstyBlade copy() {
return new BloodthirstyBlade(this);
}
}
class BloodthirstyBladeAttackEffect extends RestrictionEffect {
BloodthirstyBladeAttackEffect() {
super(Duration.WhileOnBattlefield);
staticText = "goaded";
}
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());
}
}
class BloodthirstyBladeEffect extends OneShotEffect {
BloodthirstyBladeEffect() {
super(Benefit);
staticText = "attach {this} to target creature an opponent controls";
}
private BloodthirstyBladeEffect(final BloodthirstyBladeEffect effect) {
super(effect);
}
@Override
public BloodthirstyBladeEffect copy() {
return new BloodthirstyBladeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent == null) {
return false;
}
permanent.attachTo(source.getFirstTarget(), game);
return true;
}
}

View file

@ -42,6 +42,7 @@ public final class Commander2019Edition extends ExpansionSet {
cards.add(new SetCardInfo("Biomass Mutation", 187, Rarity.RARE, mage.cards.b.BiomassMutation.class)); cards.add(new SetCardInfo("Biomass Mutation", 187, Rarity.RARE, mage.cards.b.BiomassMutation.class));
cards.add(new SetCardInfo("Bloodfell Caves", 230, Rarity.COMMON, mage.cards.b.BloodfellCaves.class)); cards.add(new SetCardInfo("Bloodfell Caves", 230, Rarity.COMMON, mage.cards.b.BloodfellCaves.class));
cards.add(new SetCardInfo("Bloodhall Priest", 188, Rarity.RARE, mage.cards.b.BloodhallPriest.class)); cards.add(new SetCardInfo("Bloodhall Priest", 188, Rarity.RARE, mage.cards.b.BloodhallPriest.class));
cards.add(new SetCardInfo("Bloodthirsty Blade", 53, Rarity.UNCOMMON, mage.cards.b.BloodthirstyBlade.class));
cards.add(new SetCardInfo("Blossoming Sands", 231, Rarity.COMMON, mage.cards.b.BlossomingSands.class)); cards.add(new SetCardInfo("Blossoming Sands", 231, Rarity.COMMON, mage.cards.b.BlossomingSands.class));
cards.add(new SetCardInfo("Bojuka Bog", 232, Rarity.COMMON, mage.cards.b.BojukaBog.class)); cards.add(new SetCardInfo("Bojuka Bog", 232, Rarity.COMMON, mage.cards.b.BojukaBog.class));
cards.add(new SetCardInfo("Bone Miser", 15, Rarity.RARE, mage.cards.b.BoneMiser.class)); cards.add(new SetCardInfo("Bone Miser", 15, Rarity.RARE, mage.cards.b.BoneMiser.class));