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,25 +90,27 @@ class SustainingSpiritReplacementEffect extends ReplacementEffectImpl {
|
||||||
return new SustainingSpiritReplacementEffect(this);
|
return new SustainingSpiritReplacementEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
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());
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
if (permanent != null) {
|
||||||
if (permanent != null) {
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
if (controller != null
|
||||||
if (controller != null
|
&& (controller.getLife() > 0) &&(controller.getLife() - event.getAmount()) < 1
|
||||||
&& (controller.getLife() > 0) &&(controller.getLife() - event.getAmount()) < 1
|
&& event.getPlayerId().equals(controller.getId())
|
||||||
&& event.getPlayerId().equals(controller.getId())
|
) {
|
||||||
) {
|
event.setAmount(controller.getLife() - 1);
|
||||||
event.setAmount(controller.getLife() - 1);
|
//unsure how to make this comply with
|
||||||
//unsure how to make this comply with
|
// 10/1/2008: The ability doesn't change how much damage is dealt;
|
||||||
// 10/1/2008: The ability doesn't change how much damage is dealt;
|
// it just changes how much life that damage makes you lose.
|
||||||
// it just changes how much life that damage makes you lose.
|
// An effect such as Spirit Link will see the full amount of damage being dealt.
|
||||||
// An effect such as Spirit Link will see the full amount of damage being dealt.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,18 @@
|
||||||
package mage.sets.betrayersofkamigawa;
|
package mage.sets.betrayersofkamigawa;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
import mage.abilities.effects.common.DamageTargetEffect;
|
import mage.abilities.effects.common.DamageTargetEffect;
|
||||||
import mage.abilities.effects.common.continious.CantGainLifeTargetEffect;
|
import mage.abilities.effects.common.continious.CantGainLifeTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
import mage.target.TargetPlayer;
|
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.
|
// Flames of the Blood Hand deals 4 damage to target player. The damage can't be prevented.
|
||||||
this.getSpellAbility().addEffect(new DamageTargetEffect(4, false));
|
this.getSpellAbility().addEffect(new DamageTargetEffect(4, false));
|
||||||
// If that player would gain life this turn, that player gains no life instead.
|
// If that player would gain life this turn, that player gains no life instead.
|
||||||
Effect effect = new CantGainLifeTargetEffect(Duration.EndOfTurn);
|
this.getSpellAbility().addEffect(new FlamesOfTheBloodHandReplacementEffect());
|
||||||
effect.setText("If that player would gain life this turn, that player gains no life instead");
|
|
||||||
this.getSpellAbility().addEffect(effect);
|
|
||||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,3 +70,41 @@ public class FlamesOfTheBloodHand extends CardImpl {
|
||||||
return new FlamesOfTheBloodHand(this);
|
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;
|
package mage.sets.scourge;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
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.DamageTargetEffect;
|
||||||
import mage.abilities.effects.common.continious.CantGainLifeAllEffect;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
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.
|
// 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));
|
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.
|
// If a player would gain life, that player gains no life instead.
|
||||||
Effect effect = new CantGainLifeAllEffect(Duration.WhileOnBattlefield);
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SulfuricVortexReplacementEffect()));
|
||||||
effect.setText("If a player would gain life, that player gains no life instead");
|
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,3 +74,41 @@ public class SulfuricVortex extends CardImpl {
|
||||||
return new SulfuricVortex(this);
|
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 {
|
static {
|
||||||
filter.add(new PlayerPredicate(TargetController.OPPONENT));
|
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;
|
private final int amount;
|
||||||
|
|
Loading…
Reference in a new issue