[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

@ -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>";