mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
add ReplaceLifeReduced
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
package forge.game.replacement;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
|
import forge.game.card.Card;
|
||||||
|
import forge.util.Expressions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for this type.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ReplaceLifeReduced extends ReplacementEffect {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new replace life reduced.
|
||||||
|
*
|
||||||
|
* @param map the map
|
||||||
|
* @param host the host
|
||||||
|
*/
|
||||||
|
public ReplaceLifeReduced(Map<String, String> map, Card host, boolean intrinsic) {
|
||||||
|
super(map, host, intrinsic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.card.replacement.ReplacementEffect#canReplace(java.util.HashMap)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean canReplace(Map<AbilityKey, Object> runParams) {
|
||||||
|
if (!matchesValidParam("ValidPlayer", runParams.get(AbilityKey.Affected))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (hasParam("Result")) {
|
||||||
|
final int n = (Integer)runParams.get(AbilityKey.Result);
|
||||||
|
String comparator = getParam("Result");
|
||||||
|
final String operator = comparator.substring(0, 2);
|
||||||
|
final int operandValue = Integer.parseInt(comparator.substring(2));
|
||||||
|
if (!Expressions.compare(n, operator, operandValue)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@ public enum ReplacementType {
|
|||||||
GainLife(ReplaceGainLife.class),
|
GainLife(ReplaceGainLife.class),
|
||||||
GameLoss(ReplaceGameLoss.class),
|
GameLoss(ReplaceGameLoss.class),
|
||||||
Learn(ReplaceLearn.class),
|
Learn(ReplaceLearn.class),
|
||||||
|
LifeReduced(ReplaceLifeReduced.class),
|
||||||
Mill(ReplaceMill.class),
|
Mill(ReplaceMill.class),
|
||||||
Moved(ReplaceMoved.class),
|
Moved(ReplaceMoved.class),
|
||||||
ProduceMana(ReplaceProduceMana.class),
|
ProduceMana(ReplaceProduceMana.class),
|
||||||
|
|||||||
Reference in New Issue
Block a user