mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 22:12:03 -08:00
* UnearthAbility - Fixed that unearthed creatures had no haste.
This commit is contained in:
parent
ef83ec2874
commit
9c6db9405a
4 changed files with 28 additions and 21 deletions
|
|
@ -156,7 +156,8 @@ public class ContinuousEffects implements Serializable {
|
|||
case WhileInGraveyard:
|
||||
HashSet<Ability> abilities = layeredEffects.getAbility(effect.getId());
|
||||
for (Ability ability: abilities) {
|
||||
if (ability.isInUseableZone(game, null, false)) {
|
||||
// If e.g. triggerd abilities (non static) created the effect, the ability must not be in usable zone (e.g. Unearth giving Haste effect)
|
||||
if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game, null, false)) {
|
||||
layerEffects.add(effect);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class SacrificeTargetEffect extends OneShotEffect<SacrificeTargetEffect>
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if ("".equals(staticText) && !mode.getTargets().isEmpty()) {
|
||||
if (staticText.isEmpty() && !mode.getTargets().isEmpty()) {
|
||||
if (mode.getTargets().get(0).getNumberOfTargets() == 1) {
|
||||
return "The controller of target " + mode.getTargets().get(0).getTargetName() + " sacrifices it";
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@
|
|||
|
||||
package mage.abilities.effects.common.continious;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl<GainAbilitySou
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.addAbility(ability, game);
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -28,10 +28,6 @@
|
|||
|
||||
package mage.abilities.keyword;
|
||||
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
|
|
@ -39,8 +35,12 @@ import mage.abilities.costs.mana.ManaCosts;
|
|||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
|
||||
import mage.abilities.effects.common.ExileSourceEffect;
|
||||
import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
|
||||
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
|
||||
import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
|
|
@ -49,11 +49,19 @@ import mage.game.events.ZoneChangeEvent;
|
|||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*
|
||||
*
|
||||
* 702.82. Unearth
|
||||
*
|
||||
* 702.82a Unearth is an activated ability that functions while the card with unearth
|
||||
* is in a graveyard. "Unearth [cost]" means "[Cost]: Return this card from your graveyard
|
||||
* to the battlefield. It gains haste. Exile it at the beginning of the next end step.
|
||||
* If it would leave the battlefield, exile it instead of putting it anywhere else.
|
||||
* Activate this ability only any time you could cast a sorcery."
|
||||
*
|
||||
*/
|
||||
public class UnearthAbility extends ActivatedAbilityImpl<UnearthAbility> {
|
||||
|
||||
protected boolean unearthed;
|
||||
|
||||
public UnearthAbility(ManaCosts costs) {
|
||||
super(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), costs);
|
||||
this.timing = TimingRule.SORCERY;
|
||||
|
|
@ -64,7 +72,6 @@ public class UnearthAbility extends ActivatedAbilityImpl<UnearthAbility> {
|
|||
|
||||
public UnearthAbility(final UnearthAbility ability) {
|
||||
super(ability);
|
||||
this.unearthed = ability.unearthed;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -72,13 +79,12 @@ public class UnearthAbility extends ActivatedAbilityImpl<UnearthAbility> {
|
|||
return new UnearthAbility(this);
|
||||
}
|
||||
|
||||
public boolean isUnearthed() {
|
||||
return unearthed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Unearth " + super.getRule();
|
||||
StringBuilder sb = new StringBuilder("Unearth ").append(this.getManaCosts().getText());
|
||||
sb.append(" <i>(").append(this.getManaCosts().getText());
|
||||
sb.append(": Return this card from your graveyard to the battlefield. It gains haste. Exile it at the beginning of the next end step or if it would leave the battlefield. Unearth only as a sorcery.)");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -133,8 +139,9 @@ class UnearthLeavesBattlefieldEffect extends ReplacementEffectImpl<UnearthLeaves
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() != Zone.EXILED)
|
||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() != Zone.EXILED) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -149,5 +156,4 @@ class UnearthLeavesBattlefieldEffect extends ReplacementEffectImpl<UnearthLeaves
|
|||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return apply(game, source);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue