- refactoring related to #8375 "C" cards

This commit is contained in:
Jeff Wadsworth 2021-10-19 15:33:37 -05:00
parent 5b9477caae
commit 2e625cc5a5
25 changed files with 29 additions and 29 deletions

View file

@ -119,7 +119,7 @@ enum CallerOfTheHuntAdjuster implements CostAdjuster {
effectPowerToughness.setText("");
SimpleStaticAbility setPT = new SimpleStaticAbility(Zone.ALL, effectPowerToughness);
GainAbilityTargetEffect gainAbility = new GainAbilityTargetEffect(setPT, Duration.EndOfGame);
gainAbility.setTargetPointer(new FixedTarget(ability.getSourceId()));
gainAbility.setTargetPointer(new FixedTarget(ability.getSourceId(), game));
game.getState().addEffect(gainAbility, ability);
}
}

View file

@ -84,13 +84,13 @@ class CaptivatingGlanceEffect extends OneShotEffect {
if (enchantedCreature != null) {
if (clashResult) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, false, controller.getId());
effect.setTargetPointer(new FixedTarget(enchantedCreature.getId()));
effect.setTargetPointer(new FixedTarget(enchantedCreature.getId(), game));
game.addEffect(effect, source);
} else {
Player opponentWhomControllerClashedWith = game.getPlayer(targetPointer.getFirst(game, source));
if (opponentWhomControllerClashedWith != null) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, false, opponentWhomControllerClashedWith.getId());
effect.setTargetPointer(new FixedTarget(enchantedCreature.getId()));
effect.setTargetPointer(new FixedTarget(enchantedCreature.getId(), game));
game.addEffect(effect, source);
}
}

View file

@ -113,7 +113,7 @@ class CapturedByTheConsulateTriggeredAbility extends TriggeredAbilityImpl {
@Override
public String getTriggerPhrase() {
return "Whenever an opponent casts a spell, if it has a single target, " ;
return "Whenever an opponent casts a spell, if it has a single target, ";
}
@Override

View file

@ -73,7 +73,7 @@ class CemeteryPucaEffect extends OneShotEffect {
if (copyFromCreature != null) {
game.copyPermanent(Duration.WhileOnBattlefield, copyFromCreature, copyToCreature.getId(), source, new EmptyCopyApplier());
ContinuousEffect effect = new GainAbilityTargetEffect(new DiesCreatureTriggeredAbility(new DoIfCostPaid(new CemeteryPucaEffect(), new ManaCostsImpl("{1}")), false, new FilterCreaturePermanent("a creature"), true), Duration.WhileOnBattlefield);
effect.setTargetPointer(new FixedTarget(copyToCreature.getId()));
effect.setTargetPointer(new FixedTarget(copyToCreature.getId(), game));
game.addEffect(effect, source);
return true;
}

View file

@ -75,7 +75,7 @@ class ChainOfAcidEffect extends OneShotEffect {
Player affectedPlayer = game.getPlayer(permanent.getControllerId());
if (affectedPlayer != null) {
Effect effect = new DestroyTargetEffect();
effect.setTargetPointer(new FixedTarget(targetId));
effect.setTargetPointer(new FixedTarget(targetId, game));
effect.apply(game, source);
if (affectedPlayer.chooseUse(Outcome.Copy, "Copy the spell?", source, game)) {
Spell spell = game.getStack().getSpell(source.getSourceId());

View file

@ -64,7 +64,7 @@ class ChainOfSmogEffect extends OneShotEffect {
Player affectedPlayer = game.getPlayer(targetId);
if (affectedPlayer != null) {
Effect effect = new DiscardTargetEffect(2);
effect.setTargetPointer(new FixedTarget(targetId));
effect.setTargetPointer(new FixedTarget(targetId, game));
effect.apply(game, source);
if (affectedPlayer.chooseUse(Outcome.Copy, "Copy the spell?", source, game)) {
Spell spell = game.getStack().getSpell(source.getSourceId());

View file

@ -70,7 +70,7 @@ class ChainStasisEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
Effect effect = new MayTapOrUntapTargetEffect();
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
effect.apply(game, source);
Player player = game.getPlayer(permanent.getControllerId());
if (player == null) {

View file

@ -94,7 +94,7 @@ class ChandraPyromasterEffect1 extends OneShotEffect {
if (creature != null) {
creature.damage(1, source.getSourceId(), source, game, false, true);
ContinuousEffect effect = new CantBlockTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature.getId()));
effect.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(effect, source);
}
return true;

View file

@ -66,7 +66,7 @@ class ChemistersTrickEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, source.getControllerId(), source.getSourceId(), game)) {
AttacksIfAbleTargetEffect effect = new AttacksIfAbleTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature.getId()));
effect.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(effect, source);
}
return true;

View file

@ -80,7 +80,7 @@ class CircleOfFlameTriggeredAbility extends TriggeredAbilityImpl {
}
if (youOrYourPlaneswalker) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(attacker.getId()));
effect.setTargetPointer(new FixedTarget(attacker.getId(), game));
}
return true;
}

View file

@ -136,14 +136,14 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect {
if (player != null && permanent != null) {
if (player.chooseUse(Outcome.Neutral, "Remove a counter?", source, game)) {
RemoveCounterTargetEffect effect = new RemoveCounterTargetEffect();
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
effect.apply(game, source);
} else {
Counter counter = selectCounterType(game, source, permanent);
if (counter != null) {
AddCountersTargetEffect effect = new AddCountersTargetEffect(counter);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
effect.apply(game, source);
}
}
@ -155,13 +155,13 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect {
if (player.chooseUse(Outcome.Neutral, "Remove a counter?", source, game)) {
Counter counter = selectCounterType(game, source, card);
RemoveCounterTargetEffect effect = new RemoveCounterTargetEffect(counter);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
effect.apply(game, source);
} else {
Counter counter = selectCounterType(game, source, card);
if (counter != null) {
AddCountersTargetEffect effect = new AddCountersTargetEffect(counter);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
effect.apply(game, source);
}
}

View file

@ -170,7 +170,7 @@ class CodieVociferousCodexEffect extends OneShotEffect {
}
controller.moveCards(toCast, Zone.EXILED, source, game);
PlayFromNotOwnHandZoneTargetEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, TargetController.YOU, Duration.EndOfTurn, true);
effect.setTargetPointer(new FixedTarget(toCast.getId()));
effect.setTargetPointer(new FixedTarget(toCast.getId(), game));
game.addEffect(effect, source);
toExile.remove(toCast);
controller.putCardsOnBottomOfLibrary(toExile, game, source, false);

View file

@ -66,7 +66,7 @@ class CommuneWithLavaEffect extends OneShotEffect {
for (Card card : cards) {
ContinuousEffect effect = new CommuneWithLavaMayPlayEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source);
}

View file

@ -78,7 +78,7 @@ class ContemptEffect extends OneShotEffect {
if (attachedToPermanent != null) {
Effect effect = new ReturnToHandTargetEffect();
effect.setTargetPointer(new FixedTarget(
attachedToPermanent.getId())).setText("return "
attachedToPermanent.getId(), game)).setText("return "
+ attachedToPermanent.getName() + " to owner's hand.");
AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(effect);
game.addDelayedTriggeredAbility(ability, source);

View file

@ -55,7 +55,7 @@ class CowardiceTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isCreature(game)) {
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true;
}
return false;

View file

@ -64,7 +64,7 @@ public final class CragSaurian extends CardImpl {
Player newController = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (newController != null && controller != null && !controller.equals(newController)) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, newController.getId());
effect.setTargetPointer(new FixedTarget(source.getSourceId()));
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
game.addEffect(effect, source);
return true;
}

View file

@ -76,7 +76,7 @@ class CrashingBoarsEffect extends OneShotEffect {
Target target = new TargetControlledCreaturePermanent(1, 1, filter, true);
if (target.choose(Outcome.Neutral, defendingPlayer.getId(), source.getSourceId(), game)) {
RequirementEffect effect = new MustBeBlockedByTargetSourceEffect();
effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
game.addEffect(effect, source);
}
return true;

View file

@ -115,7 +115,7 @@ class CrownOfDoomEffect extends OneShotEffect {
&& newController != null
&& !Objects.equals(controller.getId(), newController.getId())) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, newController.getId());
effect.setTargetPointer(new FixedTarget(source.getSourceId()));
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
game.addEffect(effect, source);
return true;
}

View file

@ -70,7 +70,7 @@ class CrownOfEmpiresEffect extends OneShotEffect {
}
if (scepter && throne) {
ContinuousEffect effect = new CrownOfEmpiresControlEffect();
effect.setTargetPointer(new FixedTarget(target.getId()));
effect.setTargetPointer(new FixedTarget(target.getId(), game));
game.getState().setValue(source.getSourceId().toString(), source.getControllerId());
game.addEffect(effect, source);
} else {

View file

@ -84,7 +84,7 @@ class CrystallizationTriggeredAbility extends TriggeredAbilityImpl {
if (enchantment != null && enchantment.getAttachedTo() != null) {
UUID enchanted = enchantment.getAttachedTo();
if (event.getTargetId().equals(enchanted)) {
getEffects().get(0).setTargetPointer(new FixedTarget(enchanted));
getEffects().get(0).setTargetPointer(new FixedTarget(enchanted, game));
return true;
}
}

View file

@ -89,7 +89,7 @@ class CunningAbductionExileEffect extends OneShotEffect {
game.addEffect(effect, source);
// and you may spend mana as though it were mana of any color to cast it
effect = new CunningAbductionSpendAnyManaEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source);
}
return true;

View file

@ -78,7 +78,7 @@ class CurseOfPredationTriggeredAbility extends TriggeredAbilityImpl {
if (enchantment != null
&& enchantment.isAttachedTo(defender.getId())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
effect.setTargetPointer(new FixedTarget(event.getSourceId(), game));
}
return true;
}

View file

@ -83,7 +83,7 @@ class CurseOfStalkedPreyTriggeredAbility extends TriggeredAbilityImpl {
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player player = game.getPlayer(enchantment.getAttachedTo());
if (player != null && event.getTargetId().equals(player.getId())) {
getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId()));
getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId(), game));
return true;
}
}

View file

@ -84,7 +84,7 @@ class CurseOfVengeanceTriggeredAbility extends TriggeredAbilityImpl {
if (enchantment != null && spell != null
&& enchantment.isAttachedTo(spell.getControllerId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(getSourceId()));
this.getEffects().get(0).setTargetPointer(new FixedTarget(getSourceId(), game));
return true;
}
return false;

View file

@ -135,7 +135,7 @@ class CustodyBattleUnlessPaysEffect extends OneShotEffect {
if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId())
&& game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) {
ContinuousEffect effect = new GiveControlEffect();
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
game.addEffect(effect, source);
game.informPlayers(game.getPlayer(source.getFirstTarget()).getLogName() + " gains control of " + sourcePermanent.getIdName());
}