mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Fixed that abilities of copied permanents (e.g. Phyrexian Metamorph copying Harmonic Sliver) that gain abilities to other permanents were in some situations not correctly applied to that other permanents.
This commit is contained in:
parent
f553098ba1
commit
14a8632f0f
7 changed files with 9 additions and 16 deletions
|
@ -30,7 +30,6 @@ package mage.sets.newphyrexia;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
|
@ -38,7 +37,6 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CopyPermanentEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterPermanent;
|
||||
|
@ -46,9 +44,6 @@ import mage.filter.predicate.Predicates;
|
|||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
|
||||
/**
|
||||
|
|
|
@ -95,21 +95,14 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
|
||||
if (event.getTargetId().equals(source.getSourceId())) {
|
||||
if (condition == null || condition.apply(game, source)) {
|
||||
return true;
|
||||
}
|
||||
if (event.getTargetId().equals(source.getSourceId())) {
|
||||
if (condition == null || condition.apply(game, source)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
if (optional) {
|
||||
|
|
|
@ -80,6 +80,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
|
|||
public GainAbilityAllEffect(final GainAbilityAllEffect effect) {
|
||||
super(effect);
|
||||
this.ability = effect.ability.copy();
|
||||
ability.newId(); // This is needed if the effect is copied e.g. by a clone so the ability can be added multiple times to permanents
|
||||
this.filter = effect.filter.copy();
|
||||
this.excludeSource = effect.excludeSource;
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl {
|
|||
public GainAbilityAttachedEffect(final GainAbilityAttachedEffect effect) {
|
||||
super(effect);
|
||||
this.ability = effect.ability.copy();
|
||||
ability.newId(); // This is needed if the effect is copied e.g. by a clone so the ability can be added multiple times to permanents
|
||||
this.attachmentType = effect.attachmentType;
|
||||
this.fixedTarget = effect.fixedTarget;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ public class GainAbilityPairedEffect extends ContinuousEffectImpl {
|
|||
public GainAbilityPairedEffect(final GainAbilityPairedEffect effect) {
|
||||
super(effect);
|
||||
this.ability = effect.ability.copy();
|
||||
ability.newId(); // This is needed if the effect is copied e.g. by a clone so the ability can be added multiple times to permanents
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,7 +69,7 @@ public class GainAbilityPairedEffect extends ContinuousEffectImpl {
|
|||
Permanent paired = game.getPermanent(permanent.getPairedCard());
|
||||
if (paired != null) {
|
||||
permanent.addAbility(ability, game);
|
||||
paired.addAbility(ability, source.getSourceId(), game);
|
||||
paired.addAbility(ability, source.getSourceId(), game, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl implements Sou
|
|||
public GainAbilitySourceEffect(final GainAbilitySourceEffect effect) {
|
||||
super(effect);
|
||||
this.ability = effect.ability.copy();
|
||||
ability.newId(); // This is needed if the effect is copied e.g. by a clone so the ability can be added multiple times to permanents
|
||||
this.onCard = effect.onCard;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
|
|||
public GainAbilityTargetEffect(final GainAbilityTargetEffect effect) {
|
||||
super(effect);
|
||||
this.ability = effect.ability.copy();
|
||||
ability.newId(); // This is needed if the effect is copied e.g. by a clone so the ability can be added multiple times to permanents
|
||||
this.onCard = effect.onCard;
|
||||
this.durationPhaseStep = effect.durationPhaseStep;
|
||||
this.durationPlayerId = effect.durationPlayerId;
|
||||
|
|
Loading…
Reference in a new issue