- Finished refactoring related to #8375 "T to Z" cards

This commit is contained in:
Jeff Wadsworth 2021-10-22 15:10:37 -05:00
parent ad0d802ed2
commit ed4bc46164
17 changed files with 49 additions and 56 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.t;
import java.util.UUID;
@ -103,7 +102,7 @@ class TaigamSidisisHandEffect extends OneShotEffect {
if (cost instanceof ExileFromGraveCost) {
amount = ((ExileFromGraveCost) cost).getExiledCards().size();
ContinuousEffect effect = new BoostTargetEffect(-amount, -amount, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(source.getTargets().getFirstTarget()));
effect.setTargetPointer(new FixedTarget(source.getTargets().getFirstTarget(), game));
game.addEffect(effect, source);
}
}

View file

@ -21,7 +21,6 @@ import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author LevelX2
*/
@ -36,7 +35,6 @@ public final class Teleportal extends CardImpl {
public Teleportal(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{U}{R}");
// Target creature you control gets +1/+0 until end of turn and can't be blocked this turn.
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
this.getSpellAbility().addEffect(new BoostTargetEffect(1, 0, Duration.EndOfTurn));
@ -77,7 +75,7 @@ class TeleportalEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
CantBeBlockedTargetEffect effect = new CantBeBlockedTargetEffect();
effect.setTargetPointer(new FixedTarget(creature.getId()));
effect.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(effect, source);
}
return true;

View file

@ -1,4 +1,3 @@
package mage.cards.t;
import java.util.UUID;
@ -28,7 +27,7 @@ import mage.target.targetpointer.FixedTarget;
public final class Tephraderm extends CardImpl {
public Tephraderm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}");
this.subtype.add(SubType.BEAST);
this.power = new MageInt(4);
this.toughness = new MageInt(5);
@ -74,10 +73,11 @@ class TephradermCreatureDamageTriggeredAbility extends TriggeredAbilityImpl {
}
Permanent sourcePermanent = game.getPermanent(event.getSourceId());
if (sourcePermanent != null && FILTER_CREATURE.match(sourcePermanent, getSourceId(), getControllerId(), game)) {
if (sourcePermanent != null
&& FILTER_CREATURE.match(sourcePermanent, getSourceId(), getControllerId(), game)) {
for (Effect effect : getEffects()) {
if (effect instanceof DamageTargetEffect) {
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId()));
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId(), game));
((DamageTargetEffect) effect).setAmount(StaticValue.get(event.getAmount()));
}
}

View file

@ -110,11 +110,12 @@ class TheWretchedEffect extends OneShotEffect {
if (combatGroup.getAttackers().contains(source.getSourceId())) {
for (UUID creatureId : combatGroup.getBlockers()) {
Permanent blocker = game.getPermanent(creatureId);
if (blocker != null && blocker.getBlocking() > 0) {
if (blocker != null
&& blocker.getBlocking() > 0) {
ContinuousEffect effect = new ConditionalContinuousEffect(
new GainControlTargetEffect(Duration.Custom, source.getControllerId()),
new SourceOnBattlefieldControlUnchangedCondition(), "");
effect.setTargetPointer(new FixedTarget(blocker.getId()));
effect.setTargetPointer(new FixedTarget(blocker.getId(), game));
game.addEffect(effect, source);
}

View file

@ -108,7 +108,7 @@ class TidalFlatsEffect extends OneShotEffect {
Permanent blocker = game.getPermanent(blockerId);
if (blocker != null && Objects.equals(blocker.getControllerId(), controller.getId())) {
ContinuousEffect effect = new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn);
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.t;
import java.util.UUID;
@ -19,7 +18,6 @@ import mage.constants.Outcome;
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.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
@ -31,8 +29,7 @@ import mage.target.targetpointer.FixedTarget;
public final class TowerAbove extends CardImpl {
public TowerAbove(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2/G}{2/G}{2/G}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2/G}{2/G}{2/G}");
// <i>({2G} can be paid with any two mana or with {G}. This card's converted mana cost is 6.)</i>
// Until end of turn, target creature gets +4/+4 and gains trample, wither, and "When this creature attacks, target creature blocks it this turn if able."
@ -73,10 +70,10 @@ class TowerAboveEffect extends OneShotEffect {
ContinuousEffect effect2 = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
ContinuousEffect effect3 = new GainAbilityTargetEffect(WitherAbility.getInstance(), Duration.EndOfTurn);
ContinuousEffect effect4 = new GainAbilityTargetEffect(new TowerAboveTriggeredAbility(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(target.getId()));
effect2.setTargetPointer(new FixedTarget(target.getId()));
effect3.setTargetPointer(new FixedTarget(target.getId()));
effect4.setTargetPointer(new FixedTarget(target.getId()));
effect.setTargetPointer(new FixedTarget(target.getId(), game));
effect2.setTargetPointer(new FixedTarget(target.getId(), game));
effect3.setTargetPointer(new FixedTarget(target.getId(), game));
effect4.setTargetPointer(new FixedTarget(target.getId(), game));
effect4.setText("");
game.addEffect(effect, source);
game.addEffect(effect2, source);

View file

@ -1,4 +1,3 @@
package mage.cards.t;
import mage.abilities.Ability;
@ -77,7 +76,7 @@ class TrespassersCurseTriggeredAbility extends TriggeredAbilityImpl {
&& game.getControllerId(event.getTargetId()).equals(enchantment.getAttachedTo())
&& game.getPermanent(event.getTargetId()).isCreature(game)) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo()));
effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo(), game));
}
return true;
}
@ -86,7 +85,7 @@ class TrespassersCurseTriggeredAbility extends TriggeredAbilityImpl {
@Override
public String getTriggerPhrase() {
return "Whenever a creature enters the battlefield under enchanted player's control, " ;
return "Whenever a creature enters the battlefield under enchanted player's control, ";
}
@Override

View file

@ -137,7 +137,7 @@ class UginTheIneffableEffect extends OneShotEffect {
// look at face-down card in exile
UginTheIneffableLookAtFaceDownEffect lookAtEffect = new UginTheIneffableLookAtFaceDownEffect();
lookAtEffect.setTargetPointer(new FixedTarget(card.getId()));
lookAtEffect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(lookAtEffect, source);
tokenObjs.add(new MageObjectReference(addedTokenId, game));

View file

@ -1,4 +1,3 @@
package mage.cards.u;
import java.util.UUID;
@ -25,8 +24,7 @@ import mage.target.targetpointer.FixedTarget;
public final class UnwillingRecruit extends CardImpl {
public UnwillingRecruit(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{R}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}{R}{R}");
// Gain control of target creature until end of turn. Untap that creature. It gets +X/+0 and gains haste until end of turn.
this.getSpellAbility().addEffect(new UnwillingRecruitEffect());
@ -64,7 +62,7 @@ class UnwillingRecruitEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
if (targetCreature != null) {
source.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId()));
source.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId(), game));
game.addEffect(new GainControlTargetEffect(Duration.EndOfTurn), source);
targetCreature.untap(game);
game.addEffect(new BoostTargetEffect(source.getManaCostsToPay().getX(), 0, Duration.EndOfTurn), source);

View file

@ -1,5 +1,3 @@
package mage.cards.u;
import java.util.UUID;
@ -29,8 +27,8 @@ import mage.target.targetpointer.FixedTarget;
*/
public final class UrzasEngine extends CardImpl {
public UrzasEngine (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{5}");
public UrzasEngine(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{5}");
this.subtype.add(SubType.JUGGERNAUT);
this.power = new MageInt(1);
this.toughness = new MageInt(5);
@ -45,7 +43,7 @@ public final class UrzasEngine extends CardImpl {
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new UrzasEngineEffect(), new ManaCostsImpl("{3}")));
}
public UrzasEngine (final UrzasEngine card) {
public UrzasEngine(final UrzasEngine card) {
super(card);
}
@ -78,9 +76,12 @@ class UrzasEngineEffect extends OneShotEffect {
if (sourcePermanent != null) {
for (UUID bandedId : sourcePermanent.getBandedCards()) {
Permanent banded = game.getPermanent(bandedId);
if (banded != null && banded.isAttacking() && banded.getBandedCards() != null && banded.getBandedCards().contains(sourcePermanent.getId())) {
if (banded != null
&& banded.isAttacking()
&& banded.getBandedCards() != null
&& banded.getBandedCards().contains(sourcePermanent.getId())) {
GainAbilityTargetEffect effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(bandedId));
effect.setTargetPointer(new FixedTarget(bandedId, game));
game.addEffect(effect, source);
}
}

View file

@ -247,7 +247,7 @@ class ValkiGodOfLiesCopyExiledEffect extends OneShotEffect {
Card chosenExiledCard = game.getCard(target.getFirstTarget());
if (chosenExiledCard != null) {
ContinuousEffect copyEffect = new CopyEffect(Duration.WhileOnBattlefield, chosenExiledCard.getMainCard(), source.getSourceId());
copyEffect.setTargetPointer(new FixedTarget(Valki.getId()));
copyEffect.setTargetPointer(new FixedTarget(Valki.getId(), game));
game.addEffect(copyEffect, source);
return true;
}

View file

@ -1,4 +1,3 @@
package mage.cards.v;
import java.util.Objects;
@ -19,7 +18,6 @@ import mage.constants.SubType;
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.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -31,7 +29,7 @@ import mage.target.targetpointer.FixedTarget;
public final class Venom extends CardImpl {
public Venom(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{G}");
this.subtype.add(SubType.AURA);
// Enchant creature
@ -86,15 +84,17 @@ class VenomTriggeredAbility extends TriggeredAbilityImpl {
if (enchantment != null && enchantment.getAttachedTo() != null) {
Permanent enchantedCreature = game.getPermanent(enchantment.getAttachedTo());
if (enchantedCreature != null) {
if (blocker != null && !Objects.equals(blocker, enchantedCreature)
if (blocker != null
&& !Objects.equals(blocker, enchantedCreature)
&& !blocker.hasSubtype(SubType.WALL, game)
&& Objects.equals(blocked, enchantedCreature)) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId()));
this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId(), game));
return true;
}
if (blocker != null && Objects.equals(blocker, enchantedCreature)
if (blocker != null
&& Objects.equals(blocker, enchantedCreature)
&& !blocked.hasSubtype(SubType.WALL, game)) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId()));
this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId(), game));
return true;
}
}

View file

@ -123,7 +123,7 @@ class VraskaTheUnseenTriggeredAbility extends TriggeredAbilityImpl {
Permanent sourceOfDamage = game.getPermanent(event.getSourceId());
if (sourceOfDamage != null && sourceOfDamage.isCreature(game)) {
Effect effect = this.getEffects().get(0);
effect.setTargetPointer(new FixedTarget(sourceOfDamage.getId()));
effect.setTargetPointer(new FixedTarget(sourceOfDamage.getId(), game));
return true;
}
}

View file

@ -122,9 +122,9 @@ class WallOfStolenIdentityCopyEffect extends OneShotEffect {
ContinuousEffect effect2 = new GainAbilityTargetEffect(ability, Duration.Custom);
ConditionalContinuousEffect conditionalEffect = new ConditionalContinuousEffect(
effect2, new WallOfStolenIdentityCondition(
source,
source.getControllerId(),
sourcePermanent.getZoneChangeCounter(game)), "");
source,
source.getControllerId(),
sourcePermanent.getZoneChangeCounter(game)), "");
conditionalEffect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
game.addEffect(conditionalEffect, source);
return true;

View file

@ -1,4 +1,3 @@
package mage.cards.w;
import java.util.UUID;
@ -24,7 +23,7 @@ import mage.target.targetpointer.FixedTarget;
public final class WildDefiance extends CardImpl {
public WildDefiance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
// Whenever a creature you control becomes the target of an instant or sorcery spell, that creature gets +3/+3 until end of turn.
this.addAbility(new CreaturesYouControlBecomesTargetTriggeredAbility(new BoostTargetEffect(3, 3, Duration.EndOfTurn)));
@ -63,14 +62,16 @@ class CreaturesYouControlBecomesTargetTriggeredAbility extends TriggeredAbilityI
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isControlledBy(this.controllerId) && permanent.isCreature(game)) {
if (permanent != null
&& permanent.isControlledBy(this.controllerId)
&& permanent.isCreature(game)) {
MageObject object = game.getObject(event.getSourceId());
if (object instanceof Spell) {
Card c = (Spell) object;
if (c.isInstantOrSorcery(game)) {
if (getTargets().isEmpty()) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
}
}
return true;

View file

@ -72,7 +72,7 @@ class WithdrawEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Effect effect = new ReturnToHandTargetEffect();
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
effect.apply(game, source);
Permanent secondCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (secondCreature != null) {

View file

@ -1,4 +1,3 @@
package mage.cards.w;
import java.util.UUID;
@ -27,7 +26,7 @@ import mage.target.targetpointer.FixedTarget;
public final class WoodenStake extends CardImpl {
public WoodenStake(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);
// Equip {1}
@ -73,7 +72,7 @@ class WoodenStakeBlocksOrBecomesBlockedTriggeredAbility extends TriggeredAbility
Permanent blocks = game.getPermanent(event.getTargetId());
if (blocks != null && blocks.hasSubtype(SubType.VAMPIRE, game)) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
}
return true;
}
@ -83,7 +82,7 @@ class WoodenStakeBlocksOrBecomesBlockedTriggeredAbility extends TriggeredAbility
Permanent blockedBy = game.getPermanent(event.getSourceId());
if (blockedBy != null && blockedBy.hasSubtype(SubType.VAMPIRE, game)) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
effect.setTargetPointer(new FixedTarget(event.getSourceId(), game));
}
return true;
}