* Fixed bug with P/T boost triggered by blocking creatures not lasting until end of turn (e.g. Rabid Elephant).

This commit is contained in:
LevelX2 2016-03-17 15:44:38 +01:00
parent 60936a672c
commit 4bf8226a43
10 changed files with 31 additions and 31 deletions

View file

@ -57,6 +57,7 @@ import mage.target.common.TargetCreaturePermanent;
public class BeastmastersMagemark extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control that are enchanted");
static {
filter.add(new EnchantedPredicate());
filter.add(new ControllerPredicate(TargetController.YOU));
@ -74,13 +75,13 @@ public class BeastmastersMagemark extends CardImpl {
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Creatures you control that are enchanted get +1/+1.
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);
// Whenever a creature you control that's enchanted 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 effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false,filter,false));
this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false, filter, false));
}
public BeastmastersMagemark(final BeastmastersMagemark card) {

View file

@ -55,7 +55,7 @@ public class JohtullWurm extends CardImpl {
// Whenever Johtull Wurm becomes blocked, it gets -2/-1 until end of turn for each creature blocking it beyond the first.
DynamicValue blockedCreatureCount = new BlockedCreatureCount("each creature blocking it beyond the first", true);
Effect effect = new BoostSourceEffect(new MultipliedValue(blockedCreatureCount, -2), new MultipliedValue(blockedCreatureCount, -1), Duration.EndOfTurn);
Effect effect = new BoostSourceEffect(new MultipliedValue(blockedCreatureCount, -2), new MultipliedValue(blockedCreatureCount, -1), Duration.EndOfTurn, true);
effect.setText("it gets -2/-1 until end of turn for each creature blocking it beyond the first");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}

View file

@ -53,7 +53,7 @@ public class SparringGolem extends CardImpl {
// 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 effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}

View file

@ -30,9 +30,9 @@ package mage.sets.legions;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BecomesBlockedAllTriggeredAbility;
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
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;
@ -47,6 +47,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
public class BerserkMurlodont extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a Beast");
static {
filter.add(new SubtypePredicate("Beast"));
}
@ -60,9 +61,9 @@ public class BerserkMurlodont extends CardImpl {
// 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 effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false,filter,false));
this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false, filter, false));
}
public BerserkMurlodont(final BerserkMurlodont card) {

View file

@ -56,7 +56,7 @@ public class JungleWurm extends CardImpl {
// 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("each creature blocking it beyond the first", true);
DynamicValue value = new MultipliedValue(blockedCreatureCount, -1);
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn);
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
effect.setText("it gets -1/-1 until end of turn for each creature blocking it beyond the first");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}

View file

@ -54,7 +54,7 @@ public class ElvishBerserker extends CardImpl {
// 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 effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}

View file

@ -56,7 +56,7 @@ public class RabidElephant extends CardImpl {
// 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 effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
effect.setText("it gets +2/+2 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}

View file

@ -66,7 +66,7 @@ public class SpinedSliver extends CardImpl {
// Whenever a Sliver becomes blocked, that Sliver 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 effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
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,

View file

@ -57,7 +57,7 @@ public class GangOfElk extends CardImpl {
// Whenever Gang of Elk 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 effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
effect.setText("it gets +2/+2 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}

View file

@ -35,22 +35,21 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import mage.game.events.GameEvent;
/**
*
* @author LoneFox
*/
public class RampageAbility extends BecomesBlockedTriggeredAbility {
private final String rule;
public RampageAbility(int amount) {
super(null, false);
rule = "rampage " + amount;
rule = "rampage " + amount + "(Whenever this creature becomes blocked, it gets +"
+ amount + "/+" + amount + " until end of turn for each creature blocking it beyond the first.)";
RampageValue rv = new RampageValue(amount);
this.addEffect(new BoostSourceEffect(rv, rv, Duration.EndOfTurn));
this.addEffect(new BoostSourceEffect(rv, rv, Duration.EndOfTurn, true));
}
public RampageAbility(final RampageAbility ability) {
@ -69,7 +68,6 @@ public class RampageAbility extends BecomesBlockedTriggeredAbility {
}
}
class RampageValue implements DynamicValue {
private final int amount;
@ -89,9 +87,8 @@ class RampageValue implements DynamicValue {
@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())) {
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
if (combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
int blockers = combatGroup.getBlockers().size();
return blockers > 1 ? (blockers - 1) * amount : 0;
}
@ -101,6 +98,7 @@ class RampageValue implements DynamicValue {
@Override
public String getMessage() {
return "Rampage " + amount;
return "rampage " + amount + "(Whenever this creature becomes blocked, it gets +"
+ amount + "/+" + amount + " until end of turn for each creature blocking it beyond the first.)";
}
}