Some changes related to #4893.

This commit is contained in:
LevelX2 2018-05-03 01:33:21 +02:00
parent 9919a3403d
commit cddd81123b
37 changed files with 245 additions and 137 deletions

View file

@ -27,6 +27,7 @@
*/
package mage.abilities.effects.common;
import java.util.Objects;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
@ -36,8 +37,6 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import java.util.Objects;
/**
*
* @author jeffwadsworth
@ -67,6 +66,17 @@ public class CantBeRegeneratedSourceEffect extends ContinuousRuleModifyingEffect
return event.getType() == EventType.REGENERATE;
}
@Override
public void init(Ability source, Game game) {
super.init(source, game); //To change body of generated methods, choose Tools | Templates.
if (duration.isOnlyValidIfNoZoneChange()) {
// If source permanent is no longer onto battlefield discard the effect
if (source.getSourcePermanentIfItStillExists(game) == null) {
discard();
}
}
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return Objects.equals(source.getSourceId(), event.getTargetId());