- Added Oath of Lim-Dul and Stench of Evil.

This commit is contained in:
Jeff 2019-01-04 10:44:20 -06:00
parent a21d481755
commit c5624a7c58
3 changed files with 222 additions and 0 deletions

View file

@ -0,0 +1,139 @@
package mage.cards.o;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.DiscardTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author jeffwadsworth
*/
public final class OathOfLimDul extends CardImpl {
public OathOfLimDul(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}");
// Whenever you lose life, for each 1 life you lost, sacrifice a permanent other than Oath of Lim-Dul unless you discard a card.
this.addAbility(new OathOfLimDulTriggeredAbility());
// {B}{B}: Draw a card.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{B}{B}")));
}
private OathOfLimDul(final OathOfLimDul card) {
super(card);
}
@Override
public OathOfLimDul copy() {
return new OathOfLimDul(this);
}
}
class OathOfLimDulTriggeredAbility extends TriggeredAbilityImpl {
public OathOfLimDulTriggeredAbility() {
super(Zone.BATTLEFIELD, new OathOfLimDulEffect());
}
public OathOfLimDulTriggeredAbility(final OathOfLimDulTriggeredAbility ability) {
super(ability);
}
@Override
public OathOfLimDulTriggeredAbility copy() {
return new OathOfLimDulTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.LOST_LIFE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(controllerId)) {
game.getState().setValue(sourceId.toString() + "oathOfLimDul", event.getAmount());
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever you lose life, for each 1 life you lost, sacrifice a permanent other than {this} unless you discard a card.";
}
}
class OathOfLimDulEffect extends OneShotEffect {
private final static FilterControlledPermanent filter = new FilterControlledPermanent("controlled permanent other than Oath of Lim-Dul");
static {
filter.add(new AnotherPredicate());
}
public OathOfLimDulEffect() {
super(Outcome.Neutral);
}
public OathOfLimDulEffect(final OathOfLimDulEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
int amount = (int) game.getState().getValue(source.getSourceId().toString() + "oathOfLimDul");
if (amount > 0
&& controller != null) {
for (int i = 0; i < amount; i++) {
TargetControlledPermanent target = new TargetControlledPermanent(filter);
target.setNotTarget(true);
if (target.canChoose(controller.getId(), game)
&& controller.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) {
Cost cost = new DiscardTargetCost(new TargetCardInHand());
if (cost.canPay(source, source.getSourceId(), controller.getId(), game)
&& controller.chooseUse(Outcome.Benefit,
"Do you wish to discard a card rather than sacrifice the target permanent?", source, game)) {
cost.pay(source, game, source.getSourceId(), controller.getId(), true);
} else {
Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
if (targetPermanent != null) {
targetPermanent.sacrifice(source.getSourceId(), game);
}
}
}
}
return true;
}
return false;
}
@Override
public OathOfLimDulEffect copy() {
return new OathOfLimDulEffect(this);
}
}

View file

@ -0,0 +1,81 @@
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public final class StenchOfEvil extends CardImpl {
public StenchOfEvil(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}{B}");
// Destroy all Plains. For each land destroyed this way, Stench of Evil deals 1 damage to that land's controller unless he or she pays {2}.
this.getSpellAbility().addEffect(new StenchOfEvilEffect());
}
private StenchOfEvil(final StenchOfEvil card) {
super(card);
}
@Override
public StenchOfEvil copy() {
return new StenchOfEvil(this);
}
}
class StenchOfEvilEffect extends OneShotEffect {
private static final FilterLandPermanent filter = new FilterLandPermanent();
static {
filter.add(new SubtypePredicate(SubType.PLAINS));
}
public StenchOfEvilEffect() {
super(Outcome.Benefit);
this.staticText = "Destroy all Plains. For each land destroyed this way, {this} deals 1 damage to that land's controller unless he or she pays {2}";
}
public StenchOfEvilEffect(final StenchOfEvilEffect effect) {
super(effect);
}
@Override
public StenchOfEvilEffect copy() {
return new StenchOfEvilEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (Permanent land : game.getBattlefield().getAllActivePermanents(filter, game)) {
UUID landControllerId = land.getControllerId();
if (land.destroy(source.getSourceId(), game, false)) {
Cost cost = new ManaCostsImpl("{2}");
Player landController = game.getPlayer(landControllerId);
if (landController != null
&& cost.canPay(source, source.getSourceId(), landControllerId, game)
&& !cost.pay(source, game, source.getSourceId(), landControllerId, false)) {
landController.damage(1, source.getSourceId(), game, false, true);
}
}
}
return true;
}
}

View file

@ -238,6 +238,7 @@ public final class IceAge extends ExpansionSet {
cards.add(new SetCardInfo("Nature's Lore", 255, Rarity.UNCOMMON, mage.cards.n.NaturesLore.class));
cards.add(new SetCardInfo("Necropotence", 154, Rarity.RARE, mage.cards.n.Necropotence.class));
cards.add(new SetCardInfo("Norritt", 155, Rarity.COMMON, mage.cards.n.Norritt.class));
cards.add(new SetCardInfo("Oath of Lim-Dul", 44, Rarity.RARE, mage.cards.o.OathOfLimDul.class));
cards.add(new SetCardInfo("Onyx Talisman", 331, Rarity.UNCOMMON, mage.cards.o.OnyxTalisman.class));
cards.add(new SetCardInfo("Orcish Cannoneers", 205, Rarity.UNCOMMON, mage.cards.o.OrcishCannoneers.class));
cards.add(new SetCardInfo("Orcish Healer", 208, Rarity.UNCOMMON, mage.cards.o.OrcishHealer.class));
@ -304,6 +305,7 @@ public final class IceAge extends ExpansionSet {
cards.add(new SetCardInfo("Spoils of Evil", 163, Rarity.RARE, mage.cards.s.SpoilsOfEvil.class));
cards.add(new SetCardInfo("Staff of the Ages", 340, Rarity.RARE, mage.cards.s.StaffOfTheAges.class));
cards.add(new SetCardInfo("Stampede", 265, Rarity.RARE, mage.cards.s.Stampede.class));
cards.add(new SetCardInfo("Stench of Evil", 165, Rarity.UNCOMMON, mage.cards.s.StenchOfEvil.class));
cards.add(new SetCardInfo("Stone Rain", 217, Rarity.COMMON, mage.cards.s.StoneRain.class));
cards.add(new SetCardInfo("Stone Spirit", 218, Rarity.UNCOMMON, mage.cards.s.StoneSpirit.class));
cards.add(new SetCardInfo("Stonehands", 219, Rarity.COMMON, mage.cards.s.Stonehands.class));