* Fixed that some cards apply or not apply triggered effects after zone change (Bellowing Fiend, Flayed Nim, Genesis Chamber, Grim Feast, see #6187);

This commit is contained in:
Oleg Agafonov 2020-01-15 06:10:00 +04:00
parent bcb5be77be
commit 3f7b0da884
7 changed files with 25 additions and 20 deletions

View file

@ -15,6 +15,7 @@ import mage.constants.SubType;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID; import java.util.UUID;
@ -68,7 +69,7 @@ class BellowingFiendEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
boolean applied = false; boolean applied = false;
Permanent damagedCreature = game.getPermanentOrLKIBattlefield(targetPointer.getFirst(game, source)); Permanent damagedCreature = ((FixedTarget) targetPointer).getTargetedPermanentOrLKIBattlefield(game);
if (damagedCreature != null) { if (damagedCreature != null) {
Player controller = game.getPlayer(damagedCreature.getControllerId()); Player controller = game.getPlayer(damagedCreature.getControllerId());
if (controller != null) { if (controller != null) {

View file

@ -1,7 +1,5 @@
package mage.cards.f; package mage.cards.f;
import java.util.StringTokenizer;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
@ -21,8 +19,10 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.StringTokenizer;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class FaerieArtisans extends CardImpl { public final class FaerieArtisans extends CardImpl {
@ -79,7 +79,7 @@ class FaerieArtisansEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanentToCopy = game.getPermanentOrLKIBattlefield(getTargetPointer().getFixedTarget(game, source).getTarget()); Permanent permanentToCopy = game.getPermanentOrLKIBattlefield(targetPointer.getFixedTarget(game, source).getTarget());
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null && permanentToCopy != null) { if (controller != null && permanentToCopy != null) {
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, CardType.ARTIFACT, false); CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, CardType.ARTIFACT, false);

View file

@ -1,7 +1,5 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToACreatureTriggeredAbility; import mage.abilities.common.DealsCombatDamageToACreatureTriggeredAbility;
@ -9,18 +7,20 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.RegenerateSourceEffect; import mage.abilities.effects.common.RegenerateSourceEffect;
import mage.constants.SubType;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class FlayedNim extends CardImpl { public final class FlayedNim extends CardImpl {
@ -67,7 +67,7 @@ class FlayedNimEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanentOrLKIBattlefield(targetPointer.getFirst(game, source)); Permanent creature = ((FixedTarget) targetPointer).getTargetedPermanentOrLKIBattlefield(game);
if (creature == null) { if (creature == null) {
return false; return false;
} }

View file

@ -1,7 +1,5 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbility; import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
@ -20,9 +18,11 @@ import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.MyrToken; import mage.game.permanent.token.MyrToken;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
*
* @author Plopman * @author Plopman
*/ */
public final class GenesisChamber extends CardImpl { public final class GenesisChamber extends CardImpl {
@ -41,8 +41,8 @@ public final class GenesisChamber extends CardImpl {
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability,
SourceUntappedCondition.instance, SourceUntappedCondition.instance,
"Whenever a nontoken creature enters the battlefield, " "Whenever a nontoken creature enters the battlefield, "
+ "if {this} is untapped, " + "if {this} is untapped, "
+ "that creature's controller creates a 1/1 colorless Myr artifact creature token")); + "that creature's controller creates a 1/1 colorless Myr artifact creature token"));
} }
public GenesisChamber(final GenesisChamber card) { public GenesisChamber(final GenesisChamber card) {
@ -92,7 +92,7 @@ class GenesisChamberEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanentOrLKIBattlefield(targetPointer.getFirst(game, source)); Permanent permanent = ((FixedTarget) targetPointer).getTargetedPermanentOrLKIBattlefield(game);
if (permanent != null) { if (permanent != null) {
MyrToken token = new MyrToken(); MyrToken token = new MyrToken();
token.putOntoBattlefield(1, game, source.getSourceId(), permanent.getControllerId()); token.putOntoBattlefield(1, game, source.getSourceId(), permanent.getControllerId());

View file

@ -14,6 +14,7 @@ import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID; import java.util.UUID;
@ -90,7 +91,7 @@ class GrimFeastEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanentOrLKIBattlefield(targetPointer.getFirst(game, source)); Permanent creature = ((FixedTarget) targetPointer).getTargetedPermanentOrLKIBattlefield(game);
if (creature == null) { if (creature == null) {
return false; return false;
} }

View file

@ -71,7 +71,10 @@ class IncongruityEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanentOrLKIBattlefield(targetPointer.getFirst(game, source)); // If the target creature is an illegal target by the time Incongruity tries to resolve, the spell doesnt resolve.
// No player creates a Frog Lizard token.
// (2019-01-25)
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) { if (permanent != null) {
FrogLizardToken token = new FrogLizardToken(); FrogLizardToken token = new FrogLizardToken();
token.putOntoBattlefield(1, game, source.getSourceId(), permanent.getControllerId()); token.putOntoBattlefield(1, game, source.getSourceId(), permanent.getControllerId());

View file

@ -73,8 +73,8 @@ class LesserWerewolfEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Permanent targetPermanent = game.getPermanentOrLKIBattlefield(targetPointer.getFirst(game, source)); Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source)); // must be valid target
if (controller != null && sourcePermanent != null && targetPermanent != null) { if (controller != null && sourcePermanent != null && targetPermanent != null) {
if (sourcePermanent.getPower().getValue() >= 1) { if (sourcePermanent.getPower().getValue() >= 1) {
game.addEffect(new BoostSourceEffect(-1, 0, Duration.EndOfTurn), source); game.addEffect(new BoostSourceEffect(-1, 0, Duration.EndOfTurn), source);