1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-09 17:00:09 -09:00

Fixed that Haste effects given to Obzedat on enters the battlefield stayed after going back to hand and recasting of it.

This commit is contained in:
LevelX2 2014-03-14 15:05:36 +01:00
parent dc0d5a4bc8
commit d1082293a8
4 changed files with 12 additions and 6 deletions
Mage.Sets/src/mage/sets/theros
Mage/src/mage/abilities

View file

@ -155,8 +155,9 @@ class WhipOfErebosReplacementEffect extends ReplacementEffectImpl<WhipOfErebosRe
@Override @Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Card card = game.getCard(source.getFirstTarget()); Card card = game.getCard(source.getFirstTarget());
if (card != null) { Player controller = game.getPlayer(source.getControllerId());
card.moveToExile(null, "", source.getId(), game); if (card != null && controller != null) {
controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, null);
} }
return true; return true;
} }

View file

@ -34,6 +34,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player;
/** /**
* *
@ -58,13 +59,14 @@ public class ExileSourceEffect extends OneShotEffect<ExileSourceEffect> {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId()); Permanent permanent = game.getPermanent(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (permanent != null) { if (permanent != null) {
return permanent.moveToExile(null, "", source.getId(), game); return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, null);
} else { } else {
// try to exile card // try to exile card -> is this correct in all cases? (LevelX2)
Card card = game.getCard(source.getSourceId()); Card card = game.getCard(source.getSourceId());
if (card != null) { if (card != null) {
return card.moveToExile(null, "", source.getSourceId(), game); return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, null);
} }
} }
return false; return false;

View file

@ -109,6 +109,9 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl<GainAbilitySou
permanent.addAbility(ability, source.getSourceId(), game); permanent.addAbility(ability, source.getSourceId(), game);
return true; return true;
} }
if (duration.equals(Duration.Custom)) {
this.discard();
}
} }
return false; return false;
} }

View file

@ -65,7 +65,7 @@ public class UnearthAbility extends ActivatedAbilityImpl<UnearthAbility> {
public UnearthAbility(ManaCosts costs) { public UnearthAbility(ManaCosts costs) {
super(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), costs); super(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), costs);
this.timing = TimingRule.SORCERY; this.timing = TimingRule.SORCERY;
this.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield)); this.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.Custom));
this.addEffect(new CreateDelayedTriggeredAbilityEffect(new UnearthDelayedTriggeredAbility())); this.addEffect(new CreateDelayedTriggeredAbilityEffect(new UnearthDelayedTriggeredAbility()));
this.addEffect(new UnearthLeavesBattlefieldEffect()); this.addEffect(new UnearthLeavesBattlefieldEffect());
} }