Implemented Summary Judgment

This commit is contained in:
Evan Kranzler 2019-01-11 15:26:14 -05:00
parent 47ff1eddf3
commit 5087ba3bb8
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.condition.common.AddendumCondition;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SummaryJudgement extends CardImpl {
private static final FilterPermanent filter = new FilterCreaturePermanent("tapped creature");
static {
filter.add(new TappedPredicate());
}
public SummaryJudgement(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
// Summary Judgement deals 3 damage to target tapped creature.
// Addendum If you cast this spell during your main phase, it deals 5 damage to that creature instead.
this.getSpellAbility().addEffect(new SummaryJudgementEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
}
private SummaryJudgement(final SummaryJudgement card) {
super(card);
}
@Override
public SummaryJudgement copy() {
return new SummaryJudgement(this);
}
}
class SummaryJudgementEffect extends OneShotEffect {
SummaryJudgementEffect() {
super(Outcome.Benefit);
staticText = "{this} deals 3 damage to target tapped creature." +
"<br><i>Addendum</i> &mdash; f you cast this spell during your main phase, " +
"it deals 5 damage to that creature instead.";
}
private SummaryJudgementEffect(final SummaryJudgementEffect effect) {
super(effect);
}
@Override
public SummaryJudgementEffect copy() {
return new SummaryJudgementEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
int damage = 3;
if (AddendumCondition.instance.apply(game, source)) {
damage = 5;
}
return permanent.damage(damage, source.getSourceId(), game) > 0;
}
}

View file

@ -196,6 +196,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
cards.add(new SetCardInfo("Sphinx's Insight", 209, Rarity.COMMON, mage.cards.s.SphinxsInsight.class));
cards.add(new SetCardInfo("Spirit of the Spires", 23, Rarity.UNCOMMON, mage.cards.s.SpiritOfTheSpires.class));
cards.add(new SetCardInfo("Stomping Ground", 259, Rarity.RARE, mage.cards.s.StompingGround.class));
cards.add(new SetCardInfo("Summary Judgement", 24, Rarity.COMMON, mage.cards.s.SummaryJudgement.class));
cards.add(new SetCardInfo("Sunder Shaman", 210, Rarity.UNCOMMON, mage.cards.s.SunderShaman.class));
cards.add(new SetCardInfo("Syndicate Guildmage", 211, Rarity.UNCOMMON, mage.cards.s.SyndicateGuildmage.class));
cards.add(new SetCardInfo("Syndicate Messenger", 25, Rarity.COMMON, mage.cards.s.SyndicateMessenger.class));