Update Circles Of Protection

This commit is contained in:
Quercitron 2014-05-23 23:50:42 +04:00
parent 90756d1e5e
commit b98173569b
5 changed files with 70 additions and 287 deletions

View file

@ -29,24 +29,30 @@ package mage.sets.iceage;
import java.util.UUID;
import mage.constants.*;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PreventNextDamageFromChosenSourceToYouEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterObject;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.TargetSource;
/**
*
* @author Plopman
*/
public class CircleOfProtectionBlack extends CardImpl<CircleOfProtectionBlack> {
private static final FilterObject filter = new FilterObject("black source");
static {
filter.add(new ColorPredicate(ObjectColor.BLACK));
}
public CircleOfProtectionBlack(UUID ownerId) {
super(ownerId, 236, "Circle of Protection: Black", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
@ -55,7 +61,8 @@ public class CircleOfProtectionBlack extends CardImpl<CircleOfProtectionBlack> {
this.color.setWhite(true);
// {1}: The next time a black source of your choice would deal damage to you this turn, prevent that damage.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CircleOfProtectionBlackEffect() , new ManaCostsImpl("1")));
Effect effect = new PreventNextDamageFromChosenSourceToYouEffect(Duration.EndOfTurn, filter);
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("1")));
}
public CircleOfProtectionBlack(final CircleOfProtectionBlack card) {
@ -67,54 +74,3 @@ public class CircleOfProtectionBlack extends CardImpl<CircleOfProtectionBlack> {
return new CircleOfProtectionBlack(this);
}
}
class CircleOfProtectionBlackEffect extends PreventionEffectImpl<CircleOfProtectionBlackEffect> {
private static final FilterObject filter = new FilterObject("black source");
static{
filter.add(new ColorPredicate(ObjectColor.BLACK));
}
private final TargetSource target;
public CircleOfProtectionBlackEffect() {
super(Duration.EndOfTurn);
target = new TargetSource(filter);
staticText = "The next time a black source of your choice would deal damage to you this turn, prevent that damage";
}
public CircleOfProtectionBlackEffect(final CircleOfProtectionBlackEffect effect) {
super(effect);
this.target = effect.target.copy();
}
@Override
public CircleOfProtectionBlackEffect copy() {
return new CircleOfProtectionBlackEffect(this);
}
@Override
public void init(Ability source, Game game) {
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
preventDamageAction(event, source, game);
this.used = true;
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!this.used && super.applies(event, source, game)) {
if (event.getTargetId().equals(source.getControllerId()) && event.getSourceId().equals(target.getFirstTarget())) {
return true;
}
}
return false;
}
}

View file

@ -29,18 +29,18 @@ package mage.sets.iceage;
import java.util.UUID;
import mage.constants.*;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PreventNextDamageFromChosenSourceToYouEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterObject;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.TargetSource;
/**
*
@ -48,6 +48,12 @@ import mage.target.TargetSource;
*/
public class CircleOfProtectionBlue extends CardImpl<CircleOfProtectionBlue> {
private static final FilterObject filter = new FilterObject("blue source");
static {
filter.add(new ColorPredicate(ObjectColor.BLUE));
}
public CircleOfProtectionBlue(UUID ownerId) {
super(ownerId, 237, "Circle of Protection: Blue", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.expansionSetCode = "ICE";
@ -55,8 +61,8 @@ public class CircleOfProtectionBlue extends CardImpl<CircleOfProtectionBlue> {
this.color.setWhite(true);
// {1}: The next time a blue source of your choice would deal damage to you this turn, prevent that damage.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CircleOfProtectionBlueEffect() , new ManaCostsImpl("1")));
Effect effect = new PreventNextDamageFromChosenSourceToYouEffect(Duration.EndOfTurn, filter);
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("1")));
}
public CircleOfProtectionBlue(final CircleOfProtectionBlue card) {
@ -68,51 +74,3 @@ public class CircleOfProtectionBlue extends CardImpl<CircleOfProtectionBlue> {
return new CircleOfProtectionBlue(this);
}
}
class CircleOfProtectionBlueEffect extends PreventionEffectImpl<CircleOfProtectionBlueEffect> {
private static final FilterObject filter = new FilterObject("blue source");
static{
filter.add(new ColorPredicate(ObjectColor.BLUE));
}
private final TargetSource target;
public CircleOfProtectionBlueEffect() {
super(Duration.EndOfTurn);
target = new TargetSource(filter);
staticText = "The next time a blue source of your choice would deal damage to you this turn, prevent that damage";
}
public CircleOfProtectionBlueEffect(final CircleOfProtectionBlueEffect effect) {
super(effect);
this.target = effect.target.copy();
}
@Override
public CircleOfProtectionBlueEffect copy() {
return new CircleOfProtectionBlueEffect(this);
}
@Override
public void init(Ability source, Game game) {
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
preventDamageAction(event, source, game);
this.used = true;
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!this.used && super.applies(event, source, game)) {
if (event.getTargetId().equals(source.getControllerId()) && event.getSourceId().equals(target.getFirstTarget())) {
return true;
}
}
return false;
}
}

