Fix Render Silent and remove some unnecessary custom effects I noticed via the previous commit

This commit is contained in:
Alex W. Jackson 2022-09-09 15:41:37 -04:00
parent 092f3c3fe1
commit 5bfbeff87d
5 changed files with 49 additions and 120 deletions

View file

@ -26,8 +26,8 @@ public final class AetherBurst extends CardImpl {
public AetherBurst(UUID ownerId, CardSetInfo setInfo) { public AetherBurst(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Return up to X target creatures to their owners' hands, where X is one plus the number of cards named Aether Burst in all graveyards as you cast Aether Burst. // Return up to X target creatures to their owners' hands, where X is one plus the number of cards named Aether Burst in all graveyards as you cast this spell.
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect().setText("Return up to X target creatures to their owners' hands, where X is one plus the number of cards named Aether Burst in all graveyards as you cast Aether Burst")); this.getSpellAbility().addEffect(new ReturnToHandTargetEffect().setText("Return up to X target creatures to their owners' hands, where X is one plus the number of cards named Aether Burst in all graveyards as you cast this spell"));
this.getSpellAbility().addTarget(new DynamicTargetCreaturePermanent()); this.getSpellAbility().addTarget(new DynamicTargetCreaturePermanent());
this.getSpellAbility().setTargetAdjuster(AetherBurstAdjuster.instance); this.getSpellAbility().setTargetAdjuster(AetherBurstAdjuster.instance);
} }

View file

@ -2,25 +2,15 @@ package mage.cards.c;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.AttacksAttachedTriggeredAbility; import mage.abilities.common.AttacksAttachedTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.effects.common.combat.CantBeBlockedAttachedEffect; import mage.abilities.effects.common.combat.CantBeBlockedAttachedEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AttachmentType; import mage.constants.*;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -42,11 +32,15 @@ public final class CloakingDevice extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// Enchanted creature can't be blocked. // Enchanted creature can't be blocked.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedAttachedEffect(AttachmentType.AURA))); this.addAbility(new SimpleStaticAbility(new CantBeBlockedAttachedEffect(AttachmentType.AURA)));
// Whenever enchanted creature attacks, defending player loses 1 life. // Whenever enchanted creature attacks, defending player loses 1 life.
this.addAbility(new AttacksAttachedTriggeredAbility(new CloakingDeviceLoseLifeDefendingPlayerEffect(), AttachmentType.AURA, false)); this.addAbility(new AttacksAttachedTriggeredAbility(
new LoseLifeTargetEffect(1).setText("defending player loses 1 life"),
AttachmentType.AURA,
false,
SetTargetPointer.PLAYER
));
} }
private CloakingDevice(final CloakingDevice card) { private CloakingDevice(final CloakingDevice card) {
@ -58,37 +52,3 @@ public final class CloakingDevice extends CardImpl {
return new CloakingDevice(this); return new CloakingDevice(this);
} }
} }
class CloakingDeviceLoseLifeDefendingPlayerEffect extends OneShotEffect {
public CloakingDeviceLoseLifeDefendingPlayerEffect() {
super(Outcome.Damage);
this.staticText = "defending player loses 1 life";
}
public CloakingDeviceLoseLifeDefendingPlayerEffect(final CloakingDeviceLoseLifeDefendingPlayerEffect effect) {
super(effect);
}
@Override
public CloakingDeviceLoseLifeDefendingPlayerEffect copy() {
return new CloakingDeviceLoseLifeDefendingPlayerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player defender = game.getPlayer(game.getCombat().getDefendingPlayerId(enchantment.getAttachedTo(), game));
if (defender != null) {
defender.loseLife(1, game, source, false);
}
}
return true;
}
}

View file

@ -1,4 +1,3 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
@ -7,14 +6,11 @@ import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CounterTargetEffect;
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.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.MulticoloredPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.stack.Spell; import mage.game.stack.Spell;
@ -32,7 +28,7 @@ public final class RenderSilent extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{W}{U}{U}"); super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{W}{U}{U}");
// Counter target spell. Its controller can't cast spells this turn. // Counter target spell. Its controller can't cast spells this turn.
this.getSpellAbility().addEffect(new CounterTargetEffect()); this.getSpellAbility().addEffect(new RenderSilentCounterEffect());
this.getSpellAbility().addTarget(new TargetSpell()); this.getSpellAbility().addTarget(new TargetSpell());
this.getSpellAbility().addEffect(new RenderSilentEffect()); this.getSpellAbility().addEffect(new RenderSilentEffect());
} }
@ -47,6 +43,38 @@ public final class RenderSilent extends CardImpl {
} }
} }
class RenderSilentCounterEffect extends OneShotEffect {
public RenderSilentCounterEffect() {
super(Outcome.Detriment);
}
public RenderSilentCounterEffect(final RenderSilentCounterEffect effect) {
super(effect);
}
@Override
public RenderSilentCounterEffect copy() {
return new RenderSilentCounterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(source.getFirstTarget());
if (spell != null) {
source.getEffects().get(1).setTargetPointer(new FixedTarget(spell.getControllerId()));
return game.getStack().counter(source.getFirstTarget(), source, game);
}
return false;
}
@Override
public String getText(Mode mode) {
return "Counter target " + mode.getTargets().get(0).getTargetName();
}
}
class RenderSilentEffect extends ContinuousRuleModifyingEffectImpl { class RenderSilentEffect extends ContinuousRuleModifyingEffectImpl {
public RenderSilentEffect() { public RenderSilentEffect() {

View file

@ -1,29 +1,24 @@
package mage.cards.y; package mage.cards.y;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.DiesSourceTriggeredAbility; import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SkipNextPlayerUntapStepEffect; import mage.abilities.effects.common.SkipNextPlayerUntapStepEffect;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
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.SubType; import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.Target;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.Targets; import mage.target.targetpointer.SecondTargetPointer;
/** /**
* *
@ -47,7 +42,7 @@ public final class YoseiTheMorningStar extends CardImpl {
Ability ability = new DiesSourceTriggeredAbility(new SkipNextPlayerUntapStepEffect("target")); Ability ability = new DiesSourceTriggeredAbility(new SkipNextPlayerUntapStepEffect("target"));
ability.addTarget(new TargetPlayer()); ability.addTarget(new TargetPlayer());
ability.addTarget(new YoseiTheMorningStarTarget()); ability.addTarget(new YoseiTheMorningStarTarget());
ability.addEffect(new YoseiTheMorningStarTapEffect()); ability.addEffect(new TapTargetEffect().setTargetPointer(new SecondTargetPointer()));
this.addAbility(ability); this.addAbility(ability);
} }
@ -63,7 +58,7 @@ public final class YoseiTheMorningStar extends CardImpl {
class YoseiTheMorningStarTarget extends TargetPermanent { class YoseiTheMorningStarTarget extends TargetPermanent {
private static final FilterPermanent filterTemplate = new FilterPermanent("up to five target permanents that player controls that will be tapped"); private static final FilterPermanent filterTemplate = new FilterPermanent("permanents that player controls");
public YoseiTheMorningStarTarget() { public YoseiTheMorningStarTarget() {
super(0, 5, filterTemplate, false); super(0, 5, filterTemplate, false);
@ -88,42 +83,4 @@ class YoseiTheMorningStarTarget extends TargetPermanent {
public YoseiTheMorningStarTarget copy() { public YoseiTheMorningStarTarget copy() {
return new YoseiTheMorningStarTarget(this); return new YoseiTheMorningStarTarget(this);
} }
}
class YoseiTheMorningStarTapEffect extends OneShotEffect {
public YoseiTheMorningStarTapEffect() {
super(Outcome.Tap);
staticText = "Tap up to five target permanents that player controls";
}
public YoseiTheMorningStarTapEffect(final YoseiTheMorningStarTapEffect effect) {
super(effect);
}
@Override
public YoseiTheMorningStarTapEffect copy() {
return new YoseiTheMorningStarTapEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Targets targets = source.getTargets();
Target target1 = targets.get(1);
for (UUID target : target1.getTargets()) {
Permanent permanent = game.getPermanent(target);
if (permanent != null) {
permanent.tap(source, game);
} else {
return false;
}
}
return true;
}
@Override
public String getText(Mode mode) {
return staticText;
}
} }

View file

@ -52,22 +52,6 @@ public class TapTargetEffect extends OneShotEffect {
if (staticText != null && !staticText.isEmpty()) { if (staticText != null && !staticText.isEmpty()) {
return staticText; return staticText;
} }
return "tap " + getTargetPointer().describeTargets(mode.getTargets(), "that creature");
if (mode.getTargets().isEmpty()) {
return "tap target permanent";
}
Target target = mode.getTargets().get(0);
if (target.getMaxNumberOfTargets() > 1 || target.getNumberOfTargets() == 0) {
if (target.getMaxNumberOfTargets() == target.getNumberOfTargets()) {
return "tap " + CardUtil.numberToText(target.getNumberOfTargets()) + " target " + target.getTargetName() + 's';
} else {
return "tap up to " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + " target " + target.getTargetName() + (target.getMaxNumberOfTargets() > 1 ? "s" : "");
}
} else if (target.getMaxNumberOfTargets() == 0) {
return "tap X target " + mode.getTargets().get(0).getTargetName();
} else {
return "tap target " + mode.getTargets().get(0).getTargetName();
}
} }
} }