[MIC] Implemented Sigardian Zealot

This commit is contained in:
Evan Kranzler 2021-09-16 09:09:41 -04:00
parent 6a174d58cf
commit 244cacfe3b
4 changed files with 174 additions and 34 deletions

View file

@ -1,9 +1,9 @@
package mage.cards.s;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.hint.common.CovenHint;
import mage.abilities.keyword.DoubleStrikeAbility;
@ -11,15 +11,17 @@ import mage.abilities.keyword.FlashAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturesWithDifferentPowers;
import mage.target.targetpointer.FixedTargets;
import java.util.Objects;
import java.util.UUID;
/**
@ -41,14 +43,7 @@ public final class SigardasVanguard extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever Sigarda's Vanguard enters the battlefield or attacks, choose any number of creatures with different powers. Those creatures gain double strike until end of turn.
Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(
new GainAbilityTargetEffect(
DoubleStrikeAbility.getInstance(), Duration.EndOfTurn
).setText("choose any number of creatures with different powers. " +
"Those creatures gain double strike until end of turn")
);
ability.addTarget(new SigardasVanguardTarget());
this.addAbility(ability.addHint(CovenHint.instance));
this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new SigardasVanguardEffect()).addHint(CovenHint.instance));
}
private SigardasVanguard(final SigardasVanguard card) {
@ -61,39 +56,37 @@ public final class SigardasVanguard extends CardImpl {
}
}
class SigardasVanguardTarget extends TargetCreaturePermanent {
class SigardasVanguardEffect extends OneShotEffect {
private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent("creatures with different powers");
SigardasVanguardTarget() {
super(0, Integer.MAX_VALUE, filter, false);
SigardasVanguardEffect() {
super(Outcome.Benefit);
staticText = "choose any number of creatures with different powers. " +
"Those creatures gain double strike until end of turn";
}
private SigardasVanguardTarget(final SigardasVanguardTarget target) {
super(target);
private SigardasVanguardEffect(final SigardasVanguardEffect effect) {
super(effect);
}
@Override
public SigardasVanguardTarget copy() {
return new SigardasVanguardTarget(this);
public SigardasVanguardEffect copy() {
return new SigardasVanguardEffect(this);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (!super.canTarget(controllerId, id, source, game)) {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Permanent creature = game.getPermanent(id);
if (creature == null) {
TargetPermanent target = new TargetCreaturesWithDifferentPowers();
player.choose(outcome, target, source.getSourceId(), game);
if (target.getTargets().isEmpty()) {
return false;
}
return this.getTargets()
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.map(MageObject::getPower)
.mapToInt(MageInt::getValue)
.noneMatch(p -> creature.getPower().getValue() == p);
game.addEffect(new GainAbilityTargetEffect(
DoubleStrikeAbility.getInstance(), Duration.EndOfTurn
).setTargetPointer(new FixedTargets(new CardsImpl(target.getTargets()), game)), source);
return true;
}
}

View file

@ -0,0 +1,93 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturesWithDifferentPowers;
import mage.target.targetpointer.FixedTargets;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SigardianZealot extends CardImpl {
public SigardianZealot(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.CLERIC);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// At the beginning of combat on your turn, choose any number of creatures with different powers. Each of them gets +X/+X and gains vigilance until end of turn, where X is Sigardian Zealot's power.
this.addAbility(new BeginningOfCombatTriggeredAbility(
new SigardianZealotEffect(), TargetController.YOU, false
));
}
private SigardianZealot(final SigardianZealot card) {
super(card);
}
@Override
public SigardianZealot copy() {
return new SigardianZealot(this);
}
}
class SigardianZealotEffect extends OneShotEffect {
SigardianZealotEffect() {
super(Outcome.Benefit);
staticText = "choose any number of creatures with different powers. " +
"Each of them gets +X/+X and gains vigilance until end of turn, where X is {this}'s power";
}
private SigardianZealotEffect(final SigardianZealotEffect effect) {
super(effect);
}
@Override
public SigardianZealotEffect copy() {
return new SigardianZealotEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = source.getSourcePermanentOrLKI(game);
if (player == null || permanent == null) {
return false;
}
int power = permanent.getPower().getValue();
if (power == 0) {
return false;
}
TargetPermanent target = new TargetCreaturesWithDifferentPowers();
player.choose(outcome, target, source.getSourceId(), game);
Cards cards = new CardsImpl(target.getTargets());
if (cards.isEmpty()) {
return false;
}
game.addEffect(new BoostTargetEffect(power, power).setTargetPointer(new FixedTargets(cards, game)), source);
game.addEffect(new GainAbilityTargetEffect(
VigilanceAbility.getInstance(), Duration.EndOfTurn
).setTargetPointer(new FixedTargets(cards, game)), source);
return true;
}
}

View file

@ -112,6 +112,7 @@ public final class MidnightHuntCommander extends ExpansionSet {
cards.add(new SetCardInfo("Shamanic Revelation", 143, Rarity.RARE, mage.cards.s.ShamanicRevelation.class));
cards.add(new SetCardInfo("Sigarda's Vanguard", 8, Rarity.RARE, mage.cards.s.SigardasVanguard.class));
cards.add(new SetCardInfo("Sigarda, Heron's Grace", 155, Rarity.MYTHIC, mage.cards.s.SigardaHeronsGrace.class));
cards.add(new SetCardInfo("Sigardian Zealot", 29, Rarity.RARE, mage.cards.s.SigardianZealot.class));
cards.add(new SetCardInfo("Sky Diamond", 161, Rarity.COMMON, mage.cards.s.SkyDiamond.class));
cards.add(new SetCardInfo("Sol Ring", 162, Rarity.UNCOMMON, mage.cards.s.SolRing.class));
cards.add(new SetCardInfo("Somberwald Beastmaster", 30, Rarity.RARE, mage.cards.s.SomberwaldBeastmaster.class));

View file

@ -0,0 +1,53 @@
package mage.target.common;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import java.util.Objects;
import java.util.UUID;
/**
* @author TheElk801
*/
public class TargetCreaturesWithDifferentPowers extends TargetPermanent {
private static final FilterPermanent filter
= new FilterCreaturePermanent("creatures with different powers");
public TargetCreaturesWithDifferentPowers() {
super(0, Integer.MAX_VALUE, filter, false);
}
private TargetCreaturesWithDifferentPowers(final TargetCreaturesWithDifferentPowers target) {
super(target);
}
@Override
public TargetCreaturesWithDifferentPowers copy() {
return new TargetCreaturesWithDifferentPowers(this);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (!super.canTarget(controllerId, id, source, game)) {
return false;
}
Permanent creature = game.getPermanent(id);
if (creature == null) {
return false;
}
return this.getTargets()
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.map(MageObject::getPower)
.mapToInt(MageInt::getValue)
.noneMatch(p -> creature.getPower().getValue() == p);
}
}