ReplaceLifeReduced: update for Bloodletter (#4197)

* ReplaceLifeReduced: update for Bloodletter

* add Bloodletter of aclazotz
This commit is contained in:
Hans Mackowiak
2023-11-25 20:41:07 +01:00
committed by GitHub
parent e67f71aa66
commit 1bfa22e5b5
11 changed files with 61 additions and 38 deletions

View File

@@ -556,7 +556,7 @@ public class Player extends GameEntity implements Comparable<Player> {
int oldLife = life;
// Run applicable replacement effects
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(this);
repParams.put(AbilityKey.Result, oldLife-toLose);
repParams.put(AbilityKey.Amount, toLose);
repParams.put(AbilityKey.IsDamage, damage);
switch (getGame().getReplacementHandler().run(ReplacementType.LifeReduced, repParams)) {
@@ -565,8 +565,7 @@ public class Player extends GameEntity implements Comparable<Player> {
case Updated:
// check if this is still the affected player
if (this.equals(repParams.get(AbilityKey.Affected))) {
int result = (int) repParams.get(AbilityKey.Result);
toLose = oldLife - result;
toLose = (int) repParams.get(AbilityKey.Amount);
// there is nothing that changes lifegain into lifeloss this way
if (toLose <= 0) {
return 0;

View File

@@ -4,6 +4,8 @@ import java.util.Map;
import forge.game.ability.AbilityKey;
import forge.game.card.Card;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.util.Expressions;
/**
@@ -27,7 +29,13 @@ public class ReplaceLifeReduced extends ReplacementEffect {
*/
@Override
public boolean canReplace(Map<AbilityKey, Object> runParams) {
if (!matchesValidParam("ValidPlayer", runParams.get(AbilityKey.Affected))) {
int amount = (int)runParams.get(AbilityKey.Amount);
Player affected = (Player) runParams.get(AbilityKey.Affected);
if (amount <= 0) {
return false;
}
if (!matchesValidParam("ValidPlayer", affected)) {
return false;
}
@@ -36,8 +44,9 @@ public class ReplaceLifeReduced extends ReplacementEffect {
return false;
}
}
if (hasParam("Result")) {
final int n = (Integer)runParams.get(AbilityKey.Result);
final int n = affected.getLife() - amount;
String comparator = getParam("Result");
final String operator = comparator.substring(0, 2);
final int operandValue = Integer.parseInt(comparator.substring(2));
@@ -47,4 +56,10 @@ public class ReplaceLifeReduced extends ReplacementEffect {
}
return true;
}
@Override
public void setReplacingObjects(Map<AbilityKey, Object> runParams, SpellAbility sa) {
sa.setReplacingObjectsFrom(runParams, AbilityKey.Amount);
sa.setReplacingObject(AbilityKey.Player, runParams.get(AbilityKey.Affected));
}
}

View File

@@ -2,8 +2,8 @@ Name:Ali from Cairo
ManaCost:2 R R
Types:Creature Human
PT:0/1
R:Event$ LifeReduced | ActiveZones$ Battlefield | ValidPlayer$ You | Result$ LT1 | IsDamage$ True | CheckSVar$ YourLife | SVarCompare$ GE1 | ReplaceWith$ ReduceLoss | Description$ Damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Result | VarValue$ X
SVar:X:ReplaceCount$Result/NMinus.1
SVar:YourLife:Count$YourLifeTotal
R:Event$ LifeReduced | ActiveZones$ Battlefield | ValidPlayer$ You.lifeGE1 | Result$ LT1 | IsDamage$ True | ReplaceWith$ ReduceLoss | Description$ Damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Amount | VarValue$ X
SVar:X:ReplaceCount$Amount/LimitMax.Difference
SVar:Difference:Count$YourLifeTotal/Minus.1
Oracle:Damage that would reduce your life total to less than 1 reduces it to 1 instead.

View File

@@ -6,10 +6,10 @@ K:Flash
K:Flying
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigEffect | TriggerDescription$ When CARDNAME enters the battlefield, until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:TrigEffect:DB$ Effect | Name$ Angel of Grace Effect | ReplacementEffects$ SelflessDamage | Description$ Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:SelflessDamage:Event$ LifeReduced | ValidPlayer$ You | Result$ LT1 | IsDamage$ True | CheckSVar$ YourLife | SVarCompare$ GE1 | ReplaceWith$ ReduceLoss | Description$ Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Result | VarValue$ X
SVar:X:ReplaceCount$Result/NMinus.1
SVar:YourLife:Count$YourLifeTotal
SVar:SelflessDamage:Event$ LifeReduced | ValidPlayer$ You.lifeGE1 | Result$ LT1 | IsDamage$ True | ReplaceWith$ ReduceLoss | Description$ Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Amount | VarValue$ X
SVar:X:ReplaceCount$Amount/LimitMax.Difference
SVar:Difference:Count$YourLifeTotal/Minus.1
A:AB$ SetLife | Cost$ 4 W W ExileFromGrave<1/CARDNAME> | Defined$ You | ActivationZone$ Graveyard | LifeAmount$ 10 | SpellDescription$ Your life total becomes 10.
AI:RemoveDeck:Random
Oracle:Flash\nFlying\nWhen Angel of Grace enters the battlefield, until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead.\n{4}{W}{W}, Exile Angel of Grace from your graveyard: Your life total becomes 10.

View File

@@ -4,8 +4,8 @@ Types:Instant
K:Split second
A:SP$ Effect | StaticAbilities$ STCantLose | ReplacementEffects$ SelflessDamage | AILogic$ Fog | SpellDescription$ You can't lose the game this turn and your opponents can't win the game this turn. Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:STCantLose:Mode$ Continuous | Affected$ You | AddKeyword$ You can't lose the game. & Your opponents can't win the game. | Description$ You can't lose the game. Your opponents can't win the game.
SVar:SelflessDamage:Event$ LifeReduced | ValidPlayer$ You | Result$ LT1 | IsDamage$ True | CheckSVar$ YourLife | SVarCompare$ GE1 | ReplaceWith$ ReduceLoss | Description$ Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Result | VarValue$ X
SVar:X:ReplaceCount$Result/NMinus.1
SVar:YourLife:Count$YourLifeTotal
SVar:SelflessDamage:Event$ LifeReduced | ValidPlayer$ You.lifeGE1 | Result$ LT1 | IsDamage$ True | ReplaceWith$ ReduceLoss | Description$ Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Amount | VarValue$ X
SVar:X:ReplaceCount$Amount/LimitMax.Difference
SVar:Difference:Count$YourLifeTotal/Minus.1
Oracle:Split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)\nYou can't lose the game this turn and your opponents can't win the game this turn. Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead.

View File

@@ -3,10 +3,11 @@ ManaCost:4 G G G
Types:Creature Wurm
PT:7/7
K:Trample
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ TrigLife | CheckSVar$ ElderscaleCondition | SVarCompare$ LT7 | TriggerDescription$ When CARDNAME enters the battlefield, if your life total is less than 7, your life total becomes 7.
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ TrigLife | CheckSVar$ YourLife | SVarCompare$ LT7 | TriggerDescription$ When CARDNAME enters the battlefield, if your life total is less than 7, your life total becomes 7.
SVar:TrigLife:DB$ SetLife | Defined$ You | LifeAmount$ 7
R:Event$ LifeReduced | ActiveZones$ Battlefield | ValidPlayer$ You | Result$ LT7 | IsDamage$ True | CheckSVar$ ElderscaleCondition | SVarCompare$ GE7 | ReplaceWith$ ReduceLoss | Description$ As long as you have 7 or more life, damage that would reduce your life total to less than 7 reduces it to 7 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Result | VarValue$ X
SVar:X:ReplaceCount$Result/NMinus.7
SVar:ElderscaleCondition:Count$YourLifeTotal
R:Event$ LifeReduced | ActiveZones$ Battlefield | ValidPlayer$ You.lifeGE7 | Result$ LT7 | IsDamage$ True | ReplaceWith$ ReduceLoss | Description$ As long as you have 7 or more life, damage that would reduce your life total to less than 7 reduces it to 7 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Amount | VarValue$ X
SVar:X:ReplaceCount$Amount/LimitMax.Difference
SVar:Difference:Count$YourLifeTotal/Minus.7
SVar:YourLife:Count$YourLifeTotal
Oracle:Trample\nWhen Elderscale Wurm enters the battlefield, if your life total is less than 7, your life total becomes 7.\nAs long as you have 7 or more life, damage that would reduce your life total to less than 7 reduces it to 7 instead.

View File

@@ -3,8 +3,8 @@ ManaCost:4 R
Types:Creature Human Rogue
PT:0/1
K:Morph:R R
R:Event$ LifeReduced | ActiveZones$ Battlefield | ValidPlayer$ You | Result$ LT1 | IsDamage$ True | CheckSVar$ YourLife | SVarCompare$ GE1 | ReplaceWith$ ReduceLoss | Description$ Damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Result | VarValue$ X
SVar:X:ReplaceCount$Result/NMinus.1
SVar:YourLife:Count$YourLifeTotal
R:Event$ LifeReduced | ActiveZones$ Battlefield | ValidPlayer$ You.lifeGE1 | Result$ LT1 | IsDamage$ True | ReplaceWith$ ReduceLoss | Description$ Damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Amount | VarValue$ X
SVar:X:ReplaceCount$Amount/LimitMax.Difference
SVar:Difference:Count$YourLifeTotal/Minus.1
Oracle:Damage that would reduce your life total to less than 1 reduces it to 1 instead.\nMorph {R}{R} (You may cast this card face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.)

View File

@@ -5,9 +5,9 @@ Loyalty:4
A:AB$ PumpAll | Cost$ AddCounter<2/LOYALTY> | Planeswalker$ True | ValidCards$ Creature.withFlying+YouCtrl | NumAtt$ +1 | NumDef$ +1 | SpellDescription$ Creatures you control with flying get +1/+1 until end of turn.
A:AB$ Token | Cost$ SubCounter<3/LOYALTY> | Planeswalker$ True | TokenScript$ w_4_4_angel_flying_vigilance | TokenOwner$ You | SpellDescription$ Create a 4/4 white Angel creature token with flying and vigilance.
A:AB$ Effect | Cost$ SubCounter<6/LOYALTY> | Name$ Emblem - Serra the Benevolent | Image$ emblem_serra_the_benevolent | ReplacementEffects$ STWorship | Planeswalker$ True | Ultimate$ True | Stackable$ False | Duration$ Permanent | AILogic$ Always | SpellDescription$ You get an emblem with "If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead."
SVar:STWorship:Event$ LifeReduced | ValidPlayer$ You | Result$ LT1 | IsDamage$ True | CheckSVar$ YourLife | SVarCompare$ GE1 | IsPresent$ Creature.YouCtrl | ReplaceWith$ ReduceLoss | Description$ If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Result | VarValue$ X
SVar:X:ReplaceCount$Result/NMinus.1
SVar:YourLife:Count$YourLifeTotal
SVar:STWorship:Event$ LifeReduced | ValidPlayer$ You.lifeGE1 | Result$ LT1 | IsDamage$ True | IsPresent$ Creature.YouCtrl | ReplaceWith$ ReduceLoss | Description$ If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Amount | VarValue$ X
SVar:X:ReplaceCount$Amount/LimitMax.Difference
SVar:Difference:Count$YourLifeTotal/Minus.1
DeckHas:Ability$Token
Oracle:[+2]: Creatures you control with flying get +1/+1 until end of turn.\n[-3]: Create a 4/4 white Angel creature token with flying and vigilance.\n[-6]: You get an emblem with "If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead."

View File

@@ -3,8 +3,8 @@ ManaCost:1 W
Types:Creature Angel Spirit
PT:0/3
K:Cumulative upkeep:1 W
R:Event$ LifeReduced | ActiveZones$ Battlefield | ValidPlayer$ You | Result$ LT1 | IsDamage$ True | CheckSVar$ YourLife | SVarCompare$ GE1 | ReplaceWith$ ReduceLoss | Description$ Damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Result | VarValue$ X
SVar:X:ReplaceCount$Result/NMinus.1
SVar:YourLife:Count$YourLifeTotal
R:Event$ LifeReduced | ActiveZones$ Battlefield | ValidPlayer$ You.lifeGE1 | Result$ LT1 | IsDamage$ True | ReplaceWith$ ReduceLoss | Description$ Damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Amount | VarValue$ X
SVar:X:ReplaceCount$Amount/LimitMax.Difference
SVar:Difference:Count$YourLifeTotal/Minus.1
Oracle:Cumulative upkeep {1}{W} (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.)\nDamage that would reduce your life total to less than 1 reduces it to 1 instead.

View File

@@ -0,0 +1,8 @@
Name:Bloodletter of Aclazotz
ManaCost:1 B B B
Types:Creature Vampire Demon
PT:2/4
K:Flying
R:Event$ LifeReduced | ValidPlayer$ Opponent | PlayerTurn$ True | ReplaceWith$ LoseTwice | ActiveZones$ Battlefield | Description$ If an opponent would lose life during your turn, they lose twice that much life instead. (Damage causes loss of life.)
SVar:LoseTwice:DB$ ReplaceEffect | VarName$ Amount | VarValue$ ReplaceCount$Amount/Twice
Oracle:Flying\nIf an opponent would lose life during your turn, they lose twice that much life instead. (Damage causes loss of life.)

View File

@@ -1,8 +1,8 @@
Name:Worship
ManaCost:3 W
Types:Enchantment
R:Event$ LifeReduced | ActiveZones$ Battlefield | ValidPlayer$ You | Result$ LT1 | IsDamage$ True | CheckSVar$ YourLife | SVarCompare$ GE1 | IsPresent$ Creature.YouCtrl | ReplaceWith$ ReduceLoss | Description$ If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Result | VarValue$ X
SVar:X:ReplaceCount$Result/NMinus.1
SVar:YourLife:Count$YourLifeTotal
R:Event$ LifeReduced | ActiveZones$ Battlefield | ValidPlayer$ You.lifeGE1 | Result$ LT1 | IsDamage$ True | IsPresent$ Creature.YouCtrl | ReplaceWith$ ReduceLoss | Description$ If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead.
SVar:ReduceLoss:DB$ ReplaceEffect | VarName$ Amount | VarValue$ X
SVar:X:ReplaceCount$Amount/LimitMax.Difference
SVar:Difference:Count$YourLifeTotal/Minus.1
Oracle:If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead.