diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/BarrageOfBoulders.java b/Mage.Sets/src/mage/sets/khansoftarkir/BarrageOfBoulders.java index e3e275c848d..d7ab4ff46a5 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/BarrageOfBoulders.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/BarrageOfBoulders.java @@ -28,8 +28,8 @@ package mage.sets.khansoftarkir; import java.util.UUID; +import mage.abilities.Ability; import mage.abilities.condition.common.FerociousCondition; -import mage.abilities.decorator.ConditionalRestrictionEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageAllEffect; import mage.abilities.effects.common.combat.CantBlockAllEffect; @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.TargetController; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; /** * @@ -62,9 +63,7 @@ public class BarrageOfBoulders extends CardImpl { // Barrage of Boulders deals 1 damage to each creature you don't control. this.getSpellAbility().addEffect(new DamageAllEffect(1, filter)); // Ferocious - If you control a creature with power 4 or greater, creatures can't block this turn - Effect effect = new ConditionalRestrictionEffect(Duration.EndOfTurn, - new CantBlockAllEffect(new FilterCreaturePermanent("creatures"), Duration.EndOfTurn), - FerociousCondition.getInstance() , null); + Effect effect = new BarrageOfBouldersCantBlockAllEffect(new FilterCreaturePermanent("creatures"), Duration.EndOfTurn); effect.setText("

Ferocious - If you control a creature with power 4 or greater, creatures can't block this turn"); this.getSpellAbility().addEffect(effect); } @@ -78,3 +77,27 @@ public class BarrageOfBoulders extends CardImpl { return new BarrageOfBoulders(this); } } + +class BarrageOfBouldersCantBlockAllEffect extends CantBlockAllEffect { + + public BarrageOfBouldersCantBlockAllEffect(FilterCreaturePermanent filter, Duration duration) { + super(filter, duration); + } + + public BarrageOfBouldersCantBlockAllEffect(final BarrageOfBouldersCantBlockAllEffect effect) { + super(effect); + } + + @Override + public void init(Ability source, Game game) { + if (!FerociousCondition.getInstance().apply(game, source)) { + discard(); + } + } + + @Override + public BarrageOfBouldersCantBlockAllEffect copy() { + return new BarrageOfBouldersCantBlockAllEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/CratersClaws.java b/Mage.Sets/src/mage/sets/khansoftarkir/CratersClaws.java index f9046e9b7dc..90034d6d00f 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/CratersClaws.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/CratersClaws.java @@ -28,15 +28,17 @@ package mage.sets.khansoftarkir; import java.util.UUID; -import mage.abilities.condition.InvertCondition; +import mage.abilities.Ability; +import mage.abilities.Mode; import mage.abilities.condition.common.FerociousCondition; -import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.IntPlusDynamicValue; import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; +import mage.game.Game; import mage.target.common.TargetCreatureOrPlayer; /** @@ -52,17 +54,9 @@ public class CratersClaws extends CardImpl { this.color.setRed(true); // Crater's Claws deals X damage to target creature or player. - this.getSpellAbility().addEffect(new ConditionalOneShotEffect( - new DamageTargetEffect(new ManacostVariableValue()), - new InvertCondition(FerociousCondition.getInstance()), - "{this} deals X damage to target creature or player.")); - this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); - // Ferocious - Crater's Claws deals X plus 2 damage to that creature or player instead if you control a creature with power 4 or greater. - this.getSpellAbility().addEffect(new ConditionalOneShotEffect( - new DamageTargetEffect(new IntPlusDynamicValue(2, new ManacostVariableValue())), - FerociousCondition.getInstance(), - "

Ferocious - Crater's Claws deals X plus 2 damage to that creature or player instead if you control a creature with power 4 or greater")); + this.getSpellAbility().addEffect(new CratersClawsDamageTargetEffect(new ManacostVariableValue())); + this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); } public CratersClaws(final CratersClaws card) { @@ -74,3 +68,35 @@ public class CratersClaws extends CardImpl { return new CratersClaws(this); } } + +class CratersClawsDamageTargetEffect extends DamageTargetEffect { + + + public CratersClawsDamageTargetEffect(DynamicValue amount) { + super(amount, false); + } + + public CratersClawsDamageTargetEffect(final CratersClawsDamageTargetEffect effect) { + super(effect); + } + + @Override + public CratersClawsDamageTargetEffect copy() { + return new CratersClawsDamageTargetEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + if (FerociousCondition.getInstance().apply(game, source)) { + amount = new IntPlusDynamicValue(2, new ManacostVariableValue()); + } + return super.apply(game, source); + } + + @Override + public String getText(Mode mode) { + return "{this} deals X damage to target creature or player." + + "

Ferocious - {this} deals X plus 2 damage to that creature or player instead if you control a creature with power 4 or greater"; + } + +} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/FeedTheClan.java b/Mage.Sets/src/mage/sets/khansoftarkir/FeedTheClan.java index 43574560c86..6698bd9347b 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/FeedTheClan.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/FeedTheClan.java @@ -28,16 +28,15 @@ package mage.sets.khansoftarkir; import java.util.UUID; -import mage.abilities.condition.InvertCondition; +import mage.abilities.Ability; import mage.abilities.condition.common.FerociousCondition; -import mage.abilities.decorator.ConditionalOneShotEffect; -import mage.abilities.dynamicvalue.IntPlusDynamicValue; -import mage.abilities.dynamicvalue.common.ManacostVariableValue; -import mage.abilities.effects.common.DamageTargetEffect; -import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.constants.CardType; +import mage.constants.Outcome; import mage.constants.Rarity; +import mage.game.Game; +import mage.players.Player; /** * @@ -52,16 +51,8 @@ public class FeedTheClan extends CardImpl { this.color.setGreen(true); // You gain 5 life. - this.getSpellAbility().addEffect(new ConditionalOneShotEffect( - new GainLifeEffect(5), - new InvertCondition(FerociousCondition.getInstance()), - "You gain 5 life")); - - // Ferocious - You gain 10 life instead if you control a creature with power 4 or greater. - this.getSpellAbility().addEffect(new ConditionalOneShotEffect( - new GainLifeEffect(10), - FerociousCondition.getInstance(), - "

Ferocious - You gain 10 life instead if you control a creature with power 4 or greater")); + // Ferocious - You gain 10 life instead if you control a creature with power 4 or greater + this.getSpellAbility().addEffect(new FeedTheClanEffect()); } @@ -74,3 +65,34 @@ public class FeedTheClan extends CardImpl { return new FeedTheClan(this); } } + +class FeedTheClanEffect extends OneShotEffect { + + public FeedTheClanEffect() { + super(Outcome.GainLife); + this.staticText = "You gain 5 life.

Ferocious - You gain 10 life instead if you control a creature with power 4 or greater"; + } + + public FeedTheClanEffect(final FeedTheClanEffect effect) { + super(effect); + } + + @Override + public FeedTheClanEffect copy() { + return new FeedTheClanEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + if (FerociousCondition.getInstance().apply(game, source)) { + controller.gainLife(10, game); + } else { + controller.gainLife(5, game); + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/IcyBlast.java b/Mage.Sets/src/mage/sets/khansoftarkir/IcyBlast.java index e9343631854..79cc02d6a52 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/IcyBlast.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/IcyBlast.java @@ -31,7 +31,6 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.abilities.condition.common.FerociousCondition; -import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.SkipNextUntapTargetEffect; import mage.abilities.effects.common.TapTargetEffect; @@ -59,9 +58,7 @@ public class IcyBlast extends CardImpl { this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, new FilterCreaturePermanent(), false)); // Ferocious - If you control a creature with power 4 or greater, those creatures don't untap during their controllers' next untap steps. - Effect effect = new ConditionalContinuousRuleModifyingEffect( - new SkipNextUntapTargetEffect(), - FerociousCondition.getInstance()); + Effect effect = new IcyBlastSkipNextUntapTargetEffect(); effect.setText("

Ferocious - If you control a creature with power 4 or greater, those creatures don't untap during their controllers' next untap steps"); this.getSpellAbility().addEffect(effect); } @@ -85,3 +82,31 @@ public class IcyBlast extends CardImpl { return new IcyBlast(this); } } + +class IcyBlastSkipNextUntapTargetEffect extends SkipNextUntapTargetEffect { + + public IcyBlastSkipNextUntapTargetEffect() { + super(); + } + + public IcyBlastSkipNextUntapTargetEffect(final IcyBlastSkipNextUntapTargetEffect effect) { + super(effect); + } + + @Override + public IcyBlastSkipNextUntapTargetEffect copy() { + return new IcyBlastSkipNextUntapTargetEffect(this); + } + + @Override + public void init(Ability source, Game game) { + if (!FerociousCondition.getInstance().apply(game, source)) { + discard(); + } + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/RoarOfChallenge.java b/Mage.Sets/src/mage/sets/khansoftarkir/RoarOfChallenge.java index 236615cb767..771fe386ba5 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/RoarOfChallenge.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/RoarOfChallenge.java @@ -33,15 +33,20 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.LockedInCondition; import mage.abilities.condition.common.FerociousCondition; import mage.abilities.decorator.ConditionalContinousEffect; +import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.combat.MustBeBlockedByAllTargetEffect; import mage.abilities.effects.common.continious.GainAbilityTargetEffect; import mage.abilities.keyword.IndestructibleAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; import mage.target.common.TargetCreaturePermanent; /** @@ -57,13 +62,10 @@ public class RoarOfChallenge extends CardImpl { this.color.setGreen(true); // All creatures able to block target creature this turn do so. - this.getSpellAbility().addEffect(new MustBeBlockedByAllTargetEffect(Duration.EndOfTurn)); - this.getSpellAbility().addTarget(new TargetCreaturePermanent()); // Ferocious - That creature gains indestructible until end of turn if you control a creature with power 4 or greater. - this.getSpellAbility().addEffect(new ConditionalContinousEffect( - new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), - new LockedInCondition(FerociousCondition.getInstance()), - "

Ferocious - That creature gains indestructible until end of turn if you control a creature with power 4 or greater")); + this.getSpellAbility().addEffect(new MustBeBlockedByAllTargetEffect(Duration.EndOfTurn)); + this.getSpellAbility().addEffect(new RoarOfChallengeEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } public RoarOfChallenge(final RoarOfChallenge card) { @@ -75,3 +77,34 @@ public class RoarOfChallenge extends CardImpl { return new RoarOfChallenge(this); } } + +class RoarOfChallengeEffect extends OneShotEffect { + + public RoarOfChallengeEffect() { + super(Outcome.AddAbility); + this.staticText = "

Ferocious - That creature gains indestructible until end of turn if you control a creature with power 4 or greater"; + } + + public RoarOfChallengeEffect(final RoarOfChallengeEffect effect) { + super(effect); + } + + @Override + public RoarOfChallengeEffect copy() { + return new RoarOfChallengeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + if (FerociousCondition.getInstance().apply(game, source)) { + ContinuousEffect effect = new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn); + effect.setTargetPointer(getTargetPointer()); + game.addEffect(effect, source); + } + return true; + } + return false; + } +}