diff --git a/Mage.Sets/src/mage/cards/a/AngelOfVitality.java b/Mage.Sets/src/mage/cards/a/AngelOfVitality.java index 9692190bcab..10f232ff6fe 100644 --- a/Mage.Sets/src/mage/cards/a/AngelOfVitality.java +++ b/Mage.Sets/src/mage/cards/a/AngelOfVitality.java @@ -5,17 +5,15 @@ import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; import mage.abilities.decorator.ConditionalContinuousEffect; -import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.effects.common.replacement.GainPlusOneLifeReplacementEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Outcome; import mage.constants.SubType; import mage.game.Game; -import mage.game.events.GameEvent; import mage.players.Player; import java.util.UUID; @@ -36,7 +34,7 @@ public final class AngelOfVitality extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // If you would gain life, you gain that much life plus 1 instead. - this.addAbility(new SimpleStaticAbility(new AngelOfVitalityEffect())); + this.addAbility(new SimpleStaticAbility(new GainPlusOneLifeReplacementEffect())); // Angel of Vitality gets +2/+2 as long as you have 25 or more life. this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( @@ -55,44 +53,6 @@ public final class AngelOfVitality extends CardImpl { } } -class AngelOfVitalityEffect extends ReplacementEffectImpl { - - AngelOfVitalityEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "If you would gain life, you gain that much life plus 1 instead"; - } - - private AngelOfVitalityEffect(final AngelOfVitalityEffect effect) { - super(effect); - } - - @Override - public AngelOfVitalityEffect copy() { - return new AngelOfVitalityEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - event.setAmount(event.getAmount() + 1); - return false; - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.GAIN_LIFE; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - return source.isControlledBy(event.getPlayerId()); - } -} - enum AngelOfVitalityCondition implements Condition { instance; diff --git a/Mage.Sets/src/mage/cards/b/BilboBirthdayCelebrant.java b/Mage.Sets/src/mage/cards/b/BilboBirthdayCelebrant.java new file mode 100644 index 00000000000..036502e3560 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BilboBirthdayCelebrant.java @@ -0,0 +1,72 @@ +package mage.cards.b; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.common.ExileSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalActivatedAbility; +import mage.abilities.effects.common.replacement.GainPlusOneLifeReplacementEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BilboBirthdayCelebrant extends CardImpl { + + public BilboBirthdayCelebrant(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{B}{G}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HALFLING); + this.subtype.add(SubType.ROGUE); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // If you would gain life, you gain that much life plus 1 instead. + this.addAbility(new SimpleStaticAbility(new GainPlusOneLifeReplacementEffect())); + + // {2}{W}{B}{G}, {T}, Exile Bilbo, Birthday Celebrant: Search your library for any number of creature cards, put them onto the battlefield, then shuffle. Activate only if you have 111 or more life. + Ability ability = new ConditionalActivatedAbility(new SearchLibraryPutInPlayEffect( + new TargetCardInLibrary(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_CREATURES) + ), new ManaCostsImpl<>("{2}{W}{B}{G}"), BilboBirthdayCelebrantCondition.instance); + ability.addCost(new TapSourceCost()); + ability.addCost(new ExileSourceCost()); + this.addAbility(ability); + } + + private BilboBirthdayCelebrant(final BilboBirthdayCelebrant card) { + super(card); + } + + @Override + public BilboBirthdayCelebrant copy() { + return new BilboBirthdayCelebrant(this); + } +} + +enum BilboBirthdayCelebrantCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return game.getPlayer(source.getControllerId()).getLife() >= 111; + } + + @Override + public String toString() { + return "you have 111 or more life"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/c/ClericClass.java b/Mage.Sets/src/mage/cards/c/ClericClass.java index 7ae9cf2c6c4..aa7d5d0a174 100644 --- a/Mage.Sets/src/mage/cards/c/ClericClass.java +++ b/Mage.Sets/src/mage/cards/c/ClericClass.java @@ -5,19 +5,21 @@ import mage.abilities.common.BecomesClassLevelTriggeredAbility; import mage.abilities.common.GainLifeControllerTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.continuous.GainClassAbilitySourceEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.effects.common.replacement.GainPlusOneLifeReplacementEffect; import mage.abilities.keyword.ClassLevelAbility; import mage.abilities.keyword.ClassReminderAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.StaticFilters; import mage.game.Game; -import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCardInYourGraveyard; @@ -39,7 +41,7 @@ public final class ClericClass extends CardImpl { this.addAbility(new ClassReminderAbility()); // If you would gain life, you gain that much life plus 1 instead. - this.addAbility(new SimpleStaticAbility(new ClericClassLifeEffect())); + this.addAbility(new SimpleStaticAbility(new GainPlusOneLifeReplacementEffect())); // {3}{W}: Level 2 this.addAbility(new ClassLevelAbility(2, "{3}{W}")); @@ -70,44 +72,6 @@ public final class ClericClass extends CardImpl { } } -class ClericClassLifeEffect extends ReplacementEffectImpl { - - ClericClassLifeEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "If you would gain life, you gain that much life plus 1 instead"; - } - - private ClericClassLifeEffect(final ClericClassLifeEffect effect) { - super(effect); - } - - @Override - public ClericClassLifeEffect copy() { - return new ClericClassLifeEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - event.setAmount(event.getAmount() + 1); - return false; - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.GAIN_LIFE; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - return source.isControlledBy(event.getPlayerId()); - } -} - class ClericClassReturnEffect extends OneShotEffect { ClericClassReturnEffect() { diff --git a/Mage.Sets/src/mage/cards/h/HeronOfHope.java b/Mage.Sets/src/mage/cards/h/HeronOfHope.java index bb50322bd81..e07c7fd86e7 100644 --- a/Mage.Sets/src/mage/cards/h/HeronOfHope.java +++ b/Mage.Sets/src/mage/cards/h/HeronOfHope.java @@ -1,26 +1,22 @@ package mage.cards.h; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; -import mage.abilities.keyword.LifelinkAbility; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.SubType; +import mage.abilities.effects.common.replacement.GainPlusOneLifeReplacementEffect; import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.LifelinkAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.game.Game; -import mage.game.events.GameEvent; +import mage.constants.Duration; +import mage.constants.SubType; + +import java.util.UUID; /** - * * @author weirddan455 */ public final class HeronOfHope extends CardImpl { @@ -36,7 +32,7 @@ public final class HeronOfHope extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // If you would gain life, you gain that much life plus 1 instead. - this.addAbility(new SimpleStaticAbility(new HeronOfHopeEffect())); + this.addAbility(new SimpleStaticAbility(new GainPlusOneLifeReplacementEffect())); // {1}{W}: Heron of Hope gains lifelink until end of turn. this.addAbility(new SimpleActivatedAbility( @@ -54,36 +50,3 @@ public final class HeronOfHope extends CardImpl { return new HeronOfHope(this); } } - -class HeronOfHopeEffect extends ReplacementEffectImpl { - - public HeronOfHopeEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "If you would gain life, you gain that much life plus 1 instead"; - } - - private HeronOfHopeEffect(final HeronOfHopeEffect effect) { - super(effect); - } - - @Override - public HeronOfHopeEffect copy() { - return new HeronOfHopeEffect(this); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - event.setAmount(event.getAmount() + 1); - return false; - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.GAIN_LIFE; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - return source.isControlledBy(event.getPlayerId()); - } -} diff --git a/Mage.Sets/src/mage/cards/h/HonorTroll.java b/Mage.Sets/src/mage/cards/h/HonorTroll.java index f905bc7eddd..09a0cd3b336 100644 --- a/Mage.Sets/src/mage/cards/h/HonorTroll.java +++ b/Mage.Sets/src/mage/cards/h/HonorTroll.java @@ -5,17 +5,15 @@ import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; import mage.abilities.decorator.ConditionalContinuousEffect; -import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.effects.common.replacement.GainPlusOneLifeReplacementEffect; import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Outcome; import mage.constants.SubType; import mage.game.Game; -import mage.game.events.GameEvent; import mage.players.Player; import java.util.UUID; @@ -37,7 +35,7 @@ public final class HonorTroll extends CardImpl { this.addAbility(VigilanceAbility.getInstance()); // If you would gain life, you gain that much life plus 1 instead. - this.addAbility(new SimpleStaticAbility(new HonorTrollEffect())); + this.addAbility(new SimpleStaticAbility(new GainPlusOneLifeReplacementEffect())); // Honor Troll gets +2/+1 as long as you have 25 or more life. this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( @@ -56,44 +54,6 @@ public final class HonorTroll extends CardImpl { } } -class HonorTrollEffect extends ReplacementEffectImpl { - - HonorTrollEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "If you would gain life, you gain that much life plus 1 instead"; - } - - private HonorTrollEffect(final HonorTrollEffect effect) { - super(effect); - } - - @Override - public HonorTrollEffect copy() { - return new HonorTrollEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - event.setAmount(event.getAmount() + 1); - return false; - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.GAIN_LIFE; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - return source.isControlledBy(event.getPlayerId()); - } -} - enum HonorTrollCondition implements Condition { instance; diff --git a/Mage.Sets/src/mage/cards/k/KnightOfDawnsLight.java b/Mage.Sets/src/mage/cards/k/KnightOfDawnsLight.java index 98dbf466d33..96387f693b9 100644 --- a/Mage.Sets/src/mage/cards/k/KnightOfDawnsLight.java +++ b/Mage.Sets/src/mage/cards/k/KnightOfDawnsLight.java @@ -1,25 +1,21 @@ package mage.cards.k; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.SubType; +import mage.abilities.effects.common.replacement.GainPlusOneLifeReplacementEffect; import mage.abilities.keyword.FirstStrikeAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.game.Game; -import mage.game.events.GameEvent; +import mage.constants.Duration; +import mage.constants.SubType; + +import java.util.UUID; /** - * * @author weirddan455 */ public final class KnightOfDawnsLight extends CardImpl { @@ -36,7 +32,7 @@ public final class KnightOfDawnsLight extends CardImpl { this.addAbility(FirstStrikeAbility.getInstance()); // If you would gain life, you gain that much life plus 1 instead. - this.addAbility(new SimpleStaticAbility(new KnightOfDawnsLightEffect())); + this.addAbility(new SimpleStaticAbility(new GainPlusOneLifeReplacementEffect())); // {1}{W}: Knight of Dawn's Light gets +1/+1 until end of turn. this.addAbility(new SimpleActivatedAbility( @@ -54,36 +50,3 @@ public final class KnightOfDawnsLight extends CardImpl { return new KnightOfDawnsLight(this); } } - -class KnightOfDawnsLightEffect extends ReplacementEffectImpl { - - public KnightOfDawnsLightEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit); - this.staticText = "If you would gain life, you gain that much life plus 1 instead."; - } - - private KnightOfDawnsLightEffect(final KnightOfDawnsLightEffect effect) { - super(effect); - } - - @Override - public KnightOfDawnsLightEffect copy() { - return new KnightOfDawnsLightEffect(this); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - event.setAmount(event.getAmount() + 1); - return false; - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.GAIN_LIFE; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - return source.isControlledBy(event.getPlayerId()); - } -} diff --git a/Mage.Sets/src/mage/sets/TalesOfMiddleEarthCommander.java b/Mage.Sets/src/mage/sets/TalesOfMiddleEarthCommander.java index 983def5124c..3682b04a6e3 100644 --- a/Mage.Sets/src/mage/sets/TalesOfMiddleEarthCommander.java +++ b/Mage.Sets/src/mage/sets/TalesOfMiddleEarthCommander.java @@ -32,6 +32,7 @@ public final class TalesOfMiddleEarthCommander extends ExpansionSet { cards.add(new SetCardInfo("Battlefield Forge", 296, Rarity.RARE, mage.cards.b.BattlefieldForge.class)); cards.add(new SetCardInfo("Beast Within", 234, Rarity.UNCOMMON, mage.cards.b.BeastWithin.class)); cards.add(new SetCardInfo("Beregond of the Guard", 9, Rarity.RARE, mage.cards.b.BeregondOfTheGuard.class)); + cards.add(new SetCardInfo("Bilbo, Birthday Celebrant", 48, Rarity.RARE, mage.cards.b.BilboBirthdayCelebrant.class)); cards.add(new SetCardInfo("Birds of Paradise", 235, Rarity.RARE, mage.cards.b.BirdsOfParadise.class)); cards.add(new SetCardInfo("Blasphemous Act", 211, Rarity.RARE, mage.cards.b.BlasphemousAct.class)); cards.add(new SetCardInfo("Bojuka Bog", 358, Rarity.MYTHIC, mage.cards.b.BojukaBog.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/replacement/GainPlusOneLifeReplacementEffect.java b/Mage/src/main/java/mage/abilities/effects/common/replacement/GainPlusOneLifeReplacementEffect.java new file mode 100644 index 00000000000..e403ac6e21e --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/replacement/GainPlusOneLifeReplacementEffect.java @@ -0,0 +1,50 @@ +package mage.abilities.effects.common.replacement; + +import mage.abilities.Ability; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.util.CardUtil; + +/** + * @author TheElk801 + */ +public class GainPlusOneLifeReplacementEffect extends ReplacementEffectImpl { + + public GainPlusOneLifeReplacementEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "if you would gain life, you gain that much life plus 1 instead"; + } + + private GainPlusOneLifeReplacementEffect(final GainPlusOneLifeReplacementEffect effect) { + super(effect); + } + + @Override + public GainPlusOneLifeReplacementEffect copy() { + return new GainPlusOneLifeReplacementEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + event.setAmount(CardUtil.overflowInc(event.getAmount(), 1)); + return false; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.GAIN_LIFE; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return source.isControlledBy(event.getPlayerId()); + } +}