- refactoring related to #8375 "B" cards

This commit is contained in:
Jeff Wadsworth 2021-10-19 15:17:59 -05:00
parent 8e3d4aed7e
commit 5b9477caae
9 changed files with 25 additions and 37 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.b;
import java.util.UUID;
@ -71,7 +70,7 @@ class BattleCryTriggeredAbility extends DelayedTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId()));
getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId(), game));
return true;
}

View file

@ -1,5 +1,3 @@
package mage.cards.b;
import java.util.UUID;
@ -27,8 +25,8 @@ import mage.target.targetpointer.FixedTarget;
*/
public final class BattlegraceAngel extends CardImpl {
public BattlegraceAngel (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}{W}");
public BattlegraceAngel(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
this.subtype.add(SubType.ANGEL);
this.power = new MageInt(4);
@ -44,7 +42,7 @@ public final class BattlegraceAngel extends CardImpl {
this.addAbility(new BattlegraceAngelAbility());
}
public BattlegraceAngel (final BattlegraceAngel card) {
public BattlegraceAngel(final BattlegraceAngel card) {
super(card);
}
@ -77,10 +75,10 @@ class BattlegraceAngelAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.isActivePlayer(this.controllerId) ) {
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

@ -1,4 +1,3 @@
package mage.cards.b;
import mage.MageObjectReference;
@ -131,7 +130,7 @@ class BerserkDestroyEffect extends OneShotEffect {
if (controller != null) {
//create delayed triggered ability
Effect effect = new BerserkDelayedDestroyEffect();
effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source), game));
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;

View file

@ -1,4 +1,3 @@
package mage.cards.b;
import java.util.UUID;
@ -64,7 +63,7 @@ class BesmirchEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
if (game.getPermanent(source.getFirstTarget()) != null) {
TargetPointer target = new FixedTarget(source.getFirstTarget());
TargetPointer target = new FixedTarget(source.getFirstTarget(), game);
// gain control
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn);

View file

@ -1,5 +1,3 @@
package mage.cards.b;
import java.util.UUID;
@ -28,28 +26,24 @@ import mage.target.targetpointer.FixedTarget;
*
* @author LevelX2
*/
public final class BorosBattleshaper extends CardImpl {
public BorosBattleshaper (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{R}{W}");
public BorosBattleshaper(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}{W}");
this.subtype.add(SubType.MINOTAUR, SubType.SOLDIER);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// At the beginning of each combat, up to one target creature attacks or blocks this combat if able and up to one target creature can't attack or block this combat.
Ability ability = new BeginningOfCombatTriggeredAbility(Zone.BATTLEFIELD, new BorosBattleshaperEffect(), TargetController.ANY, false, false);
ability.addTarget(new TargetCreaturePermanent(0,1,new FilterCreaturePermanent("creature that attacks or blocks if able"),false));
ability.addTarget(new TargetCreaturePermanent(0,1,new FilterCreaturePermanent("creature that can't attack or block"),false));
ability.addTarget(new TargetCreaturePermanent(0, 1, new FilterCreaturePermanent("creature that attacks or blocks if able"), false));
ability.addTarget(new TargetCreaturePermanent(0, 1, new FilterCreaturePermanent("creature that can't attack or block"), false));
this.addAbility(ability);
}
public BorosBattleshaper (final BorosBattleshaper card) {
public BorosBattleshaper(final BorosBattleshaper card) {
super(card);
}
@ -83,18 +77,18 @@ class BorosBattleshaperEffect extends OneShotEffect {
if (game.getOpponents(creature1.getControllerId()).contains(game.getActivePlayerId())) {
// Blocks
ContinuousEffectImpl effect = new BlocksIfAbleTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature1.getId()));
effect.setTargetPointer(new FixedTarget(creature1.getId(), game));
game.addEffect(effect, source);
effect = new GainAbilityTargetEffect(BlocksThisTurnMarkerAbility.getInstance(), Duration.EndOfTurn, "");
effect.setTargetPointer(new FixedTarget(creature1.getId()));
effect.setTargetPointer(new FixedTarget(creature1.getId(), game));
game.addEffect(effect, source);
} else {
// Attacks
ContinuousEffectImpl effect = new AttacksIfAbleTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature1.getId()));
effect.setTargetPointer(new FixedTarget(creature1.getId(), game));
game.addEffect(effect, source);
effect = new GainAbilityTargetEffect(AttacksThisTurnMarkerAbility.getInstance(), Duration.EndOfTurn, "");
effect.setTargetPointer(new FixedTarget(creature1.getId()));
effect.setTargetPointer(new FixedTarget(creature1.getId(), game));
game.addEffect(effect, source);
}
@ -104,12 +98,12 @@ class BorosBattleshaperEffect extends OneShotEffect {
if (game.getOpponents(creature2.getControllerId()).contains(game.getActivePlayerId())) {
// Blocks
ContinuousEffectImpl effect = new CantBlockTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature2.getId()));
effect.setTargetPointer(new FixedTarget(creature2.getId(), game));
game.addEffect(effect, source);
} else {
// Attacks
ContinuousEffectImpl effect = new CantAttackTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature2.getId()));
effect.setTargetPointer(new FixedTarget(creature2.getId(), game));
game.addEffect(effect, source);
}
}

View file

@ -69,7 +69,7 @@ class BrackwaterElementalSacrificeEffect extends OneShotEffect {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null) {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice {this}");
sacrificeEffect.setTargetPointer(new FixedTarget(sourcePermanent.getId()));
sacrificeEffect.setTargetPointer(new FixedTarget(sourcePermanent.getId(), game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
}
return false;

View file

@ -77,7 +77,7 @@ class EnteringReturnFromGraveyardToBattlefieldEffect extends OneShotEffect {
if (card != null) {
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(card.getId()));
effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source);
}
}

View file

@ -72,7 +72,7 @@ class BurnFromWithinEffect extends OneShotEffect {
int damageDealt = creature.damage(amount, source.getSourceId(), source, game, false, true);
if (damageDealt > 0) {
ContinuousEffect effect = new LoseAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature.getId()));
effect.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(effect, source);
}
return true;

View file

@ -86,7 +86,7 @@ class BurningCinderFuryOfCrimsonChaosFireAbility extends TriggeredAbilityImpl {
@Override
public String getTriggerPhrase() {
return "Whenever any player taps a permanent, " ;
return "Whenever any player taps a permanent, ";
}
}
@ -133,7 +133,7 @@ class BurningCinderFuryOfCrimsonChaosFireEffect extends OneShotEffect {
if (chosenOpponent != null) {
game.informPlayers(tappingPlayer.getLogName() + " chose " + chosenOpponent.getLogName() + " to gain control of " + permanentToControl.getLogName() + " at the beginning of the next end step");
ContinuousEffect effect = new BurningCinderFuryOfCrimsonChaosFireCreatureGainControlEffect(Duration.Custom, chosenOpponent.getId());
effect.setTargetPointer(new FixedTarget(permanentToControl.getId()));
effect.setTargetPointer(new FixedTarget(permanentToControl.getId(), game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
return true;
}
@ -200,7 +200,6 @@ class BurningCinderFuryOfCrimsonChaosFireWatcher extends Watcher {
super(WatcherScope.GAME);
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.TAPPED) {