- refactoring related to #8375 "L/M/N/O/P/Q/R/S" cards

This commit is contained in:
Jeff Wadsworth 2021-10-22 11:49:00 -05:00
parent d42ca9767a
commit 8db2ba470b
41 changed files with 116 additions and 145 deletions

View file

@ -120,7 +120,8 @@ class AdarkarValkyrieDelayedTriggeredAbility extends DelayedTriggeredAbility {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (((ZoneChangeEvent) event).isDiesEvent() if (((ZoneChangeEvent) event).isDiesEvent()
&& mor.refersTo(((ZoneChangeEvent) event).getTarget(), game)) { && mor.refersTo(((ZoneChangeEvent) event).getTarget(), game)
&& game.getState().getZone(event.getTargetId()) == Zone.GRAVEYARD) { // must be in the graveyard
getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game)); getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true; return true;

View file

@ -1,4 +1,3 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID; import java.util.UUID;
@ -80,14 +79,14 @@ class MammothHarnessTriggeredAbility extends BlocksOrBecomesBlockedSourceTrigger
if (event.getSourceId().equals(attachedTo.getId())) { if (event.getSourceId().equals(attachedTo.getId())) {
Permanent blocked = game.getPermanent(event.getTargetId()); Permanent blocked = game.getPermanent(event.getTargetId());
if (blocked != null && filter.match(blocked, game)) { if (blocked != null && filter.match(blocked, game)) {
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId())); this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true; return true;
} }
} }
if (event.getTargetId().equals(attachedTo.getId())) { if (event.getTargetId().equals(attachedTo.getId())) {
Permanent blocker = game.getPermanent(event.getSourceId()); Permanent blocker = game.getPermanent(event.getSourceId());
if (blocker != null) { if (blocker != null) {
this.getEffects().setTargetPointer(new FixedTarget(event.getSourceId())); this.getEffects().setTargetPointer(new FixedTarget(event.getSourceId(), game));
return true; return true;
} }
} }

View file

@ -88,11 +88,11 @@ class MassMutinyEffect extends OneShotEffect {
Permanent targetCreature = game.getPermanent(target.getFirstTarget()); Permanent targetCreature = game.getPermanent(target.getFirstTarget());
if (targetCreature != null) { if (targetCreature != null) {
ContinuousEffect effect1 = new GainControlTargetEffect(Duration.EndOfTurn); ContinuousEffect effect1 = new GainControlTargetEffect(Duration.EndOfTurn);
effect1.setTargetPointer(new FixedTarget(targetCreature.getId())); effect1.setTargetPointer(new FixedTarget(targetCreature.getId(), game));
game.addEffect(effect1, source); game.addEffect(effect1, source);
ContinuousEffect effect2 = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); ContinuousEffect effect2 = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect2.setTargetPointer(new FixedTarget(targetCreature.getId())); effect2.setTargetPointer(new FixedTarget(targetCreature.getId(), game));
game.addEffect(effect2, source); game.addEffect(effect2, source);
targetCreature.untap(game); targetCreature.untap(game);

View file

@ -1,4 +1,3 @@
package mage.cards.m; package mage.cards.m;
import java.util.List; import java.util.List;
@ -26,7 +25,7 @@ import mage.target.targetpointer.FixedTarget;
public final class MobRule extends CardImpl { public final class MobRule extends CardImpl {
public MobRule(UUID ownerId, CardSetInfo setInfo) { public MobRule(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{R}{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{R}{R}");
// Choose one // Choose one
// Gain control of all creatures with power 4 or greater until end of turn. Untap those creatures. They gain haste until end of turn. // Gain control of all creatures with power 4 or greater until end of turn. Untap those creatures. They gain haste until end of turn.
@ -83,7 +82,7 @@ class MobRuleEffect extends OneShotEffect {
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(filter, game); List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(filter, game);
for (Permanent creature : creatures) { for (Permanent creature : creatures) {
ContinuousEffect effect = new MobRuleControlAllEffect(source.getControllerId()); ContinuousEffect effect = new MobRuleControlAllEffect(source.getControllerId());
effect.setTargetPointer(new FixedTarget(creature.getId())); effect.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
applied = true; applied = true;
} }
@ -93,7 +92,7 @@ class MobRuleEffect extends OneShotEffect {
} }
for (Permanent creature : creatures) { for (Permanent creature : creatures) {
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature.getId())); effect.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
applied = true; applied = true;
} }

View file

@ -100,11 +100,11 @@ class MoltenPrimordialEffect extends OneShotEffect {
Permanent targetCreature = game.getPermanent(target.getFirstTarget()); Permanent targetCreature = game.getPermanent(target.getFirstTarget());
if (targetCreature != null) { if (targetCreature != null) {
ContinuousEffect effect1 = new GainControlTargetEffect(Duration.EndOfTurn); ContinuousEffect effect1 = new GainControlTargetEffect(Duration.EndOfTurn);
effect1.setTargetPointer(new FixedTarget(targetCreature.getId())); effect1.setTargetPointer(new FixedTarget(targetCreature.getId(), game));
game.addEffect(effect1, source); game.addEffect(effect1, source);
ContinuousEffect effect2 = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); ContinuousEffect effect2 = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect2.setTargetPointer(new FixedTarget(targetCreature.getId())); effect2.setTargetPointer(new FixedTarget(targetCreature.getId(), game));
game.addEffect(effect2, source); game.addEffect(effect2, source);
targetCreature.untap(game); targetCreature.untap(game);

View file

@ -81,7 +81,7 @@ class MyrBattlesphereTriggeredAbility extends TriggeredAbilityImpl {
Permanent source = game.getPermanent(event.getSourceId()); Permanent source = game.getPermanent(event.getSourceId());
if (source != null && source.getId().equals(this.getSourceId())) { if (source != null && source.getId().equals(this.getSourceId())) {
UUID defenderId = game.getCombat().getDefenderId(event.getSourceId()); UUID defenderId = game.getCombat().getDefenderId(event.getSourceId());
this.getEffects().get(0).setTargetPointer(new FixedTarget(defenderId)); this.getEffects().get(0).setTargetPointer(new FixedTarget(defenderId, game));
return true; return true;
} }
return false; return false;

View file

@ -88,7 +88,7 @@ class MysticReflectionEffect extends OneShotEffect {
// The zone is ALL because if the targeted permanent leaves the battlefield, the replacement effect still applies. // The zone is ALL because if the targeted permanent leaves the battlefield, the replacement effect still applies.
SimpleStaticAbility staticAbilityOnCard = new SimpleStaticAbility(Zone.ALL, new MysticReflectionReplacementEffect(watcher.getEnteredThisTurn(), source.getSourceId().toString())); SimpleStaticAbility staticAbilityOnCard = new SimpleStaticAbility(Zone.ALL, new MysticReflectionReplacementEffect(watcher.getEnteredThisTurn(), source.getSourceId().toString()));
MysticReflectionGainAbilityEffect gainAbilityEffect = new MysticReflectionGainAbilityEffect(staticAbilityOnCard); MysticReflectionGainAbilityEffect gainAbilityEffect = new MysticReflectionGainAbilityEffect(staticAbilityOnCard);
gainAbilityEffect.setTargetPointer(new FixedTarget(targetedPermanent.getMainCard().getId())); gainAbilityEffect.setTargetPointer(new FixedTarget(targetedPermanent.getMainCard().getId(), game));
game.addEffect(gainAbilityEffect, source); game.addEffect(gainAbilityEffect, source);
return true; return true;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.n; package mage.cards.n;
import mage.MageObject; import mage.MageObject;
@ -88,13 +87,14 @@ class NecromanticSelectionEffect extends OneShotEffect {
} }
filter.add(Predicates.or(cardIdPredicates)); filter.add(Predicates.or(cardIdPredicates));
Target target = new TargetCardInGraveyard(filter); Target target = new TargetCardInGraveyard(filter);
if (controller.chooseTarget(outcome, target, source, game)) { target.setNotTarget(true);
if (controller.chooseTarget(Outcome.Benefit, target, source, game)) {
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card != null) { if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game); controller.moveCards(card, Zone.BATTLEFIELD, source, game);
ContinuousEffect effect = new BecomesBlackZombieAdditionEffect(); ContinuousEffect effect = new BecomesBlackZombieAdditionEffect();
effect.setText("It's a black Zombie in addition to its other colors and types"); effect.setText("It's a black Zombie in addition to its other colors and types");
effect.setTargetPointer(new FixedTarget(card.getId())); effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
} }
} }

View file

@ -1,4 +1,3 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID; import java.util.UUID;
@ -17,7 +16,6 @@ import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.events.DamagedPlayerEvent; import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
@ -28,10 +26,9 @@ import mage.target.targetpointer.FixedTarget;
public final class NecropolisRegent extends CardImpl { public final class NecropolisRegent extends CardImpl {
public NecropolisRegent(UUID ownerId, CardSetInfo setInfo) { public NecropolisRegent(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}{B}");
this.subtype.add(SubType.VAMPIRE); this.subtype.add(SubType.VAMPIRE);
this.power = new MageInt(6); this.power = new MageInt(6);
this.toughness = new MageInt(5); this.toughness = new MageInt(5);
@ -79,7 +76,7 @@ class NecropolisRegentTriggeredAbility extends TriggeredAbilityImpl {
if (creature != null && creature.isControlledBy(controllerId)) { if (creature != null && creature.isControlledBy(controllerId)) {
this.getEffects().clear(); this.getEffects().clear();
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(event.getAmount())); Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(event.getAmount()));
effect.setTargetPointer(new FixedTarget(creature.getId())); effect.setTargetPointer(new FixedTarget(creature.getId(), game));
this.addEffect(effect); this.addEffect(effect);
return true; return true;
} }
@ -91,4 +88,4 @@ class NecropolisRegentTriggeredAbility extends TriggeredAbilityImpl {
public String getRule() { public String getRule() {
return "Whenever a creature you control deals combat damage to a player, put that many +1/+1 counters on it."; return "Whenever a creature you control deals combat damage to a player, put that many +1/+1 counters on it.";
} }
} }

View file

@ -1,4 +1,3 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID; import java.util.UUID;
@ -102,7 +101,7 @@ class NettlingImpDelayedDestroyEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
DestroyTargetEffect effect = new DestroyTargetEffect(); DestroyTargetEffect effect = new DestroyTargetEffect();
effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility
= new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.ALL, effect, TargetController.ANY, new InvertCondition(TargetAttackedThisTurnCondition.instance)); = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.ALL, effect, TargetController.ANY, new InvertCondition(TargetAttackedThisTurnCondition.instance));
delayedAbility.getDuration(); delayedAbility.getDuration();

View file

@ -102,7 +102,7 @@ class NorrittDelayedDestroyEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
DestroyTargetEffect effect = new DestroyTargetEffect(); DestroyTargetEffect effect = new DestroyTargetEffect();
effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility
= new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.ALL, effect, TargetController.ANY, new InvertCondition(TargetAttackedThisTurnCondition.instance)); = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.ALL, effect, TargetController.ANY, new InvertCondition(TargetAttackedThisTurnCondition.instance));
delayedAbility.getDuration(); delayedAbility.getDuration();

View file

@ -1,4 +1,3 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID; import java.util.UUID;
@ -33,7 +32,7 @@ import mage.target.targetpointer.FixedTarget;
* @author fireshoes * @author fireshoes
*/ */
public final class NoyanDarRoilShaper extends CardImpl { public final class NoyanDarRoilShaper extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery card"); private static final FilterSpell filter = new FilterSpell("instant or sorcery card");
static { static {
@ -43,7 +42,7 @@ public final class NoyanDarRoilShaper extends CardImpl {
} }
public NoyanDarRoilShaper(UUID ownerId, CardSetInfo setInfo) { public NoyanDarRoilShaper(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{U}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.MERFOLK); this.subtype.add(SubType.MERFOLK);
this.subtype.add(SubType.ALLY); this.subtype.add(SubType.ALLY);
@ -90,8 +89,8 @@ class NoyanDarEffect extends OneShotEffect {
targetId = target.getFirstTarget(); targetId = target.getFirstTarget();
} }
if (targetId != null) { if (targetId != null) {
FixedTarget fixedTarget = new FixedTarget(targetId); FixedTarget fixedTarget = new FixedTarget(targetId, game);
ContinuousEffect continuousEffect = new BecomesCreatureTargetEffect(new AwakenElementalToken(), false, true, Duration.Custom); ContinuousEffect continuousEffect = new BecomesCreatureTargetEffect(new AwakenElementalToken(), false, true, Duration.EndOfGame);
continuousEffect.setTargetPointer(fixedTarget); continuousEffect.setTargetPointer(fixedTarget);
game.addEffect(continuousEffect, source); game.addEffect(continuousEffect, source);
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(3)); Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(3));
@ -102,7 +101,6 @@ class NoyanDarEffect extends OneShotEffect {
} }
} }
class AwakenElementalToken extends TokenImpl { class AwakenElementalToken extends TokenImpl {
public AwakenElementalToken() { public AwakenElementalToken() {
@ -115,6 +113,7 @@ class AwakenElementalToken extends TokenImpl {
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
} }
public AwakenElementalToken(final AwakenElementalToken token) { public AwakenElementalToken(final AwakenElementalToken token) {
super(token); super(token);
} }

View file

@ -66,9 +66,9 @@ class OracleEnVecEffect extends OneShotEffect {
OracleEnVecEffect() { OracleEnVecEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
this.staticText = "Target opponent chooses any number of creatures they control. During that player's next turn, " + this.staticText = "Target opponent chooses any number of creatures they control. During that player's next turn, "
"the chosen creatures attack if able, and other creatures can't attack. At the beginning of that turn's end step, " + + "the chosen creatures attack if able, and other creatures can't attack. At the beginning of that turn's end step, "
"destroy each of the chosen creatures that didn't attack this turn"; + "destroy each of the chosen creatures that didn't attack this turn";
} }
OracleEnVecEffect(final OracleEnVecEffect effect) { OracleEnVecEffect(final OracleEnVecEffect effect) {
@ -270,7 +270,7 @@ class OracleEnVecDestroyEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(targetId); Permanent permanent = game.getPermanent(targetId);
if (permanent != null && !watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game))) { if (permanent != null && !watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game))) {
Effect effect = new DestroyTargetEffect(); Effect effect = new DestroyTargetEffect();
effect.setTargetPointer(new FixedTarget(targetId)); effect.setTargetPointer(new FixedTarget(targetId, game));
effect.apply(game, source); effect.apply(game, source);
} }
} }

View file

@ -1,4 +1,3 @@
package mage.cards.o; package mage.cards.o;
import java.util.HashMap; import java.util.HashMap;
@ -116,7 +115,7 @@ class OrderOfSuccessionEffect extends OneShotEffect {
Permanent creature = game.getPermanent(entry.getValue()); Permanent creature = game.getPermanent(entry.getValue());
if (creature != null) { if (creature != null) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame, player.getId()); ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame, player.getId());
effect.setTargetPointer(new FixedTarget(creature.getId())); effect.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
game.informPlayers(new StringBuilder(player.getLogName()).append(" gains control of ").append(creature.getName()).toString()); game.informPlayers(new StringBuilder(player.getLogName()).append(" gains control of ").append(creature.getName()).toString());
} }

View file

@ -1,4 +1,3 @@
package mage.cards.p; package mage.cards.p;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -66,12 +65,13 @@ class PacksDisdainEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId())); Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
if (player != null && player.choose(Outcome.UnboostCreature, typeChoice, game)) { if (player != null
&& player.choose(Outcome.UnboostCreature, typeChoice, game)) {
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(); FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
filter.add(SubType.byDescription(typeChoice.getChoice()).getPredicate()); filter.add(SubType.byDescription(typeChoice.getChoice()).getPredicate());
DynamicValue negativePermanentsCount = new PermanentsOnBattlefieldCount(filter, -1); DynamicValue negativePermanentsCount = new PermanentsOnBattlefieldCount(filter, -1);
ContinuousEffect effect = new BoostTargetEffect(negativePermanentsCount, negativePermanentsCount, Duration.EndOfTurn, true); ContinuousEffect effect = new BoostTargetEffect(negativePermanentsCount, negativePermanentsCount, Duration.EndOfTurn, true);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
return true; return true;
} }

View file

@ -97,7 +97,7 @@ class ParoxysmEffect extends OneShotEffect {
creatureAttachedTo.destroy(source, game, false); creatureAttachedTo.destroy(source, game, false);
} else { } else {
ContinuousEffect effect = new BoostTargetEffect(3, 3, Duration.EndOfTurn); ContinuousEffect effect = new BoostTargetEffect(3, 3, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creatureAttachedTo.getId())); effect.setTargetPointer(new FixedTarget(creatureAttachedTo.getId(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
} }
return true; return true;

View file

@ -1,4 +1,3 @@
package mage.cards.p; package mage.cards.p;
import java.util.UUID; import java.util.UUID;
@ -99,9 +98,10 @@ class PatronOfTheVeinCreatureDiesTriggeredAbility extends TriggeredAbilityImpl {
if (((ZoneChangeEvent) event).isDiesEvent()) { if (((ZoneChangeEvent) event).isDiesEvent()) {
if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
Card creature = game.getPermanentOrLKIBattlefield(event.getTargetId()); Card creature = game.getPermanentOrLKIBattlefield(event.getTargetId());
if (creature != null && creature.isCreature(game)) { if (creature != null
&& creature.isCreature(game)) {
for (Effect effect : this.getEffects()) { for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(creature.getId())); effect.setTargetPointer(new FixedTarget(creature.getId(), game));
} }
return true; return true;
} }
@ -141,7 +141,7 @@ class PatronOfTheVeinExileCreatureEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if(controller == null){ if (controller == null) {
return false; return false;
} }
MageObject sourceObject = source.getSourceObject(game); MageObject sourceObject = source.getSourceObject(game);
@ -149,7 +149,7 @@ class PatronOfTheVeinExileCreatureEffect extends OneShotEffect {
if (card != null) { if (card != null) {
Effect effect = new ExileTargetEffect(); Effect effect = new ExileTargetEffect();
effect.setTargetPointer(new FixedTarget(card.getId())); effect.setTargetPointer(new FixedTarget(card.getId(), game));
effect.apply(game, source); effect.apply(game, source);
} }

View file

@ -25,7 +25,6 @@ import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ToughnessPredicate; import mage.filter.predicate.mageobject.ToughnessPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
@ -88,15 +87,15 @@ class PhantasmalMountEffect extends OneShotEffect {
Permanent targetCreature = game.getPermanent(source.getFirstTarget()); Permanent targetCreature = game.getPermanent(source.getFirstTarget());
if (targetCreature != null) { if (targetCreature != null) {
ContinuousEffect effect = new BoostTargetEffect(1, 1, Duration.EndOfTurn); ContinuousEffect effect = new BoostTargetEffect(1, 1, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
Effect sacrificeCreatureEffect = new SacrificeTargetEffect(); Effect sacrificeCreatureEffect = new SacrificeTargetEffect();
Effect sacrificePhantasmalMountEffect = new SacrificeTargetEffect(); Effect sacrificePhantasmalMountEffect = new SacrificeTargetEffect();
ContinuousEffect gainAbility = new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn); ContinuousEffect gainAbility = new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn);
gainAbility.setTargetPointer(new FixedTarget(source.getFirstTarget())); gainAbility.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
game.addEffect(gainAbility, source); game.addEffect(gainAbility, source);
sacrificeCreatureEffect.setTargetPointer(new FixedTarget(source.getFirstTarget())); sacrificeCreatureEffect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
sacrificePhantasmalMountEffect.setTargetPointer(new FixedTarget(source.getSourceId())); sacrificePhantasmalMountEffect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
DelayedTriggeredAbility dTA = new PhantasmalMountDelayedTriggeredAbility( DelayedTriggeredAbility dTA = new PhantasmalMountDelayedTriggeredAbility(
sacrificeCreatureEffect, sacrificeCreatureEffect,
source.getSourceId()); source.getSourceId());

View file

@ -80,7 +80,7 @@ class PreacherEffect extends OneShotEffect {
new GainControlTargetEffect(Duration.Custom), new GainControlTargetEffect(Duration.Custom),
sourceTappedCondition, sourceTappedCondition,
"Gain control of target creature of an opponent's choice that they control for as long as {this} remains tapped"); "Gain control of target creature of an opponent's choice that they control for as long as {this} remains tapped");
effect.setTargetPointer(new FixedTarget(targetPermanent.getId())); effect.setTargetPointer(new FixedTarget(targetPermanent.getId(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
return true; return true;
} }

View file

@ -1,5 +1,3 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
@ -18,7 +16,6 @@ import mage.constants.SuperType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
/** /**
@ -28,8 +25,7 @@ import mage.target.targetpointer.FixedTarget;
public final class RafiqOfTheMany extends CardImpl { public final class RafiqOfTheMany extends CardImpl {
public RafiqOfTheMany(UUID ownerId, CardSetInfo setInfo) { public RafiqOfTheMany(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{W}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{W}{U}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
@ -77,10 +73,10 @@ class RafiqOfTheManyAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (game.isActivePlayer(this.controllerId) ) { if (game.isActivePlayer(this.controllerId)) {
if (game.getCombat().attacksAlone()) { if (game.getCombat().attacksAlone()) {
for (Effect effect: this.getEffects()) { for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0))); effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0), game));
} }
return true; return true;
} }

View file

@ -144,7 +144,7 @@ class RagingRiverEffect extends OneShotEffect {
} }
} }
RestrictionEffect effect = new CantBeBlockedByAllTargetEffect(filter, Duration.EndOfCombat); RestrictionEffect effect = new CantBeBlockedByAllTargetEffect(filter, Duration.EndOfCombat);
effect.setTargetPointer(new FixedTarget(attacker.getId())); effect.setTargetPointer(new FixedTarget(attacker.getId(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
} }
} }

View file

@ -86,8 +86,8 @@ class RichesEffect extends OneShotEffect {
// Has to be done as a separate loop in case there's a situation where one creature's // Has to be done as a separate loop in case there's a situation where one creature's
// controller depends on another creatures controller. // controller depends on another creatures controller.
for (UUID target : creaturesToSteal) { for (UUID target : creaturesToSteal) {
GainControlTargetEffect eff = new GainControlTargetEffect(Duration.Custom, true); GainControlTargetEffect eff = new GainControlTargetEffect(Duration.EndOfGame, true);
eff.setTargetPointer(new FixedTarget(target)); eff.setTargetPointer(new FixedTarget(target, game));
game.addEffect(eff, source); game.addEffect(eff, source);
} }

View file

@ -1,4 +1,3 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
@ -12,7 +11,6 @@ import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
@ -23,8 +21,7 @@ import mage.target.targetpointer.FixedTarget;
public final class RakingCanopy extends CardImpl { public final class RakingCanopy extends CardImpl {
public RakingCanopy(UUID ownerId, CardSetInfo setInfo) { public RakingCanopy(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}{G}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{G}");
// Whenever a creature with flying attacks you, Raking Canopy deals 4 damage to it. // Whenever a creature with flying attacks you, Raking Canopy deals 4 damage to it.
this.addAbility(new RakingCanopyTriggeredAbility()); this.addAbility(new RakingCanopyTriggeredAbility());
@ -63,12 +60,13 @@ class RakingCanopyTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Permanent attacker = game.getPermanent(event.getSourceId()); Permanent attacker = game.getPermanent(event.getSourceId());
if (attacker == null || !attacker.getAbilities().contains(FlyingAbility.getInstance())) { if (attacker == null
|| !attacker.getAbilities().contains(FlyingAbility.getInstance())) {
return false; return false;
} }
if (event.getTargetId().equals(this.getControllerId())) { if (event.getTargetId().equals(this.getControllerId())) {
for (Effect effect : this.getEffects()) { for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(attacker.getId())); effect.setTargetPointer(new FixedTarget(attacker.getId(), game));
} }
return true; return true;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.r; package mage.cards.r;
import java.util.HashSet; import java.util.HashSet;
@ -32,7 +31,7 @@ import mage.target.targetpointer.FixedTarget;
public final class ReinsOfPower extends CardImpl { public final class ReinsOfPower extends CardImpl {
public ReinsOfPower(UUID ownerId, CardSetInfo setInfo) { public ReinsOfPower(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}{U}");
// Untap all creatures you control and all creatures target opponent controls. You and that opponent each gain control of all creatures the other controls until end of turn. Those creatures gain haste until end of turn. // Untap all creatures you control and all creatures target opponent controls. You and that opponent each gain control of all creatures the other controls until end of turn. Those creatures gain haste until end of turn.
this.getSpellAbility().addEffect(new ReinsOfPowerEffect()); this.getSpellAbility().addEffect(new ReinsOfPowerEffect());
@ -50,21 +49,21 @@ public final class ReinsOfPower extends CardImpl {
} }
class ReinsOfPowerEffect extends OneShotEffect { class ReinsOfPowerEffect extends OneShotEffect {
ReinsOfPowerEffect() { ReinsOfPowerEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
this.staticText = "Untap all creatures you control and all creatures target opponent controls. You and that opponent each gain control of all creatures the other controls until end of turn. Those creatures gain haste until end of turn"; this.staticText = "Untap all creatures you control and all creatures target opponent controls. You and that opponent each gain control of all creatures the other controls until end of turn. Those creatures gain haste until end of turn";
} }
ReinsOfPowerEffect(final ReinsOfPowerEffect effect) { ReinsOfPowerEffect(final ReinsOfPowerEffect effect) {
super(effect); super(effect);
} }
@Override @Override
public ReinsOfPowerEffect copy() { public ReinsOfPowerEffect copy() {
return new ReinsOfPowerEffect(this); return new ReinsOfPowerEffect(this);
} }
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
UUID opponentId = this.getTargetPointer().getFirst(game, source); UUID opponentId = this.getTargetPointer().getFirst(game, source);
@ -73,7 +72,7 @@ class ReinsOfPowerEffect extends OneShotEffect {
FilterCreaturePermanent filter = new FilterCreaturePermanent(); FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(Predicates.or(new ControllerIdPredicate(source.getControllerId()), new ControllerIdPredicate(opponentId))); filter.add(Predicates.or(new ControllerIdPredicate(source.getControllerId()), new ControllerIdPredicate(opponentId)));
new UntapAllEffect(filter).apply(game, source); new UntapAllEffect(filter).apply(game, source);
// You and that opponent each gain control of all creatures the other controls until end of turn. // You and that opponent each gain control of all creatures the other controls until end of turn.
Set<UUID> yourCreatures = new HashSet<>(); Set<UUID> yourCreatures = new HashSet<>();
Set<UUID> opponentCreatures = new HashSet<>(); Set<UUID> opponentCreatures = new HashSet<>();
@ -87,18 +86,18 @@ class ReinsOfPowerEffect extends OneShotEffect {
} }
for (UUID creatureId : yourCreatures) { for (UUID creatureId : yourCreatures) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn, opponentId); ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn, opponentId);
effect.setTargetPointer(new FixedTarget(creatureId)); effect.setTargetPointer(new FixedTarget(creatureId, game));
game.addEffect(effect, source); game.addEffect(effect, source);
} }
for (UUID creatureId : opponentCreatures) { for (UUID creatureId : opponentCreatures) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn); ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creatureId)); effect.setTargetPointer(new FixedTarget(creatureId, game));
game.addEffect(effect, source); game.addEffect(effect, source);
} }
// Those creatures gain haste until end of turn. // Those creatures gain haste until end of turn.
game.addEffect(new GainAbilityAllEffect(HasteAbility.getInstance(), Duration.EndOfTurn, filter), source); game.addEffect(new GainAbilityAllEffect(HasteAbility.getInstance(), Duration.EndOfTurn, filter), source);
return true; return true;
} }
return false; return false;

View file

@ -1,4 +1,3 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
@ -59,7 +58,6 @@ enum LostLifeCondition implements Condition {
instance; instance;
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class); PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class);
@ -92,7 +90,7 @@ class RevengeEffect extends OneShotEffect {
Permanent target = game.getPermanent(targetPointer.getFirst(game, source)); Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
if (target != null && target.isCreature(game)) { if (target != null && target.isCreature(game)) {
ContinuousEffect effect = new BoostTargetEffect(4, 0, Duration.EndOfTurn); ContinuousEffect effect = new BoostTargetEffect(4, 0, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(target.getId())); effect.setTargetPointer(new FixedTarget(target.getId(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
return true; return true;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
@ -34,8 +33,7 @@ public final class RideDown extends CardImpl {
} }
public RideDown(UUID ownerId, CardSetInfo setInfo) { public RideDown(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{R}{W}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}{W}");
// Destroy target blocking creature. Creatures that were blocked by that creature this combat gain trample until end of turn. // Destroy target blocking creature. Creatures that were blocked by that creature this combat gain trample until end of turn.
this.getSpellAbility().addEffect(new RideDownEffect()); this.getSpellAbility().addEffect(new RideDownEffect());
@ -77,9 +75,9 @@ class RideDownEffect extends OneShotEffect {
if (blockingCreature != null) { if (blockingCreature != null) {
for (CombatGroup combatGroup : game.getCombat().getGroups()) { for (CombatGroup combatGroup : game.getCombat().getGroups()) {
if (combatGroup.getBlockers().contains(blockingCreature.getId())) { if (combatGroup.getBlockers().contains(blockingCreature.getId())) {
for (UUID attackerId: combatGroup.getAttackers()) { for (UUID attackerId : combatGroup.getAttackers()) {
ContinuousEffect effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn); ContinuousEffect effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(attackerId)); effect.setTargetPointer(new FixedTarget(attackerId, game));
game.addEffect(effect, source); game.addEffect(effect, source);
} }
break; break;

View file

@ -11,7 +11,6 @@ import mage.constants.Duration;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
@ -67,7 +66,7 @@ class RighteousIndignationTriggeredAbility extends TriggeredAbilityImpl {
if (blocked != null) { if (blocked != null) {
if (blocked.getColor(game).contains(ObjectColor.BLACK) if (blocked.getColor(game).contains(ObjectColor.BLACK)
|| blocked.getColor(game).contains(ObjectColor.RED)) { || blocked.getColor(game).contains(ObjectColor.RED)) {
getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId())); getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId(), game));
return true; return true;
} }
} }

View file

@ -1,4 +1,3 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
@ -72,21 +71,25 @@ class RiskyMoveGetControlEffect extends OneShotEffect {
MageObject sourceObject = source.getSourceObject(game); MageObject sourceObject = source.getSourceObject(game);
Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Player newController = game.getPlayer(getTargetPointer().getFirst(game, source)); Player newController = game.getPlayer(getTargetPointer().getFirst(game, source));
if (newController != null && controller != null && sourceObject != null && sourceObject.equals(sourcePermanent)) { if (newController != null
&& controller != null
&& sourceObject != null
&& sourceObject.equals(sourcePermanent)) {
// remove old control effects of the same player // remove old control effects of the same player
for (ContinuousEffect effect : game.getState().getContinuousEffects().getLayeredEffects(game)) { for (ContinuousEffect effect : game.getState().getContinuousEffects().getLayeredEffects(game)) {
if (effect instanceof GainControlTargetEffect) { if (effect instanceof GainControlTargetEffect) {
UUID checkId = (UUID) effect.getValue("RiskyMoveSourceId"); UUID checkId = (UUID) effect.getValue("RiskyMoveSourceId");
UUID controllerId = (UUID) effect.getValue("RiskyMoveControllerId"); UUID controllerId = (UUID) effect.getValue("RiskyMoveControllerId");
if (source.getSourceId().equals(checkId) && newController.getId().equals(controllerId)) { if (source.getSourceId().equals(checkId)
&& newController.getId().equals(controllerId)) {
effect.discard(); effect.discard();
} }
} }
} }
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, true, newController.getId()); ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame, true, newController.getId());
effect.setValue("RiskyMoveSourceId", source.getSourceId()); effect.setValue("RiskyMoveSourceId", source.getSourceId());
effect.setValue("RiskyMoveControllerId", newController.getId()); effect.setValue("RiskyMoveControllerId", newController.getId());
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId())); effect.setTargetPointer(new FixedTarget(sourcePermanent.getId(), game));
effect.setText("and gains control of it"); effect.setText("and gains control of it");
game.addEffect(effect, source); game.addEffect(effect, source);
return true; return true;
@ -122,11 +125,10 @@ class RiskyMoveTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public String getTriggerPhrase() { public String getTriggerPhrase() {
return "When you gain control of {this} from another player, " ; return "When you gain control of {this} from another player, ";
} }
} }
class RiskyMoveFlipCoinEffect extends OneShotEffect { class RiskyMoveFlipCoinEffect extends OneShotEffect {
public RiskyMoveFlipCoinEffect() { public RiskyMoveFlipCoinEffect() {
@ -149,14 +151,18 @@ class RiskyMoveFlipCoinEffect extends OneShotEffect {
if (controller != null) { if (controller != null) {
Target target1 = new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent(), true); Target target1 = new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent(), true);
Target target2 = new TargetOpponent(true); Target target2 = new TargetOpponent(true);
if (target1.canChoose(source.getSourceId(), controller.getId(), game)) { if (target1.canChoose(source.getSourceId(), controller.getId(), game)) {
while (!target1.isChosen() && target1.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { while (!target1.isChosen()
&& target1.canChoose(source.getSourceId(), controller.getId(), game)
&& controller.canRespond()) {
controller.chooseTarget(outcome, target1, source, game); controller.chooseTarget(outcome, target1, source, game);
} }
} }
if (target2.canChoose(source.getSourceId(), controller.getId(), game)) { if (target2.canChoose(source.getSourceId(), controller.getId(), game)) {
while (!target2.isChosen() && target2.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { while (!target2.isChosen()
&& target2.canChoose(source.getSourceId(), controller.getId(), game)
&& controller.canRespond()) {
controller.chooseTarget(outcome, target2, source, game); controller.chooseTarget(outcome, target2, source, game);
} }
} }
@ -164,7 +170,7 @@ class RiskyMoveFlipCoinEffect extends OneShotEffect {
Player chosenOpponent = game.getPlayer(target2.getFirstTarget()); Player chosenOpponent = game.getPlayer(target2.getFirstTarget());
if (!controller.flipCoin(source, game, true)) { if (!controller.flipCoin(source, game, true)) {
if (permanent != null && chosenOpponent != null) { if (permanent != null && chosenOpponent != null) {
ContinuousEffect effect = new RiskyMoveCreatureGainControlEffect(Duration.Custom, chosenOpponent.getId()); ContinuousEffect effect = new RiskyMoveCreatureGainControlEffect(Duration.EndOfGame, chosenOpponent.getId());
effect.setTargetPointer(new FixedTarget(permanent, game)); effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source); game.addEffect(effect, source);
game.informPlayers(chosenOpponent.getLogName() + " has gained control of " + permanent.getLogName()); game.informPlayers(chosenOpponent.getLogName() + " has gained control of " + permanent.getLogName());

View file

@ -1,4 +1,3 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID; import java.util.UUID;
@ -30,7 +29,7 @@ import mage.target.targetpointer.FixedTarget;
public final class SereneMaster extends CardImpl { public final class SereneMaster extends CardImpl {
public SereneMaster(UUID ownerId, CardSetInfo setInfo) { public SereneMaster(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.MONK); this.subtype.add(SubType.MONK);
@ -83,10 +82,10 @@ class SereneMasterEffect extends OneShotEffect {
int newSourcePower = attackingCreature.getPower().getValue(); int newSourcePower = attackingCreature.getPower().getValue();
int newAttackerPower = sourceCreature.getPower().getValue(); int newAttackerPower = sourceCreature.getPower().getValue();
ContinuousEffect effect = new SetPowerToughnessTargetEffect(newSourcePower, sourceCreature.getToughness().getValue(), Duration.EndOfCombat); ContinuousEffect effect = new SetPowerToughnessTargetEffect(newSourcePower, sourceCreature.getToughness().getValue(), Duration.EndOfCombat);
effect.setTargetPointer(new FixedTarget(source.getSourceId())); effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
effect = new SetPowerToughnessTargetEffect(newAttackerPower, attackingCreature.getToughness().getValue(), Duration.EndOfCombat); effect = new SetPowerToughnessTargetEffect(newAttackerPower, attackingCreature.getToughness().getValue(), Duration.EndOfCombat);
effect.setTargetPointer(new FixedTarget(attackingCreature.getId())); effect.setTargetPointer(new FixedTarget(attackingCreature.getId(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
return true; return true;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID; import java.util.UUID;
@ -71,7 +70,7 @@ class MayRemoveM1M1CouterTargetEffect extends OneShotEffect {
if (target.getCounters(game).getCount(CounterType.M1M1) > 0) { if (target.getCounters(game).getCount(CounterType.M1M1) > 0) {
if (controller.chooseUse(outcome, "Remove a -1/-1 counter from " + target.getIdName() + "?", source, game)) { if (controller.chooseUse(outcome, "Remove a -1/-1 counter from " + target.getIdName() + "?", source, game)) {
Effect effect = new RemoveCounterTargetEffect(CounterType.M1M1.createInstance()); Effect effect = new RemoveCounterTargetEffect(CounterType.M1M1.createInstance());
effect.setTargetPointer(new FixedTarget(target.getId())); effect.setTargetPointer(new FixedTarget(target.getId(), game));
effect.apply(game, source); effect.apply(game, source);
} }
} }
@ -84,4 +83,3 @@ class MayRemoveM1M1CouterTargetEffect extends OneShotEffect {
return new MayRemoveM1M1CouterTargetEffect(this); return new MayRemoveM1M1CouterTargetEffect(this);
} }
} }

View file

@ -1,4 +1,3 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID; import java.util.UUID;
@ -91,7 +90,7 @@ class ShowOfDominanceEffect extends OneShotEffect {
} }
} }
if (selectedCreature != null) { if (selectedCreature != null) {
FixedTarget target = new FixedTarget(selectedCreature.getId()); FixedTarget target = new FixedTarget(selectedCreature.getId(), game);
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(4)); Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(4));
effect.setTargetPointer(target); effect.setTargetPointer(target);

View file

@ -1,4 +1,3 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID; import java.util.UUID;
@ -14,7 +13,6 @@ import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
@ -25,12 +23,10 @@ import mage.target.targetpointer.FixedTarget;
public final class SigilCaptain extends CardImpl { public final class SigilCaptain extends CardImpl {
public SigilCaptain(UUID ownerId, CardSetInfo setInfo) { public SigilCaptain(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{W}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{W}{W}");
this.subtype.add(SubType.RHINO); this.subtype.add(SubType.RHINO);
this.subtype.add(SubType.SOLDIER); this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(3); this.power = new MageInt(3);
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
@ -73,7 +69,7 @@ class SigilCaptainTriggeredAbility extends TriggeredAbilityImpl {
&& permanent.getPower().getValue() == 1 && permanent.getPower().getValue() == 1
&& permanent.getToughness().getValue() == 1) { && permanent.getToughness().getValue() == 1) {
for (Effect effect : this.getEffects()) { for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId())); effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
} }
return true; return true;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID; import java.util.UUID;
@ -33,7 +32,7 @@ import mage.target.targetpointer.FixedTarget;
public final class SigilOfValor extends CardImpl { public final class SigilOfValor extends CardImpl {
public SigilOfValor(UUID ownerId, CardSetInfo setInfo) { public SigilOfValor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
this.subtype.add(SubType.EQUIPMENT); this.subtype.add(SubType.EQUIPMENT);
// Whenever equipped creature attacks alone, it gets +1/+1 until end of turn for each other creature you control. // Whenever equipped creature attacks alone, it gets +1/+1 until end of turn for each other creature you control.
@ -81,7 +80,7 @@ class SigilOfValorTriggeredAbility extends TriggeredAbilityImpl {
UUID attackerId = game.getCombat().getAttackers().get(0); UUID attackerId = game.getCombat().getAttackers().get(0);
if (equipment != null if (equipment != null
&& equipment.isAttachedTo(attackerId)) { && equipment.isAttachedTo(attackerId)) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(attackerId)); this.getEffects().get(0).setTargetPointer(new FixedTarget(attackerId, game));
return true; return true;
} }
} }

View file

@ -83,7 +83,7 @@ class CreaturesYouControlBecomesTargetTriggeredAbility extends TriggeredAbilityI
|| object.isSorcery(game)) { || object.isSorcery(game)) {
if (getTargets().isEmpty()) { if (getTargets().isEmpty()) {
for (Effect effect : getEffects()) { for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId())); effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
} }
} }
return true; return true;

View file

@ -102,7 +102,7 @@ class SkyfireKirinEffect extends OneShotEffect {
} }
if (targetCreature != null) { if (targetCreature != null) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn); ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(targetCreature.getId())); effect.setTargetPointer(new FixedTarget(targetCreature.getId(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
return true; return true;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID; import java.util.UUID;
@ -94,8 +93,8 @@ class SokenzanRenegadeEffect extends OneShotEffect {
} }
} }
if (newController != null) { if (newController != null) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, newController.getId()); ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame, newController.getId());
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId())); effect.setTargetPointer(new FixedTarget(sourcePermanent.getId(), game));
game.addEffect(effect, source); game.addEffect(effect, source);
if (!source.isControlledBy(newController.getId())) { if (!source.isControlledBy(newController.getId())) {
game.informPlayers(newController.getLogName() + " got control of " + sourcePermanent.getLogName()); game.informPlayers(newController.getLogName() + " got control of " + sourcePermanent.getLogName());

View file

@ -1,4 +1,3 @@
package mage.cards.s; package mage.cards.s;
import mage.MageInt; import mage.MageInt;
@ -71,7 +70,7 @@ class SoulScarMageDamageReplacementEffect extends ReplacementEffectImpl {
Permanent toGetCounters = game.getPermanent(event.getTargetId()); Permanent toGetCounters = game.getPermanent(event.getTargetId());
if (toGetCounters != null) { if (toGetCounters != null) {
AddCountersTargetEffect addCounters = new AddCountersTargetEffect(CounterType.M1M1.createInstance(), StaticValue.get(event.getAmount())); AddCountersTargetEffect addCounters = new AddCountersTargetEffect(CounterType.M1M1.createInstance(), StaticValue.get(event.getAmount()));
addCounters.setTargetPointer(new FixedTarget(toGetCounters.getId())); addCounters.setTargetPointer(new FixedTarget(toGetCounters.getId(), game));
addCounters.apply(game, source); addCounters.apply(game, source);
return true; return true;
} }

View file

@ -77,7 +77,7 @@ class CreatureControlledAttacksAloneTriggeredAbility extends TriggeredAbilityImp
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (game.isActivePlayer(this.controllerId)) { if (game.isActivePlayer(this.controllerId)) {
if (game.getCombat().attacksAlone()) { if (game.getCombat().attacksAlone()) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0))); this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0), game));
return true; return true;
} }
} }

View file

@ -1,4 +1,3 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID; import java.util.UUID;
@ -17,7 +16,6 @@ import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -30,7 +28,7 @@ import mage.target.targetpointer.FixedTarget;
public final class SpinalGraft extends CardImpl { public final class SpinalGraft extends CardImpl {
public SpinalGraft(UUID ownerId, CardSetInfo setInfo) { public SpinalGraft(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{B}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}");
this.subtype.add(SubType.AURA); this.subtype.add(SubType.AURA);
// Enchant creature // Enchant creature
@ -38,10 +36,10 @@ public final class SpinalGraft extends CardImpl {
this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
this.addAbility(new EnchantAbility(auraTarget.getTargetName())); this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// Enchanted creature gets +3/+3. // Enchanted creature gets +3/+3.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(3, 3, Duration.WhileOnBattlefield))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(3, 3, Duration.WhileOnBattlefield)));
// When enchanted creature becomes the target of a spell or ability, destroy that creature. It can't be regenerated. // When enchanted creature becomes the target of a spell or ability, destroy that creature. It can't be regenerated.
this.addAbility(new SpinalGraftTriggeredAbility()); this.addAbility(new SpinalGraftTriggeredAbility());
} }
@ -57,15 +55,15 @@ public final class SpinalGraft extends CardImpl {
} }
class SpinalGraftTriggeredAbility extends TriggeredAbilityImpl { class SpinalGraftTriggeredAbility extends TriggeredAbilityImpl {
public SpinalGraftTriggeredAbility() { public SpinalGraftTriggeredAbility() {
super(Zone.BATTLEFIELD, new DestroyTargetEffect(true)); super(Zone.BATTLEFIELD, new DestroyTargetEffect(true));
} }
public SpinalGraftTriggeredAbility(final SpinalGraftTriggeredAbility ability) { public SpinalGraftTriggeredAbility(final SpinalGraftTriggeredAbility ability) {
super(ability); super(ability);
} }
@Override @Override
public SpinalGraftTriggeredAbility copy() { public SpinalGraftTriggeredAbility copy() {
return new SpinalGraftTriggeredAbility(this); return new SpinalGraftTriggeredAbility(this);
@ -75,20 +73,20 @@ class SpinalGraftTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkEventType(GameEvent event, Game game) { public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TARGETED; return event.getType() == GameEvent.EventType.TARGETED;
} }
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(sourceId); Permanent enchantment = game.getPermanent(sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) { if (enchantment != null && enchantment.getAttachedTo() != null) {
UUID enchanted = enchantment.getAttachedTo(); UUID enchanted = enchantment.getAttachedTo();
if (event.getTargetId().equals(enchanted)) { if (event.getTargetId().equals(enchanted)) {
getEffects().get(0).setTargetPointer(new FixedTarget(enchanted)); getEffects().get(0).setTargetPointer(new FixedTarget(enchanted, game));
return true; return true;
} }
} }
return false; return false;
} }
@Override @Override
public String getRule() { public String getRule() {
return "When enchanted creature becomes the target of a spell or ability, destroy that creature. It can't be regenerated."; return "When enchanted creature becomes the target of a spell or ability, destroy that creature. It can't be regenerated.";

View file

@ -1,4 +1,3 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID; import java.util.UUID;
@ -52,7 +51,7 @@ public final class Sporogenesis extends CardImpl {
this.addAbility(new SporogenesisTriggeredAbility()); this.addAbility(new SporogenesisTriggeredAbility());
// When Sporogenesis leaves the battlefield, remove all fungus counters from all creatures. // When Sporogenesis leaves the battlefield, remove all fungus counters from all creatures.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new SporogenesisRemoveCountersEffect(), false)); this.addAbility(new LeavesBattlefieldTriggeredAbility(new SporogenesisRemoveCountersEffect(), false));
} }
private Sporogenesis(final Sporogenesis card) { private Sporogenesis(final Sporogenesis card) {
@ -94,7 +93,7 @@ class SporogenesisTriggeredAbility extends TriggeredAbilityImpl {
&& permanent.isCreature(game) && permanent.isCreature(game)
&& permanent.getCounters(game).containsKey(CounterType.FUNGUS)) { && permanent.getCounters(game).containsKey(CounterType.FUNGUS)) {
Effect effect = this.getEffects().get(0); Effect effect = this.getEffects().get(0);
effect.setTargetPointer(new FixedTarget(event.getTargetId())); effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true; return true;
} }
} }

View file

@ -1,4 +1,3 @@
package mage.cards.s; package mage.cards.s;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
@ -71,7 +70,7 @@ class SwordOfKaldraTriggeredAbility extends TriggeredAbilityImpl {
if (equipment != null if (equipment != null
&& equipment.getAttachedTo() != null && equipment.getAttachedTo() != null
&& event.getSourceId().equals(equipment.getAttachedTo())) { && event.getSourceId().equals(equipment.getAttachedTo())) {
getEffects().setTargetPointer(new FixedTarget(event.getTargetId())); getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true; return true;
} }
return false; return false;
@ -79,7 +78,7 @@ class SwordOfKaldraTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public String getTriggerPhrase() { public String getTriggerPhrase() {
return "Whenever equipped creature deals damage to a creature, " ; return "Whenever equipped creature deals damage to a creature, ";
} }
} }