- refactoring related to #8375 "E and F" cards

This commit is contained in:
Jeff Wadsworth 2021-10-20 11:42:36 -05:00
parent 0e8218e8c4
commit f48eb4a179
15 changed files with 36 additions and 52 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.e;
import java.util.UUID;
@ -33,7 +32,7 @@ public final class EldraziMimic extends CardImpl {
}
public EldraziMimic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}");
this.subtype.add(SubType.ELDRAZI);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
@ -76,7 +75,7 @@ class EldraziMimicEffect extends OneShotEffect {
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (permanent != null) {
ContinuousEffect effect = new SetPowerToughnessTargetEffect(permanent.getPower().getValue(), permanent.getToughness().getValue(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(source.getSourceId()));
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
game.addEffect(effect, source);
return true;
}

View file

@ -1,4 +1,3 @@
package mage.cards.e;
import java.util.UUID;
@ -67,7 +66,7 @@ class ElkinBottleExileEffect extends OneShotEffect {
if (card != null) {
controller.moveCardsToExile(card, source, game, true, source.getSourceId(), CardUtil.createObjectRealtedWindowTitle(source, game, null));
ContinuousEffect effect = new ElkinBottleCastFromExileEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source);
}
return true;

View file

@ -1,4 +1,3 @@
package mage.cards.e;
import java.util.UUID;
@ -82,7 +81,7 @@ class ErraticMutationEffect extends OneShotEffect {
int boostValue = nonLandCard.getManaValue();
// unboost target
ContinuousEffect effect = new BoostTargetEffect(boostValue, -boostValue, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source), game));
game.addEffect(effect, source);
}
// put the cards on the bottom of the library in any order

View file

@ -41,9 +41,9 @@ class EscapeToTheWildsEffect extends OneShotEffect {
EscapeToTheWildsEffect() {
super(Outcome.PlayForFree);
this.staticText = "Exile the top five cards of your library. " +
"You may play cards exiled this way until the end of your next turn.<br>" +
"You may play an additional land this turn.";
this.staticText = "Exile the top five cards of your library. "
+ "You may play cards exiled this way until the end of your next turn.<br>"
+ "You may play an additional land this turn.";
}
private EscapeToTheWildsEffect(final EscapeToTheWildsEffect effect) {
@ -67,7 +67,7 @@ class EscapeToTheWildsEffect extends OneShotEffect {
cards.getCards(game).stream().forEach(card -> {
ContinuousEffect effect = new EscapeToTheWildsMayPlayEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source);
});
game.addEffect(new PlayAdditionalLandsControllerEffect(1, Duration.EndOfTurn), source);

View file

@ -76,7 +76,7 @@ class FatalLoreEffect extends OneShotEffect {
&& controller.choose(Outcome.DestroyPermanent, target, source.getSourceId(), game)) {
for (UUID targetId : target.getTargets()) {
Effect destroyCreature = new DestroyTargetEffect(true);
destroyCreature.setTargetPointer(new FixedTarget(targetId));
destroyCreature.setTargetPointer(new FixedTarget(targetId, game));
destroyCreature.apply(game, source);
}
Effect opponentDrawsCards = new DrawCardTargetEffect(StaticValue.get(3), false, true);

View file

@ -1,4 +1,3 @@
package mage.cards.f;
import java.util.UUID;
@ -25,7 +24,7 @@ import mage.target.targetpointer.FixedTarget;
public final class Feint extends CardImpl {
public Feint(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{R}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}");
// Tap all creatures blocking target attacking creature. Prevent all combat damage that would be dealt this turn by that creature and each creature blocking it.
this.getSpellAbility().addEffect(new PreventDamageByTargetEffect(Duration.EndOfTurn, true).setText(""));
@ -72,7 +71,7 @@ class FeintEffect extends OneShotEffect {
if (blocker != null) {
blocker.tap(source, game);
PreventionEffect effect = new PreventDamageByTargetEffect(Duration.EndOfTurn, true);
effect.setTargetPointer(new FixedTarget(blocker.getId()));
effect.setTargetPointer(new FixedTarget(blocker.getId(), game));
game.addEffect(effect, source);
}
}

View file

@ -1,4 +1,3 @@
package mage.cards.f;
import java.util.UUID;
@ -28,7 +27,7 @@ import mage.target.targetpointer.FixedTarget;
public final class FickleEfreet extends CardImpl {
public FickleEfreet(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.subtype.add(SubType.EFREET);
this.power = new MageInt(5);
@ -49,7 +48,6 @@ public final class FickleEfreet extends CardImpl {
}
}
class FickleEfreetChangeControlEffect extends OneShotEffect {
public FickleEfreetChangeControlEffect() {
@ -82,7 +80,7 @@ class FickleEfreetChangeControlEffect extends OneShotEffect {
Player chosenOpponent = game.getPlayer(target.getFirstTarget());
if (chosenOpponent != null) {
ContinuousEffect effect = new FickleEfreetGainControlEffect(Duration.Custom, target.getFirstTarget());
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId()));
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId(), game));
game.addEffect(effect, source);
game.informPlayers(chosenOpponent.getLogName() + " has gained control of " + sourcePermanent.getLogName());
return true;

View file

@ -63,7 +63,7 @@ class FightingChanceEffect extends OneShotEffect {
for (UUID blocker : game.getCombat().getBlockers()) {
if (player.flipCoin(source, game, true)) {
PreventDamageByTargetEffect effect = new PreventDamageByTargetEffect(Duration.EndOfTurn, true);
effect.setTargetPointer(new FixedTarget(blocker));
effect.setTargetPointer(new FixedTarget(blocker, game));
game.addEffect(effect, source);
}
}

View file

@ -1,5 +1,3 @@
package mage.cards.f;
import java.util.UUID;
@ -16,7 +14,6 @@ import mage.constants.TurnPhase;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.turn.TurnMod;
import mage.target.targetpointer.FixedTarget;
@ -28,10 +25,7 @@ import mage.target.targetpointer.FixedTarget;
public final class FinestHour extends CardImpl {
public FinestHour(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}{W}{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{W}{U}");
// Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.)
this.addAbility(new ExaltedAbility());
@ -76,8 +70,8 @@ class FinestHourAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
if (game.isActivePlayer(this.controllerId)) {
if (game.getCombat().attacksAlone()) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0), game));
}
return true;
}

View file

@ -100,7 +100,7 @@ class FireGiantsFuryDelayedTriggeredAbility extends DelayedTriggeredAbility {
this.mor = mor;
}
private FireGiantsFuryDelayedTriggeredAbility (FireGiantsFuryDelayedTriggeredAbility ability) {
private FireGiantsFuryDelayedTriggeredAbility(FireGiantsFuryDelayedTriggeredAbility ability) {
super(ability);
this.mor = ability.mor;
}
@ -161,7 +161,7 @@ class FireGiantsFuryDelayedEffect extends OneShotEffect {
for (Card card : cards) {
ContinuousEffect effect = new FireGiantsFuryMayPlayEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source);
}

View file

@ -67,12 +67,12 @@ class FistfulOfForceEffect extends OneShotEffect {
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null && creature != null) {
ContinuousEffect effect = new BoostTargetEffect(2,2,Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature.getId()));
effect.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(effect, source);
if (ClashEffect.getInstance().apply(game, source)) {
game.addEffect(effect.copy(), source);
effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature.getId()));
effect.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(effect.copy(), source);
}
return true;

View file

@ -81,7 +81,7 @@ class FollowedFootstepsEffect extends OneShotEffect {
Permanent target = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo());
if (target != null) {
Effect effect = new CreateTokenCopyTargetEffect();
effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo()));
effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo(), game));
return effect.apply(game, source);
}
}

