Refactored AkromasMemorial with CompoundAbility

This commit is contained in:
magenoxx 2012-07-08 09:38:59 +04:00
parent 1acf00a5da
commit 0211b4f1af
2 changed files with 10 additions and 14 deletions

View file

@ -27,11 +27,10 @@
*/ */
package mage.sets.magic2013; package mage.sets.magic2013;
import java.util.UUID;
import mage.Constants; import mage.Constants;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.abilities.CompoundAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect; import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.*; import mage.abilities.keyword.*;
@ -40,9 +39,10 @@ import mage.filter.Filter;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import java.util.UUID;
/** /**
* * @author Loki, noxx
* @author Loki
*/ */
public class AkromasMemorial extends CardImpl<AkromasMemorial> { public class AkromasMemorial extends CardImpl<AkromasMemorial> {
private static final FilterCard filterBlack = new FilterCard("Black"); private static final FilterCard filterBlack = new FilterCard("Black");
@ -66,13 +66,8 @@ public class AkromasMemorial extends CardImpl<AkromasMemorial> {
@Override @Override
public void build() { public void build() {
// Creatures you control have flying, first strike, vigilance, trample, haste, and protection from black and from red. // Creatures you control have flying, first strike, vigilance, trample, haste, and protection from black and from red.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(FlyingAbility.getInstance(), Constants.Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Creatures you control")))); CompoundAbility abilities = new CompoundAbility(FlyingAbility.getInstance(), FirstStrikeAbility.getInstance(), VigilanceAbility.getInstance(), TrampleAbility.getInstance(), HasteAbility.getInstance(), new ProtectionAbility(filterBlack), new ProtectionAbility(filterRed));
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Constants.Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Creatures you control")))); this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(abilities, Constants.Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Creatures you control"))));
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(VigilanceAbility.getInstance(), Constants.Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Creatures you control"))));
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(TrampleAbility.getInstance(), Constants.Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Creatures you control"))));
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(HasteAbility.getInstance(), Constants.Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Creatures you control"))));
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(new ProtectionAbility(filterBlack), Constants.Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Creatures you control"))));
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(new ProtectionAbility(filterRed), Constants.Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Creatures you control"))));
} }
public AkromasMemorial(final AkromasMemorial card) { public AkromasMemorial(final AkromasMemorial card) {

View file

@ -28,7 +28,6 @@
package mage.sets.zendikar; package mage.sets.zendikar;
import java.util.UUID;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Duration; import mage.Constants.Duration;
import mage.Constants.Rarity; import mage.Constants.Rarity;
@ -42,6 +41,8 @@ import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import java.util.UUID;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
@ -81,7 +82,7 @@ class BraveTheElementsEffect extends GainAbilityControlledEffect {
public BraveTheElementsEffect() { public BraveTheElementsEffect() {
super(new ProtectionAbility(new FilterCard()), Duration.EndOfTurn, filter1); super(new ProtectionAbility(new FilterCard()), Duration.EndOfTurn, filter1);
filter2 = (FilterCard)((ProtectionAbility)ability).getFilter(); filter2 = (FilterCard)((ProtectionAbility)getFirstAbility()).getFilter();
filter2.setUseColor(true); filter2.setUseColor(true);
filter2.setScopeColor(ComparisonScope.Any); filter2.setScopeColor(ComparisonScope.Any);
staticText = "Choose a color. White creatures you control gain protection from the chosen color until end of turn"; staticText = "Choose a color. White creatures you control gain protection from the chosen color until end of turn";
@ -102,7 +103,7 @@ class BraveTheElementsEffect extends GainAbilityControlledEffect {
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
filter2.setColor(choice.getColor()); filter2.setColor(choice.getColor());
filter2.setMessage(choice.getChoice()); filter2.setMessage(choice.getChoice());
ability = new ProtectionAbility(new FilterCard(filter2)); setAbility(new ProtectionAbility(new FilterCard(filter2)));
return super.apply(game, source); return super.apply(game, source);
} }