mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
*Added a GameLoss replacement effect.
*Added Lich's Mirror.
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -10820,6 +10820,7 @@ src/main/java/forge/card/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/card/replacement/ReplaceDamage.java -text
|
||||
src/main/java/forge/card/replacement/ReplaceDraw.java -text
|
||||
src/main/java/forge/card/replacement/ReplaceGainLife.java -text
|
||||
src/main/java/forge/card/replacement/ReplaceGameLoss.java -text
|
||||
src/main/java/forge/card/replacement/ReplacementEffect.java -text
|
||||
src/main/java/forge/card/replacement/ReplacementHandler.java -text
|
||||
src/main/java/forge/card/replacement/package-info.java svneol=native#text/plain
|
||||
|
||||
@@ -2089,6 +2089,16 @@ public abstract class Player extends GameEntity {
|
||||
System.out.println("Tried to lose, but currently can't.");
|
||||
return false;
|
||||
}
|
||||
|
||||
//Replacement effects
|
||||
HashMap<String,Object> runParams = new HashMap<String,Object>();
|
||||
runParams.put("Affected", this);
|
||||
runParams.put("Event", "GameLoss");
|
||||
|
||||
if(AllZone.getReplacementHandler().run(runParams)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.lossState = state;
|
||||
this.loseConditionSpell = spellName;
|
||||
return true;
|
||||
@@ -2176,12 +2186,11 @@ public abstract class Player extends GameEntity {
|
||||
}
|
||||
|
||||
if (this.lossState != GameLossReason.DidNotLoseYet) {
|
||||
return true;
|
||||
return this.loseConditionMet(lossState, null);
|
||||
}
|
||||
|
||||
if (this.poisonCounters >= 10) {
|
||||
this.loseConditionMet(GameLossReason.Poisoned, null);
|
||||
return true;
|
||||
return this.loseConditionMet(GameLossReason.Poisoned, null);
|
||||
}
|
||||
|
||||
if (this.cantLoseForZeroOrLessLife()) {
|
||||
@@ -2190,8 +2199,7 @@ public abstract class Player extends GameEntity {
|
||||
|
||||
final boolean hasNoLife = this.getLife() <= 0;
|
||||
if (hasNoLife) {
|
||||
this.loseConditionMet(GameLossReason.LifeReachedZero, null);
|
||||
return true;
|
||||
return this.loseConditionMet(GameLossReason.LifeReachedZero, null);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
57
src/main/java/forge/card/replacement/ReplaceGameLoss.java
Normal file
57
src/main/java/forge/card/replacement/ReplaceGameLoss.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package forge.card.replacement;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
*
|
||||
*/
|
||||
public class ReplaceGameLoss extends ReplacementEffect {
|
||||
|
||||
/**
|
||||
* Instantiates a new replace gain life.
|
||||
*
|
||||
* @param map the map
|
||||
* @param host the host
|
||||
*/
|
||||
public ReplaceGameLoss(HashMap<String, String> map, Card host) {
|
||||
super(map, host);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.replacement.ReplacementEffect#canReplace(java.util.HashMap)
|
||||
*/
|
||||
@Override
|
||||
public boolean canReplace(HashMap<String, Object> runParams) {
|
||||
if (!runParams.get("Event").equals("GameLoss")) {
|
||||
return false;
|
||||
}
|
||||
if (this.getMapParams().containsKey("ValidPlayer")) {
|
||||
if (!AllZoneUtil.matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidPlayer").split(","), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.replacement.ReplacementEffect#getCopy()
|
||||
*/
|
||||
@Override
|
||||
public ReplacementEffect getCopy() {
|
||||
return new ReplaceGameLoss(this.getMapParams(), getHostCard());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.replacement.ReplacementEffect#setReplacingObjects(java.util.HashMap, forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
@Override
|
||||
public void setReplacingObjects(HashMap<String, Object> runParams, SpellAbility sa) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -186,6 +186,8 @@ public class ReplacementHandler {
|
||||
ret = new ReplaceGainLife(mapParams, host);
|
||||
} else if (eventToReplace.equals("DamageDone")) {
|
||||
ret = new ReplaceDamage(mapParams, host);
|
||||
} else if (eventToReplace.equals("GameLoss")) {
|
||||
ret = new ReplaceGameLoss(mapParams, host);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user