Fixed Nemesis of Mortals, modified Loreseeker's Stone (bug #3823)

This commit is contained in:
Evan Kranzler 2017-08-16 07:58:36 -04:00
parent 5b736912b4
commit 9c3938157f
2 changed files with 50 additions and 4 deletions

View file

@ -33,6 +33,7 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.cards.CardImpl;
@ -53,11 +54,14 @@ import mage.util.CardUtil;
public class LoreseekersStone extends CardImpl {
public LoreseekersStone(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{6}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}");
// {3}, {T}: Draw three cards. This ability costs {1} more to activate for each card in your hand.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(3), new GenericManaCost(3));
ability.addCost(new TapSourceCost());
ability.addCost(new TapSourceCost());
for (Effect effect : ability.getEffects()) {
effect.setText("Draw three cards. This ability costs {1} more to activate for each card in your hand");
}
this.addAbility(ability);
this.addAbility(new SimpleStaticAbility(Zone.ALL, new LoreseekersStoneCostIncreasingEffect(ability.getOriginalId())));
@ -77,9 +81,8 @@ class LoreseekersStoneCostIncreasingEffect extends CostModificationEffectImpl {
private final UUID originalId;
LoreseekersStoneCostIncreasingEffect (UUID originalId ) {
LoreseekersStoneCostIncreasingEffect(UUID originalId) {
super(Duration.EndOfGame, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "This ability costs {1} more to activate for each card in your hand";
this.originalId = originalId;
}

View file

@ -32,13 +32,20 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.effects.common.cost.SourceCostReductionForEachCardInGraveyardEffect;
import mage.abilities.keyword.MonstrosityAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.CostModificationType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
/**
*
@ -64,6 +71,7 @@ public class NemesisOfMortals extends CardImpl {
effect.setText("Monstrosity 5. This ability costs {1} less to activate for each creature card in your graveyard");
}
this.addAbility(ability);
this.addAbility(new SimpleStaticAbility(Zone.ALL, new NemesisOfMortalsCostReducingEffect(ability.getOriginalId())));
}
public NemesisOfMortals(final NemesisOfMortals card) {
@ -75,3 +83,38 @@ public class NemesisOfMortals extends CardImpl {
return new NemesisOfMortals(this);
}
}
class NemesisOfMortalsCostReducingEffect extends CostModificationEffectImpl {
private final UUID originalId;
NemesisOfMortalsCostReducingEffect(UUID originalId) {
super(Duration.EndOfGame, Outcome.Benefit, CostModificationType.REDUCE_COST);
this.originalId = originalId;
}
NemesisOfMortalsCostReducingEffect(final NemesisOfMortalsCostReducingEffect effect) {
super(effect);
this.originalId = effect.originalId;
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
CardUtil.reduceCost(abilityToModify, controller.getGraveyard().getCards(new FilterCreatureCard(), game).size());
}
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify.getOriginalId().equals(originalId);
}
@Override
public NemesisOfMortalsCostReducingEffect copy() {
return new NemesisOfMortalsCostReducingEffect(this);
}
}