Removed unused object.

This commit is contained in:
LevelX2 2016-10-02 17:42:59 +02:00
parent f8accc4122
commit 34442ca00a

View file

@ -32,6 +32,7 @@ import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.ModeChoiceSourceCondition;
import mage.abilities.effects.common.ChooseModeEffect;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.keyword.HasteAbility;
@ -45,29 +46,26 @@ import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.abilities.effects.common.ChooseModeEffect;
/**
*
* @author Eirkei
*/
public class AshlingsPrerogative extends CardImpl {
public class AshlingsPrerogative extends CardImpl {
private final static FilterCreaturePermanent filterCreature = new FilterCreaturePermanent("creature");
public AshlingsPrerogative(UUID ownerId) {
super(ownerId, 150, "Ashling's Prerogative", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
this.expansionSetCode = "LRW";
// As Ashling's Prerogative enters the battlefield, choose odd or even.
this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Odd or even?", "Odd", "Even"), null, "As {this} enters the battlefield, choose odd or even. (Zero is even.)", ""));
// Each creature with converted mana cost of the chosen value has haste.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AshlingsPrerogativeCorrectOddityEffect()));
// Each creature without converted mana cost of the chosen value enters the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AshlingsPrerogativeIncorrectOddityEffect()));
}
public AshlingsPrerogative(final AshlingsPrerogative card) {
@ -81,51 +79,50 @@ public class AshlingsPrerogative extends CardImpl {
}
class AshlingsPrerogativeIncorrectOddityEffect extends PermanentsEnterBattlefieldTappedEffect {
private static final FilterCreaturePermanent creaturefilter = new FilterCreaturePermanent("Each creature without converted mana cost of the chosen value");
private static final ModeChoiceSourceCondition oddCondition = new ModeChoiceSourceCondition("Odd");
public AshlingsPrerogativeIncorrectOddityEffect(){
public AshlingsPrerogativeIncorrectOddityEffect() {
super(creaturefilter);
staticText = "Each creature without converted mana cost of the chosen value enters the battlefield tapped.";
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
int incorrectModResult;
if (oddCondition.apply(game, source)){
if (oddCondition.apply(game, source)) {
incorrectModResult = 0;
} else {
incorrectModResult = 1;
}
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
return permanent != null && creaturefilter.match(permanent, game) && permanent.getConvertedManaCost() % 2 == incorrectModResult;
}
}
class AshlingsPrerogativeCorrectOddityEffect extends GainAbilityAllEffect{
class AshlingsPrerogativeCorrectOddityEffect extends GainAbilityAllEffect {
private static final FilterCreaturePermanent creaturefilter = new FilterCreaturePermanent("Each creature with converted mana cost of the chosen value");
private static final ModeChoiceSourceCondition oddCondition = new ModeChoiceSourceCondition("Odd");
public AshlingsPrerogativeCorrectOddityEffect() {
super(HasteAbility.getInstance(), Duration.WhileOnBattlefield, creaturefilter);
staticText = "Each creature with converted mana cost of the chosen value has haste.";
}
@Override
protected boolean selectedByRuntimeData(Permanent permanent, Ability source, Game game) {
int correctModResult;
if (oddCondition.apply(game, source)){
if (oddCondition.apply(game, source)) {
correctModResult = 1;
} else {
correctModResult = 0;
}
return permanent != null && creaturefilter.match(permanent, game) && permanent.getConvertedManaCost() % 2 == correctModResult;
}
}
}