Refactored Blocked Creature effect

This commit is contained in:
markedagain 2016-02-23 23:54:57 -05:00
parent 3ac7976dda
commit 188db6eedc
11 changed files with 537 additions and 709 deletions

View file

@ -29,9 +29,11 @@ package mage.sets.guildpact;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedAllTriggeredAbility;
import mage.abilities.common.BecomesBlockedTriggeredAbility; import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect; 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)); ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1,1, Duration.WhileOnBattlefield, filter, false));
this.addAbility(ability); 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. // 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) { public BeastmastersMagemark(final BeastmastersMagemark card) {
@ -137,4 +142,4 @@ class BeastmastersMagemarkValue implements DynamicValue {
public String getMessage() { public String getMessage() {
return "+1/+1 until end of turn for each creature blocking it"; return "+1/+1 until end of turn for each creature blocking it";
} }
} }

View file

@ -1,119 +1,73 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 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 * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * 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 * 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 * 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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * 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 * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * 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 * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.iceage; package mage.sets.iceage;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.common.BecomesBlockedTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.dynamicvalue.MultipliedValue; import mage.abilities.dynamicvalue.MultipliedValue;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.Game;
import mage.game.combat.CombatGroup; /**
*
/** * @author fireshoes
* */
* @author fireshoes public class JohtullWurm extends CardImpl {
*/
public class JohtullWurm extends CardImpl { public JohtullWurm(UUID ownerId) {
super(ownerId, 138, "Johtull Wurm", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{5}{G}");
public JohtullWurm(UUID ownerId) { this.expansionSetCode = "ICE";
super(ownerId, 138, "Johtull Wurm", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{5}{G}"); this.subtype.add("Wurm");
this.expansionSetCode = "ICE"; this.power = new MageInt(6);
this.subtype.add("Wurm"); this.toughness = new MageInt(6);
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);
// Whenever Johtull Wurm becomes blocked, it gets -2/-1 until end of turn for each creature blocking it beyond the first. int value = Math.negateExact(Integer.parseInt(toughnessValue.toString()) - 1);
this.addAbility(new JohtullWurmAbility());
} 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");
public JohtullWurm(final JohtullWurm card) { this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
super(card); }
}
public JohtullWurm(final JohtullWurm card) {
@Override super(card);
public JohtullWurm copy() { }
return new JohtullWurm(this);
} @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";
}
}

View file

@ -1,116 +1,69 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 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 * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * 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 * 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 * 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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * 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 * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * 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 * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.invasion; package mage.sets.invasion;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.common.BecomesBlockedTriggeredAbility; import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.Effect;
import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl;
import mage.cards.CardImpl; import mage.constants.CardType;
import mage.constants.CardType; import mage.constants.Duration;
import mage.constants.Duration; import mage.constants.Rarity;
import mage.constants.Rarity;
import mage.game.Game; /**
import mage.game.combat.CombatGroup; *
* @author fireshoes
/** */
* public class SparringGolem extends CardImpl {
* @author fireshoes
*/ public SparringGolem(UUID ownerId) {
public class SparringGolem extends CardImpl { super(ownerId, 312, "Sparring Golem", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
this.expansionSetCode = "INV";
public SparringGolem(UUID ownerId) { this.subtype.add("Golem");
super(ownerId, 312, "Sparring Golem", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}"); this.power = new MageInt(2);
this.expansionSetCode = "INV"; this.toughness = new MageInt(2);
this.subtype.add("Golem");
this.power = new MageInt(2); // Whenever Sparring Golem becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
this.toughness = new MageInt(2); BlockedCreatureCount value = new BlockedCreatureCount();
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn);
// Whenever Sparring Golem becomes blocked, it gets +1/+1 until end of turn for each creature blocking it. effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
this.addAbility(new SparringGolemAbility()); this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
} }
public SparringGolem(final SparringGolem card) { public SparringGolem(final SparringGolem card) {
super(card); super(card);
} }
@Override @Override
public SparringGolem copy() { public SparringGolem copy() {
return new SparringGolem(this); 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";
}
}

View file

@ -1,67 +1,76 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 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 * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * 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 * 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 * 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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * 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 * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * 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 * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.legions; package mage.sets.legions;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility; import mage.abilities.common.BecomesBlockedAllTriggeredAbility;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl; import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.constants.CardType; import mage.cards.CardImpl;
import mage.constants.Duration; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Duration;
import mage.constants.Rarity;
/** import mage.filter.common.FilterCreaturePermanent;
* import mage.filter.predicate.mageobject.SubtypePredicate;
* @author fireshoes
*/ /**
public class BerserkMurlodont extends CardImpl { *
* @author Markedagain
public BerserkMurlodont(UUID ownerId) { */
super(ownerId, 117, "Berserk Murlodont", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}"); public class BerserkMurlodont extends CardImpl {
this.expansionSetCode = "LGN";
this.subtype.add("Beast"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a Beast");
this.power = new MageInt(3); static {
this.toughness = new MageInt(3); filter.add(new SubtypePredicate("Beast"));
}
// 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); public BerserkMurlodont(UUID ownerId) {
effect.setText("it gets +1/+1 until end of turn for each creature blocking it"); super(ownerId, 117, "Berserk Murlodont", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}");
this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(effect, false)); this.expansionSetCode = "LGN";
} this.subtype.add("Beast");
this.power = new MageInt(3);
public BerserkMurlodont(final BerserkMurlodont card) { this.toughness = new MageInt(3);
super(card);
} // Whenever a Beast becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
BlockedCreatureCount value = new BlockedCreatureCount();
@Override Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn);
public BerserkMurlodont copy() { effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
return new BerserkMurlodont(this); this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false,filter,false));
} }
}
public BerserkMurlodont(final BerserkMurlodont card) {
super(card);
}
@Override
public BerserkMurlodont copy() {
return new BerserkMurlodont(this);
}
}

View file

@ -1,119 +1,71 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 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 * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * 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 * 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 * 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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * 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 * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * 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 * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.mirage; package mage.sets.mirage;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.common.BecomesBlockedTriggeredAbility; import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.Effect;
import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl;
import mage.cards.CardImpl; import mage.constants.CardType;
import mage.constants.CardType; import mage.constants.Duration;
import mage.constants.Duration; import mage.constants.Rarity;
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 {
*
* @author LoneFox public JungleWurm(UUID ownerId) {
*/ super(ownerId, 122, "Jungle Wurm", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
public class JungleWurm extends CardImpl { this.expansionSetCode = "MIR";
this.subtype.add("Wurm");
public JungleWurm(UUID ownerId) { this.power = new MageInt(5);
super(ownerId, 122, "Jungle Wurm", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); this.toughness = new MageInt(5);
this.expansionSetCode = "MIR";
this.subtype.add("Wurm"); // Whenever Jungle Wurm becomes blocked, it gets -1/-1 until end of turn for each creature blocking it beyond the first.
this.power = new MageInt(5); BlockedCreatureCount blockedCreatureCount = new BlockedCreatureCount();
this.toughness = new MageInt(5); int value = Math.negateExact(Integer.parseInt(blockedCreatureCount.toString()) - 1);
// Whenever Jungle Wurm becomes blocked, it gets -1/-1 until end of turn for each creature blocking it beyond the first. Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn);
this.addAbility(new JungleWurmAbility()); 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); public JungleWurm(final JungleWurm card) {
} super(card);
}
@Override
public JungleWurm copy() { @Override
return new JungleWurm(this); 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";
}
}

View file

@ -1,117 +1,74 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 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 * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * 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 * 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 * 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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * 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 * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * 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 * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.ninthedition; package mage.sets.ninthedition;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedTriggeredAbility; import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect; import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.Effect;
import mage.cards.CardImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.constants.CardType; import mage.cards.CardImpl;
import mage.constants.Duration; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Duration;
import mage.game.Game; import mage.constants.Rarity;
import mage.game.combat.CombatGroup; import mage.game.Game;
import mage.game.combat.CombatGroup;
/**
* /**
* @author ilcartographer *
*/ * @author ilcartographer
public class ElvishBerserker extends CardImpl { */
public class ElvishBerserker extends CardImpl {
public ElvishBerserker(UUID ownerId) {
super(ownerId, 237, "Elvish Berserker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{G}"); public ElvishBerserker(UUID ownerId) {
this.expansionSetCode = "9ED"; super(ownerId, 237, "Elvish Berserker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{G}");
this.subtype.add("Elf"); this.expansionSetCode = "9ED";
this.subtype.add("Berserker"); this.subtype.add("Elf");
this.power = new MageInt(1); this.subtype.add("Berserker");
this.toughness = new MageInt(1); 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()); // 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);
public ElvishBerserker(final ElvishBerserker card) { effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
super(card); this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
} }
@Override public ElvishBerserker(final ElvishBerserker card) {
public ElvishBerserker copy() { super(card);
return new ElvishBerserker(this); }
}
} @Override
public ElvishBerserker copy() {
class ElvishBerserkerAbility extends BecomesBlockedTriggeredAbility { return new ElvishBerserker(this);
}
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";
}
}

View file

@ -1,117 +1,72 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 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 * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * 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 * 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 * 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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * 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 * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * 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 * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.odyssey; package mage.sets.odyssey;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.common.BecomesBlockedTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.MultipliedValue;
import mage.abilities.effects.Effect; import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.Effect;
import mage.cards.CardImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.constants.CardType; import mage.cards.CardImpl;
import mage.constants.Duration; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Duration;
import mage.game.Game; import mage.constants.Rarity;
import mage.game.combat.CombatGroup;
/**
/** *
* * @author LevelX2
* @author LevelX2 */
*/ public class RabidElephant extends CardImpl {
public class RabidElephant extends CardImpl {
public RabidElephant(UUID ownerId) {
public RabidElephant(UUID ownerId) { super(ownerId, 263, "Rabid Elephant", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}");
super(ownerId, 263, "Rabid Elephant", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}"); this.expansionSetCode = "ODY";
this.expansionSetCode = "ODY"; this.subtype.add("Elephant");
this.subtype.add("Elephant");
this.power = new MageInt(3);
this.power = new MageInt(3); this.toughness = new MageInt(4);
this.toughness = new MageInt(4);
// Whenever Rabid Elephant becomes blocked, it gets +2/+2 until end of turn for each creature blocking it.
// 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);
this.addAbility(new RabidElephantAbility()); 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);
} public RabidElephant(final RabidElephant card) {
super(card);
@Override }
public RabidElephant copy() {
return new RabidElephant(this); @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";
}
}

View file

@ -52,7 +52,7 @@ public class RazorclawBear extends CardImpl {
// Whenever Razorclaw Bear becomes blocked, it gets +2/+2 until end of turn. // Whenever Razorclaw Bear becomes blocked, it gets +2/+2 until end of turn.
Effect effect = new BoostSourceEffect(2, 2, Duration.EndOfTurn); 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)); this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
} }

