Implement Orcish Mine

This commit is contained in:
Noah Gleason 2018-06-23 19:42:19 -04:00
parent eb85146367
commit 39ec630c45
No known key found for this signature in database
GPG key ID: EC030EC6B0650A40
3 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,102 @@
package mage.cards.o;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.common.DamageAttachedControllerEffect;
import mage.abilities.effects.common.DestroyAttachedToEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetLandPermanent;
import mage.abilities.Ability;
import mage.abilities.effects.common.AttachEffect;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
/**
*
* @author noahg
*/
public final class OrcishMine extends CardImpl {
public OrcishMine(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{R}");
this.subtype.add(SubType.AURA);
// Enchant land
TargetPermanent auraTarget = new TargetLandPermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.DestroyPermanent));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Orcish Mine enters the battlefield with three ore counters on it.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.ORE.createInstance(3)), "with three ore counters on it"));
// At the beginning of your upkeep or whenever enchanted land becomes tapped, remove an ore counter from Orcish Mine.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new RemoveCounterSourceEffect(CounterType.ORE.createInstance()), TargetController.YOU, false));
this.addAbility(new BecomesTappedAttachedTriggeredAbility(new RemoveCounterSourceEffect(CounterType.ORE.createInstance()), "enchanted land", false));
// When the last ore counter is removed from Orcish Mine, destroy enchanted land and Orcish Mine deals 2 damage to that land's controller.
this.addAbility(new OrcishMineAbility());
}
public OrcishMine(final OrcishMine card) {
super(card);
}
@Override
public OrcishMine copy() {
return new OrcishMine(this);
}
}
class OrcishMineAbility extends TriggeredAbilityImpl {
public OrcishMineAbility() {
super(Zone.BATTLEFIELD, new DestroyAttachedToEffect("enchanted land"));
this.addEffect(new DamageAttachedControllerEffect(2));
}
public OrcishMineAbility(final OrcishMineAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.COUNTER_REMOVED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getData().equals("ore") && event.getTargetId().equals(this.getSourceId())) {
Permanent p = game.getPermanent(this.getSourceId());
if (p != null) {
return p.getCounters(game).getCount(CounterType.ORE) == 0;
}
}
return false;
}
@Override
public OrcishMineAbility copy() {
return new OrcishMineAbility(this);
}
@Override
public String getRule() {
return "When the last ore counter is removed from {this}, destroy enchanted land and {this} deals 2 damage to that land's controller.";
}
}

View file

@ -130,6 +130,7 @@ public final class Homelands extends ExpansionSet {
cards.add(new SetCardInfo("Mesa Falcon", "10b", Rarity.COMMON, MesaFalcon.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mystic Decree", 34, Rarity.RARE, mage.cards.m.MysticDecree.class));
cards.add(new SetCardInfo("Narwhal", 35, Rarity.RARE, mage.cards.n.Narwhal.class));
cards.add(new SetCardInfo("Orcish Mine", 78, Rarity.UNCOMMON, mage.cards.o.OrcishMine.class));
cards.add(new SetCardInfo("Primal Order", 92, Rarity.RARE, mage.cards.p.PrimalOrder.class));
cards.add(new SetCardInfo("Rashka the Slayer", 12, Rarity.RARE, mage.cards.r.RashkaTheSlayer.class));
cards.add(new SetCardInfo("Reef Pirates", "36a", Rarity.COMMON, ReefPirates.class, NON_FULL_USE_VARIOUS));

View file

@ -80,6 +80,7 @@ public enum CounterType {
MUSTER("muster"),
NET("net"),
OMEN("omen"),
ORE("ore"),
P0P1(new BoostCounter(0, 1).name),
P1P0(new BoostCounter(1, 0).name),
P1P1(new BoostCounter(1, 1).name),