View file

@ -29,18 +29,18 @@ package mage.sets.iceage;
import java.util.UUID;
import mage.constants.*;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PreventNextDamageFromChosenSourceToYouEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterObject;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.TargetSource;
/**
*
@ -48,6 +48,12 @@ import mage.target.TargetSource;
*/
public class CircleOfProtectionGreen extends CardImpl<CircleOfProtectionGreen> {
private static final FilterObject filter = new FilterObject("green source");
static {
filter.add(new ColorPredicate(ObjectColor.GREEN));
}
public CircleOfProtectionGreen(UUID ownerId) {
super(ownerId, 238, "Circle of Protection: Green", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.expansionSetCode = "ICE";
@ -55,8 +61,8 @@ public class CircleOfProtectionGreen extends CardImpl<CircleOfProtectionGreen> {
this.color.setWhite(true);
// {1}: The next time a green source of your choice would deal damage to you this turn, prevent that damage.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CircleOfProtectionGreenEffect() , new ManaCostsImpl("1")));
Effect effect = new PreventNextDamageFromChosenSourceToYouEffect(Duration.EndOfTurn, filter);
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("1")));
}
public CircleOfProtectionGreen(final CircleOfProtectionGreen card) {
@ -68,52 +74,3 @@ public class CircleOfProtectionGreen extends CardImpl<CircleOfProtectionGreen> {
return new CircleOfProtectionGreen(this);
}
}
class CircleOfProtectionGreenEffect extends PreventionEffectImpl<CircleOfProtectionGreenEffect> {
private static final FilterObject filter = new FilterObject("green source");
static{
filter.add(new ColorPredicate(ObjectColor.GREEN));
}
private final TargetSource target;
public CircleOfProtectionGreenEffect() {
super(Duration.EndOfTurn);
target = new TargetSource(filter);
staticText = "The next time a green source of your choice would deal damage to you this turn, prevent that damage";
}
public CircleOfProtectionGreenEffect(final CircleOfProtectionGreenEffect effect) {
super(effect);
this.target = effect.target.copy();
}
@Override
public CircleOfProtectionGreenEffect copy() {
return new CircleOfProtectionGreenEffect(this);
}
@Override
public void init(Ability source, Game game) {
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
preventDamageAction(event, source, game);
this.used = true;
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!this.used && super.applies(event, source, game)) {
if (event.getTargetId().equals(source.getControllerId()) && event.getSourceId().equals(target.getFirstTarget())) {
return true;
}
}
return false;
}
}

View file

