mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
[40K] Implement Inquisitor Eisenhorn (#9678)
* [40K] Implement Inquisitor Eisenhorn * Add Cherubael file author * Fixed Inquisitor Eisenhorn failing to reveal top card of library as its drawn
This commit is contained in:
parent
3b8ae39e4c
commit
b44dc7335e
3 changed files with 178 additions and 0 deletions
145
Mage.Sets/src/mage/cards/i/InquisitorEisenhorn.java
Normal file
145
Mage.Sets/src/mage/cards/i/InquisitorEisenhorn.java
Normal file
|
@ -0,0 +1,145 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.SavedDamageValue;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.keyword.InvestigateEffect;
|
||||
import mage.abilities.hint.HintUtils;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.CherubaelToken;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.common.CardsAmountDrawnThisTurnWatcher;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author PurpleCrowbar
|
||||
*/
|
||||
public final class InquisitorEisenhorn extends CardImpl {
|
||||
|
||||
public InquisitorEisenhorn(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{B}");
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN, SubType.INQUISITOR);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// You may reveal the first card you draw each turn as you draw it. Whenever you reveal an instant or
|
||||
// sorcery card this way, create Cherubael, a legendary 4/4 black Demon creature token with flying.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new InquisitorEisenhornReplacementEffect()), new CardsAmountDrawnThisTurnWatcher());
|
||||
|
||||
// Whenever Inquisitor Eisenhorn deals combat damage to a player, investigate that many times.
|
||||
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
|
||||
new InvestigateEffect(SavedDamageValue.MANY).setText("investigate that many times"),
|
||||
false, true
|
||||
));
|
||||
}
|
||||
|
||||
private InquisitorEisenhorn(final InquisitorEisenhorn card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InquisitorEisenhorn copy() {
|
||||
return new InquisitorEisenhorn(this);
|
||||
}
|
||||
}
|
||||
|
||||
class InquisitorEisenhornReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
public InquisitorEisenhornReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Neutral);
|
||||
this.staticText = "You may reveal the first card you draw each turn as you draw it. Whenever you reveal an instant or " +
|
||||
"sorcery card this way, create Cherubael, a legendary 4/4 black Demon creature token with flying";
|
||||
}
|
||||
|
||||
public InquisitorEisenhornReplacementEffect(final InquisitorEisenhornReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InquisitorEisenhornReplacementEffect copy() {
|
||||
return new InquisitorEisenhornReplacementEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
// reveal the top card and draw (return false to continue to default draw)
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (permanent == null || controller == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Card topCard = controller.getLibrary().getFromTop(game);
|
||||
if (topCard == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (topCard.isInstantOrSorcery(game)) {
|
||||
new CherubaelToken().putOntoBattlefield(1, game, source);
|
||||
}
|
||||
|
||||
// reveal
|
||||
controller.setTopCardRevealed(true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DRAW_CARD;
|
||||
}
|
||||
|
||||
String getAppliedMark(Game game, Ability source) {
|
||||
return source.getId() + "-applied-" + source.getControllerId() + "-" + game.getState().getTurnNum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (!event.getPlayerId().equals(source.getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (permanent == null && controller == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Card topCard = controller.getLibrary().getFromTop(game);
|
||||
if (topCard == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// only first drawn card
|
||||
// if card cast on that turn or controller changed then needs history from watcher
|
||||
CardsAmountDrawnThisTurnWatcher watcher = game.getState().getWatcher(CardsAmountDrawnThisTurnWatcher.class);
|
||||
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// one time use (if multiple cards drawn)
|
||||
String mark = getAppliedMark(game, source);
|
||||
if (game.getState().getValue(mark) != null) {
|
||||
return false;
|
||||
}
|
||||
game.getState().setValue(mark, true);
|
||||
|
||||
// ask player to reveal top card
|
||||
String mes = topCard.getName() + ", " + (topCard.isInstantOrSorcery(game)
|
||||
? HintUtils.prepareText("you will create Cherubael", Color.green)
|
||||
: HintUtils.prepareText("you won't create Cherubael", Color.red));
|
||||
return controller.chooseUse(Outcome.Benefit, "Reveal first drawn card (" + mes + ")?", source, game);
|
||||
}
|
||||
}
|
|
@ -146,6 +146,7 @@ public final class Warhammer40000 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Icon of Ancestry", 242, Rarity.RARE, mage.cards.i.IconOfAncestry.class));
|
||||
cards.add(new SetCardInfo("Illuminor Szeras", 37, Rarity.RARE, mage.cards.i.IlluminorSzeras.class));
|
||||
cards.add(new SetCardInfo("Imotekh the Stormlord", 5, Rarity.MYTHIC, mage.cards.i.ImotekhTheStormlord.class));
|
||||
cards.add(new SetCardInfo("Inquisitor Eisenhorn", 127, Rarity.RARE, mage.cards.i.InquisitorEisenhorn.class));
|
||||
cards.add(new SetCardInfo("Inquisitor Greyfax", 3, Rarity.MYTHIC, mage.cards.i.InquisitorGreyfax.class));
|
||||
cards.add(new SetCardInfo("Inquisitorial Rosette", 159, Rarity.RARE, mage.cards.i.InquisitorialRosette.class));
|
||||
cards.add(new SetCardInfo("Inspiring Call", 217, Rarity.UNCOMMON, mage.cards.i.InspiringCall.class));
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
|
||||
/**
|
||||
* @author PurpleCrowbar
|
||||
*/
|
||||
public final class CherubaelToken extends TokenImpl {
|
||||
|
||||
public CherubaelToken() {
|
||||
super("Cherubael", "Cherubael, a legendary 4/4 black Demon creature token with flying");
|
||||
cardType.add(CardType.CREATURE);
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
subtype.add(SubType.DEMON);
|
||||
color.setBlack(true);
|
||||
power = new MageInt(4);
|
||||
toughness = new MageInt(4);
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
}
|
||||
|
||||
public CherubaelToken(final CherubaelToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
public CherubaelToken copy() {
|
||||
return new CherubaelToken(this);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue