Merge branch 'ea_ae' into 'master'

Enduring Angel // Angelic Enforcer and support

See merge request core-developers/forge!5317
This commit is contained in:
Michael Kamensky
2021-09-12 03:42:11 +00:00
7 changed files with 92 additions and 9 deletions

View File

@@ -551,6 +551,13 @@ public class Player extends GameEntity implements Comparable<Player> {
}
if (toLose > 0) {
int oldLife = life;
// Run applicable replacement effects
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(this);
repParams.put(AbilityKey.Result, oldLife-toLose);
if (game.getReplacementHandler().run(ReplacementType.LifeReduced, repParams)
!= ReplacementResult.NotReplaced) {
return 0;
}
life -= toLose;
view.updateLife(this);
lifeLost = toLose;

View File

@@ -12,7 +12,7 @@ import forge.game.card.Card;
public class ReplaceGameLoss extends ReplacementEffect {
/**
* Instantiates a new replace gain life.
* Instantiates a new replace game loss.
*
* @param map the map
* @param host the host

View File

@@ -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;
}
}

View File

@@ -29,6 +29,7 @@ public enum ReplacementType {
GainLife(ReplaceGainLife.class),
GameLoss(ReplaceGameLoss.class),
Learn(ReplaceLearn.class),
LifeReduced(ReplaceLifeReduced.class),
Mill(ReplaceMill.class),
Moved(ReplaceMoved.class),
ProduceMana(ReplaceProduceMana.class),

View File

@@ -1,8 +1,7 @@
Name:Beacon of Immortality
ManaCost:5 W
Types:Instant
A:SP$ GainLife | Cost$ 5 W | ValidTgts$ Player | TgtPrompt$ Select target player | LifeAmount$ X | SubAbility$ DBShuffle | SpellDescription$ Double target player's life total. Shuffle CARDNAME into its owner's library.
A:SP$ SetLife | ValidTgts$ Player | TgtPrompt$ Select target player | LifeAmount$ X | SubAbility$ DBShuffle | SpellDescription$ Double target player's life total. Shuffle CARDNAME into its owner's library.
SVar:DBShuffle:DB$ ChangeZone | Origin$ Stack | Destination$ Library | Shuffle$ True
SVar:X:TargetedPlayer$LifeTotal
SVar:Picture:http://www.wizards.com/global/images/magic/general/beacon_of_immortality.jpg
SVar:X:TargetedPlayer$LifeTotal/Twice
Oracle:Double target player's life total. Shuffle Beacon of Immortality into its owner's library.

View File

@@ -2,7 +2,8 @@ Name:Revival
ManaCost:WB WB
AlternateMode:Split
Types:Sorcery
A:SP$ ChangeZone | Cost$ WB WB | Origin$ Graveyard | Destination$ Battlefield | TgtPrompt$ Choose target creature in your graveyard | ValidTgts$ Creature.YouOwn+cmcLE3 | SpellDescription$ Return target creature card with mana value 3 or less from your graveyard to the battlefield.
A:SP$ ChangeZone | Origin$ Graveyard | Destination$ Battlefield | TgtPrompt$ Select target creature card in your graveyard with mana value 3 or less | ValidTgts$ Creature.YouOwn+cmcLE3 | SpellDescription$ Return target creature card with mana value 3 or less from your graveyard to the battlefield.
DeckHas:Ability$Graveyard
Oracle:Return target creature card with mana value 3 or less from your graveyard to the battlefield.
ALTERNATE
@@ -10,8 +11,8 @@ ALTERNATE
Name:Revenge
ManaCost:4 W B
Types:Sorcery
A:SP$ GainLife | Cost$ 4 W B | LifeAmount$ X | SubAbility$ DBLoseHalf | SpellDescription$ Double your life total. Target opponent loses half their life, rounded up.
A:SP$ SetLife | LifeAmount$ X | SubAbility$ DBLoseHalf | SpellDescription$ Double your life total. Target opponent loses half their life, rounded up.
SVar:DBLoseHalf:DB$ LoseLife | ValidTgts$ Opponent | LifeAmount$ Y
SVar:X:Count$YourLifeTotal
SVar:X:Count$YourLifeTotal/Twice
SVar:Y:Count$TargetedLifeTotal/HalfUp
Oracle:Double your life total. Target opponent loses half their life, rounded up.

View File

@@ -0,0 +1,31 @@
Name:Enduring Angel
ManaCost:2 W W W
Types:Creature Angel
PT:3/3
K:Flying
K:Double Strike
S:Mode$ Continuous | Affected$ You | AddKeyword$ Hexproof | Description$ You have hexproof.
R:Event$ LifeReduced | ValidPlayer$ You | Result$ LE0 | ReplaceWith$ Transform | Description$ If your life total would be reduced to 0 or less, instead transform CARDNAME and your life total becomes 3. Then if CARDNAME didn't transform this way, you lose the game.
SVar:Transform:DB$ SetState | Defined$ Self | Mode$ Transform | RememberChanged$ True | SubAbility$ DBSetLife
SVar:DBSetLife:DB$ SetLife | Defined$ You | LifeAmount$ 3 | SubAbility$ DBLoseGame
SVar:DBLoseGame:DB$ LosesGame | Defined$ You | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ NE1 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
AlternateMode:DoubleFaced
Oracle:Flying, double strike\nYou have hexproof.\nIf your life total would be reduced to 0 or less, instead transform Enduring Angel and your life total becomes 3. Then if Enduring Angel didn't transform this way, you lose the game.
ALTERNATE
Name:Angelic Enforcer
ManaCost:no cost
Colors:white
Types:Creature Angel
PT:*/*
K:Flying
S:Mode$ Continuous | Affected$ You | AddKeyword$ Hexproof | Description$ You have hexproof.
S:Mode$ Continuous | EffectZone$ All | CharacteristicDefining$ True | SetPower$ X | SetToughness$ X | Description$ CARDNAME's power and toughness are each equal to your life total.
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigDoubleLife | TriggerDescription$ Whenever CARDNAME attacks, double your life total.
SVar:TrigDoubleLife:DB$ SetLife | LifeAmount$ Y
SVar:X:Count$YourLifeTotal
SVar:Y:Count$YourLifeTotal/Twice
SVar:HasAttackEffect:TRUE
Oracle:Flying\nYou have hexproof.\nAngelic Enforcer's power and toughness are each equal to your life total.\nWhenever Angelic Enforcer attacks, double your life total.