From 4bf8226a43e0a2fea9c9b69e2258c6df41259316 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 17 Mar 2016 15:44:38 +0100 Subject: [PATCH] * Fixed bug with P/T boost triggered by blocking creatures not lasting until end of turn (e.g. Rabid Elephant). --- .../sets/guildpact/BeastmastersMagemark.java | 13 ++++++------ .../src/mage/sets/iceage/JohtullWurm.java | 2 +- .../src/mage/sets/invasion/SparringGolem.java | 4 ++-- .../mage/sets/legions/BerserkMurlodont.java | 9 +++++---- .../src/mage/sets/mirage/JungleWurm.java | 2 +- .../sets/ninthedition/ElvishBerserker.java | 2 +- .../src/mage/sets/odyssey/RabidElephant.java | 4 ++-- .../mage/sets/stronghold/SpinedSliver.java | 4 ++-- .../src/mage/sets/urzaslegacy/GangOfElk.java | 2 +- .../abilities/keyword/RampageAbility.java | 20 +++++++++---------- 10 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Mage.Sets/src/mage/sets/guildpact/BeastmastersMagemark.java b/Mage.Sets/src/mage/sets/guildpact/BeastmastersMagemark.java index 51659bd954..5a72d7f068 100644 --- a/Mage.Sets/src/mage/sets/guildpact/BeastmastersMagemark.java +++ b/Mage.Sets/src/mage/sets/guildpact/BeastmastersMagemark.java @@ -55,13 +55,14 @@ import mage.target.common.TargetCreaturePermanent; * @author Markedagain */ 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)); } - + public BeastmastersMagemark(UUID ownerId) { super(ownerId, 80, "Beastmaster's Magemark", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); this.expansionSetCode = "GPT"; @@ -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) { @@ -91,4 +92,4 @@ public class BeastmastersMagemark extends CardImpl { public BeastmastersMagemark copy() { return new BeastmastersMagemark(this); } -} \ 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 d1fd3b5b7a..d70517d687 100644 --- a/Mage.Sets/src/mage/sets/iceage/JohtullWurm.java +++ b/Mage.Sets/src/mage/sets/iceage/JohtullWurm.java @@ -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)); } diff --git a/Mage.Sets/src/mage/sets/invasion/SparringGolem.java b/Mage.Sets/src/mage/sets/invasion/SparringGolem.java index 98304b10f8..90cdc61ad8 100644 --- a/Mage.Sets/src/mage/sets/invasion/SparringGolem.java +++ b/Mage.Sets/src/mage/sets/invasion/SparringGolem.java @@ -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)); } @@ -66,4 +66,4 @@ public class SparringGolem extends CardImpl { 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 dcddb71fa2..687d8be5a5 100644 --- a/Mage.Sets/src/mage/sets/legions/BerserkMurlodont.java +++ b/Mage.Sets/src/mage/sets/legions/BerserkMurlodont.java @@ -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,10 +47,11 @@ 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")); } - + public BerserkMurlodont(UUID ownerId) { super(ownerId, 117, "Berserk Murlodont", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}"); this.expansionSetCode = "LGN"; @@ -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) { diff --git a/Mage.Sets/src/mage/sets/mirage/JungleWurm.java b/Mage.Sets/src/mage/sets/mirage/JungleWurm.java index 7a66ccdeca..4eda2a767b 100644 --- a/Mage.Sets/src/mage/sets/mirage/JungleWurm.java +++ b/Mage.Sets/src/mage/sets/mirage/JungleWurm.java @@ -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)); } diff --git a/Mage.Sets/src/mage/sets/ninthedition/ElvishBerserker.java b/Mage.Sets/src/mage/sets/ninthedition/ElvishBerserker.java index 924d718d4c..a992950f50 100644 --- a/Mage.Sets/src/mage/sets/ninthedition/ElvishBerserker.java +++ b/Mage.Sets/src/mage/sets/ninthedition/ElvishBerserker.java @@ -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)); } diff --git a/Mage.Sets/src/mage/sets/odyssey/RabidElephant.java b/Mage.Sets/src/mage/sets/odyssey/RabidElephant.java index 27a3afff09..4cb21b2726 100644 --- a/Mage.Sets/src/mage/sets/odyssey/RabidElephant.java +++ b/Mage.Sets/src/mage/sets/odyssey/RabidElephant.java @@ -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)); } @@ -69,4 +69,4 @@ public class RabidElephant extends CardImpl { public RabidElephant copy() { return new RabidElephant(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/stronghold/SpinedSliver.java b/Mage.Sets/src/mage/sets/stronghold/SpinedSliver.java index cf3f572246..990976bb93 100644 --- a/Mage.Sets/src/mage/sets/stronghold/SpinedSliver.java +++ b/Mage.Sets/src/mage/sets/stronghold/SpinedSliver.java @@ -66,14 +66,14 @@ 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, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, filter, "Whenever a Sliver becomes blocked, that Sliver gets +1/+1 until end of turn for each creature blocking it."))); - } + } public SpinedSliver(final SpinedSliver card) { super(card); diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/GangOfElk.java b/Mage.Sets/src/mage/sets/urzaslegacy/GangOfElk.java index c3ccea9928..7715bd8dc3 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/GangOfElk.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/GangOfElk.java @@ -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)); } diff --git a/Mage/src/main/java/mage/abilities/keyword/RampageAbility.java b/Mage/src/main/java/mage/abilities/keyword/RampageAbility.java index f399d80f7c..29fde94fe9 100644 --- a/Mage/src/main/java/mage/abilities/keyword/RampageAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/RampageAbility.java @@ -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,11 +87,10 @@ 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())) { - int blockers = combatGroup.getBlockers().size(); - return blockers > 1 ? (blockers - 1) * amount : 0; + for (CombatGroup combatGroup : game.getCombat().getGroups()) { + if (combatGroup.getAttackers().contains(sourceAbility.getSourceId())) { + int blockers = combatGroup.getBlockers().size(); + return blockers > 1 ? (blockers - 1) * amount : 0; } } return 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.)"; } }