@ -29,18 +29,18 @@ package mage.sets.iceage;
import java.util.UUID;
import mage.constants.*;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PreventNextDamageFromChosenSourceToYouEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterObject;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.TargetSource;
/**
*
@ -48,6 +48,12 @@ import mage.target.TargetSource;
*/
public class CircleOfProtectionRed extends CardImpl<CircleOfProtectionRed> {
private static final FilterObject filter = new FilterObject("red source");
static {
filter.add(new ColorPredicate(ObjectColor.RED));
}
public CircleOfProtectionRed(UUID ownerId) {
super(ownerId, 239, "Circle of Protection: Red", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.expansionSetCode = "ICE";
@ -55,8 +61,8 @@ public class CircleOfProtectionRed extends CardImpl<CircleOfProtectionRed> {
this.color.setWhite(true);
// {1}: The next time a red source of your choice would deal damage to you this turn, prevent that damage.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CircleOfProtectionRedEffect() , new ManaCostsImpl("1")));
Effect effect = new PreventNextDamageFromChosenSourceToYouEffect(Duration.EndOfTurn, filter);
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("1")));
}
public CircleOfProtectionRed(final CircleOfProtectionRed card) {
@ -68,54 +74,3 @@ public class CircleOfProtectionRed extends CardImpl<CircleOfProtectionRed> {
return new CircleOfProtectionRed(this);
}
}
class CircleOfProtectionRedEffect extends PreventionEffectImpl<CircleOfProtectionRedEffect> {
private static final FilterObject filter = new FilterObject("red source");
static{
filter.add(new ColorPredicate(ObjectColor.RED));
}
private final TargetSource target;
public CircleOfProtectionRedEffect() {
super(Duration.EndOfTurn);
target = new TargetSource(filter);
staticText = "The next time a red source of your choice would deal damage to you this turn, prevent that damage";
}
public CircleOfProtectionRedEffect(final CircleOfProtectionRedEffect effect) {
super(effect);
this.target = effect.target.copy();
}
@Override
public CircleOfProtectionRedEffect copy() {
return new CircleOfProtectionRedEffect(this);
}
@Override
public void init(Ability source, Game game) {
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
preventDamageAction(event, source, game);
this.used = true;
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!this.used && super.applies(event, source, game)) {
if (event.getTargetId().equals(source.getControllerId()) && event.getSourceId().equals(target.getFirstTarget())) {
return true;
}
}
return false;
}
}

View file

@ -29,18 +29,18 @@ package mage.sets.iceage;
import java.util.UUID;
import mage.constants.*;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PreventNextDamageFromChosenSourceToYouEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterObject;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.TargetSource;
/**
*
@ -48,6 +48,12 @@ import mage.target.TargetSource;
*/
public class CircleOfProtectionWhite extends CardImpl<CircleOfProtectionWhite> {
private static final FilterObject filter = new FilterObject("white source");
static {
filter.add(new ColorPredicate(ObjectColor.WHITE));
}
public CircleOfProtectionWhite(UUID ownerId) {
super(ownerId, 240, "Circle of Protection: White", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.expansionSetCode = "ICE";
@ -55,8 +61,8 @@ public class CircleOfProtectionWhite extends CardImpl<CircleOfProtectionWhite> {
this.color.setWhite(true);
// {1}: The next time a white source of your choice would deal damage to you this turn, prevent that damage.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CircleOfProtectionWhiteEffect() , new ManaCostsImpl("1")));
Effect effect = new PreventNextDamageFromChosenSourceToYouEffect(Duration.EndOfTurn, filter);
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("1")));;
}
public CircleOfProtectionWhite(final CircleOfProtectionWhite card) {
@ -68,52 +74,3 @@ public class CircleOfProtectionWhite extends CardImpl<CircleOfProtectionWhite> {
return new CircleOfProtectionWhite(this);
}
}
class CircleOfProtectionWhiteEffect extends PreventionEffectImpl<CircleOfProtectionWhiteEffect> {
private static final FilterObject filter = new FilterObject("white source");
static{
filter.add(new ColorPredicate(ObjectColor.WHITE));
}
private final TargetSource target;
public CircleOfProtectionWhiteEffect() {
super(Duration.EndOfTurn);
target = new TargetSource(filter);
staticText = "The next time a white source of your choice would deal damage to you this turn, prevent that damage";
}
public CircleOfProtectionWhiteEffect(final CircleOfProtectionWhiteEffect effect) {
super(effect);
this.target = effect.target.copy();
}
@Override
public CircleOfProtectionWhiteEffect copy() {
return new CircleOfProtectionWhiteEffect(this);
}
@Override
public void init(Ability source, Game game) {
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
preventDamageAction(event, source, game);
this.used = true;
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!this.used && super.applies(event, source, game)) {
if (event.getTargetId().equals(source.getControllerId()) && event.getSourceId().equals(target.getFirstTarget())) {
return true;
}
}
return false;
}
}