View file

@ -32,6 +32,8 @@ import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility; import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; 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.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -54,7 +56,6 @@ public class SpinedSliver extends CardImpl {
filter.add(new SubtypePredicate("Sliver")); filter.add(new SubtypePredicate("Sliver"));
} }
public SpinedSliver(UUID ownerId) { public SpinedSliver(UUID ownerId) {
super(ownerId, 142, "Spined Sliver", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{R}{G}"); super(ownerId, 142, "Spined Sliver", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{R}{G}");
this.expansionSetCode = "STH"; this.expansionSetCode = "STH";
@ -64,7 +65,10 @@ public class SpinedSliver extends CardImpl {
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// Whenever a Sliver becomes blocked, that Sliver gets +1/+1 until end of turn for each creature blocking it. // 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, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new GainAbilityAllEffect(ability, new GainAbilityAllEffect(ability,
Duration.WhileOnBattlefield, filter, Duration.WhileOnBattlefield, filter,

View file

@ -32,6 +32,8 @@ import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedTriggeredAbility; import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue; 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.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -57,7 +59,10 @@ public class GangOfElk extends CardImpl {
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// Whenever Gang of Elk becomes blocked, it gets +2/+2 until end of turn for each creature blocking it. // 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) { public GangOfElk(final GangOfElk card) {
@ -68,51 +73,4 @@ public class GangOfElk extends CardImpl {
public GangOfElk copy() { public GangOfElk copy() {
return new GangOfElk(this); 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";
}
}

View file

@ -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";
}
}