mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* Unearth - Fixed a problem with exiling the unearthed creature (fixes #1912).
This commit is contained in:
parent
0d11a39fc4
commit
6a03522ee8
4 changed files with 34 additions and 33 deletions
|
@ -29,6 +29,7 @@ package mage.sets.darkascension;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
|
@ -115,14 +116,13 @@ class DungeonGeistsEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
return event.getType() == GameEvent.EventType.UNTAP || event.getType() == GameEvent.EventType.ZONE_CHANGE || event.getType() == GameEvent.EventType.LOST_CONTROL;
|
return event.getType() == GameEvent.EventType.UNTAP || event.getType() == GameEvent.EventType.ZONE_CHANGE || event.getType() == GameEvent.EventType.LOST_CONTROL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
// Source must be on the battlefield (it's neccessary to check here because if as response to the enter
|
// Source must be on the battlefield (it's neccessary to check here because if as response to the enter
|
||||||
// the battlefield triggered ability the source dies (or will be exiled), then the ZONE_CHANGE or LOST_CONTROL
|
// the battlefield triggered ability the source dies (or will be exiled), then the ZONE_CHANGE or LOST_CONTROL
|
||||||
// event will happen before this effect is applied ever)
|
// event will happen before this effect is applied ever)
|
||||||
Permanent sourcePermanent = (Permanent) source.getSourceObjectIfItStillExists(game);
|
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
|
||||||
if (sourcePermanent == null || !sourcePermanent.getControllerId().equals(source.getControllerId())) {
|
if (!(sourceObject instanceof Permanent) || !((Permanent) sourceObject).getControllerId().equals(source.getControllerId())) {
|
||||||
discard();
|
discard();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ package mage.sets.tempest;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
|
@ -116,8 +117,8 @@ class StarkeOfRathEffect extends OneShotEffect {
|
||||||
if (targetPermanent != null) {
|
if (targetPermanent != null) {
|
||||||
targetPermanent.destroy(source.getSourceId(), game, false);
|
targetPermanent.destroy(source.getSourceId(), game, false);
|
||||||
}
|
}
|
||||||
Permanent sourcePermanent = (Permanent) source.getSourceObjectIfItStillExists(game);
|
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
|
||||||
if (sourcePermanent != null && targetPermanent != null) {
|
if ((sourceObject instanceof Permanent) && targetPermanent != null) {
|
||||||
ContinuousEffect effect = new StarkeOfRathControlEffect();
|
ContinuousEffect effect = new StarkeOfRathControlEffect();
|
||||||
effect.setTargetPointer(new FixedTarget(targetPermanent.getControllerId()));
|
effect.setTargetPointer(new FixedTarget(targetPermanent.getControllerId()));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
|
|
|
@ -1176,7 +1176,7 @@ public abstract class AbilityImpl implements Ability {
|
||||||
MageObjectReference mor = new MageObjectReference(currentObject, game);
|
MageObjectReference mor = new MageObjectReference(currentObject, game);
|
||||||
if (mor.getZoneChangeCounter() == getSourceObjectZoneChangeCounter()) {
|
if (mor.getZoneChangeCounter() == getSourceObjectZoneChangeCounter()) {
|
||||||
// source object has meanwhile not changed zone
|
// source object has meanwhile not changed zone
|
||||||
return sourceObject;
|
return currentObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.abilities.keyword;
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -55,11 +54,12 @@ import mage.players.Player;
|
||||||
*
|
*
|
||||||
* 702.82. Unearth
|
* 702.82. Unearth
|
||||||
*
|
*
|
||||||
* 702.82a Unearth is an activated ability that functions while the card with unearth
|
* 702.82a Unearth is an activated ability that functions while the card with
|
||||||
* is in a graveyard. "Unearth [cost]" means "[Cost]: Return this card from your graveyard
|
* unearth is in a graveyard. "Unearth [cost]" means "[Cost]: Return this card
|
||||||
* to the battlefield. It gains haste. Exile it at the beginning of the next end step.
|
* from your graveyard to the battlefield. It gains haste. Exile it at the
|
||||||
* If it would leave the battlefield, exile it instead of putting it anywhere else.
|
* beginning of the next end step. If it would leave the battlefield, exile it
|
||||||
* Activate this ability only any time you could cast a sorcery."
|
* instead of putting it anywhere else. Activate this ability only any time you
|
||||||
|
* could cast a sorcery."
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class UnearthAbility extends ActivatedAbilityImpl {
|
public class UnearthAbility extends ActivatedAbilityImpl {
|
||||||
|
@ -149,7 +149,7 @@ class UnearthLeavesBattlefieldEffect extends ReplacementEffectImpl {
|
||||||
if (event.getTargetId().equals(source.getSourceId())) {
|
if (event.getTargetId().equals(source.getSourceId())) {
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() != Zone.EXILED) {
|
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() != Zone.EXILED) {
|
||||||
// started in graveyard goint to battlefield so current zone change counter has to be +1
|
// started in graveyard going to battlefield so current zone change counter has to be +1
|
||||||
return source.getSourceObjectZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(source.getSourceId());
|
return source.getSourceObjectZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(source.getSourceId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue