Implemented Departed Deckhand

This commit is contained in:
Evan Kranzler 2018-06-21 08:37:18 -04:00
parent 08d9463b1e
commit db07686008
3 changed files with 91 additions and 2 deletions

View file

@ -0,0 +1,76 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BecomesTargetTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetControlledCreaturePermanent;
/**
*
* @author TheElk801
*/
public final class DepartedDeckhand extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(Predicates.not(new SubtypePredicate(SubType.SPIRIT)));
}
public DepartedDeckhand(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.subtype.add(SubType.SPIRIT);
this.subtype.add(SubType.PIRATE);
// When Departed Deckhand becomes the target of a spell, sacrifice it.
this.addAbility(new BecomesTargetTriggeredAbility(
new SacrificeSourceEffect(),
StaticFilters.FILTER_SPELL_A
));
// Departed Deckhand can only be blocked by Spirits.
Ability ability = new SimpleStaticAbility(
Zone.BATTLEFIELD,
new CantBeBlockedByCreaturesSourceEffect(
filter, Duration.WhileOnBattlefield
).setText("{this} can only be blocked by Spirits")
);
this.addAbility(ability);
// {3}{U}: Target creature you control can only be blocked by Spirits this turn.
ability = new SimpleActivatedAbility(
new CantBeBlockedTargetEffect(
filter, Duration.EndOfTurn
).setText("Target creature you control can only be blocked by Spirits this turn"),
new ManaCostsImpl("{3}{U}")
);
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
}
public DepartedDeckhand(final DepartedDeckhand card) {
super(card);
}
@Override
public DepartedDeckhand copy() {
return new DepartedDeckhand(this);
}
}

View file

@ -71,6 +71,7 @@ public final class CoreSet2019 extends ExpansionSet {
cards.add(new SetCardInfo("Death Baron", 90, Rarity.RARE, mage.cards.d.DeathBaron.class));
cards.add(new SetCardInfo("Declare Dominance", 175, Rarity.UNCOMMON, mage.cards.d.DeclareDominance.class));
cards.add(new SetCardInfo("Demon of Catastrophes", 91, Rarity.RARE, mage.cards.d.DemonOfCatastrophes.class));
cards.add(new SetCardInfo("Departed Deckhand", 49, Rarity.UNCOMMON, mage.cards.d.DepartedDeckhand.class));
cards.add(new SetCardInfo("Desecrated Tomb", 230, Rarity.RARE, mage.cards.d.DesecratedTomb.class));
cards.add(new SetCardInfo("Diamond Mare", 231, Rarity.UNCOMMON, mage.cards.d.DiamondMare.class));
cards.add(new SetCardInfo("Diregraf Ghoul", 92, Rarity.UNCOMMON, mage.cards.d.DiregrafGhoul.class));

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -6,6 +5,8 @@ import mage.abilities.Mode;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;
@ -17,16 +18,27 @@ import mage.util.CardUtil;
*/
public class CantBeBlockedTargetEffect extends RestrictionEffect {
private final FilterCreaturePermanent filter;
public CantBeBlockedTargetEffect() {
this(Duration.EndOfTurn);
}
public CantBeBlockedTargetEffect(Duration duration) {
this(StaticFilters.FILTER_PERMANENT_CREATURE, duration);
this.staticText = null;
}
public CantBeBlockedTargetEffect(FilterCreaturePermanent filter, Duration duration) {
super(duration, Outcome.Benefit);
this.filter = filter;
staticText = new StringBuilder("{this} can't be blocked ")
.append(filter.getMessage().startsWith("except by") ? "" : "by ").append(filter.getMessage()).toString();
}
public CantBeBlockedTargetEffect(CantBeBlockedTargetEffect effect) {
super(effect);
this.filter = effect.filter;
}
@Override
@ -36,7 +48,7 @@ public class CantBeBlockedTargetEffect extends RestrictionEffect {
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
return false;
return !filter.match(blocker, source.getSourceId(), source.getControllerId(), game);
}
@Override