mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[MH2] Implemented Obsidian Charmaw
This commit is contained in:
parent
bd948a267e
commit
ee5fea7116
2 changed files with 107 additions and 0 deletions
106
Mage.Sets/src/mage/cards/o/ObsidianCharmaw.java
Normal file
106
Mage.Sets/src/mage/cards/o/ObsidianCharmaw.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
package mage.cards.o;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.effects.common.cost.SpellCostReductionForEachSourceEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ObsidianCharmaw extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterLandPermanent("nonbasic land an opponent controls");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(SuperType.BASIC.getPredicate()));
|
||||
filter.add(TargetController.OPPONENT.getControllerPredicate());
|
||||
}
|
||||
|
||||
private static final Hint hint = new ValueHint(
|
||||
"Lands your opponents control that could produce {C}", ObsidianCharmawValue.instance
|
||||
);
|
||||
|
||||
public ObsidianCharmaw(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
|
||||
|
||||
this.subtype.add(SubType.DRAGON);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// This spell costs {1} less to cast for each land your opponents control that could produce {C}.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.ALL, new SpellCostReductionForEachSourceEffect(1, ObsidianCharmawValue.instance)
|
||||
).addHint(hint));
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// When Obsidian Charmaw enters the battlefield, destroy target nonbasic land an opponent controls
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect());
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private ObsidianCharmaw(final ObsidianCharmaw card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObsidianCharmaw copy() {
|
||||
return new ObsidianCharmaw(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum ObsidianCharmawValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return game
|
||||
.getBattlefield()
|
||||
.getActivePermanents(
|
||||
StaticFilters.FILTER_OPPONENTS_PERMANENT,
|
||||
sourceAbility.getControllerId(), sourceAbility.getSourceId(), game
|
||||
).stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(MageObject::isLand)
|
||||
.filter(permanent -> permanent
|
||||
.getAbilities()
|
||||
.getActivatedManaAbilities(Zone.BATTLEFIELD)
|
||||
.stream()
|
||||
.anyMatch(ability -> ability.getProducableManaTypes(game).contains(ManaType.COLORLESS)))
|
||||
.mapToInt(x -> 1)
|
||||
.sum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObsidianCharmawValue copy() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "land your opponents control that could produce {C}";
|
||||
}
|
||||
}
|
|
@ -86,6 +86,7 @@ public final class ModernHorizons2 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Mystic Redaction", 53, Rarity.UNCOMMON, mage.cards.m.MysticRedaction.class));
|
||||
cards.add(new SetCardInfo("Necromancer's Familiar", 94, Rarity.UNCOMMON, mage.cards.n.NecromancersFamiliar.class));
|
||||
cards.add(new SetCardInfo("Nevinyrral's Disk", 298, Rarity.RARE, mage.cards.n.NevinyrralsDisk.class));
|
||||
cards.add(new SetCardInfo("Obsidian Charmaw", 137, Rarity.RARE, mage.cards.o.ObsidianCharmaw.class));
|
||||
cards.add(new SetCardInfo("Orchard Strider", 169, Rarity.COMMON, mage.cards.o.OrchardStrider.class));
|
||||
cards.add(new SetCardInfo("Patriarch's Bidding", 275, Rarity.RARE, mage.cards.p.PatriarchsBidding.class));
|
||||
cards.add(new SetCardInfo("Phantasmal Dreadmaw", 55, Rarity.COMMON, mage.cards.p.PhantasmalDreadmaw.class));
|
||||
|
|
Loading…
Reference in a new issue