Implemented Marble Priest

This commit is contained in:
Evan Kranzler 2018-06-10 00:01:25 -04:00
parent 955ec5064c
commit 3dcfa773e0
3 changed files with 89 additions and 4 deletions

View file

@ -0,0 +1,74 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.PreventAllDamageToSourceEffect;
import mage.abilities.effects.common.combat.MustBeBlockedByAllSourceEffect;
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.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author TheElk801
*/
public final class MarblePriest extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(SubType.WALL, "Walls");
public MarblePriest(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{5}");
this.subtype.add(SubType.CLERIC);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// All Walls able to block Marble Priest do so.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD,
new MustBeBlockedByAllSourceEffect(
Duration.WhileOnBattlefield,
filter
)
));
// Prevent all combat damage that would be dealt to Marble Priest by Walls.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD,
new MarblePriestPreventionEffect()
));
}
public MarblePriest(final MarblePriest card) {
super(card);
}
@Override
public MarblePriest copy() {
return new MarblePriest(this);
}
}
class MarblePriestPreventionEffect extends PreventAllDamageToSourceEffect {
public MarblePriestPreventionEffect() {
super(Duration.WhileOnBattlefield);
staticText = "Prevent all combat damage that would be dealt to {this} by Walls";
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return super.applies(event, source, game)
&& event.getFlag()
&& game.getObject(event.getSourceId()).hasSubtype(SubType.WALL, game)
&& event.getTargetId().equals(source.getSourceId());
}
}

View file

@ -173,6 +173,7 @@ public final class Legends extends ExpansionSet {
cards.add(new SetCardInfo("Lost Soul", 111, Rarity.COMMON, mage.cards.l.LostSoul.class)); cards.add(new SetCardInfo("Lost Soul", 111, Rarity.COMMON, mage.cards.l.LostSoul.class));
cards.add(new SetCardInfo("Mana Drain", 65, Rarity.UNCOMMON, mage.cards.m.ManaDrain.class)); cards.add(new SetCardInfo("Mana Drain", 65, Rarity.UNCOMMON, mage.cards.m.ManaDrain.class));
cards.add(new SetCardInfo("Mana Matrix", 285, Rarity.RARE, mage.cards.m.ManaMatrix.class)); cards.add(new SetCardInfo("Mana Matrix", 285, Rarity.RARE, mage.cards.m.ManaMatrix.class));
cards.add(new SetCardInfo("Marble Priest", 231, Rarity.UNCOMMON, mage.cards.m.MarblePriest.class));
cards.add(new SetCardInfo("Marhault Elsdragon", 244, Rarity.UNCOMMON, mage.cards.m.MarhaultElsdragon.class)); cards.add(new SetCardInfo("Marhault Elsdragon", 244, Rarity.UNCOMMON, mage.cards.m.MarhaultElsdragon.class));
cards.add(new SetCardInfo("Mirror Universe", 287, Rarity.RARE, mage.cards.m.MirrorUniverse.class)); cards.add(new SetCardInfo("Mirror Universe", 287, Rarity.RARE, mage.cards.m.MirrorUniverse.class));
cards.add(new SetCardInfo("Moat", 28, Rarity.RARE, mage.cards.m.Moat.class)); cards.add(new SetCardInfo("Moat", 28, Rarity.RARE, mage.cards.m.Moat.class));

View file

@ -1,11 +1,11 @@
package mage.abilities.effects.common.combat; package mage.abilities.effects.common.combat;
import java.util.UUID; import java.util.UUID;
import mage.constants.Duration; import mage.constants.Duration;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.RequirementEffect; import mage.abilities.effects.RequirementEffect;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -15,23 +15,33 @@ import mage.game.permanent.Permanent;
*/ */
public class MustBeBlockedByAllSourceEffect extends RequirementEffect { public class MustBeBlockedByAllSourceEffect extends RequirementEffect {
private final FilterCreaturePermanent filter;
public MustBeBlockedByAllSourceEffect() { public MustBeBlockedByAllSourceEffect() {
this(Duration.WhileOnBattlefield); this(Duration.WhileOnBattlefield);
} }
public MustBeBlockedByAllSourceEffect(Duration duration) { public MustBeBlockedByAllSourceEffect(Duration duration) {
this(duration, StaticFilters.FILTER_PERMANENT_CREATURES);
}
public MustBeBlockedByAllSourceEffect(Duration duration, FilterCreaturePermanent filter) {
super(duration); super(duration);
staticText = "All creatures able to block {this} do so"; this.filter = filter;
staticText = "All " + filter.getMessage() + " able to block {this} do so";
} }
public MustBeBlockedByAllSourceEffect(final MustBeBlockedByAllSourceEffect effect) { public MustBeBlockedByAllSourceEffect(final MustBeBlockedByAllSourceEffect effect) {
super(effect); super(effect);
this.filter = effect.filter;
} }
@Override @Override
public boolean applies(Permanent permanent, Ability source, Game game) { public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent sourceCreature = game.getPermanent(source.getSourceId()); Permanent sourceCreature = game.getPermanent(source.getSourceId());
if (sourceCreature != null && sourceCreature.isAttacking()) { if (sourceCreature != null
&& sourceCreature.isAttacking()
&& filter.match(permanent, game)) {
return permanent.canBlock(source.getSourceId(), game); return permanent.canBlock(source.getSourceId(), game);
} }
return false; return false;