[VOW] Implemented Investigator's Journal

This commit is contained in:
Daniel Bomar 2021-11-01 09:21:50 -05:00
parent 9506147356
commit d0466ff6f3
No known key found for this signature in database
GPG key ID: C86C8658F4023918
3 changed files with 107 additions and 0 deletions

View file

@ -0,0 +1,105 @@
package mage.cards.i;
import java.util.HashMap;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author weirddan455
*/
public final class InvestigatorsJournal extends CardImpl {
public InvestigatorsJournal(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
this.subtype.add(SubType.CLUE);
// Investigator's Journal enters the battlefield with a number of suspect counters on it equal to the greatest number of creatures a player controls.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.SUSPECT.createInstance(), InvestigatorsJournalValue.instance, false),
"with a number of suspect counters on it equal to the greatest number of creatures a player controls"
));
// {2}, {T}, Remove a suspect counter from Investigator's Journal: Draw a card.
Ability ability = new SimpleActivatedAbility(new DrawCardSourceControllerEffect(1), new GenericManaCost(2));
ability.addCost(new TapSourceCost());
ability.addCost(new RemoveCountersSourceCost(CounterType.SUSPECT.createInstance()));
this.addAbility(ability);
// {2}, Sacrifice Investigator's Journal: Draw a card.
ability = new SimpleActivatedAbility(new DrawCardSourceControllerEffect(1), new GenericManaCost(2));
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}
private InvestigatorsJournal(final InvestigatorsJournal card) {
super(card);
}
@Override
public InvestigatorsJournal copy() {
return new InvestigatorsJournal(this);
}
}
enum InvestigatorsJournalValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
HashMap<UUID, Integer> creatureCounts = new HashMap<>();
for (UUID playerId : game.getState().getPlayersInRange(sourceAbility.getControllerId(), game)) {
creatureCounts.put(playerId, 0);
}
for (Permanent permanent : game.getBattlefield().getAllPermanents()) {
if (permanent.isPhasedIn() && permanent.isCreature(game)) {
UUID controllerId = permanent.getControllerId();
Integer count = creatureCounts.get(controllerId);
if (count != null) {
creatureCounts.put(controllerId, count + 1);
}
}
}
int greatestCreatureCount = 0;
for (Integer count : creatureCounts.values()) {
if (count > greatestCreatureCount) {
greatestCreatureCount = count;
}
}
return greatestCreatureCount;
}
@Override
public InvestigatorsJournalValue copy() {
return instance;
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return "greatest number of creatures a player controls";
}
}

View file

@ -62,6 +62,7 @@ public final class InnistradCrimsonVow extends ExpansionSet {
cards.add(new SetCardInfo("Gryff Rider", 15, Rarity.COMMON, mage.cards.g.GryffRider.class));
cards.add(new SetCardInfo("Halana and Alena, Partners", 239, Rarity.RARE, mage.cards.h.HalanaAndAlenaPartners.class));
cards.add(new SetCardInfo("Hallowed Haunting", 17, Rarity.MYTHIC, mage.cards.h.HallowedHaunting.class));
cards.add(new SetCardInfo("Investigator's Journal", 258, Rarity.RARE, mage.cards.i.InvestigatorsJournal.class));
cards.add(new SetCardInfo("Island", 270, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Kessig Wolfrider", 165, Rarity.RARE, mage.cards.k.KessigWolfrider.class));
cards.add(new SetCardInfo("Kindly Ancestor", 22, Rarity.COMMON, mage.cards.k.KindlyAncestor.class));

View file

@ -162,6 +162,7 @@ public enum CounterType {
STORAGE("storage"),
STRIFE("strife"),
STUDY("study"),
SUSPECT("suspect"),
TASK("task"),
THEFT("theft"),
TIDE("tide"),