forked from External/mage
[LCI] Implement Deep-Cavern Bat
This commit is contained in:
parent
db7198620e
commit
9e9362d7cd
2 changed files with 113 additions and 0 deletions
112
Mage.Sets/src/mage/cards/d/DeepCavernBat.java
Normal file
112
Mage.Sets/src/mage/cards/d/DeepCavernBat.java
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.delayed.OnLeaveReturnExiledAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public final class DeepCavernBat extends CardImpl {
|
||||
|
||||
public DeepCavernBat(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
|
||||
|
||||
this.subtype.add(SubType.BAT);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Lifelink
|
||||
this.addAbility(LifelinkAbility.getInstance());
|
||||
|
||||
// When Deep-Cavern Bat enters the battlefield, look at target opponent's hand. You may exile a nonland card from it until Deep-Cavern Bat leaves the battlefield.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new DeepCaverBatEffect());
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private DeepCavernBat(final DeepCavernBat card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeepCavernBat copy() {
|
||||
return new DeepCavernBat(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DeepCaverBatEffect extends OneShotEffect {
|
||||
|
||||
DeepCaverBatEffect() {
|
||||
super(Outcome.Exile);
|
||||
staticText = "look at target opponent's hand. You may exile a nonland card from it until {this} leaves the battlefield";
|
||||
}
|
||||
|
||||
private DeepCaverBatEffect(final DeepCaverBatEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeepCaverBatEffect copy() {
|
||||
return new DeepCaverBatEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player opponent = game.getPlayer(source.getFirstTarget());
|
||||
if (controller == null || opponent == null || opponent.getHand().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MageObject sourceObj = source.getSourceObject(game);
|
||||
// Looking at the opponent's hand without check on if the bat is still on the battlefield.
|
||||
controller.lookAtCards(sourceObj == null ? null : sourceObj.getIdName(), opponent.getHand(), game);
|
||||
|
||||
Permanent bat = source.getSourcePermanentIfItStillExists(game);
|
||||
if (bat == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TargetCard target = new TargetCardInHand(
|
||||
0, 1, StaticFilters.FILTER_CARD_A_NON_LAND
|
||||
);
|
||||
controller.choose(outcome, opponent.getHand(), target, source, game);
|
||||
Card card = opponent.getHand().get(target.getFirstTarget(), game);
|
||||
if (card == null) {
|
||||
return true;
|
||||
}
|
||||
Cards cards = new CardsImpl(target.getTargets());
|
||||
controller.moveCardsToExile(
|
||||
cards.getCards(game), source, game, true,
|
||||
CardUtil.getExileZoneId(game, source),
|
||||
bat.getIdName()
|
||||
);
|
||||
game.addDelayedTriggeredAbility(new OnLeaveReturnExiledAbility(Zone.HAND), source);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -42,6 +42,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Confounding Riddle", 50, Rarity.UNCOMMON, mage.cards.c.ConfoundingRiddle.class));
|
||||
cards.add(new SetCardInfo("Cosmium Kiln", 6, Rarity.UNCOMMON, mage.cards.c.CosmiumKiln.class));
|
||||
cards.add(new SetCardInfo("Dauntless Dismantler", 8, Rarity.UNCOMMON, mage.cards.d.DauntlessDismantler.class));
|
||||
cards.add(new SetCardInfo("Deep-Cavern Bat", 102, Rarity.UNCOMMON, mage.cards.d.DeepCavernBat.class));
|
||||
cards.add(new SetCardInfo("Deeproot Pilgrimage", 52, Rarity.RARE, mage.cards.d.DeeprootPilgrimage.class));
|
||||
cards.add(new SetCardInfo("Defossilize", 103, Rarity.UNCOMMON, mage.cards.d.Defossilize.class));
|
||||
cards.add(new SetCardInfo("Didact Echo", 53, Rarity.COMMON, mage.cards.d.DidactEcho.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue