mirror of
https://github.com/correl/mage.git
synced 2025-02-27 03:45:09 +00:00
fixed Uro, Titan of Nature's Wrath (getSpellOrLKIStack return ability instead spell after card triggers);
This commit is contained in:
parent
dae2c57c45
commit
92eba9861d
3 changed files with 59 additions and 19 deletions
|
@ -18,7 +18,6 @@ import mage.constants.SuperType;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.stack.Spell;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -81,8 +80,7 @@ class UroTitanOfNaturesWrathEffect extends OneShotEffect {
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Spell spell = game.getSpellOrLKIStack(source.getSourceId());
|
if (EscapeAbility.wasCastedWithEscape(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter())) {
|
||||||
if (spell != null && spell.getSpellAbility() instanceof EscapeAbility) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return permanent.sacrifice(source.getSourceId(), game);
|
return permanent.sacrifice(source.getSourceId(), game);
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package org.mage.test.cards.triggers;
|
package org.mage.test.cards.triggers;
|
||||||
|
|
||||||
import mage.constants.PhaseStep;
|
import mage.constants.PhaseStep;
|
||||||
|
@ -8,7 +7,6 @@ import org.junit.Test;
|
||||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
|
public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
|
||||||
|
@ -74,7 +72,6 @@ public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
|
||||||
* Scion of Vitu-Ghazi if it is NOT cast from the hand, it will still allow
|
* Scion of Vitu-Ghazi if it is NOT cast from the hand, it will still allow
|
||||||
* the Populate effect. It should only allow these when it is cast from
|
* the Populate effect. It should only allow these when it is cast from
|
||||||
* hand.
|
* hand.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testScionOfVituGhaziConditionNotTrue() {
|
public void testScionOfVituGhaziConditionNotTrue() {
|
||||||
|
@ -108,7 +105,7 @@ public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dread Cacodemon's abilities should only trigger when cast from hand.
|
* Dread Cacodemon's abilities should only trigger when cast from hand.
|
||||||
*
|
* <p>
|
||||||
* Testing when cast from hand abilities take effect. Cast from hand
|
* Testing when cast from hand abilities take effect. Cast from hand
|
||||||
* destroys opponents creatures and taps all other creatures owner controls.
|
* destroys opponents creatures and taps all other creatures owner controls.
|
||||||
*/
|
*/
|
||||||
|
@ -141,7 +138,7 @@ public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dread Cacodemon's abilities should only trigger when cast from hand.
|
* Dread Cacodemon's abilities should only trigger when cast from hand.
|
||||||
*
|
* <p>
|
||||||
* Testing when card is not cast from hand, abilities do not take effect.
|
* Testing when card is not cast from hand, abilities do not take effect.
|
||||||
* All opponents creatures remain alive and owner's creatures are not
|
* All opponents creatures remain alive and owner's creatures are not
|
||||||
* tapped.
|
* tapped.
|
||||||
|
@ -181,7 +178,6 @@ public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that the cast from hand condition works for target permanent
|
* Test that the cast from hand condition works for target permanent
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testWildPair() {
|
public void testWildPair() {
|
||||||
|
@ -380,4 +376,32 @@ public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
assertLife(playerA, 15);
|
assertLife(playerA, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_MultiTriggersAndSpellLKI() {
|
||||||
|
// getSpellOrLKIStack can return last triggered ability (e.g. null) instead real spell
|
||||||
|
// need to fix it (always return last spell)
|
||||||
|
|
||||||
|
// When Uro enters the battlefield, sacrifice it unless it escaped.
|
||||||
|
// Whenever Uro enters the battlefield or attacks, you gain 3 life and draw a card, then you may put a land card from your hand onto the battlefield.
|
||||||
|
// Escape-{G}{G}{U}{U}, Exile five other cards from your graveyard. (You may cast this card from your graveyard for its escape cost.)
|
||||||
|
addCard(Zone.GRAVEYARD, playerA, "Uro, Titan of Nature's Wrath");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||||
|
addCard(Zone.GRAVEYARD, playerA, "Balduvian Bears", 5);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Uro, Titan of Nature's Wrath");
|
||||||
|
setChoice(playerA, "Balduvian Bears^Balduvian Bears^Balduvian Bears^Balduvian Bears^Balduvian Bears");
|
||||||
|
setChoice(playerA, "When {this} enters the battlefield, sacrifice it"); // sacrifice trigger must go first
|
||||||
|
setChoice(playerA, "No"); // do not put land to battlefield
|
||||||
|
|
||||||
|
// sacrifice trigger must found escape ability by getSpellOrLKIStack and keep uro on battlefield
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Uro, Titan of Nature's Wrath", 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,19 @@ import mage.constants.SpellAbilityType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
public class EscapeAbility extends SpellAbility {
|
public class EscapeAbility extends SpellAbility {
|
||||||
|
|
||||||
private static final FilterCard filter = new FilterCard("card to exile");
|
private static final FilterCard filter = new FilterCard("card to exile");
|
||||||
|
private static final String CASTED_WITH_ESCAPE_KEY = "escapeActivated";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(AnotherPredicate.instance);
|
filter.add(AnotherPredicate.instance);
|
||||||
|
@ -61,4 +65,18 @@ public class EscapeAbility extends SpellAbility {
|
||||||
return "Escape—" + this.manaCost + ", Exile " + CardUtil.numberToText(this.exileCount) +
|
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>";
|
" 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue