[M13] Magmaquake

This commit is contained in:
North 2012-07-20 21:22:01 +03:00
parent bf3d16332d
commit 1f50506c48
2 changed files with 81 additions and 5 deletions

View file

@ -0,0 +1,76 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.magic2013;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.mageobject.CardTypePredicate;
/**
*
* @author North
*/
public class Magmaquake extends CardImpl<Magmaquake> {
private static final FilterPermanent filter = new FilterPermanent("creature without flying and each planeswalker");
static {
filter.add(Predicates.or(
Predicates.and(
new CardTypePredicate(CardType.CREATURE),
Predicates.not(new AbilityPredicate(FlyingAbility.class))),
new CardTypePredicate(CardType.PLANESWALKER)));
}
public Magmaquake(UUID ownerId) {
super(ownerId, 140, "Magmaquake", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{X}{R}{R}");
this.expansionSetCode = "M13";
this.color.setRed(true);
// Magmaquake deals X damage to each creature without flying and each planeswalker.
this.getSpellAbility().addEffect(new DamageAllEffect(new ManacostVariableValue(), filter));
}
public Magmaquake(final Magmaquake card) {
super(card);
}
@Override
public Magmaquake copy() {
return new Magmaquake(this);
}
}

View file

@ -34,7 +34,7 @@ import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -44,13 +44,13 @@ import mage.game.permanent.Permanent;
*/
public class DamageAllEffect extends OneShotEffect<DamageAllEffect> {
private FilterCreaturePermanent filter;
private FilterPermanent filter;
private DynamicValue amount;
public DamageAllEffect(int amount, FilterCreaturePermanent filter) {
public DamageAllEffect(int amount, FilterPermanent filter) {
this(new StaticValue(amount), filter);
}
public DamageAllEffect(DynamicValue amount, FilterCreaturePermanent filter) {
public DamageAllEffect(DynamicValue amount, FilterPermanent filter) {
super(Outcome.Damage);
this.amount = amount;
this.filter = filter;
@ -70,7 +70,7 @@ public class DamageAllEffect extends OneShotEffect<DamageAllEffect> {
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getId(), game);
for (Permanent permanent: permanents) {
permanent.damage(amount.calculate(game, source), source.getSourceId(), game, true, false);
}