Fix Tail Swipe

This commit is contained in:
Alex W. Jackson 2022-09-02 17:28:17 -04:00
parent 7ececeffb3
commit b5459efa04
3 changed files with 68 additions and 159 deletions

View file

@ -1,39 +1,61 @@
package mage.cards.b; package mage.cards.b;
import mage.abilities.Ability; import mage.abilities.condition.Condition;
import mage.abilities.effects.OneShotEffect; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.AddContinuousEffectToGame;
import mage.abilities.effects.common.FightTargetsEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.IndestructibleAbility; import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.ComparisonType;
import mage.constants.Outcome;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID; import java.util.UUID;
/** /**
* @author TheElk801 * @author awjackson
*/ */
public final class BlizzardBrawl extends CardImpl { public final class BlizzardBrawl extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("you control three or more snow permanents");
static {
filter.add(SuperType.SNOW.getPredicate());
}
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 2);
public BlizzardBrawl(UUID ownerId, CardSetInfo setInfo) { public BlizzardBrawl(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}");
this.addSuperType(SuperType.SNOW); this.addSuperType(SuperType.SNOW);
// Choose target creature you control and target creature you don't control. If you control three or more snow permanents, the creature you control gets +1/+0 and gains indestructible until end of turn. Then those creatures fight each other. // Choose target creature you control and target creature you don't control.
this.getSpellAbility().addEffect(new BlizzardBrawlEffect()); // If you control three or more snow permanents, the creature you control gets +1/+0 and gains indestructible until end of turn.
this.getSpellAbility().addEffect(
new ConditionalOneShotEffect(
new AddContinuousEffectToGame(new BoostTargetEffect(1, 0)),
condition,
"Choose target creature you control and target creature you don't control. " +
"If you control three or more snow permanents, the creature you control gets +1/+0 " +
"and gains indestructible until end of turn."
).addEffect(
new AddContinuousEffectToGame(new GainAbilityTargetEffect(IndestructibleAbility.getInstance()))
)
);
// Then those creatures fight each other.
this.getSpellAbility().addEffect(new FightTargetsEffect()
.setText("Then those creatures fight each other. <i>(Each deals damage equal to its power to the other.)</i>")
);
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL)); this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL));
} }
@ -47,52 +69,3 @@ public final class BlizzardBrawl extends CardImpl {
return new BlizzardBrawl(this); return new BlizzardBrawl(this);
} }
} }
class BlizzardBrawlEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterControlledPermanent();
static {
filter.add(SuperType.SNOW.getPredicate());
}
BlizzardBrawlEffect() {
super(Outcome.Benefit);
staticText = "Choose target creature you control and target creature you don't control. " +
"If you control three or more snow permanents, the creature you control gets +1/+0 " +
"and gains indestructible until end of turn. " +
"Then those creatures fight each other. " +
"<i>(Each deals damage equal to its power to the other.)</i>";
}
private BlizzardBrawlEffect(final BlizzardBrawlEffect effect) {
super(effect);
}
@Override
public BlizzardBrawlEffect copy() {
return new BlizzardBrawlEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent creature1 = game.getPermanent(source.getTargets().get(0).getFirstTarget());
Permanent creature2 = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (creature1 == null) {
return false;
}
if (game.getBattlefield().count(filter, source.getControllerId(), source, game) >= 3) {
game.addEffect(new BoostTargetEffect(
1, 0, Duration.EndOfTurn
).setTargetPointer(new FixedTarget(creature1.getId(), game)), source);
game.addEffect(new GainAbilityTargetEffect(
IndestructibleAbility.getInstance(), Duration.EndOfTurn
).setTargetPointer(new FixedTarget(creature1.getId(), game)), source);
}
if (creature2 == null) {
return true;
}
game.getState().processAction(game);
return creature1.fight(creature2, source, game);
}
}

View file

