mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Sulforic Vortex and Flames of the Blood Hand - Fixed that the life gain preventing effects were not implemented as replacement effects.
This commit is contained in:
parent
89a991156d
commit
a0d2c0c22f
4 changed files with 109 additions and 24 deletions
|
@ -90,9 +90,13 @@ class SustainingSpiritReplacementEffect extends ReplacementEffectImpl {
|
|||
return new SustainingSpiritReplacementEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType().equals(GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS)) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
|
@ -107,8 +111,6 @@ class SustainingSpiritReplacementEffect extends ReplacementEffectImpl {
|
|||
// An effect such as Spirit Link will see the full amount of damage being dealt.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,13 +28,18 @@
|
|||
package mage.sets.betrayersofkamigawa;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.continious.CantGainLifeTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
/**
|
||||
|
@ -52,9 +57,7 @@ public class FlamesOfTheBloodHand extends CardImpl {
|
|||
// Flames of the Blood Hand deals 4 damage to target player. The damage can't be prevented.
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(4, false));
|
||||
// If that player would gain life this turn, that player gains no life instead.
|
||||
Effect effect = new CantGainLifeTargetEffect(Duration.EndOfTurn);
|
||||
effect.setText("If that player would gain life this turn, that player gains no life instead");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addEffect(new FlamesOfTheBloodHandReplacementEffect());
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
}
|
||||
|
||||
|
@ -67,3 +70,41 @@ public class FlamesOfTheBloodHand extends CardImpl {
|
|||
return new FlamesOfTheBloodHand(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FlamesOfTheBloodHandReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
public FlamesOfTheBloodHandReplacementEffect() {
|
||||
super(Duration.EndOfTurn, Outcome.Benefit);
|
||||
staticText = "If that player would gain life this turn, that player gains no life instead";
|
||||
}
|
||||
|
||||
public FlamesOfTheBloodHandReplacementEffect(final FlamesOfTheBloodHandReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlamesOfTheBloodHandReplacementEffect copy() {
|
||||
return new FlamesOfTheBloodHandReplacementEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.GAIN_LIFE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return event.getPlayerId().equals(getTargetPointer().getFirst(game, source));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -28,17 +28,22 @@
|
|||
package mage.sets.scourge;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.continious.CantGainLifeAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -54,10 +59,9 @@ public class SulfuricVortex extends CardImpl {
|
|||
|
||||
// At the beginning of each player's upkeep, Sulfuric Vortex deals 2 damage to that player.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2, true, "that player"), TargetController.ANY, false, true));
|
||||
|
||||
// If a player would gain life, that player gains no life instead.
|
||||
Effect effect = new CantGainLifeAllEffect(Duration.WhileOnBattlefield);
|
||||
effect.setText("If a player would gain life, that player gains no life instead");
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SulfuricVortexReplacementEffect()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -70,3 +74,41 @@ public class SulfuricVortex extends CardImpl {
|
|||
return new SulfuricVortex(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SulfuricVortexReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
public SulfuricVortexReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "If a player would gain life, that player gains no life instead";
|
||||
}
|
||||
|
||||
public SulfuricVortexReplacementEffect(final SulfuricVortexReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SulfuricVortexReplacementEffect copy() {
|
||||
return new SulfuricVortexReplacementEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.GAIN_LIFE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -28,7 +28,7 @@ public class GainLifeOpponentCost extends CostImpl {
|
|||
|
||||
static {
|
||||
filter.add(new PlayerPredicate(TargetController.OPPONENT));
|
||||
filter.add(new PlayerCanGainLifePredicate());
|
||||
filter.add(new PlayerCanGainLifePredicate()); // you can't pay the costs by letting a player gain life that can't get life by rule changing effect
|
||||
}
|
||||
|
||||
private final int amount;
|
||||
|
|
Loading…
Reference in a new issue