View file

@ -1,4 +1,3 @@
package mage.cards.f;
import java.util.UUID;
@ -19,7 +18,6 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.UnblockedPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
@ -33,7 +31,7 @@ import mage.target.targetpointer.FixedTarget;
public final class Forcefield extends CardImpl {
public Forcefield(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// {1}: The next time an unblocked creature of your choice would deal combat damage to you this turn, prevent all but 1 of that damage.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ForcefieldEffect(), new GenericManaCost(1)));
@ -50,26 +48,27 @@ public final class Forcefield extends CardImpl {
}
class ForcefieldEffect extends OneShotEffect {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("an unblocked creature");
static {
filter.add(UnblockedPredicate.instance);
}
ForcefieldEffect() {
super(Outcome.PreventDamage);
this.staticText = "The next time an unblocked creature of your choice would deal combat damage to you this turn, prevent all but 1 of that damage";
}
ForcefieldEffect(final ForcefieldEffect effect) {
super(effect);
}
@Override
public ForcefieldEffect copy() {
return new ForcefieldEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
@ -82,7 +81,7 @@ class ForcefieldEffect extends OneShotEffect {
game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen " + creature.getLogName());
}
ContinuousEffect effect = new ForcefieldPreventionEffect();
effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
game.addEffect(effect, source);
}
return true;

View file

@ -14,7 +14,6 @@ import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
@ -77,7 +76,7 @@ public final class FracturedLoyalty extends CardImpl {
if (enchantment.getAttachedTo() != null) {
if (controller != null && !enchantedCreature.isControlledBy(this.getTargetPointer().getFirst(game, source))) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame, this.getTargetPointer().getFirst(game, source));
effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo()));
effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo(), game));
game.addEffect(effect, source);
return true;
}

View file

@ -1,4 +1,3 @@
package mage.cards.f;
import java.util.UUID;
@ -25,12 +24,11 @@ import mage.target.targetpointer.FixedTarget;
* @author jeffwadsworth
*/
public final class FuriousResistance extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterBlockingCreature("blocking creature");
public FuriousResistance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{R}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}");
// Target blocking creature gets +3/+0 and gains first strike until end of turn.
this.getSpellAbility().addEffect(new FuriousResistanceEffect());
@ -64,11 +62,11 @@ class FuriousResistanceEffect extends OneShotEffect {
if (target == null) {
return false;
}
ContinuousEffect effect = new BoostTargetEffect(3, 0, Duration.EndOfTurn);
ContinuousEffect effect2 = new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(target.getId()));
effect2.setTargetPointer(new FixedTarget(target.getId()));
effect.setTargetPointer(new FixedTarget(target.getId(), game));
effect2.setTargetPointer(new FixedTarget(target.getId(), game));
game.addEffect(effect, source);
game.addEffect(effect2, source);
return true;