Crypt Rats, Pestilence Rats

This commit is contained in:
LevelX2 2012-11-07 23:41:34 +01:00
parent 59f70c28f5
commit e3ca906b05
3 changed files with 167 additions and 6 deletions

View file

@ -0,0 +1,78 @@
/*
* 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.iceage;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
/**
*
* @author LevelX2
*/
public class PestilenceRats extends CardImpl<PestilenceRats> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other Rat you control");
static{
filter.add(new SubtypePredicate("Rat"));
filter.add(new AnotherPredicate());
}
public PestilenceRats(UUID ownerId) {
super(ownerId, 45, "Pestilence Rats", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.expansionSetCode = "ICE";
this.subtype.add("Rat");
this.color.setBlack(true);
this.power = new MageInt(0);
this.toughness = new MageInt(3);
// Pestilence Rats's power is equal to the number of other Rats on the battlefield. (For example, as long as there are two other Rats on the battlefield, Pestilence Rats's power and toughness are 2/3.)
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(new PermanentsOnBattlefieldCount(filter), new StaticValue(0), Duration.WhileOnBattlefield)));
}
public PestilenceRats(final PestilenceRats card) {
super(card);
}
@Override
public PestilenceRats copy() {
return new PestilenceRats(this);
}
}

View file

@ -0,0 +1,77 @@
/*
* 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.visions;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.common.DamageEverythingEffect;
import mage.cards.CardImpl;
import mage.filter.FilterMana;
/**
*
* @author LevelX2
*/
public class CryptRats extends CardImpl<CryptRats> {
public static final FilterMana filterBlack = new FilterMana();
static {
filterBlack.setBlack(true);
}
public CryptRats(UUID ownerId) {
super(ownerId, 5, "Crypt Rats", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.expansionSetCode = "VIS";
this.subtype.add("Rat");
this.color.setBlack(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {X}: Crypt Rats deals X damage to each creature and each player. Spend only black mana this way.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageEverythingEffect(new ManacostVariableValue()), new ManaCostsImpl("{X}"));
ability.getManaCostsToPay().getVariableCosts().get(0).setFilter(filterBlack);
this.addAbility(ability);
this.addInfo("01", "Spend only black mana this way.");
}
public CryptRats(final CryptRats card) {
super(card);
}
@Override
public CryptRats copy() {
return new CryptRats(this);
}
}

View file

@ -32,6 +32,8 @@ import java.util.List;
import java.util.UUID;
import mage.Constants.Outcome;
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.game.Game;
@ -44,12 +46,16 @@ import mage.players.Player;
*/
public class DamageEverythingEffect extends OneShotEffect<DamageEverythingEffect> {
private int amount;
private DynamicValue amount;
public DamageEverythingEffect(int amount) {
this(new StaticValue(amount));
}
public DamageEverythingEffect(DynamicValue amount) {
super(Outcome.Damage);
this.amount = amount;
staticText = "{source} deals " + Integer.toString(amount) + " damage to each creature and each player";
staticText = "{source} deals " + amount.toString() + " damage to each creature and each player";
}
public DamageEverythingEffect(final DamageEverythingEffect effect) {
@ -66,14 +72,14 @@ public class DamageEverythingEffect extends OneShotEffect<DamageEverythingEffect
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game);
for (Permanent permanent: permanents) {
permanent.damage(amount, source.getId(), game, true, false);
permanent.damage(amount.calculate(game, source), source.getId(), game, true, false);
}
for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) {
Player player = game.getPlayer(playerId);
if (player != null)
player.damage(amount, source.getId(), game, false, true);
if (player != null) {
player.damage(amount.calculate(game, source), source.getId(), game, false, true);
}
}
return true;
}
}