diff --git a/Mage.Sets/src/mage/sets/guildpact/BeastmastersMagemark.java b/Mage.Sets/src/mage/sets/guildpact/BeastmastersMagemark.java index 1771bdb853..ca3bb75149 100644 --- a/Mage.Sets/src/mage/sets/guildpact/BeastmastersMagemark.java +++ b/Mage.Sets/src/mage/sets/guildpact/BeastmastersMagemark.java @@ -29,9 +29,11 @@ package mage.sets.guildpact; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.common.BecomesBlockedAllTriggeredAbility; import mage.abilities.common.BecomesBlockedTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.BlockedCreatureCount; import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.continuous.BoostAllEffect; @@ -79,7 +81,10 @@ public class BeastmastersMagemark extends CardImpl { ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1,1, Duration.WhileOnBattlefield, filter, false)); this.addAbility(ability); // Whenever a creature you control that's enchanted becomes blocked, it gets +1/+1 until end of turn for each creature blocking it. - this.addAbility(new BeastmastersMagemarkAbility()); + BlockedCreatureCount value = new BlockedCreatureCount(); + Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn); + effect.setText("it gets +1/+1 until end of turn for each creature blocking it"); + this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false,filter,false)); } public BeastmastersMagemark(final BeastmastersMagemark card) { @@ -137,4 +142,4 @@ class BeastmastersMagemarkValue implements DynamicValue { public String getMessage() { return "+1/+1 until end of turn for each creature blocking it"; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/iceage/JohtullWurm.java b/Mage.Sets/src/mage/sets/iceage/JohtullWurm.java index 524fbde519..d8e1577e16 100644 --- a/Mage.Sets/src/mage/sets/iceage/JohtullWurm.java +++ b/Mage.Sets/src/mage/sets/iceage/JohtullWurm.java @@ -1,119 +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.iceage; - -import java.util.UUID; -import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.common.BecomesBlockedTriggeredAbility; -import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.dynamicvalue.MultipliedValue; -import mage.abilities.effects.Effect; -import mage.abilities.effects.common.continuous.BoostSourceEffect; -import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.game.Game; -import mage.game.combat.CombatGroup; - -/** - * - * @author fireshoes - */ -public class JohtullWurm extends CardImpl { - - public JohtullWurm(UUID ownerId) { - super(ownerId, 138, "Johtull Wurm", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{5}{G}"); - this.expansionSetCode = "ICE"; - this.subtype.add("Wurm"); - this.power = new MageInt(6); - this.toughness = new MageInt(6); - - // Whenever Johtull Wurm becomes blocked, it gets -2/-1 until end of turn for each creature blocking it beyond the first. - this.addAbility(new JohtullWurmAbility()); - } - - public JohtullWurm(final JohtullWurm card) { - super(card); - } - - @Override - public JohtullWurm copy() { - return new JohtullWurm(this); - } -} - -class JohtullWurmAbility extends BecomesBlockedTriggeredAbility { - - public JohtullWurmAbility() { - super(null, false); - JohtullWurmValue toughnessValue = new JohtullWurmValue(); - DynamicValue powerValue = new MultipliedValue(toughnessValue, 2); - this.addEffect(new BoostSourceEffect(powerValue, toughnessValue, Duration.EndOfTurn)); - } - - public JohtullWurmAbility(final JohtullWurmAbility ability) { - super(ability); - } - - @Override - public JohtullWurmAbility copy() { - return new JohtullWurmAbility(this); - } - - @Override - public String getRule() { - return "Whenever {this} becomes blocked, it gets -2/-1 until end of turn for each creature blocking it beyond the first."; - } -} - -class JohtullWurmValue implements DynamicValue { - - @Override - public JohtullWurmValue copy() { - return new JohtullWurmValue(); - } - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - for(CombatGroup combatGroup : game.getCombat().getGroups()) { - if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) { - int blockers = combatGroup.getBlockers().size(); - return blockers > 1 ? -(blockers - 1) : 0; - } - } - return 0; - } - - @Override - public String getMessage() { - return "-2/-1 until end of turn for each creature blocking it beyond the first"; - } -} - +/* + * 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.MageInt; +import mage.abilities.common.BecomesBlockedTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.BlockedCreatureCount; +import mage.abilities.dynamicvalue.MultipliedValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; + +/** + * + * @author fireshoes + */ +public class JohtullWurm extends CardImpl { + + public JohtullWurm(UUID ownerId) { + super(ownerId, 138, "Johtull Wurm", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{5}{G}"); + this.expansionSetCode = "ICE"; + this.subtype.add("Wurm"); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Whenever Johtull Wurm becomes blocked, it gets -2/-1 until end of turn for each creature blocking it beyond the first. + DynamicValue toughnessValue = new MultipliedValue(new BlockedCreatureCount(),2); + int value = Math.negateExact(Integer.parseInt(toughnessValue.toString()) - 1); + + Effect effect = new BoostSourceEffect(powerValue, value, Duration.EndOfTurn); + effect.setText("it gets -2/-1 until end of turn for each creature blocking it beyond the first"); + this.addAbility(new BecomesBlockedTriggeredAbility(effect, false)); + } + + public JohtullWurm(final JohtullWurm card) { + super(card); + } + + @Override + public JohtullWurm copy() { + return new JohtullWurm(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/invasion/SparringGolem.java b/Mage.Sets/src/mage/sets/invasion/SparringGolem.java index 9f9a284494..98304b10f8 100644 --- a/Mage.Sets/src/mage/sets/invasion/SparringGolem.java +++ b/Mage.Sets/src/mage/sets/invasion/SparringGolem.java @@ -1,116 +1,69 @@ -/* - * 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.invasion; - -import java.util.UUID; -import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.common.BecomesBlockedTriggeredAbility; -import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.Effect; -import mage.abilities.effects.common.continuous.BoostSourceEffect; -import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.game.Game; -import mage.game.combat.CombatGroup; - -/** - * - * @author fireshoes - */ -public class SparringGolem extends CardImpl { - - public SparringGolem(UUID ownerId) { - super(ownerId, 312, "Sparring Golem", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}"); - this.expansionSetCode = "INV"; - this.subtype.add("Golem"); - this.power = new MageInt(2); - this.toughness = new MageInt(2); - - // Whenever Sparring Golem becomes blocked, it gets +1/+1 until end of turn for each creature blocking it. - this.addAbility(new SparringGolemAbility()); - } - - public SparringGolem(final SparringGolem card) { - super(card); - } - - @Override - public SparringGolem copy() { - return new SparringGolem(this); - } -} - -class SparringGolemAbility extends BecomesBlockedTriggeredAbility { - - public SparringGolemAbility() { - super(null, false); - SparringGolemValue value = new SparringGolemValue(); - this.addEffect(new BoostSourceEffect(value, value, Duration.EndOfTurn)); - } - - public SparringGolemAbility(final SparringGolemAbility ability) { - super(ability); - } - - @Override - public SparringGolemAbility copy() { - return new SparringGolemAbility(this); - } - - @Override - public String getRule() { - return "Whenever {this} becomes blocked, it gets +1/+1 until end of turn for each creature blocking it."; - } -} - -class SparringGolemValue implements DynamicValue { - - @Override - public SparringGolemValue copy() { - return new SparringGolemValue(); - } - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - for(CombatGroup combatGroup : game.getCombat().getGroups()) { - if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) { - int blockers = combatGroup.getBlockers().size(); - return blockers > 1 ? (blockers) : 0; - } - } - return 0; - } - - @Override - public String getMessage() { - return "+1/+1 until end of turn for each creature blocking it"; - } -} +/* + * 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.invasion; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.BecomesBlockedTriggeredAbility; +import mage.abilities.dynamicvalue.common.BlockedCreatureCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; + +/** + * + * @author fireshoes + */ +public class SparringGolem extends CardImpl { + + public SparringGolem(UUID ownerId) { + super(ownerId, 312, "Sparring Golem", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}"); + this.expansionSetCode = "INV"; + this.subtype.add("Golem"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Whenever Sparring Golem becomes blocked, it gets +1/+1 until end of turn for each creature blocking it. + BlockedCreatureCount value = new BlockedCreatureCount(); + Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn); + effect.setText("it gets +1/+1 until end of turn for each creature blocking it"); + this.addAbility(new BecomesBlockedTriggeredAbility(effect, false)); + } + + public SparringGolem(final SparringGolem card) { + super(card); + } + + @Override + public SparringGolem copy() { + return new SparringGolem(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/legions/BerserkMurlodont.java b/Mage.Sets/src/mage/sets/legions/BerserkMurlodont.java index d0c38c0fae..dcddb71fa2 100644 --- a/Mage.Sets/src/mage/sets/legions/BerserkMurlodont.java +++ b/Mage.Sets/src/mage/sets/legions/BerserkMurlodont.java @@ -1,67 +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.legions; - -import java.util.UUID; -import mage.MageInt; -import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility; -import mage.abilities.effects.Effect; -import mage.abilities.effects.common.continuous.BoostSourceEffect; -import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; - -/** - * - * @author fireshoes - */ -public class BerserkMurlodont extends CardImpl { - - public BerserkMurlodont(UUID ownerId) { - super(ownerId, 117, "Berserk Murlodont", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}"); - this.expansionSetCode = "LGN"; - this.subtype.add("Beast"); - this.power = new MageInt(3); - this.toughness = new MageInt(3); - - // Whenever a Beast becomes blocked, it gets +1/+1 until end of turn for each creature blocking it. - Effect effect = new BoostSourceEffect(1, 1, Duration.EndOfTurn); - effect.setText("it gets +1/+1 until end of turn for each creature blocking it"); - this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(effect, false)); - } - - public BerserkMurlodont(final BerserkMurlodont card) { - super(card); - } - - @Override - public BerserkMurlodont copy() { - return new BerserkMurlodont(this); - } -} +/* + * 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.legions; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.BecomesBlockedAllTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.dynamicvalue.common.BlockedCreatureCount; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @author Markedagain + */ +public class BerserkMurlodont extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a Beast"); + static { + filter.add(new SubtypePredicate("Beast")); + } + + public BerserkMurlodont(UUID ownerId) { + super(ownerId, 117, "Berserk Murlodont", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}"); + this.expansionSetCode = "LGN"; + this.subtype.add("Beast"); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Whenever a Beast becomes blocked, it gets +1/+1 until end of turn for each creature blocking it. + BlockedCreatureCount value = new BlockedCreatureCount(); + Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn); + effect.setText("it gets +1/+1 until end of turn for each creature blocking it"); + this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false,filter,false)); + } + + public BerserkMurlodont(final BerserkMurlodont card) { + super(card); + } + + @Override + public BerserkMurlodont copy() { + return new BerserkMurlodont(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirage/JungleWurm.java b/Mage.Sets/src/mage/sets/mirage/JungleWurm.java index 0ad2703481..947fc82784 100644 --- a/Mage.Sets/src/mage/sets/mirage/JungleWurm.java +++ b/Mage.Sets/src/mage/sets/mirage/JungleWurm.java @@ -1,119 +1,71 @@ -/* - * 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.mirage; - -import java.util.UUID; -import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.common.BecomesBlockedTriggeredAbility; -import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.Effect; -import mage.abilities.effects.common.continuous.BoostSourceEffect; -import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.game.Game; -import mage.game.combat.CombatGroup; -import mage.game.events.GameEvent; - -/** - * - * @author LoneFox - */ -public class JungleWurm extends CardImpl { - - public JungleWurm(UUID ownerId) { - super(ownerId, 122, "Jungle Wurm", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); - this.expansionSetCode = "MIR"; - this.subtype.add("Wurm"); - this.power = new MageInt(5); - this.toughness = new MageInt(5); - - // Whenever Jungle Wurm becomes blocked, it gets -1/-1 until end of turn for each creature blocking it beyond the first. - this.addAbility(new JungleWurmAbility()); - } - - public JungleWurm(final JungleWurm card) { - super(card); - } - - @Override - public JungleWurm copy() { - return new JungleWurm(this); - } -} - -class JungleWurmAbility extends BecomesBlockedTriggeredAbility { - - public JungleWurmAbility() { - super(null, false); - JungleWurmValue value = new JungleWurmValue(); - this.addEffect(new BoostSourceEffect(value, value, Duration.EndOfTurn)); - } - - public JungleWurmAbility(final JungleWurmAbility ability) { - super(ability); - } - - @Override - public JungleWurmAbility copy() { - return new JungleWurmAbility(this); - } - - @Override - public String getRule() { - return "Whenever {this} becomes blocked, it gets -1/-1 until end of turn for each creature blocking it beyond the first."; - } -} - -class JungleWurmValue implements DynamicValue { - - @Override - public JungleWurmValue copy() { - return new JungleWurmValue(); - } - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - int count = 0; - for(CombatGroup combatGroup : game.getCombat().getGroups()) { - if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) { - int blockers = combatGroup.getBlockers().size(); - return blockers > 1 ? -(blockers - 1) : 0; - } - } - return 0; - } - - @Override - public String getMessage() { - return "-1/-1 until end of turn for each creature blocking it beyond the first"; - } -} - +/* + * 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.mirage; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.BecomesBlockedTriggeredAbility; +import mage.abilities.dynamicvalue.common.BlockedCreatureCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + */ +public class JungleWurm extends CardImpl { + + public JungleWurm(UUID ownerId) { + super(ownerId, 122, "Jungle Wurm", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); + this.expansionSetCode = "MIR"; + this.subtype.add("Wurm"); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Whenever Jungle Wurm becomes blocked, it gets -1/-1 until end of turn for each creature blocking it beyond the first. + BlockedCreatureCount blockedCreatureCount = new BlockedCreatureCount(); + int value = Math.negateExact(Integer.parseInt(blockedCreatureCount.toString()) - 1); + + Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn); + effect.setText("it gets -1/-1 until end of turn for each creature blocking it beyond the first"); + this.addAbility(new BecomesBlockedTriggeredAbility(effect, false)); + } + + public JungleWurm(final JungleWurm card) { + super(card); + } + + @Override + public JungleWurm copy() { + return new JungleWurm(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ninthedition/ElvishBerserker.java b/Mage.Sets/src/mage/sets/ninthedition/ElvishBerserker.java index b53ffa4298..6f3a35091e 100644 --- a/Mage.Sets/src/mage/sets/ninthedition/ElvishBerserker.java +++ b/Mage.Sets/src/mage/sets/ninthedition/ElvishBerserker.java @@ -1,117 +1,74 @@ -/* - * 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.ninthedition; - -import java.util.UUID; -import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.common.BecomesBlockedTriggeredAbility; -import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.Effect; -import mage.abilities.effects.common.continuous.BoostSourceEffect; -import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.game.Game; -import mage.game.combat.CombatGroup; - -/** - * - * @author ilcartographer - */ -public class ElvishBerserker extends CardImpl { - - public ElvishBerserker(UUID ownerId) { - super(ownerId, 237, "Elvish Berserker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{G}"); - this.expansionSetCode = "9ED"; - this.subtype.add("Elf"); - this.subtype.add("Berserker"); - this.power = new MageInt(1); - this.toughness = new MageInt(1); - - // Whenever Elvish Berserker becomes blocked, it gets +1/+1 until end of turn for each creature blocking it. - this.addAbility(new ElvishBerserkerAbility()); - } - - public ElvishBerserker(final ElvishBerserker card) { - super(card); - } - - @Override - public ElvishBerserker copy() { - return new ElvishBerserker(this); - } -} - -class ElvishBerserkerAbility extends BecomesBlockedTriggeredAbility { - - public ElvishBerserkerAbility() { - super(null, false); - ElvishBerserkerValue value = new ElvishBerserkerValue(); - this.addEffect(new BoostSourceEffect(value, value, Duration.EndOfTurn)); - } - - public ElvishBerserkerAbility(final ElvishBerserkerAbility ability) { - super(ability); - } - - @Override - public ElvishBerserkerAbility copy() { - return new ElvishBerserkerAbility(this); - } - - @Override - public String getRule() { - return "Whenever {this} becomes blocked, it gets +1/+1 until end of turn for each creature blocking it."; - } -} - -class ElvishBerserkerValue implements DynamicValue { - - @Override - public ElvishBerserkerValue copy() { - return new ElvishBerserkerValue(); - } - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - for(CombatGroup combatGroup : game.getCombat().getGroups()) { - if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) { - int blockers = combatGroup.getBlockers().size(); - return blockers > 1 ? (blockers) : 0; - } - } - return 0; - } - - @Override - public String getMessage() { - return "+1/+1 until end of turn for each creature blocking it"; - } -} +/* + * 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.ninthedition; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BecomesBlockedTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.BlockedCreatureCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.game.Game; +import mage.game.combat.CombatGroup; + +/** + * + * @author ilcartographer + */ +public class ElvishBerserker extends CardImpl { + + public ElvishBerserker(UUID ownerId) { + super(ownerId, 237, "Elvish Berserker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{G}"); + this.expansionSetCode = "9ED"; + this.subtype.add("Elf"); + this.subtype.add("Berserker"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever Elvish Berserker becomes blocked, it gets +1/+1 until end of turn for each creature blocking it. + BlockedCreatureCount value = new BlockedCreatureCount(); + Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn); + effect.setText("it gets +1/+1 until end of turn for each creature blocking it"); + this.addAbility(new BecomesBlockedTriggeredAbility(effect, false)); + } + + public ElvishBerserker(final ElvishBerserker card) { + super(card); + } + + @Override + public ElvishBerserker copy() { + return new ElvishBerserker(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/odyssey/RabidElephant.java b/Mage.Sets/src/mage/sets/odyssey/RabidElephant.java index 4c496f27b8..7d4dac87c2 100644 --- a/Mage.Sets/src/mage/sets/odyssey/RabidElephant.java +++ b/Mage.Sets/src/mage/sets/odyssey/RabidElephant.java @@ -1,117 +1,72 @@ -/* - * 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.odyssey; - -import java.util.UUID; -import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.common.BecomesBlockedTriggeredAbility; -import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.Effect; -import mage.abilities.effects.common.continuous.BoostSourceEffect; -import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.game.Game; -import mage.game.combat.CombatGroup; - -/** - * - * @author LevelX2 - */ -public class RabidElephant extends CardImpl { - - public RabidElephant(UUID ownerId) { - super(ownerId, 263, "Rabid Elephant", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}"); - this.expansionSetCode = "ODY"; - this.subtype.add("Elephant"); - - this.power = new MageInt(3); - this.toughness = new MageInt(4); - - // Whenever Rabid Elephant becomes blocked, it gets +2/+2 until end of turn for each creature blocking it. - this.addAbility(new RabidElephantAbility()); - } - - public RabidElephant(final RabidElephant card) { - super(card); - } - - @Override - public RabidElephant copy() { - return new RabidElephant(this); - } -} - -class RabidElephantAbility extends BecomesBlockedTriggeredAbility { - - public RabidElephantAbility() { - super(null, false); - RabidElephantValue value = new RabidElephantValue(); - this.addEffect(new BoostSourceEffect(value, value, Duration.EndOfTurn)); - } - - public RabidElephantAbility(final RabidElephantAbility ability) { - super(ability); - } - - @Override - public RabidElephantAbility copy() { - return new RabidElephantAbility(this); - } - - @Override - public String getRule() { - return "Whenever {this} becomes blocked, it gets +2/+2 until end of turn for each creature blocking it."; - } -} - -class RabidElephantValue implements DynamicValue { - - @Override - public RabidElephantValue copy() { - return new RabidElephantValue(); - } - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - for(CombatGroup combatGroup : game.getCombat().getGroups()) { - if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) { - int blockers = combatGroup.getBlockers().size(); - return blockers > 1 ? (blockers) * 2 : 0; - } - } - return 0; - } - - @Override - public String getMessage() { - return "+2/+2 until end of turn for each creature blocking it"; - } -} +/* + * 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.odyssey; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.BecomesBlockedTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.MultipliedValue; +import mage.abilities.dynamicvalue.common.BlockedCreatureCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class RabidElephant extends CardImpl { + + public RabidElephant(UUID ownerId) { + super(ownerId, 263, "Rabid Elephant", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}"); + this.expansionSetCode = "ODY"; + this.subtype.add("Elephant"); + + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Whenever Rabid Elephant becomes blocked, it gets +2/+2 until end of turn for each creature blocking it. + DynamicValue value = new MultipliedValue(new BlockedCreatureCount(),2); + Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn); + effect.setText("it gets +2/+2 until end of turn for each creature blocking it"); + this.addAbility(new BecomesBlockedTriggeredAbility(effect, false)); + } + + public RabidElephant(final RabidElephant card) { + super(card); + } + + @Override + public RabidElephant copy() { + return new RabidElephant(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/portalsecondage/RazorclawBear.java b/Mage.Sets/src/mage/sets/portalsecondage/RazorclawBear.java index f8746c1fa2..3fda93ee35 100644 --- a/Mage.Sets/src/mage/sets/portalsecondage/RazorclawBear.java +++ b/Mage.Sets/src/mage/sets/portalsecondage/RazorclawBear.java @@ -52,7 +52,7 @@ public class RazorclawBear extends CardImpl { // Whenever Razorclaw Bear becomes blocked, it gets +2/+2 until end of turn. Effect effect = new BoostSourceEffect(2, 2, Duration.EndOfTurn); - effect.setText("it gets +2/+2 until end of turn for each creature blocking it"); + effect.setText("it gets +2/+2 until end of turn"); this.addAbility(new BecomesBlockedTriggeredAbility(effect, false)); } diff --git a/Mage.Sets/src/mage/sets/stronghold/SpinedSliver.java b/Mage.Sets/src/mage/sets/stronghold/SpinedSliver.java index da10b8dc8f..cf3f572246 100644 --- a/Mage.Sets/src/mage/sets/stronghold/SpinedSliver.java +++ b/Mage.Sets/src/mage/sets/stronghold/SpinedSliver.java @@ -32,6 +32,8 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.BlockedCreatureCount; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.cards.CardImpl; @@ -54,7 +56,6 @@ public class SpinedSliver extends CardImpl { filter.add(new SubtypePredicate("Sliver")); } - public SpinedSliver(UUID ownerId) { super(ownerId, 142, "Spined Sliver", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{R}{G}"); this.expansionSetCode = "STH"; @@ -64,7 +65,10 @@ public class SpinedSliver extends CardImpl { this.toughness = new MageInt(2); // Whenever a Sliver becomes blocked, that Sliver gets +1/+1 until end of turn for each creature blocking it. - Ability ability = new BecomesBlockedByCreatureTriggeredAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn), false); + BlockedCreatureCount value = new BlockedCreatureCount(); + Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn); + effect.setText("it gets +1/+1 until end of turn for each creature blocking it"); + Ability ability = new BecomesBlockedByCreatureTriggeredAbility(effect, false); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, filter, diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/GangOfElk.java b/Mage.Sets/src/mage/sets/urzaslegacy/GangOfElk.java index ec2120547f..ddd5f72d93 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/GangOfElk.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/GangOfElk.java @@ -32,6 +32,8 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.BecomesBlockedTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.MultipliedValue; +import mage.abilities.dynamicvalue.common.BlockedCreatureCount; import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; @@ -57,7 +59,10 @@ public class GangOfElk extends CardImpl { this.toughness = new MageInt(4); // Whenever Gang of Elk becomes blocked, it gets +2/+2 until end of turn for each creature blocking it. - this.addAbility(new GangOfElkAbility()); + DynamicValue value = new MultipliedValue(new BlockedCreatureCount(),2); + Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn); + effect.setText("it gets +2/+2 until end of turn for each creature blocking it"); + this.addAbility(new BecomesBlockedTriggeredAbility(effect, false)); } public GangOfElk(final GangOfElk card) { @@ -68,51 +73,4 @@ public class GangOfElk extends CardImpl { public GangOfElk copy() { return new GangOfElk(this); } -} - -class GangOfElkAbility extends BecomesBlockedTriggeredAbility { - - public GangOfElkAbility() { - super(null, false); - GangOfElkValue value = new GangOfElkValue(); - this.addEffect(new BoostSourceEffect(value, value, Duration.EndOfTurn)); - } - - public GangOfElkAbility(final GangOfElkAbility ability) { - super(ability); - } - - @Override - public GangOfElkAbility copy() { - return new GangOfElkAbility(this); - } - - @Override - public String getRule() { - return "Whenever {this} becomes blocked, it gets +2/+2 until end of turn for each creature blocking it."; - } -} - -class GangOfElkValue implements DynamicValue { - - @Override - public GangOfElkValue copy() { - return new GangOfElkValue(); - } - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - for(CombatGroup combatGroup : game.getCombat().getGroups()) { - if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) { - int blockers = combatGroup.getBlockers().size(); - return blockers > 1 ? (blockers) * 2 : 0; - } - } - return 0; - } - - @Override - public String getMessage() { - return "+2/+2 until end of turn for each creature blocking it"; - } -} +} \ No newline at end of file diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/BlockedCreatureCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/BlockedCreatureCount.java new file mode 100644 index 0000000000..ff7a3fd15b --- /dev/null +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/BlockedCreatureCount.java @@ -0,0 +1,81 @@ +/* + * 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.abilities.dynamicvalue.common; + +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.game.Game; +import mage.game.combat.CombatGroup; + +/** + * + * @author Markedagain + */ +public class BlockedCreatureCount implements DynamicValue { + private String message; + + public BlockedCreatureCount() { + this("each creature blocking it"); + } + + public BlockedCreatureCount(String message) { + this.message = message; + } + + public BlockedCreatureCount(final BlockedCreatureCount dynamicValue) { + super(); + this.message = dynamicValue.message; + } + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + for(CombatGroup combatGroup : game.getCombat().getGroups()) { + if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) { + int blockers = combatGroup.getBlockers().size(); + return blockers > 1 ? (blockers) : 0; + } + } + return 0; + } + + @Override + public BlockedCreatureCount copy() { + return new BlockedCreatureCount(this); + } + + @Override + public String getMessage() { + return message; + } + + @Override + public String toString() { + return "X"; + } +}