diff --git a/Mage.Sets/src/mage/sets/newphyrexia/EleshNornGrandCenobite.java b/Mage.Sets/src/mage/sets/newphyrexia/EleshNornGrandCenobite.java new file mode 100644 index 0000000000..6e8625c0bb --- /dev/null +++ b/Mage.Sets/src/mage/sets/newphyrexia/EleshNornGrandCenobite.java @@ -0,0 +1,73 @@ +/* + * 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.newphyrexia; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.continious.BoostControlledEffect; +import mage.abilities.effects.common.continious.BoostOpponentsEffect; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.filter.common.FilterCreaturePermanent; + +/** + * + * @author Loki + */ +public class EleshNornGrandCenobite extends CardImpl { + private static FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures"); + + public EleshNornGrandCenobite (UUID ownerId) { + super(ownerId, 9, "Elesh Norn, Grand Cenobite", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{5}{W}{W}"); + this.expansionSetCode = "NPH"; + this.supertype.add("Legendary"); + this.subtype.add("Praetor"); + this.color.setWhite(true); + this.power = new MageInt(4); + this.toughness = new MageInt(7); + this.addAbility(VigilanceAbility.getInstance()); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostControlledEffect(2, 2, Constants.Duration.WhileOnBattlefield, true))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostOpponentsEffect(-2, -2, Constants.Duration.WhileOnBattlefield, filter))); + } + + public EleshNornGrandCenobite (final EleshNornGrandCenobite card) { + super(card); + } + + @Override + public EleshNornGrandCenobite copy() { + return new EleshNornGrandCenobite(this); + } + +} diff --git a/Mage/src/mage/abilities/effects/common/continious/BoostOpponentsEffect.java b/Mage/src/mage/abilities/effects/common/continious/BoostOpponentsEffect.java new file mode 100644 index 0000000000..7de6abddf7 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/continious/BoostOpponentsEffect.java @@ -0,0 +1,76 @@ +package mage.abilities.effects.common.continious; + +import mage.Constants; +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.Set; +import java.util.UUID; + +public class BoostOpponentsEffect extends ContinuousEffectImpl { + protected int power; + protected int toughness; + protected FilterCreaturePermanent filter; + + public BoostOpponentsEffect(int power, int toughness, Constants.Duration duration) { + this(power, toughness, duration, FilterCreaturePermanent.getDefault()); + } + + public BoostOpponentsEffect(int power, int toughness, Constants.Duration duration, FilterCreaturePermanent filter) { + super(duration, Constants.Layer.PTChangingEffects_7, Constants.SubLayer.ModifyPT_7c, Constants.Outcome.BoostCreature); + this.power = power; + this.toughness = toughness; + this.filter = filter; + } + + public BoostOpponentsEffect(final BoostOpponentsEffect effect) { + super(effect); + this.power = effect.power; + this.toughness = effect.toughness; + this.filter = effect.filter.copy(); + } + + @Override + public BoostOpponentsEffect copy() { + return new BoostOpponentsEffect(this); + } + + @Override + public void init(Ability source, Game game) { + super.init(source, game); + if (this.affectedObjectsSet) { + Set opponents = game.getOpponents(source.getControllerId()); + for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter)) { + if (opponents.contains(perm.getControllerId())) { + objects.add(perm.getId()); + } + } + } + } + + @Override + public boolean apply(Game game, Ability source) { + Set opponents = game.getOpponents(source.getControllerId()); + for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter)) { + if (!this.affectedObjectsSet || objects.contains(perm.getId())) { + if (opponents.contains(perm.getControllerId())) { + perm.addPower(power); + perm.addToughness(toughness); + } + } + } + return true; + } + + @Override + public String getText(Ability source) { + StringBuilder sb = new StringBuilder(); + sb.append(filter.getMessage()); + sb.append(" your opponents control get ").append(String.format("%1$+d/%2$+d", power, toughness)); + sb.append((duration== Constants.Duration.EndOfTurn?" until end of turn":"")); + return sb.toString(); + } +} diff --git a/Utils/gen-card.pl b/Utils/gen-card.pl index 35b86dff6d..c6e4bda702 100755 --- a/Utils/gen-card.pl +++ b/Utils/gen-card.pl @@ -318,7 +318,7 @@ print "card fetched\n"; my $template = Text::Template->new(SOURCE => 'cardclass.tmpl', DELIMITERS => [ '[=', '=]' ]); my %vars; $vars{'name'} = $cardname; -$cardname =~ s/[-\s\']//g; +$cardname =~ s/[-,\s\']//g; $vars{'classname'} = $cardname;