Merge pull request #11178 from ssk97/MorphRework_v2

Morph rework and check spell characteristics
This commit is contained in:
xenohedron 2023-10-02 23:01:40 -04:00 committed by GitHub
commit 9456650693
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
283 changed files with 905 additions and 649 deletions

View file

@ -35,7 +35,7 @@ public final class AbominationOfGudul extends CardImpl {
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(effect, true));
// Morph 2BGU
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{2}{B}{G}{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{B}{G}{U}")));
}
private AbominationOfGudul(final AbominationOfGudul card) {

View file

@ -28,7 +28,7 @@ public final class AbzanGuide extends CardImpl {
// Lifelink
this.addAbility(LifelinkAbility.getInstance());
// Morph {2}{W}{B}{G}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{2}{W}{B}{G}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{W}{B}{G}")));
}
private AbzanGuide(final AbzanGuide card) {

View file

@ -43,7 +43,7 @@ public final class AcidSpewerDragon extends CardImpl {
this.addAbility(DeathtouchAbility.getInstance());
// Megamorph {5}{B}{B}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{5}{B}{B}"), true));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{5}{B}{B}"), true));
// When Acid-Spewer Dragon is turned face up, put a +1/+1 counter on each other Dragon creature you control.
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new AddCountersAllEffect(CounterType.P1P1.createInstance(), filter), false, false));

View file

@ -66,10 +66,14 @@ class ActOfAuthorityEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (targetPermanent == null) { return false; }
if (targetPermanent == null) {
return false;
}
ExileTargetEffect exileTargetEffect = new ExileTargetEffect();
if (!exileTargetEffect.apply(game, source)) { return false; }
if (!exileTargetEffect.apply(game, source)) {
return false;
}
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
if (sourcePermanent == null) { return true; }
@ -111,7 +115,9 @@ class ActOfAuthorityGainControlEffect extends ContinuousEffectImpl {
permanent = game.getPermanent(targetPointer.getFirst(game, source));
}
if (permanent == null) { return false; }
if (permanent == null) {
return false;
}
return permanent.changeControllerId(controller, game, source);
}

View file

@ -28,7 +28,7 @@ public final class AerieBowmasters extends CardImpl {
this.addAbility(ReachAbility.getInstance());
// Megamorph {5}{G} <i>(You may cast this card face down as a 2/2 creature for {3}. Turn it face up at any time for its megamorph cost and put a +1/+1 counter on it.)</i>)
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{5}{G}"), true));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{5}{G}"), true));
}

View file

@ -72,7 +72,9 @@ class AetherspoutsEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
game.getPlayerList();
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
PlayerList playerList = game.getState().getPlayersInRange(controller.getId(), game);
playerList.setCurrent(game.getActivePlayerId());

View file

@ -37,7 +37,7 @@ public final class AinokSurvivalist extends CardImpl {
this.toughness = new MageInt(1);
// Megamorph {1}{G}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{1}{G}"), true));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{1}{G}"), true));
// When Ainok Survivalist is turned face up, destroy target artifact or enchantment an opponent controls.
Effect effect = new DestroyTargetEffect();

View file

@ -28,7 +28,7 @@ public final class AinokTracker extends CardImpl {
// First Strike
this.addAbility(FirstStrikeAbility.getInstance());
// Morph 4R
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{4}{R}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{4}{R}")));
}
private AinokTracker(final AinokTracker card) {

View file

@ -75,12 +75,18 @@ class AkoumHellkiteTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent == null) { return false; }
if (permanent == null) {
return false;
}
if (!permanent.isLand(game) || !permanent.isControlledBy(getControllerId())) { return false; }
if (!permanent.isLand(game) || !permanent.isControlledBy(getControllerId())) {
return false;
}
Permanent sourcePermanent = game.getPermanent(getSourceId());
if (sourcePermanent == null) { return false; }
if (sourcePermanent == null) {
return false;
}
for (Effect effect : getEffects()) {
if (effect instanceof AkoumHellkiteDamageEffect) {
@ -118,14 +124,18 @@ class AkoumHellkiteDamageEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent land = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (land == null) { return false; }
if (land == null) {
return false;
}
int damage = land.hasSubtype(SubType.MOUNTAIN, game) ? 2 : 1;
// Get target for damange
Player player = game.getPlayer(source.getFirstTarget());
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (player == null && permanent == null) { return false; }
if (player == null && permanent == null) {
return false;
}
if (player != null) {
// Target is a player

View file

@ -41,7 +41,7 @@ public final class AkromaAngelOfFury extends CardImpl {
// {R}: Akroma, Angel of Fury gets +1/+0 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1,0, Duration.EndOfTurn), new ManaCostsImpl<>("{R}")));
// Morph {3}{R}{R}{R}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{3}{R}{R}{R}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{3}{R}{R}{R}")));
}
private AkromaAngelOfFury(final AkromaAngelOfFury card) {

View file

@ -1,10 +1,10 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.EntersBattlefieldEffect;
@ -15,13 +15,14 @@ import mage.constants.*;
import mage.filter.common.FilterNonlandCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.util.CardUtil;
import mage.util.GameLog;
import java.util.UUID;
/**
*
* @author LevelX2
@ -153,10 +154,15 @@ class AlhammarretHighArbiterCantCastEffect extends ContinuousRuleModifyingEffect
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
MageObject object = game.getObject(event.getSourceId());
if (object != null && object.getName().equals(cardName)) {
return true;
SpellAbility spellAbility = SpellAbility.getSpellAbilityFromEvent(event, game);
if (spellAbility == null) {
return false;
}
Card card = spellAbility.getCharacteristics(game);
if (card == null) {
return false;
}
return CardUtil.haveSameNames(card, cardName, game);
}
return false;
}

View file

@ -65,10 +65,14 @@ class AliFromCairoReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent == null) { return false; }
if (permanent == null) {
return false;
}
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
return (controller.getLife() > 0) && (controller.getLife() - event.getAmount()) < 1
&& event.getPlayerId().equals(controller.getId());
@ -77,7 +81,9 @@ class AliFromCairoReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
// 10/1/2008: The ability doesn't change how much damage is dealt;
// it just changes how much life that damage makes you lose.

View file

@ -69,13 +69,19 @@ class AlignedHedronNetworkExileEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false;}
if (controller == null) {
return false;
}
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null) { return false; }
if (permanent == null) {
return false;
}
Set<Card> toExile = new LinkedHashSet<>(game.getBattlefield().getActivePermanents(filter, controller.getId(), source, game));
if (toExile.isEmpty()) { return false; }
if (toExile.isEmpty()) {
return false;
}
controller.moveCardsToExile(toExile, source, game, true, CardUtil.getCardExileZoneId(game, source), permanent.getIdName());
game.addDelayedTriggeredAbility(new OnLeaveReturnExiledAbility(), source);

View file

@ -79,11 +79,17 @@ class AllHallowsEveEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Card allHallowsEveCard = (Card) source.getSourceObject(game);
if (allHallowsEveCard == null) { return false; }
if (allHallowsEveCard == null) {
return false;
}
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
if (allHallowsEveCard.getCounters(game).getCount(CounterType.SCREAM) > 0) { return false; }
if (allHallowsEveCard.getCounters(game).getCount(CounterType.SCREAM) > 0) {
return false;
}
controller.moveCards(allHallowsEveCard, Zone.GRAVEYARD, source, game);
Cards allCreatureCardsInGraveyards = new CardsImpl();

View file

@ -61,10 +61,14 @@ class AnHavvaConstableEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
MageObject mageObject = game.getObject(source.getSourceId());
if (mageObject == null) { return false; }
if (mageObject == null) {
return false;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent("green creatures");
filter.add(new ColorPredicate(ObjectColor.GREEN));

View file

@ -45,7 +45,7 @@ public final class AphettoAlchemist extends CardImpl {
this.addAbility(ability);
// Morph {U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{U}")));
}
private AphettoAlchemist(final AphettoAlchemist card) {

View file

@ -30,7 +30,7 @@ public final class AphettoExterminator extends CardImpl {
this.toughness = new MageInt(1);
// Morph {3}{B}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{3}{B}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{3}{B}")));
// When Aphetto Exterminator is turned face up, target creature gets -3/-3 until end of turn.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new BoostTargetEffect(-3,-3,Duration.EndOfTurn));

View file

@ -38,7 +38,7 @@ public final class AquamorphEntity extends CardImpl {
this.addAbility(ability);
// Morph {2}{U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{2}{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{U}")));
}
private AquamorphEntity(final AquamorphEntity card) {

View file

@ -30,7 +30,7 @@ public final class AscendingAven extends CardImpl {
// Ascending Aven can block only creatures with flying.
this.addAbility(new CanBlockOnlyFlyingAbility());
// Morph {2}{U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{2}{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{U}")));
}
private AscendingAven(final AscendingAven card) {

View file

@ -39,7 +39,7 @@ public final class AshcloudPhoenix extends CardImpl {
this.addAbility(new DiesSourceTriggeredAbility(new AshcloudPhoenixEffect()));
// Morph {4}{R}{R}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{4}{R}{R}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{4}{R}{R}")));
// When Ashcloud Phoenix is turned face up, it deals 2 damage to each player.
Effect effect = new DamagePlayersEffect(2, TargetController.ANY);

View file

@ -2,6 +2,7 @@ package mage.cards.a;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
@ -116,7 +117,11 @@ class AshioksErasureReplacementEffect extends ContinuousRuleModifyingEffectImpl
if (event.getPlayerId().equals(source.getControllerId())) {
return false;
}
Card card = game.getCard(event.getSourceId());
SpellAbility spellAbility = SpellAbility.getSpellAbilityFromEvent(event, game);
if (spellAbility == null) {
return false;
}
Card card = spellAbility.getCharacteristics(game);
if (sourcePermanent == null
|| card == null) {
return false;

View file

@ -29,7 +29,7 @@ public final class AtarkaEfreet extends CardImpl {
this.toughness = new MageInt(1);
// Megamorph {2}{R}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{2}{R}"), true));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{R}"), true));
// When Atarka Efreet is turned face up, it deals 1 damage to any target.
Effect effect = new DamageTargetEffect(1, "it");

View file

@ -76,7 +76,9 @@ class AuraFinesseEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
Permanent aura = game.getPermanent(source.getFirstTarget());
Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget());

View file

@ -70,7 +70,9 @@ class AutumnWillowEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (!affectedControllerId.equals(source.getFirstTarget())) { return false; }
if (!affectedControllerId.equals(source.getFirstTarget())) {
return false;
}
Permanent creature = game.getPermanent(sourceId);
return creature != null &&sourceId.equals(source.getSourceId());

View file

@ -32,7 +32,7 @@ public final class AvenLiberator extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// Morph {3}{W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{3}{W}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{3}{W}")));
// When Aven Liberator is turned face up, target creature you control gains protection from the color of your choice until end of turn.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new GainProtectionFromColorTargetEffect(Duration.EndOfTurn));
ability.addTarget(new TargetControlledCreaturePermanent());

View file

@ -30,7 +30,7 @@ public final class AvenSunstriker extends CardImpl {
// Double strike
this.addAbility(DoubleStrikeAbility.getInstance());
// Megamorph {4}{W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{4}{W}"), true));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{4}{W}"), true));
}
private AvenSunstriker(final AvenSunstriker card) {

View file

@ -78,10 +78,14 @@ class AzorsGatewayEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
MageObject sourceObject = source.getSourceObject(game);
if (sourceObject == null) { return false; }
if (sourceObject == null) {
return false;
}
UUID exileId = CardUtil.getCardExileZoneId(game, source);

View file

@ -31,7 +31,7 @@ public final class BaneOfTheLiving extends CardImpl {
this.toughness = new MageInt(3);
// Morph {X}{B}{B}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{X}{B}{B}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{X}{B}{B}")));
// When Bane of the Living is turned face up, all creatures get -X/-X until end of turn.
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new BoostAllEffect(morphX, morphX, Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_ALL_CREATURES, false, null)));

View file

@ -131,10 +131,14 @@ class BanefireCantCounterEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Card card = game.getCard(source.getSourceId());
if (card == null) { return false; }
if (card == null) {
return false;
}
UUID spellId = card.getSpellAbility().getId();
if (!event.getTargetId().equals(spellId)) { return false; }
if (!event.getTargetId().equals(spellId)) {
return false;
}
return condition.apply(game, source);
}

View file

@ -65,7 +65,9 @@ class BathaHerdEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
int xValue = ((BecomesMonstrousSourceTriggeredAbility) source).getMonstrosityValue();

View file

@ -70,13 +70,19 @@ class BatheInLightEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
if (target == null) { return false; }
if (target == null) {
return false;
}
ChoiceColor colorChoice = new ChoiceColor();
if (!controller.choose(Outcome.Benefit, colorChoice, game)) { return false; }
if (!controller.choose(Outcome.Benefit, colorChoice, game)) {
return false;
}
game.informPlayers(target.getName() + ": " + controller.getLogName() + " has chosen " + colorChoice.getChoice());
game.getState().setValue(target.getId() + "_color", colorChoice.getColor());
@ -126,7 +132,9 @@ class ProtectionChosenColorTargetEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent == null) { return false; }
if (permanent == null) {
return false;
}
ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color");
if (color != null && (protectionAbility == null || !color.equals(chosenColor))) {

View file

@ -27,7 +27,7 @@ public final class BatteringCraghorn extends CardImpl {
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// Morph {1}{R}{R}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{1}{R}{R}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{1}{R}{R}")));
}
private BatteringCraghorn(final BatteringCraghorn card) {

View file

@ -41,7 +41,7 @@ public final class BelltollDragon extends CardImpl {
// Hexproof
this.addAbility(HexproofAbility.getInstance());
// Megamorph {5}{U}{U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{5}{U}{U}"), true));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{5}{U}{U}"), true));
// When Belltoll Dragon is turned face up, put a +1/+1 counter on each other Dragon creature you control.
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new AddCountersAllEffect(CounterType.P1P1.createInstance(), filter), false, false));

View file

@ -64,7 +64,9 @@ class BendOrBreakEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
// Map of players and their piles
Map<UUID, List<List<Permanent>>> playerPermanents = new LinkedHashMap<>();

View file

@ -63,12 +63,16 @@ class BenevolentOfferingEffect1 extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
Target target = new TargetOpponent(true);
target.choose(Outcome.Sacrifice, source.getControllerId(), source.getSourceId(), source, game);
Player opponent = game.getPlayer(target.getFirstTarget());
if (opponent == null) { return false; }
if (opponent == null) {
return false;
}
Effect effect = new CreateTokenTargetEffect(new SpiritWhiteToken(), 3);
effect.setTargetPointer(new FixedTarget(opponent.getId()));
@ -97,12 +101,16 @@ class BenevolentOfferingEffect2 extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
Target target = new TargetOpponent(true);
target.choose(Outcome.Sacrifice, source.getControllerId(), source.getSourceId(), source, game);
Player opponent = game.getPlayer(target.getFirstTarget());
if (opponent == null) { return false; }
if (opponent == null) {
return false;
}
int count = game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), game) * 2;
controller.gainLife(count, game, source);

View file

@ -127,7 +127,9 @@ class BerserkDestroyEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
//create delayed triggered ability
Effect effect = new BerserkDelayedDestroyEffect();
@ -158,13 +160,19 @@ class BerserkDelayedDestroyEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (permanent == null) { return false; }
if (permanent == null) {
return false;
}
AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class);
if (watcher == null) { return false; }
if (watcher == null) {
return false;
}
return watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game))
&& permanent.destroy(source, game, false);

View file

@ -57,7 +57,9 @@ class BiomanticMasteryEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
for (UUID playerId : getTargetPointer().getTargets(game, source)) {
Player player = game.getPlayer(playerId);

View file

@ -45,7 +45,7 @@ public final class BirchloreRangers extends CardImpl {
new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, false))));
// Morph {G}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{G}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{G}")));
}
private BirchloreRangers(final BirchloreRangers card) {

View file

@ -63,20 +63,30 @@ class BitterFeudEntersBattlefieldEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
Permanent permanent = game.getPermanentEntering(source.getSourceId());
if (permanent == null) { return false; }
if (permanent == null) {
return false;
}
TargetPlayer target = new TargetPlayer(2, 2, true);
controller.chooseTarget(outcome, target, source, game);
Player player1 = game.getPlayer(target.getFirstTarget());
if (player1 == null) { return false; }
if (player1 == null) {
return false;
}
if (target.getTargets().size() <= 1) { return false; }
if (target.getTargets().size() <= 1) {
return false;
}
Player player2 = game.getPlayer(target.getTargets().get(1));
if (player2 == null) { return false; }
if (player2 == null) {
return false;
}
game.getState().setValue(source.getSourceId() + "_player1", player1);
game.getState().setValue(source.getSourceId() + "_player2", player2);
@ -122,10 +132,14 @@ class BitterFeudEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
player1 = (Player) game.getState().getValue(source.getSourceId() + "_player1");
if (player1 == null) { return false; }
if (player1 == null) {
return false;
}
player2 = (Player) game.getState().getValue(source.getSourceId() + "_player2");
if (player2 == null) { return false; }
if (player2 == null) {
return false;
}
UUID targetPlayerId;
switch (event.getType()) {
@ -134,7 +148,9 @@ class BitterFeudEffect extends ReplacementEffectImpl {
break;
case DAMAGE_PERMANENT:
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent == null) { return false; }
if (permanent == null) {
return false;
}
targetPlayerId = permanent.getControllerId();
break;
@ -142,7 +158,9 @@ class BitterFeudEffect extends ReplacementEffectImpl {
return false;
}
if (!player1.getId().equals(targetPlayerId) && !player2.getId().equals(targetPlayerId)) { return false; }
if (!player1.getId().equals(targetPlayerId) && !player2.getId().equals(targetPlayerId)) {
return false;
}
UUID sourcePlayerId;
MageObject damageSource = game.getObject(event.getSourceId());

View file

@ -54,7 +54,9 @@ class UntapAllArtifactsEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) { return false; }
if (player == null) {
return false;
}
for (Permanent artifact: game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), game)) {
artifact.untap(game);

View file

@ -35,7 +35,7 @@ public final class BlisteringFirecat extends CardImpl {
// At the beginning of the end step, sacrifice Blistering Firecat.
this.addAbility(new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new SacrificeSourceEffect()));
// Morph {R}{R}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{R}{R}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{R}{R}")));
}
private BlisteringFirecat(final BlisteringFirecat card) {

View file

@ -63,10 +63,14 @@ class BloodBaronOfVizkopaEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
if (!conditionState(source, game)) { return false; }
if (!conditionState(source, game)) {
return false;
}
Permanent creature = game.getPermanent(source.getSourceId());
if (creature == null) { return false; }
if (creature == null) {
return false;
}
switch (layer) {
case PTChangingEffects_7:
@ -89,15 +93,23 @@ class BloodBaronOfVizkopaEffect extends ContinuousEffectImpl {
private boolean conditionState(Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
if (controller.getLife() < 30) { return false; }
if (controller.getLife() < 30) {
return false;
}
for (UUID opponentId : game.getState().getPlayersInRange(controller.getId(), game)) {
if (!controller.hasOpponent(opponentId, game)) { return false; }
if (!controller.hasOpponent(opponentId, game)) {
return false;
}
Player opponent = game.getPlayer(opponentId);
if (opponent == null) { return false; }
if (opponent == null) {
return false;
}
return opponent.getLife() < 11;
}

View file

@ -67,13 +67,19 @@ class BloodlineShamanEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject == null) { return false; }
if (sourceObject == null) {
return false;
}
Choice typeChoice = new ChoiceCreatureType(sourceObject);
if (!controller.choose(outcome, typeChoice, game)) { return false; }
if (!controller.choose(outcome, typeChoice, game)) {
return false;
}
game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice());
FilterCard filterSubtype = new FilterCard();

View file

@ -30,7 +30,7 @@ public final class BloodstokeHowler extends CardImpl {
this.toughness = new MageInt(4);
// Morph {6}{R}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{6}{R}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{6}{R}")));
// When Bloodstoke Howler is turned face up, Beast creatures you control get +3/+0 until end of turn.
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new BoostControlledEffect(3, 0, Duration.EndOfTurn, filter)));

View file

@ -40,7 +40,7 @@ public final class Boneknitter extends CardImpl {
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
// Morph {2}{B}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{2}{B}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{B}")));
}
private Boneknitter(final Boneknitter card) {

View file

@ -90,7 +90,9 @@ class DiesWhileInGraveyardTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (!zEvent.isDiesEvent()) { return false; }
if (!zEvent.isDiesEvent()) {
return false;
}
for (Zone z : Zone.values()) {
if (game.getShortLivingLKI(sourceId, z) && z != Zone.GRAVEYARD) {

View file

@ -71,7 +71,9 @@ class BoonweaverGiantEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
UUID sourcePermanentId = sourcePermanent == null ? null : sourcePermanent.getId();

View file

@ -109,10 +109,14 @@ class BosiumStripReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
Card card = (Card) game.getState().getValue("BosiumStrip");
if (card == null) { return false; }
if (card == null) {
return false;
}
((ZoneChangeEvent) event).setToZone(Zone.EXILED);
return true;
@ -126,12 +130,18 @@ class BosiumStripReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() != Zone.GRAVEYARD) { return false; }
if (zEvent.getToZone() != Zone.GRAVEYARD) {
return false;
}
Card card = game.getCard(event.getSourceId());
if (card == null) { return false; }
if (card == null) {
return false;
}
if (!StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY.match(card, game)) { return false; }
if (!StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY.match(card, game)) {
return false;
}
CastFromGraveyardWatcher watcher = game.getState().getWatcher(CastFromGraveyardWatcher.class);
return watcher != null

View file

@ -68,7 +68,9 @@ class BountyOfTheLuxaEffect extends OneShotEffect {
if (bountyOfLuxa != null && bountyOfLuxa.getZoneChangeCounter(game) != source.getSourceObjectZoneChangeCounter()) {
bountyOfLuxa = null;
}
if (controller == null) { return false; }
if (controller == null) {
return false;
}
if (bountyOfLuxa != null
&& bountyOfLuxa.getCounters(game).getCount(CounterType.FLOOD) > 0) {

View file

@ -72,7 +72,9 @@ class BraceForImpactPreventDamageTargetEffect extends PreventionEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
if (game.replaceEvent(preventEvent)) { return false; }
if (game.replaceEvent(preventEvent)) {
return false;
}
int prevented;
int damage = event.getAmount();
event.setAmount(0);

View file

@ -26,7 +26,7 @@ public final class BranchsnapLorian extends CardImpl {
// Trample
this.addAbility(TrampleAbility.getInstance());
// Morph {G}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{G}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{G}")));
}
private BranchsnapLorian(final BranchsnapLorian card) {

View file

@ -83,10 +83,14 @@ class BridgeFromBelowAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (!zEvent.isDiesEvent()) { return false; }
if (!zEvent.isDiesEvent()) {
return false;
}
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (permanent == null) { return false; }
if (permanent == null) {
return false;
}
return filter.match(permanent, controllerId, this, game);
}

View file

@ -67,7 +67,9 @@ class BrightflameEffect extends OneShotEffect {
int damageDealt = 0;
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
if (target == null) { return false; }
if (target == null) {
return false;
}
ObjectColor color = target.getColor(game);
damageDealt += target.damage(amount.calculate(game, source, this), source.getSourceId(), source, game);

View file

@ -75,7 +75,9 @@ class BrimazKingOfOreskosEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
Token token = new CatSoldierCreatureToken();
token.putOntoBattlefield(1, game, source, source.getControllerId());

View file

@ -32,7 +32,7 @@ public final class BrineElemental extends CardImpl {
this.toughness = new MageInt(4);
// Morph {5}{U}{U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{5}{U}{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{5}{U}{U}")));
// When Brine Elemental is turned face up, each opponent skips their next untap step.
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new BrineElementalEffect()));

View file

@ -30,7 +30,7 @@ public final class BroodhatchNantuko extends CardImpl {
new CreateTokenEffect(new InsectToken(), SavedDamageValue.MANY), true));
// Morph {2}{G}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{2}{G}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{G}")));
}
private BroodhatchNantuko(final BroodhatchNantuko card) {

View file

@ -76,7 +76,9 @@ class BrunaLightOfAlabasterEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
UUID bruna = source.getSourceId();
@ -91,7 +93,9 @@ class BrunaLightOfAlabasterEffect extends OneShotEffect {
filterAuraCard.add(new AuraCardCanAttachToPermanentId(bruna));
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent == null) { return false; }
if (sourcePermanent == null) {
return false;
}
List<Permanent> fromBattlefield = new ArrayList<>();
List<Card> fromHandGraveyard = new ArrayList<>();

View file

@ -72,7 +72,9 @@ class BudokaGardenerEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
if (game.getBattlefield().count(filterLands, source.getControllerId(), source, game) < 10) {
return false;
}

View file

@ -65,7 +65,9 @@ class BurnFromWithinEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) { return false; }
if (controller == null) {
return false;
}
int amount = source.getManaCostsToPay().getX();

View file

@ -29,7 +29,7 @@ public final class CabalExecutioner extends CardImpl {
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new SacrificeEffect(StaticFilters.FILTER_PERMANENT_A_CREATURE, 1, "that player"), false, true));
// Morph {3}{B}{B}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{3}{B}{B}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{3}{B}{B}")));
}
private CabalExecutioner(final CabalExecutioner card) {

View file

@ -25,7 +25,7 @@ public final class CanyonLurkers extends CardImpl {
this.toughness = new MageInt(2);
// Morph 3R
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{3}{R}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{3}{R}")));
}
private CanyonLurkers(final CanyonLurkers card) {

View file

@ -3,6 +3,7 @@ package mage.cards.c;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.common.DiscardCardCost;
@ -92,18 +93,21 @@ class ChainerNightmareAdeptContinuousEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
throw new IllegalArgumentException("Wrong code usage: can't call applies method on empty affectedAbility");
}
@Override
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game, UUID playerId) {
ChainerNightmareAdeptWatcher watcher = game.getState().getWatcher(ChainerNightmareAdeptWatcher.class);
if (watcher == null || !watcher.checkPermission(
affectedControllerId, source, game
) || game.getState().getZone(sourceId) != Zone.GRAVEYARD) {
playerId, source, game
) || game.getState().getZone(objectId) != Zone.GRAVEYARD) {
return false;
}
Card card = game.getCard(sourceId);
return card != null
&& card.getOwnerId().equals(affectedControllerId)
&& card.isCreature(game)
&& !card.isLand(game);
Card card = game.getCard(objectId);
return card != null && affectedAbility instanceof SpellAbility
&& card.getOwnerId().equals(playerId)
&& ((SpellAbility) affectedAbility).getCharacteristics(game).isCreature();
}
}

View file

@ -7,6 +7,7 @@ import mage.MageObject;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.SpellAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.GetEmblemEffect;
@ -165,10 +166,10 @@ class ChandraDressedToKillPlayEffect extends PlayFromNotOwnHandZoneTargetEffect
@Override
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game, UUID playerId) {
if (!super.applies(objectId, affectedAbility, source, game, playerId)) {
if (!(super.applies(objectId, affectedAbility, source, game, playerId) && affectedAbility instanceof SpellAbility)) {
return false;
}
Card card = game.getCard(objectId);
Card card = ((SpellAbility) affectedAbility).getCharacteristics(game);
return card != null && card.getColor(game).isRed();
}
}

View file

@ -26,7 +26,7 @@ public final class ChargingSlateback extends CardImpl {
// Charging Slateback can't block.
this.addAbility(new CantBlockAbility());
// Morph {4}{R}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{4}{R}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{4}{R}")));
}
private ChargingSlateback(final ChargingSlateback card) {

View file

@ -34,7 +34,7 @@ public final class ChromeshellCrab extends CardImpl {
this.toughness = new MageInt(3);
// Morph {4}{U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{4}{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{4}{U}")));
// When Chromeshell Crab is turned face up, you may exchange control of target creature you control and target creature an opponent controls.
Effect effect = new ExchangeControlTargetEffect(Duration.EndOfGame, rule, false, true);

View file

@ -28,7 +28,7 @@ public final class CoralTrickster extends CardImpl {
this.toughness = new MageInt(1);
// Morph {U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{U}")));
// When Coral Trickster is turned face up, you may tap or untap target permanent.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new MayTapOrUntapTargetEffect());
ability.addTarget(new TargetPermanent());

View file

@ -1,7 +1,7 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.cards.Card;
@ -19,6 +19,8 @@ import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.util.CardUtil;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -70,7 +72,11 @@ class CorneredMarketReplacementEffect extends ContinuousRuleModifyingEffectImpl
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Card card = game.getCard(event.getSourceId());
SpellAbility spellAbility = SpellAbility.getSpellAbilityFromEvent(event, game);
if (spellAbility == null) {
return false;
}
Card card = spellAbility.getCharacteristics(game);
if (card != null) {
Spell spell = game.getState().getStack().getSpell(event.getSourceId());
// Face Down cast spell (Morph creature) has no name

View file

@ -26,7 +26,7 @@ public final class CrudeRampart extends CardImpl {
// Defender
this.addAbility(DefenderAbility.getInstance());
// Morph {4}{W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{4}{W}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{4}{W}")));
}
private CrudeRampart(final CrudeRampart card) {

View file

@ -66,7 +66,9 @@ class CryOfTheCarnariumExileEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
CardsPutIntoGraveyardWatcher watcher = game.getState().getWatcher(CardsPutIntoGraveyardWatcher.class);
if (controller == null || watcher == null) { return false; }
if (controller == null || watcher == null) {
return false;
}
Cards cards = new CardsImpl(watcher.getCardsPutIntoGraveyardFromBattlefield(game));
cards.removeIf(uuid -> !game.getCard(uuid).isCreature(game));

View file

@ -4,6 +4,7 @@ import mage.MageIdentifier;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.keyword.LifelinkAbility;
@ -82,18 +83,22 @@ class DanithaNewBenaliasLightCastFromGraveyardEffect extends AsThoughEffectImpl
}
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (!source.isControlledBy(affectedControllerId) || game.getState().getZone(objectId) != Zone.GRAVEYARD) {
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game, UUID playerId) {
if (!source.isControlledBy(playerId) || game.getState().getZone(objectId) != Zone.GRAVEYARD || !(affectedAbility instanceof SpellAbility)) {
return false;
}
Card objectCard = game.getCard(objectId);
Card objectCard = ((SpellAbility) affectedAbility).getCharacteristics(game);
return objectCard != null
&& objectCard.isOwnedBy(source.getControllerId())
&& (objectCard.hasSubtype(SubType.AURA, game) || objectCard.hasSubtype(SubType.EQUIPMENT, game))
&& objectCard.getSpellAbility() != null
&& objectCard.getSpellAbility().spellCanBeActivatedRegularlyNow(affectedControllerId, game)
&& objectCard.getSpellAbility().spellCanBeActivatedRegularlyNow(playerId, game)
&& !DanithaNewBenaliasLightWatcher.isAbilityUsed(source, game);
}
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
throw new IllegalArgumentException("Wrong code usage: can't call applies method on empty affectedAbility");
}
}
class DanithaNewBenaliasLightWatcher extends Watcher {

View file

@ -37,7 +37,7 @@ public final class DaruHealer extends CardImpl {
this.addAbility(ability);
// Morph {W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{W}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{W}")));
}

View file

@ -27,7 +27,7 @@ public final class DaruLancer extends CardImpl {
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// Morph {2}{W}{W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{2}{W}{W}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{W}{W}")));
}
private DaruLancer(final DaruLancer card) {

View file

@ -28,7 +28,7 @@ public final class DaruMender extends CardImpl {
this.toughness = new MageInt(1);
// Morph {W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{W}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{W}")));
// When Daru Mender is turned face up, regenerate target creature.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new RegenerateTargetEffect());
ability.addTarget(new TargetCreaturePermanent());

View file

@ -28,7 +28,7 @@ public final class DaruSanctifier extends CardImpl {
this.toughness = new MageInt(4);
// Morph {1}{W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{1}{W}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{1}{W}")));
// When Daru Sanctifier is turned face up, destroy target enchantment.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new DestroyTargetEffect());
ability.addTarget(new TargetEnchantmentPermanent());

View file

@ -37,7 +37,7 @@ public final class DawningPurist extends CardImpl {
this.addAbility(new DawningPuristTriggeredAbility());
// Morph {1}{W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{1}{W}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{1}{W}")));
}
private DawningPurist(final DawningPurist card) {

View file

@ -41,7 +41,7 @@ public final class DeathmistRaptor extends CardImpl {
this.addAbility(new TurnedFaceUpAllTriggeredAbility(Zone.GRAVEYARD, new DeathmistRaptorEffect(), new FilterControlledPermanent("a permanent you control"), false, true));
// Megamorph {4}{G}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{4}{G}"), true));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{4}{G}"), true));
}
private DeathmistRaptor(final DeathmistRaptor card) {

View file

@ -27,7 +27,7 @@ public final class DefenderOfTheOrder extends CardImpl {
this.toughness = new MageInt(4);
// Morph {W}{W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{W}{W}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{W}{W}")));
// When Defender of the Order is turned face up, creatures you control get +0/+2 until end of turn.
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new BoostControlledEffect(0, 2, Duration.EndOfTurn)));
}

View file

@ -34,7 +34,7 @@ public final class DenProtector extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesWithLessPowerEffect()));
// Megamorph {1}{G}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{1}{G}"), true));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{1}{G}"), true));
// When Den Protector is turned face up, return target card from your graveyard to your hand.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect());

View file

@ -39,7 +39,7 @@ public final class Dermoplasm extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Morph {2}{U}{U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{2}{U}{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{U}{U}")));
// When Dermoplasm is turned face up, you may put a creature card with a morph ability from your hand onto the battlefield face up. If you do, return Dermoplasm to its owner's hand.
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new DermoplasmEffect()));

View file

@ -26,7 +26,7 @@ public final class DirgurNemesis extends CardImpl {
// Defender
this.addAbility(DefenderAbility.getInstance());
// Megamorph {6}{U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{6}{U}"), true));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{6}{U}"), true));
}
private DirgurNemesis(final DirgurNemesis card) {

View file

@ -36,7 +36,7 @@ public final class DisruptivePitmage extends CardImpl {
this.addAbility(ability);
// Morph {U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{U}")));
}
private DisruptivePitmage(final DisruptivePitmage card) {

View file

@ -39,7 +39,7 @@ public final class DragonsEyeSavants extends CardImpl {
this.toughness = new MageInt(6);
// Morph - Reveal a blue card in your hand.
this.addAbility(new MorphAbility(new RevealTargetFromHandCost(new TargetCardInHand(filter))));
this.addAbility(new MorphAbility(this, new RevealTargetFromHandCost(new TargetCardInHand(filter))));
// When Dragon's Eye Savants is turned face up, look at target opponent's hand.
Effect effect = new LookAtTargetPlayerHandEffect();

View file

@ -1,13 +1,11 @@
package mage.cards.d;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
import mage.abilities.effects.common.cost.MorphSpellsCostReductionControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.card.FaceDownCastablePredicate;
import java.util.UUID;
@ -15,18 +13,11 @@ import java.util.UUID;
* @author North
*/
public final class DreamChisel extends CardImpl {
private static final FilterCreatureCard filter = new FilterCreatureCard("Face-down creature spells");
static {
filter.add(FaceDownCastablePredicate.instance);
}
public DreamChisel(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// Face-down creature spells you cast cost {1} less to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionControllerEffect(filter, 1)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MorphSpellsCostReductionControllerEffect(1)));
}
private DreamChisel(final DreamChisel card) {
@ -37,4 +28,4 @@ public final class DreamChisel extends CardImpl {
public DreamChisel copy() {
return new DreamChisel(this);
}
}
}

View file

@ -38,7 +38,7 @@ public final class DulcetSirens extends CardImpl {
this.addAbility(ability);
// Morph {U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{U}")));
}
private DulcetSirens(final DulcetSirens card) {

View file

@ -34,7 +34,7 @@ public final class DwarvenBlastminer extends CardImpl {
this.addAbility(ability);
// Morph {R}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{R}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{R}")));
}
private DwarvenBlastminer(final DwarvenBlastminer card) {

View file

@ -34,7 +34,7 @@ public final class EbonbladeReaper extends CardImpl {
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new LoseHalfLifeTargetEffect(), false, true));
//Morph {3}{B}{B}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{3}{B}{B}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{3}{B}{B}")));
}
private EbonbladeReaper(final EbonbladeReaper card) {

View file

@ -28,7 +28,7 @@ public final class EchoTracer extends CardImpl {
this.toughness = new MageInt(2);
// Morph {2}{U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{2}{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{U}")));
// When Echo Tracer is turned face up, return target creature to its owner's hand.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new ReturnToHandTargetEffect());
ability.addTarget(new TargetCreaturePermanent());

View file

@ -40,7 +40,7 @@ public final class EfreetWeaponmaster extends CardImpl {
this.addAbility(new EfreetWeaponmasterAbility());
// Morph {2}{U}{R}{W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{2}{U}{R}{W}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{U}{R}{W}")));
}
private EfreetWeaponmaster(final EfreetWeaponmaster card) {

View file

@ -30,7 +30,7 @@ public final class ExaltedAngel extends CardImpl {
// Whenever Exalted Angel deals damage, you gain that much life.
this.addAbility(new DealsDamageGainLifeSourceTriggeredAbility());
// Morph {2}{W}{W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{2}{W}{W}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{W}{W}")));
}
private ExaltedAngel(final ExaltedAngel card) {

View file

@ -1,6 +1,7 @@
package mage.cards.e;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
@ -100,13 +101,18 @@ class ExclusionRitualReplacementEffect extends ContinuousRuleModifyingEffectImpl
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Card card = game.getCard(event.getSourceId());
if (sourcePermanent != null && card != null) {
if (!sourcePermanent.getImprinted().isEmpty()) {
Card imprintedCard = game.getCard(sourcePermanent.getImprinted().get(0));
if (imprintedCard != null) {
return CardUtil.haveSameNames(card, imprintedCard);
}
SpellAbility spellAbility = SpellAbility.getSpellAbilityFromEvent(event, game);
if (spellAbility == null) {
return false;
}
Card card = spellAbility.getCharacteristics(game);
if (card == null) {
return false;
}
if (sourcePermanent != null && !sourcePermanent.getImprinted().isEmpty()) {
Card imprintedCard = game.getCard(sourcePermanent.getImprinted().get(0));
if (imprintedCard != null) {
return CardUtil.haveSameNames(spellAbility.getCharacteristics(game), imprintedCard);
}
}
return false;

View file

@ -34,7 +34,7 @@ public final class FallenCleric extends CardImpl {
// Protection from Clerics
this.addAbility(new ProtectionAbility(filter));
// Morph {4}{B}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{4}{B}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{4}{B}")));
}
private FallenCleric(final FallenCleric card) {

View file

@ -33,7 +33,7 @@ public final class FathomSeer extends CardImpl {
this.toughness = new MageInt(3);
// Morph-Return two Islands you control to their owner's hand.
this.addAbility(new MorphAbility(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(2,2, filter, true))));
this.addAbility(new MorphAbility(this, new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(2,2, filter, true))));
// When Fathom Seer is turned face up, draw two cards.
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new DrawCardSourceControllerEffect(2)));
}

View file

@ -38,7 +38,7 @@ public final class FledglingMawcor extends CardImpl {
this.addAbility(ability);
// Morph {U}{U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{U}{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{U}{U}")));
}
private FledglingMawcor(final FledglingMawcor card) {

View file

@ -34,7 +34,7 @@ public final class FoothillGuide extends CardImpl {
// Protection from Goblins
this.addAbility(new ProtectionAbility(filter));
// Morph {W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{W}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{W}")));
}
private FoothillGuide(final FoothillGuide card) {

View file

@ -37,7 +37,7 @@ public final class FortuneThief extends CardImpl {
// Damage that would reduce your life total to less than 1 reduces it to 1 instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new FortuneThiefReplacementEffect()));
// Morph {R}{R}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{R}{R}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{R}{R}")));
}
private FortuneThief(final FortuneThief card) {

View file

@ -35,7 +35,7 @@ public final class FrontlineStrategist extends CardImpl {
this.toughness = new MageInt(1);
// Morph {W}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{W}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{W}")));
// When Frontline Strategist is turned face up, prevent all combat damage non-Soldier creatures would deal this turn.
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new PreventAllDamageByAllPermanentsEffect(filter, Duration.EndOfTurn, true).setText("prevent all combat damage non-Soldier creatures would deal this turn")));
}

View file

@ -35,7 +35,7 @@ public final class GathanRaiders extends CardImpl {
new BoostSourceEffect(2,2,Duration.WhileOnBattlefield), HellbentCondition.instance,
"<i>Hellbent</i> &mdash; {this} gets +2/+2 as long as you have no cards in hand")));
// Morph-Discard a card.
this.addAbility(new MorphAbility(new DiscardCardCost()));
this.addAbility(new MorphAbility(this, new DiscardCardCost()));
}
private GathanRaiders(final GathanRaiders card) {

View file

@ -2,12 +2,14 @@ package mage.cards.g;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -90,8 +92,12 @@ class GideonsInterventionCantCastEffect extends ContinuousRuleModifyingEffectImp
public boolean applies(GameEvent event, Ability source, Game game) {
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
MageObject object = game.getObject(event.getSourceId());
return object != null && object.getName().equals(cardName);
SpellAbility spellAbility = SpellAbility.getSpellAbilityFromEvent(event, game);
if (spellAbility == null) {
return false;
}
Card card = spellAbility.getCharacteristics(game);
return card != null && CardUtil.haveSameNames(card, cardName, game);
}
return false;
}

View file

@ -42,7 +42,6 @@ public final class GiftOfDoom extends CardImpl {
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
this.getSpellAbility().setTargetAdjuster(GiftOfDoomAdjuster.instance); // to remove the target set if Morph casting cost is paid
Ability ability = new EnchantAbility(auraTarget);
this.addAbility(ability);
@ -56,7 +55,7 @@ public final class GiftOfDoom extends CardImpl {
this.addAbility(ability2);
// MorphSacrifice another creature.
this.addAbility(new MorphAbility(new SacrificeTargetCost(
this.addAbility(new MorphAbility(this, new SacrificeTargetCost(
new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE)
)));
@ -77,18 +76,6 @@ public final class GiftOfDoom extends CardImpl {
}
}
enum GiftOfDoomAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
// if the Morph casting cost is paid, clear the target of Enchant Creature
if (game.getState().getValue("MorphAbility" + ability.getSourceId()) == "activated") {
ability.getTargets().clear();
}
}
}
class GiftOfDoomEffect extends OneShotEffect {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();

View file

@ -24,7 +24,7 @@ public final class GlacialStalker extends CardImpl {
this.toughness = new MageInt(5);
// Morph {4}{U}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{4}{U}")));
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{4}{U}")));
}
private GlacialStalker(final GlacialStalker card) {

Some files were not shown because too many files have changed in this diff Show more