mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
implement [EOE] Territorial Bruntar
This commit is contained in:
parent
9f144cd32e
commit
432b5f5559
3 changed files with 161 additions and 0 deletions
118
Mage.Sets/src/mage/cards/t/TerritorialBruntar.java
Normal file
118
Mage.Sets/src/mage/cards/t/TerritorialBruntar.java
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.LandfallAbility;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.ReachAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public final class TerritorialBruntar extends CardImpl {
|
||||
|
||||
public TerritorialBruntar(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}");
|
||||
|
||||
this.subtype.add(SubType.BEAST);
|
||||
this.power = new MageInt(6);
|
||||
this.toughness = new MageInt(6);
|
||||
|
||||
// Reach
|
||||
this.addAbility(ReachAbility.getInstance());
|
||||
|
||||
// Landfall — Whenever a land you control enters, exile cards from the top of your library until you exile a nonland card. You may cast that card this turn.
|
||||
this.addAbility(new LandfallAbility(new TerritorialBruntarEffect()));
|
||||
}
|
||||
|
||||
private TerritorialBruntar(final TerritorialBruntar card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerritorialBruntar copy() {
|
||||
return new TerritorialBruntar(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TerritorialBruntarEffect extends OneShotEffect {
|
||||
|
||||
TerritorialBruntarEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "exile cards from the top of your library until you exile a nonland card. You may cast that card this turn";
|
||||
}
|
||||
|
||||
private TerritorialBruntarEffect(final TerritorialBruntarEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
boolean didSomething = false;
|
||||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
didSomething |= controller.moveCards(card, Zone.EXILED, source, game);
|
||||
if (game.getState().getZone(card.getId()) == Zone.EXILED && !card.isLand(game)) {
|
||||
ContinuousEffect effect = new TerritorialBruntarAsThoughEffect();
|
||||
effect.setTargetPointer(new FixedTarget(card, game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return didSomething;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerritorialBruntarEffect copy() {
|
||||
return new TerritorialBruntarEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TerritorialBruntarAsThoughEffect extends AsThoughEffectImpl {
|
||||
|
||||
TerritorialBruntarAsThoughEffect() {
|
||||
super(AsThoughEffectType.CAST_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
|
||||
staticText = "you may cast that card this turn";
|
||||
}
|
||||
|
||||
private TerritorialBruntarAsThoughEffect(final TerritorialBruntarAsThoughEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerritorialBruntarAsThoughEffect copy() {
|
||||
return new TerritorialBruntarAsThoughEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
UUID targetId = getTargetPointer().getFirst(game, source);
|
||||
if (targetId == null) {
|
||||
// cleanup if the target is no longer in the exile
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
return targetId.equals(objectId)
|
||||
&& source.isControlledBy(affectedControllerId)
|
||||
&& Zone.EXILED == game.getState().getZone(objectId);
|
||||
}
|
||||
}
|
||||
|
|
@ -301,6 +301,7 @@ public final class EdgeOfEternities extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Terrapact Intimidator", 164, Rarity.UNCOMMON, mage.cards.t.TerrapactIntimidator.class));
|
||||
cards.add(new SetCardInfo("Terrasymbiosis", 210, Rarity.RARE, mage.cards.t.Terrasymbiosis.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Terrasymbiosis", 312, Rarity.RARE, mage.cards.t.Terrasymbiosis.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Territorial Bruntar", 165, Rarity.UNCOMMON, mage.cards.t.TerritorialBruntar.class));
|
||||
cards.add(new SetCardInfo("Tezzeret, Cruel Captain", 2, Rarity.MYTHIC, mage.cards.t.TezzeretCruelCaptain.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Tezzeret, Cruel Captain", 287, Rarity.MYTHIC, mage.cards.t.TezzeretCruelCaptain.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("The Dominion Bracelet", 239, Rarity.MYTHIC, mage.cards.t.TheDominionBracelet.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
package org.mage.test.cards.single.eoe;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class TerritorialBruntarTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.t.TerritorialBruntar Territorial Bruntar} {4}{R}{R}
|
||||
* Creature — Beast
|
||||
* Reach
|
||||
* Landfall — Whenever a land you control enters, exile cards from the top of your library until you exile a nonland card. You may cast that card this turn.
|
||||
* 6/6
|
||||
*/
|
||||
private static final String bruntar = "Territorial Bruntar";
|
||||
|
||||
@Test
|
||||
public void test_Simple() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, bruntar);
|
||||
addCard(Zone.HAND, playerA, "Mountain", 1);
|
||||
skipInitShuffling();
|
||||
addCard(Zone.LIBRARY, playerA, "Lightning Bolt");
|
||||
addCard(Zone.LIBRARY, playerA, "Forest", 8);
|
||||
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mountain");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
|
||||
assertTappedCount("Mountain", true, 1);
|
||||
assertExileCount(playerA, "Forest", 8);
|
||||
assertLife(playerB, 20 - 3);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue