mirror of
https://github.com/correl/mage.git
synced 2024-11-29 03:00:12 +00:00
Fix #8812 and add test
This commit is contained in:
parent
a581d55160
commit
46f98a0f88
3 changed files with 33 additions and 17 deletions
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.cards.e;
|
package mage.cards.e;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -19,9 +18,8 @@ import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.ComparisonType;
|
import mage.constants.ComparisonType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.TargetController;
|
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
|
@ -33,25 +31,21 @@ import mage.players.Player;
|
||||||
*/
|
*/
|
||||||
public final class ErebossTitan extends CardImpl {
|
public final class ErebossTitan extends CardImpl {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
|
||||||
|
|
||||||
static {
|
|
||||||
filter.add(TargetController.OPPONENT.getControllerPredicate());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ErebossTitan(UUID ownerId, CardSetInfo setInfo) {
|
public ErebossTitan(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}{B}{B}");
|
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}{B}{B}");
|
||||||
this.subtype.add(SubType.GIANT);
|
this.subtype.add(SubType.GIANT);
|
||||||
this.power = new MageInt(5);
|
this.power = new MageInt(5);
|
||||||
this.toughness = new MageInt(5);
|
this.toughness = new MageInt(5);
|
||||||
|
|
||||||
// Erebos's Titan has indestructible as long as no opponent controls a creature.
|
// As long as your opponents control no creatures, Erebos's Titan has indestructible.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
|
||||||
new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield),
|
new GainAbilitySourceEffect(
|
||||||
new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.EQUAL_TO, 0, false),
|
IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield),
|
||||||
"As long as your opponents control no creatures, {this} has indestructible")));
|
new PermanentsOnTheBattlefieldCondition(
|
||||||
|
StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE, ComparisonType.EQUAL_TO, 0, false),
|
||||||
|
"As long as your opponents control no creatures, {this} has indestructible")));
|
||||||
|
|
||||||
// Whenever a creature leaves an opponent's graveyard, you may discard a card. If you do, return Erebos's Titan from your graveyard to your hand.
|
// Whenever a creature card leaves an opponent's graveyard, you may discard a card. If you do, return Erebos's Titan from your graveyard to your hand.
|
||||||
this.addAbility(new ErebossTitanTriggeredAbility());
|
this.addAbility(new ErebossTitanTriggeredAbility());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -102,6 +96,6 @@ class ErebossTitanTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTriggerPhrase() {
|
public String getTriggerPhrase() {
|
||||||
return "Whenever a creature leaves an opponent's graveyard, " ;
|
return "Whenever a creature card leaves an opponent's graveyard, " ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ class SyrKonradTheGrimTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
}
|
}
|
||||||
// Or a creature card leaves your graveyard
|
// Or a creature card leaves your graveyard
|
||||||
return zEvent.getFromZone() == Zone.GRAVEYARD
|
return zEvent.getFromZone() == Zone.GRAVEYARD
|
||||||
&& zEvent.getPlayerId() == this.getControllerId();
|
&& card.isOwnedBy(this.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,4 +30,26 @@ public class SyrKonradTheGrimTest extends CardTestPlayerBase {
|
||||||
assertLife(playerA, 20);
|
assertLife(playerA, 20);
|
||||||
assertLife(playerB, 18);
|
assertLife(playerB, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void reanimateFromOtherGraveyardTest() {
|
||||||
|
addCard(Zone.HAND, playerA, "Reanimate");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Syr Konrad, the Grim");
|
||||||
|
addCard(Zone.GRAVEYARD, playerB, "Grizzly Bears");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.UNTAP);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerB, 20);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate", "Grizzly Bears");
|
||||||
|
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertGraveyardCount(playerB, 0);
|
||||||
|
assertPermanentCount(playerA, "Grizzly Bears", 1);
|
||||||
|
assertLife(playerA, 18); // loss of 2 from reanimate
|
||||||
|
assertLife(playerB, 20); // card leaving B's graveyard *shouldn't* cause loss of life
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue