* Fixed that lose restricting effects could not be replaced (e.g. by Abysal Persecutor's ability) if the player has conceded or left the match. Fixed that "can't win" or "can't lose" messages where repeated send to the players if such an effect activly prevents a player from losing or winning.

This commit is contained in:
LevelX2 2015-01-21 23:41:11 +01:00
parent 1340ebff49
commit c8eb9f00a9
7 changed files with 44 additions and 26 deletions

View file

@ -105,9 +105,14 @@ class LaboratoryManiacEffect extends ReplacementEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.LOSES;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.LOSES && event.getPlayerId().equals(source.getControllerId())) {
if (event.getPlayerId().equals(source.getControllerId())) {
Player player = game.getPlayer(event.getPlayerId());
if (!player.hasLost() && (
(player.getLife() > 0 || !player.canLoseByZeroOrLessLife())

View file

@ -119,9 +119,14 @@ class LichsMirrorEffect extends ReplacementEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.LOSES;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.LOSES && event.getPlayerId().equals(source.getControllerId())) {
if (event.getPlayerId().equals(source.getControllerId())) {
return true;
}
return false;

View file

@ -37,6 +37,7 @@ import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
@ -70,10 +71,10 @@ public class PlatinumAngel extends CardImpl {
return new PlatinumAngel(this);
}
class PlatinumAngelEffect extends ReplacementEffectImpl {
class PlatinumAngelEffect extends ContinuousRuleModifiyingEffectImpl {
public PlatinumAngelEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
super(Duration.WhileOnBattlefield, Outcome.Benefit, false, false);
staticText = "You can't lose the game and your opponents can't win the game";
}
@ -91,11 +92,6 @@ public class PlatinumAngel extends CardImpl {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if ((event.getType() == EventType.WINS && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) ||

View file

@ -29,6 +29,7 @@ package mage.sets.timespiral;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.SplitSecondAbility;
import mage.cards.CardImpl;
@ -71,10 +72,10 @@ public class AngelsGrace extends CardImpl {
}
}
class AngelsGraceEffect extends ReplacementEffectImpl {
class AngelsGraceEffect extends ContinuousRuleModifiyingEffectImpl {
public AngelsGraceEffect() {
super(Duration.EndOfTurn, Outcome.Benefit);
super(Duration.EndOfTurn, Outcome.Benefit, false, false);
staticText = "You can't lose the game this turn and your opponents can't win the game this turn";
}
@ -92,11 +93,6 @@ class AngelsGraceEffect extends ReplacementEffectImpl {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if ((event.getType() == EventType.WINS && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) ||
@ -124,10 +120,15 @@ class AngelsGraceReplacementEffect extends ReplacementEffectImpl {
return new AngelsGraceReplacementEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(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)
&& event.getPlayerId().equals(source.getControllerId())) {
if (event.getPlayerId().equals(source.getControllerId())) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null
&& (controller.getLife() - event.getAmount()) < 1 ) {

View file

@ -79,7 +79,7 @@ public class AbyssalPersecutor extends CardImpl {
class AbyssalPersecutorCannotWinEffect extends ContinuousRuleModifiyingEffectImpl {
AbyssalPersecutorCannotWinEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
super(Duration.WhileOnBattlefield, Outcome.Detriment, false, false);
staticText = "You can't win the game and your opponents can't lose the game";
}