[VOC] Implemented Ethereal Investigator

This commit is contained in:
Evan Kranzler 2021-11-09 07:49:24 -05:00
parent 1c131dcc95
commit 900f9d845c
4 changed files with 91 additions and 49 deletions

View file

@ -1,23 +1,20 @@
package mage.cards.c;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.keyword.InvestigateEffect;
import mage.abilities.keyword.FriendsForeverAbility;
import mage.abilities.keyword.MenaceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AttackingPredicate;
import mage.filter.common.FilterAttackingCreature;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import java.util.UUID;
@ -26,6 +23,14 @@ import java.util.UUID;
*/
public final class ChiefJimHopper extends CardImpl {
private static final FilterPermanent filter = new FilterAttackingCreature();
static {
filter.add(TokenPredicate.FALSE);
}
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter);
public ChiefJimHopper(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{W}");
@ -39,7 +44,8 @@ public final class ChiefJimHopper extends CardImpl {
this.addAbility(new MenaceAbility());
// Whenever Chief Jim Hopper attacks, investigate once for each nontoken attacking creature.
this.addAbility(new AttacksTriggeredAbility(new ChiefJimHopperEffect()));
this.addAbility(new AttacksTriggeredAbility(new InvestigateEffect(xValue)
.setText("investigate once for each nontoken attacking creature")));
// Friends forever
this.addAbility(FriendsForeverAbility.getInstance());
@ -54,33 +60,3 @@ public final class ChiefJimHopper extends CardImpl {
return new ChiefJimHopper(this);
}
}
class ChiefJimHopperEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterCreaturePermanent();
static {
filter.add(AttackingPredicate.instance);
filter.add(TokenPredicate.FALSE);
}
ChiefJimHopperEffect() {
super(Outcome.Benefit);
staticText = "investigate once for each nontoken attacking creature";
}
private ChiefJimHopperEffect(final ChiefJimHopperEffect effect) {
super(effect);
}
@Override
public ChiefJimHopperEffect copy() {
return new ChiefJimHopperEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int attackers = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
return attackers > 0 && new InvestigateEffect(attackers).apply(game, source);
}
}

View file

@ -0,0 +1,50 @@
package mage.cards.e;
import mage.MageInt;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.OpponentsCount;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.keyword.InvestigateEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.game.permanent.token.SpiritWhiteToken;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class EtherealInvestigator extends CardImpl {
public EtherealInvestigator(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Ethereal Investigator enters the battlefield, investigate X times, where X is the number of opponents you have.
this.addAbility(new EntersBattlefieldTriggeredAbility(new InvestigateEffect(OpponentsCount.instance)));
// Whenever you draw your second card each turn, create a 1/1 white Spirit creature token with flying.
this.addAbility(new DrawSecondCardTriggeredAbility(
new CreateTokenEffect(new SpiritWhiteToken()), false
));
}
private EtherealInvestigator(final EtherealInvestigator card) {
super(card);
}
@Override
public EtherealInvestigator copy() {
return new EtherealInvestigator(this);
}
}

View file

@ -54,6 +54,7 @@ public final class CrimsonVowCommander extends ExpansionSet {
cards.add(new SetCardInfo("Distant Melody", 103, Rarity.COMMON, mage.cards.d.DistantMelody.class));
cards.add(new SetCardInfo("Dovin, Grand Arbiter", 153, Rarity.MYTHIC, mage.cards.d.DovinGrandArbiter.class));
cards.add(new SetCardInfo("Drogskol Captain", 154, Rarity.UNCOMMON, mage.cards.d.DrogskolCaptain.class));
cards.add(new SetCardInfo("Ethereal Investigator", 12, Rarity.RARE, mage.cards.e.EtherealInvestigator.class));
cards.add(new SetCardInfo("Exotic Orchard", 173, Rarity.RARE, mage.cards.e.ExoticOrchard.class));
cards.add(new SetCardInfo("Falkenrath Gorger", 146, Rarity.RARE, mage.cards.f.FalkenrathGorger.class));
cards.add(new SetCardInfo("Falkenrath Noble", 128, Rarity.UNCOMMON, mage.cards.f.FalkenrathNoble.class));

View file

@ -2,6 +2,8 @@ package mage.abilities.effects.keyword;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
@ -14,13 +16,17 @@ import mage.util.CardUtil;
*/
public class InvestigateEffect extends OneShotEffect {
private final int amount;
private final DynamicValue amount;
public InvestigateEffect() {
this(1);
}
public InvestigateEffect(int amount) {
this(StaticValue.get(amount));
}
public InvestigateEffect(DynamicValue amount) {
super(Outcome.Benefit);
this.amount = amount;
}
@ -32,8 +38,12 @@ public class InvestigateEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
new ClueArtifactToken().putOntoBattlefield(amount, game, source, source.getControllerId());
for (int i = 0; i < amount; i++) {
int value = this.amount.calculate(game, source, this);
if (value < 1) {
return false;
}
new ClueArtifactToken().putOntoBattlefield(value, game, source, source.getControllerId());
for (int i = 0; i < value; i++) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.INVESTIGATED, source.getSourceId(), source, source.getControllerId()));
}
return true;
@ -50,15 +60,20 @@ public class InvestigateEffect extends OneShotEffect {
return staticText;
}
String message;
switch (amount) {
case 1:
message = ". <i>(C";
break;
case 2:
message = "twice. <i>(To investigate, c";
break;
default:
message = CardUtil.numberToText(amount) + " times. <i>(To investigate, c";
if (amount instanceof StaticValue) {
int value = ((StaticValue) amount).getValue();
switch (value) {
case 1:
message = ". <i>(C";
break;
case 2:
message = "twice. <i>(To investigate, c";
break;
default:
message = CardUtil.numberToText(value) + " times. <i>(To investigate, c";
}
} else {
message = "X times, where X is the " + amount.getMessage() + ". <i>(To investigate, c";
}
return "investigate" + message + "reate a colorless Clue artifact token " +
"with \"{2}, Sacrifice this artifact: Draw a card.\")</i>";