[MH2] Implemented Deepwood Denizen (#7878)

This commit is contained in:
Daniel Bomar 2021-06-03 18:52:32 -05:00 committed by GitHub
parent 11a19a8fc1
commit e5ccca1563
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,98 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.CostAdjuster;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.InfoEffect;
import mage.abilities.hint.ValueHint;
import mage.constants.SubType;
import mage.abilities.keyword.VigilanceAbility;
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;
import mage.util.CardUtil;
/**
*
* @author weirddan455
*/
public final class DeepwoodDenizen extends CardImpl {
public DeepwoodDenizen(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// Vigilance
this.addAbility(VigilanceAbility.getInstance());
// {5}{G}, {T}: Draw a card. This ability costs {1} less to activate for each +1/+1 counter on creatures you control.
Ability ability = new SimpleActivatedAbility(new DrawCardSourceControllerEffect(1), new ManaCostsImpl<>("{5}{G}"));
ability.addCost(new TapSourceCost());
ability.addEffect(new InfoEffect("This ability costs {1} less to activate for each +1/+1 counter on creatures you control"));
ability.setCostAdjuster(DeepwoodDenizenAdjuster.instance);
ability.addHint(new ValueHint("+1/+1 counters on creatures you control", DeepwoodDenizenValue.instance));
this.addAbility(ability);
}
private DeepwoodDenizen(final DeepwoodDenizen card) {
super(card);
}
@Override
public DeepwoodDenizen copy() {
return new DeepwoodDenizen(this);
}
}
enum DeepwoodDenizenAdjuster implements CostAdjuster {
instance;
@Override
public void adjustCosts(Ability ability, Game game) {
CardUtil.reduceCost(ability, DeepwoodDenizenValue.instance.calculate(game, ability, null));
}
}
enum DeepwoodDenizenValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int counters = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) {
if (permanent.isCreature()) {
counters += permanent.getCounters(game).getCount(CounterType.P1P1);
}
}
return counters;
}
@Override
public DynamicValue copy() {
return instance;
}
@Override
public String getMessage() {
return "+1/+1 counter on creatures you control";
}
@Override
public String toString() {
return "X";
}
}

View file

@ -81,6 +81,7 @@ public final class ModernHorizons2 extends ExpansionSet {
cards.add(new SetCardInfo("Cursed Totem", 295, Rarity.RARE, mage.cards.c.CursedTotem.class));
cards.add(new SetCardInfo("Dakkon, Shadow Slayer", 192, Rarity.MYTHIC, mage.cards.d.DakkonShadowSlayer.class));
cards.add(new SetCardInfo("Darkmoss Bridge", 245, Rarity.COMMON, mage.cards.d.DarkmossBridge.class));
cards.add(new SetCardInfo("Deepwood Denizen", 155, Rarity.COMMON, mage.cards.d.DeepwoodDenizen.class));
cards.add(new SetCardInfo("Diamond Lion", 225, Rarity.RARE, mage.cards.d.DiamondLion.class));
cards.add(new SetCardInfo("Dihada's Ploy", 193, Rarity.COMMON, mage.cards.d.DihadasPloy.class));
cards.add(new SetCardInfo("Discerning Taste", 82, Rarity.COMMON, mage.cards.d.DiscerningTaste.class));