@ -1,34 +1,44 @@
package mage.cards.j; package mage.cards.j;
import mage.abilities.Ability; import mage.abilities.condition.Condition;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.condition.common.TargetHasSubtypeCondition;
import mage.abilities.effects.OneShotEffect; import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.AddContinuousEffectToGame;
import mage.abilities.effects.common.FightTargetsEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID; import java.util.UUID;
/** /**
* @author TheElk801 * @author awjackson
*/ */
public final class Joust extends CardImpl { public final class Joust extends CardImpl {
private static final Condition condition = new TargetHasSubtypeCondition(SubType.KNIGHT);
public Joust(UUID ownerId, CardSetInfo setInfo) { public Joust(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}");
// Choose target creature you control and target creature you don't control. The creature you control gets +2/+1 until end of turn if it's a Knight. Then those creatures fight each other. // Choose target creature you control and target creature you don't control.
this.getSpellAbility().addEffect(new JoustEffect()); // The creature you control gets +2/+1 until end of turn if it's a Knight.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new AddContinuousEffectToGame(new BoostTargetEffect(2, 1)),
condition,
"Choose target creature you control and target creature you don't control. " +
"The creature you control gets +2/+1 until end of turn if it's a Knight."
));
// Then those creatures fight each other.
this.getSpellAbility().addEffect(new FightTargetsEffect()
.setText("Then those creatures fight each other. <i>(Each deals damage equal to its power to the other.)</i>")
);
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL)); this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL));
} }
@ -42,41 +52,3 @@ public final class Joust extends CardImpl {
return new Joust(this); return new Joust(this);
} }
} }
class JoustEffect extends OneShotEffect {
JoustEffect() {
super(Outcome.Benefit);
staticText = "Choose target creature you control and target creature you don't control. " +
"The creature you control gets +2/+1 until end of turn if it's a Knight. " +
"Then those creatures fight each other. <i>(Each deals damage equal to its power to the other.)</i>";
}
private JoustEffect(final JoustEffect effect) {
super(effect);
}
@Override
public JoustEffect copy() {
return new JoustEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent creature1 = game.getPermanent(source.getTargets().get(0).getFirstTarget());
Permanent creature2 = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (creature1 == null) {
return false;
}
if (creature1.hasSubtype(SubType.KNIGHT, game)) {
ContinuousEffect effect = new BoostTargetEffect(2, 1, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature1.getId(), game));
game.addEffect(effect, source);
}
if (creature2 == null) {
return true;
}
game.getState().processAction(game);
return creature1.fight(creature2, source, game);
}
}

View file

@ -2,25 +2,21 @@ package mage.cards.t;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.common.AddendumCondition; import mage.abilities.condition.common.AddendumCondition;
import mage.abilities.effects.OneShotEffect; import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.AddContinuousEffectToGame;
import mage.abilities.effects.common.FightTargetsEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.Targets;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/** /**
* *
* @author weirddan455 * @author awjackson
*/ */
public final class TailSwipe extends CardImpl { public final class TailSwipe extends CardImpl {
@ -29,8 +25,17 @@ public final class TailSwipe extends CardImpl {
// Choose target creature you control and target creature you don't control. // Choose target creature you control and target creature you don't control.
// If you cast this spell during your main phase, the creature you control gets +1/+1 until end of turn. // If you cast this spell during your main phase, the creature you control gets +1/+1 until end of turn.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new AddContinuousEffectToGame(new BoostTargetEffect(1, 1)),
AddendumCondition.instance,
"Choose target creature you control and target creature you don't control. " +
"If you cast this spell during your main phase, the creature you control gets +1/+1 until end of turn."
));
// Then those creatures fight each other. // Then those creatures fight each other.
this.getSpellAbility().addEffect(new TailSwipeEffect()); this.getSpellAbility().addEffect(new FightTargetsEffect()
.setText("Then those creatures fight each other. <i>(Each deals damage equal to its power to the other.)</i>")
);
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL)); this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL));
} }
@ -44,44 +49,3 @@ public final class TailSwipe extends CardImpl {
return new TailSwipe(this); return new TailSwipe(this);
} }
} }
class TailSwipeEffect extends OneShotEffect {
public TailSwipeEffect() {
super(Outcome.Benefit);
this.staticText = "Choose target creature you control and target creature you don't control. " +
"If you cast this spell during your main phase, the creature you control gets +1/+1 until end of turn. " +
"Then those creatures fight each other. " +
"<i>(Each deals damage equal to its power to the other.)</i>";
}
private TailSwipeEffect(final TailSwipeEffect effect) {
super(effect);
}
@Override
public TailSwipeEffect copy() {
return new TailSwipeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Targets targets = source.getTargets();
if (targets.size() < 2) {
return false;
}
Permanent creature1 = game.getPermanent(targets.get(0).getFirstTarget());
Permanent creature2 = game.getPermanent(targets.get(1).getFirstTarget());
if (creature1 == null) {
return false;
}
if (AddendumCondition.instance.apply(game, source)) {
game.addEffect(new BoostTargetEffect(1, 1)
.setTargetPointer(new FixedTarget(creature1, game)), source);
}
if (creature2 != null) {
creature1.fight(creature2, source, game);
}
return true;
}
}