diff --git a/Mage.Sets/src/mage/cards/a/AngelicAccord.java b/Mage.Sets/src/mage/cards/a/AngelicAccord.java index eb73267182..2cbe190e36 100644 --- a/Mage.Sets/src/mage/cards/a/AngelicAccord.java +++ b/Mage.Sets/src/mage/cards/a/AngelicAccord.java @@ -27,17 +27,15 @@ */ package mage.cards.a; -import mage.abilities.Ability; import mage.abilities.CountType; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; -import mage.abilities.condition.IntCompareCondition; +import mage.abilities.condition.common.YouGainedLifeCondition; import mage.abilities.effects.common.CreateTokenEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.TargetController; import mage.constants.Zone; -import mage.game.Game; import mage.game.permanent.token.AngelToken; import mage.watchers.common.PlayerGainedLifeWatcher; @@ -66,25 +64,3 @@ public class AngelicAccord extends CardImpl { return new AngelicAccord(this); } } - -class YouGainedLifeCondition extends IntCompareCondition { - - public YouGainedLifeCondition(CountType type, int value) { - super(type, value); - } - - @Override - protected int getInputValue(Game game, Ability source) { - int gainedLife = 0; - PlayerGainedLifeWatcher watcher = (PlayerGainedLifeWatcher) game.getState().getWatchers().get(PlayerGainedLifeWatcher.class.getName()); - if (watcher != null) { - gainedLife = watcher.getLiveGained(source.getControllerId()); - } - return gainedLife; - } - - @Override - public String toString() { - return "if you gained 4 or more life this turn "; - } -} diff --git a/Mage.Sets/src/mage/cards/l/LoneRider.java b/Mage.Sets/src/mage/cards/l/LoneRider.java index 9ab1c92918..f38f85343d 100644 --- a/Mage.Sets/src/mage/cards/l/LoneRider.java +++ b/Mage.Sets/src/mage/cards/l/LoneRider.java @@ -28,11 +28,10 @@ package mage.cards.l; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.CountType; import mage.abilities.TriggeredAbility; import mage.abilities.common.OnEventTriggeredAbility; -import mage.abilities.condition.IntCompareCondition; +import mage.abilities.condition.common.YouGainedLifeCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.TransformSourceEffect; import mage.abilities.keyword.FirstStrikeAbility; @@ -42,7 +41,6 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.cards.i.ItThatRidesAsOne; import mage.constants.CardType; -import mage.game.Game; import mage.game.events.GameEvent; import mage.watchers.common.PlayerGainedLifeWatcher; @@ -86,26 +84,4 @@ public class LoneRider extends CardImpl { public LoneRider copy() { return new LoneRider(this); } -} - -class YouGainedLifeCondition extends IntCompareCondition { - - public YouGainedLifeCondition(CountType type, int value) { - super(type, value); - } - - @Override - protected int getInputValue(Game game, Ability source) { - int gainedLife = 0; - PlayerGainedLifeWatcher watcher = (PlayerGainedLifeWatcher) game.getState().getWatchers().get(PlayerGainedLifeWatcher.class.getName()); - if (watcher != null) { - gainedLife = watcher.getLiveGained(source.getControllerId()); - } - return gainedLife; - } - - @Override - public String toString() { - return "if you gained 3 or more life this turn "; - } -} +} \ No newline at end of file diff --git a/Mage/src/main/java/mage/abilities/condition/common/YouGainedLifeCondition.java b/Mage/src/main/java/mage/abilities/condition/common/YouGainedLifeCondition.java new file mode 100644 index 0000000000..edfed0b8c0 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/condition/common/YouGainedLifeCondition.java @@ -0,0 +1,33 @@ +package mage.abilities.condition.common; + +import mage.abilities.Ability; +import mage.abilities.CountType; +import mage.abilities.condition.IntCompareCondition; +import mage.game.Game; +import mage.watchers.common.PlayerGainedLifeWatcher; + +/** + * Created by IGOUDT on 5-4-2017. + */ +public class YouGainedLifeCondition extends IntCompareCondition { + + public YouGainedLifeCondition(CountType type, int value) { + super(type, value); + } + + @Override + protected int getInputValue(Game game, Ability source) { + int gainedLife = 0; + PlayerGainedLifeWatcher watcher = (PlayerGainedLifeWatcher) game.getState().getWatchers().get(PlayerGainedLifeWatcher.class.getName()); + if (watcher != null) { + gainedLife = watcher.getLiveGained(source.getControllerId()); + } + return gainedLife; + } + + @Override + public String toString() { + return String.format("if you gained %s or more life this turn ", value); + } +} +