mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Cankerous Thirst - Fixed spell handling.
This commit is contained in:
parent
111be48211
commit
86bf88fb6a
1 changed files with 53 additions and 17 deletions
|
@ -1,11 +1,10 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.common.ManaWasSpentCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -13,8 +12,13 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.SecondTargetPointer;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.watchers.common.ManaSpentToCastWatcher;
|
||||
|
||||
/**
|
||||
|
@ -28,19 +32,9 @@ public final class CankerousThirst extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{B/G}");
|
||||
|
||||
// If {B} was spent to cast Cankerous Thirst, you may have target creature get -3/-3 until end of turn. If {G} was spent to cast Cankerous Thirst, you may have target creature get +3/+3 until end of turn.
|
||||
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
|
||||
new BoostTargetEffect(-3, -3, Duration.EndOfTurn),
|
||||
new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.B)),
|
||||
"If {B} was spent to cast {this}, you may have target creature get -3/-3 until end of turn"));
|
||||
|
||||
ContinuousEffect effect = new BoostTargetEffect(3, 3, Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new SecondTargetPointer());
|
||||
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
|
||||
effect,
|
||||
new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.G)),
|
||||
"If {G} was spent to cast {this}, you may have target creature get +3/+3 until end of turn"));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addEffect(new CankerousThirstEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature (1th effect -3/-3)")));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature (2nd effect +3/+3)")));
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<i>(Do both if {B}{G} was spent.)</i>"));
|
||||
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||
}
|
||||
|
@ -55,3 +49,45 @@ public final class CankerousThirst extends CardImpl {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class CankerousThirstEffect extends OneShotEffect {
|
||||
|
||||
public CankerousThirstEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "If {B} was spent to cast {this}, you may have target creature get -3/-3 until end of turn. If {G} was spent to cast {this}, you may have target creature get +3/+3 until end of turn";
|
||||
}
|
||||
|
||||
public CankerousThirstEffect(final CankerousThirstEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CankerousThirstEffect copy() {
|
||||
return new CankerousThirstEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (new ManaWasSpentCondition(ColoredManaSymbol.B).apply(game, source)) {
|
||||
Permanent targetCreature1 = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (targetCreature1 != null && controller.chooseUse(Outcome.UnboostCreature, "Let " + targetCreature1.getIdName() + " get -3/-3 until end of turn?", source, game)) {
|
||||
ContinuousEffect effect = new BoostTargetEffect(-3, -3, Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(targetCreature1, game));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
}
|
||||
if (new ManaWasSpentCondition(ColoredManaSymbol.G).apply(game, source)) {
|
||||
Permanent targetCreature2 = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (targetCreature2 != null && controller.chooseUse(Outcome.UnboostCreature, "Let " + targetCreature2.getIdName() + " get +3/+3 until end of turn?", source, game)) {
|
||||
ContinuousEffect effect = new BoostTargetEffect(+3, +3, Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(targetCreature2, game));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue