fixed Uro, Titan of Nature's Wrath (getSpellOrLKIStack return ability instead spell after card triggers);

This commit is contained in:
Oleg Agafonov 2020-01-14 11:48:15 +04:00
parent dae2c57c45
commit 92eba9861d
3 changed files with 59 additions and 19 deletions

View file

@ -8,15 +8,19 @@ import mage.constants.SpellAbilityType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.target.common.TargetCardInYourGraveyard;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public class EscapeAbility extends SpellAbility {
private static final FilterCard filter = new FilterCard("card to exile");
private static final String CASTED_WITH_ESCAPE_KEY = "escapeActivated";
static {
filter.add(AnotherPredicate.instance);
@ -61,4 +65,18 @@ public class EscapeAbility extends SpellAbility {
return "Escape—" + this.manaCost + ", Exile " + CardUtil.numberToText(this.exileCount) +
" other cards from your graveyard. <i>(You may cast this card from your graveyard for its escape cost.)</i>";
}
@Override
public boolean activate(Game game, boolean noMana) {
if (super.activate(game, noMana)) {
game.getState().setValue(CASTED_WITH_ESCAPE_KEY + getSourceId().toString() + (getSourceObjectZoneChangeCounter() + 1), Boolean.TRUE);
return true;
}
return false;
}
public static boolean wasCastedWithEscape(Game game, UUID sourceId, int sourceZCC) {
Object activated = game.getState().getValue(CASTED_WITH_ESCAPE_KEY + sourceId.toString() + sourceZCC);
return activated != null;
}
}