mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
* Phyrexian Unlife - Fixed that the first ability is a continuous effect instead wrongly a replacement effect.
This commit is contained in:
parent
63a083ef0d
commit
d7a8bd64e2
5 changed files with 104 additions and 48 deletions
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common.continious;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class DontLoseByZeroOrLessLifeEffect extends ContinuousEffectImpl<DontLoseByZeroOrLessLifeEffect> {
|
||||
|
||||
public DontLoseByZeroOrLessLifeEffect(Duration duration) {
|
||||
super(duration, Layer.PlayerEffects, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "You don't lose the game for having 0 or less life";
|
||||
}
|
||||
|
||||
public DontLoseByZeroOrLessLifeEffect(final DontLoseByZeroOrLessLifeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DontLoseByZeroOrLessLifeEffect copy() {
|
||||
return new DontLoseByZeroOrLessLifeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.setLoseByZeroOrLessLife(false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1236,7 +1236,10 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
|
||||
//20091005 - 704.5a/704.5b/704.5c
|
||||
for (Player player: state.getPlayers().values()) {
|
||||
if (!player.hasLost() && (player.getLife() <= 0 || player.isEmptyDraw() || player.getCounters().getCount(CounterType.POISON) >= 10)) {
|
||||
if (!player.hasLost()
|
||||
&& ((player.getLife() <= 0 && player.canLoseByZeroOrLessLife())
|
||||
|| player.isEmptyDraw()
|
||||
|| player.getCounters().getCount(CounterType.POISON) >= 10)) {
|
||||
player.lost(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,6 +101,9 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
boolean canPaySacrificeCost();
|
||||
void setLifeTotalCanChange(boolean lifeTotalCanChange);
|
||||
boolean isLifeTotalCanChange();
|
||||
void setLoseByZeroOrLessLife(boolean LoseByZeroOrLessLife);
|
||||
boolean canLoseByZeroOrLessLife();
|
||||
|
||||
/**
|
||||
* Returns alternative casting costs a player can cast spells for
|
||||
*
|
||||
|
|
|
|||
|
|
@ -163,11 +163,14 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
|
||||
protected RangeOfInfluence range;
|
||||
protected Set<UUID> inRange = new HashSet<>();
|
||||
|
||||
protected boolean isTestMode = false;
|
||||
protected boolean canGainLife = true;
|
||||
protected boolean canLoseLife = true;
|
||||
protected boolean canPayLifeCost = true;
|
||||
protected boolean canPaySacrificeCost = true;
|
||||
protected boolean loseByZeroOrLessLife = true;
|
||||
|
||||
protected final List<AlternativeSourceCosts> alternativeSourceCosts = new ArrayList<>();
|
||||
|
||||
protected boolean isGameUnderControl = true;
|
||||
|
|
@ -234,6 +237,8 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
this.range = player.range;
|
||||
this.canGainLife = player.canGainLife;
|
||||
this.canLoseLife = player.canLoseLife;
|
||||
this.loseByZeroOrLessLife = player.loseByZeroOrLessLife;
|
||||
|
||||
this.attachments.addAll(player.attachments);
|
||||
|
||||
this.inRange.addAll(player.inRange);
|
||||
|
|
@ -294,6 +299,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
this.userData = player.getUserData();
|
||||
this.canPayLifeCost = player.canPayLifeCost();
|
||||
this.canPaySacrificeCost = player.canPaySacrificeCost();
|
||||
this.loseByZeroOrLessLife = player.canLoseByZeroOrLessLife();
|
||||
this.alternativeSourceCosts.addAll(player.getAlternativeSourceCosts());
|
||||
this.storedBookmark = player.getStoredBookmark();
|
||||
|
||||
|
|
@ -359,6 +365,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
this.canLoseLife = true;
|
||||
this.canPayLifeCost = true;
|
||||
this.canPaySacrificeCost = true;
|
||||
this.loseByZeroOrLessLife = true;
|
||||
this.topCardRevealed = false;
|
||||
this.alternativeSourceCosts.clear();
|
||||
}
|
||||
|
|
@ -1558,7 +1565,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
opponentsAlive++;
|
||||
}
|
||||
}
|
||||
if (opponentsAlive == 0) {
|
||||
if (opponentsAlive == 0 && !hasWon()) {
|
||||
game.informPlayers(new StringBuilder(this.getName()).append(" has won the game").toString());
|
||||
this.wins = true;
|
||||
game.end();
|
||||
|
|
@ -2042,6 +2049,16 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
this.canPaySacrificeCost = canPaySacrificeCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canLoseByZeroOrLessLife() {
|
||||
return loseByZeroOrLessLife;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLoseByZeroOrLessLife(boolean loseByZeroOrLessLife) {
|
||||
this.loseByZeroOrLessLife = loseByZeroOrLessLife;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean autoLoseGame() {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue