mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
* Induce Despair - Fixed not working boost effect.
This commit is contained in:
parent
2abfad795e
commit
269653d115
1 changed files with 15 additions and 12 deletions
|
@ -28,33 +28,35 @@
|
||||||
package mage.sets.riseoftheeldrazi;
|
package mage.sets.riseoftheeldrazi;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.*;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
|
||||||
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
||||||
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.filter.common.FilterCreatureCard;
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetCardInHand;
|
import mage.target.common.TargetCardInHand;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
*/
|
*/
|
||||||
public class InduceDespair extends CardImpl {
|
public class InduceDespair extends CardImpl {
|
||||||
|
|
||||||
private static final FilterCreatureCard filter = new FilterCreatureCard("creature card from your hand");
|
private static final FilterCreatureCard filter = new FilterCreatureCard("creature card from your hand");
|
||||||
|
|
||||||
public InduceDespair(UUID ownerId) {
|
public InduceDespair(UUID ownerId) {
|
||||||
super(ownerId, 114, "Induce Despair", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{B}");
|
super(ownerId, 114, "Induce Despair", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{B}");
|
||||||
this.expansionSetCode = "ROE";
|
this.expansionSetCode = "ROE";
|
||||||
|
|
||||||
|
|
||||||
// As an additional cost to cast Induce Despair, reveal a creature card from your hand.
|
// As an additional cost to cast Induce Despair, reveal a creature card from your hand.
|
||||||
// Target creature gets -X/-X until end of turn, where X is the revealed card's converted mana cost.
|
// Target creature gets -X/-X until end of turn, where X is the revealed card's converted mana cost.
|
||||||
this.getSpellAbility().addEffect(new InduceDespairEffect());
|
this.getSpellAbility().addEffect(new InduceDespairEffect());
|
||||||
|
@ -87,13 +89,14 @@ class InduceDespairEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
RevealTargetFromHandCost cost = (RevealTargetFromHandCost) source.getCosts().get(0);
|
RevealTargetFromHandCost cost = (RevealTargetFromHandCost) source.getCosts().get(0);
|
||||||
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
||||||
if (cost != null) {
|
if (cost != null && creature != null) {
|
||||||
int CMC = -1 * cost.convertedManaCosts;
|
int cmcBoost = -1 * cost.convertedManaCosts;
|
||||||
if (creature != null) {
|
ContinuousEffect effect = new BoostTargetEffect(cmcBoost, cmcBoost, Duration.EndOfTurn);
|
||||||
creature.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(CMC, CMC, Duration.EndOfTurn)), source.getSourceId(), game, false);
|
effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game)));
|
||||||
}
|
game.addEffect(effect, source);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue