mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Updated Flickering Ward, Pentarch Ward, and Voice of All with new protection effects and updated Glissa Sunseeker code for npe check.
This commit is contained in:
parent
d8dc95c16f
commit
f9e833409c
4 changed files with 25 additions and 146 deletions
|
@ -106,7 +106,7 @@ class GlissaSunseekerEffect extends OneShotEffect {
|
||||||
int colorlessMana = pool.getColorless();
|
int colorlessMana = pool.getColorless();
|
||||||
int manaPoolTotal = blackMana + whiteMana + blueMana + greenMana + redMana + colorlessMana;
|
int manaPoolTotal = blackMana + whiteMana + blueMana + greenMana + redMana + colorlessMana;
|
||||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (controller != null) {
|
if (controller != null && permanent != null) {
|
||||||
if (permanent.getManaCost().convertedManaCost() == manaPoolTotal) {
|
if (permanent.getManaCost().convertedManaCost() == manaPoolTotal) {
|
||||||
return permanent.destroy(source.getSourceId(), game, false);
|
return permanent.destroy(source.getSourceId(), game, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,23 +29,16 @@ package mage.sets.planeshift;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.common.ChooseColorEffect;
|
||||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
import mage.abilities.effects.keyword.ProtectionChosenColorSourceEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.abilities.keyword.ProtectionAbility;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.choices.ChoiceColor;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.filter.FilterCard;
|
import mage.constants.Zone;
|
||||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
|
||||||
import mage.game.Game;
|
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -62,9 +55,11 @@ public class VoiceOfAll extends CardImpl {
|
||||||
|
|
||||||
// Flying
|
// Flying
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
// As Voice of All enters the battlefield, choose a color.
|
// As Voice of All enters the battlefield, choose a color.
|
||||||
// Voice of All has protection from the chosen color.
|
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Benefit)));
|
||||||
this.addAbility(new AsEntersBattlefieldAbility(new VoiceOfAllEffect()));
|
|
||||||
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ProtectionChosenColorSourceEffect()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public VoiceOfAll(final VoiceOfAll card) {
|
public VoiceOfAll(final VoiceOfAll card) {
|
||||||
|
@ -75,37 +70,4 @@ public class VoiceOfAll extends CardImpl {
|
||||||
public VoiceOfAll copy() {
|
public VoiceOfAll copy() {
|
||||||
return new VoiceOfAll(this);
|
return new VoiceOfAll(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class VoiceOfAllEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
public VoiceOfAllEffect() {
|
|
||||||
super(Outcome.Protect);
|
|
||||||
this.staticText = "{this} gains protection from the color of your choice";
|
|
||||||
}
|
|
||||||
|
|
||||||
public VoiceOfAllEffect(final VoiceOfAllEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VoiceOfAllEffect copy() {
|
|
||||||
return new VoiceOfAllEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
ChoiceColor choice = new ChoiceColor();
|
|
||||||
choice.setMessage("Choose color to get protection from");
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller != null && controller.choose(outcome, choice, game)) {
|
|
||||||
FilterCard protectionFilter = new FilterCard();
|
|
||||||
protectionFilter.add(new ColorPredicate(choice.getColor()));
|
|
||||||
protectionFilter.setMessage(choice.getChoice().toLowerCase());
|
|
||||||
ContinuousEffect effect = new GainAbilitySourceEffect(new ProtectionAbility(protectionFilter), Duration.WhileOnBattlefield);
|
|
||||||
game.addEffect(effect, source);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -28,29 +28,20 @@
|
||||||
package mage.sets.tempest;
|
package mage.sets.tempest;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
|
||||||
import mage.abilities.effects.OneShotEffect;
|
|
||||||
import mage.abilities.effects.common.AttachEffect;
|
import mage.abilities.effects.common.AttachEffect;
|
||||||
|
import mage.abilities.effects.common.ChooseColorEffect;
|
||||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
import mage.abilities.effects.keyword.ProtectionChosenColorAttachedEffect;
|
||||||
import mage.abilities.keyword.EnchantAbility;
|
import mage.abilities.keyword.EnchantAbility;
|
||||||
import mage.abilities.keyword.ProtectionAbility;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.choices.ChoiceColor;
|
|
||||||
import mage.constants.AttachmentType;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterCard;
|
|
||||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
|
||||||
import mage.game.Game;
|
|
||||||
import mage.players.Player;
|
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
@ -72,8 +63,10 @@ public class FlickeringWard extends CardImpl {
|
||||||
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
||||||
|
|
||||||
// As Flickering Ward enters the battlefield, choose a color.
|
// As Flickering Ward enters the battlefield, choose a color.
|
||||||
|
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Benefit)));
|
||||||
|
|
||||||
// Enchanted creature has protection from the chosen color. This effect doesn't remove Flickering Ward.
|
// Enchanted creature has protection from the chosen color. This effect doesn't remove Flickering Ward.
|
||||||
this.addAbility(new AsEntersBattlefieldAbility(new FlickeringWardEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ProtectionChosenColorAttachedEffect(true)));
|
||||||
|
|
||||||
// {W}: Return Flickering Ward to its owner's hand.
|
// {W}: Return Flickering Ward to its owner's hand.
|
||||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(), new ManaCostsImpl("{W}")));
|
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(), new ManaCostsImpl("{W}")));
|
||||||
|
@ -87,39 +80,4 @@ public class FlickeringWard extends CardImpl {
|
||||||
public FlickeringWard copy() {
|
public FlickeringWard copy() {
|
||||||
return new FlickeringWard(this);
|
return new FlickeringWard(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class FlickeringWardEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
public FlickeringWardEffect() {
|
|
||||||
super(Outcome.Protect);
|
|
||||||
this.staticText = "enchanted creature has protection from the chosen color. This effect doesn't remove {this}";
|
|
||||||
}
|
|
||||||
|
|
||||||
public FlickeringWardEffect(final FlickeringWardEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FlickeringWardEffect copy() {
|
|
||||||
return new FlickeringWardEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
ChoiceColor choice = new ChoiceColor();
|
|
||||||
choice.setMessage("Choose color to get protection from");
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller != null && controller.choose(outcome, choice, game)) {
|
|
||||||
FilterCard protectionFilter = new FilterCard();
|
|
||||||
protectionFilter.add(new ColorPredicate(choice.getColor()));
|
|
||||||
protectionFilter.setMessage(choice.getChoice().toLowerCase());
|
|
||||||
ProtectionAbility protectionAbility = new ProtectionAbility(protectionFilter);
|
|
||||||
protectionAbility.setRemovesAuras(false);
|
|
||||||
ContinuousEffect effect = new GainAbilityAttachedEffect(protectionAbility, AttachmentType.AURA, Duration.WhileOnBattlefield);
|
|
||||||
game.addEffect(effect, source);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -28,27 +28,19 @@
|
||||||
package mage.sets.timespiral;
|
package mage.sets.timespiral;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
|
||||||
import mage.abilities.effects.common.AttachEffect;
|
import mage.abilities.effects.common.AttachEffect;
|
||||||
|
import mage.abilities.effects.common.ChooseColorEffect;
|
||||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
import mage.abilities.effects.keyword.ProtectionChosenColorAttachedEffect;
|
||||||
import mage.abilities.keyword.EnchantAbility;
|
import mage.abilities.keyword.EnchantAbility;
|
||||||
import mage.abilities.keyword.ProtectionAbility;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.choices.ChoiceColor;
|
|
||||||
import mage.constants.AttachmentType;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.filter.FilterCard;
|
import mage.constants.Zone;
|
||||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
|
||||||
import mage.game.Game;
|
|
||||||
import mage.players.Player;
|
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
@ -73,8 +65,10 @@ public class PentarchWard extends CardImpl {
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)));
|
||||||
|
|
||||||
// As Pentarch Ward enters the battlefield, choose a color.
|
// As Pentarch Ward enters the battlefield, choose a color.
|
||||||
|
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Benefit)));
|
||||||
|
|
||||||
// Enchanted creature has protection from the chosen color. This effect doesn't remove Pentarch Ward.
|
// Enchanted creature has protection from the chosen color. This effect doesn't remove Pentarch Ward.
|
||||||
this.addAbility(new AsEntersBattlefieldAbility(new PentarchWardEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ProtectionChosenColorAttachedEffect(true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public PentarchWard(final PentarchWard card) {
|
public PentarchWard(final PentarchWard card) {
|
||||||
|
@ -85,39 +79,4 @@ public class PentarchWard extends CardImpl {
|
||||||
public PentarchWard copy() {
|
public PentarchWard copy() {
|
||||||
return new PentarchWard(this);
|
return new PentarchWard(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PentarchWardEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
public PentarchWardEffect() {
|
|
||||||
super(Outcome.Protect);
|
|
||||||
this.staticText = "enchanted creature has protection from the chosen color. This effect doesn't remove {this}";
|
|
||||||
}
|
|
||||||
|
|
||||||
public PentarchWardEffect(final PentarchWardEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PentarchWardEffect copy() {
|
|
||||||
return new PentarchWardEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
ChoiceColor choice = new ChoiceColor();
|
|
||||||
choice.setMessage("Choose color to get protection from");
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller != null && controller.choose(outcome, choice, game)) {
|
|
||||||
FilterCard protectionFilter = new FilterCard();
|
|
||||||
protectionFilter.add(new ColorPredicate(choice.getColor()));
|
|
||||||
protectionFilter.setMessage(choice.getChoice().toLowerCase());
|
|
||||||
ProtectionAbility protectionAbility = new ProtectionAbility(protectionFilter);
|
|
||||||
protectionAbility.setRemovesAuras(false);
|
|
||||||
ContinuousEffect effect = new GainAbilityAttachedEffect(protectionAbility, AttachmentType.AURA, Duration.WhileOnBattlefield);
|
|
||||||
game.addEffect(effect, source);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue