Player: Static for CantGainLife

This commit is contained in:
Hans Mackowiak
2021-11-07 12:45:50 +01:00
parent 1b59d25046
commit f1201a7e68
18 changed files with 77 additions and 28 deletions

View File

@@ -105,6 +105,7 @@ import forge.game.spellability.SpellAbility;
import forge.game.staticability.StaticAbility;
import forge.game.staticability.StaticAbilityCantBeCast;
import forge.game.staticability.StaticAbilityCantDraw;
import forge.game.staticability.StaticAbilityCantGainLosePayLife;
import forge.game.staticability.StaticAbilityCantPutCounter;
import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerHandler;
@@ -539,7 +540,7 @@ public class Player extends GameEntity implements Comparable<Player> {
}
public final boolean canGainLife() {
return !hasLost() && !hasKeyword("You can't gain life.") && !hasKeyword("Your life total can't change.");
return !hasLost() && !StaticAbilityCantGainLosePayLife.anyCantGainLife(this);
}
public final int loseLife(int toLose, final boolean damage, final boolean manaBurn) {
@@ -607,14 +608,14 @@ public class Player extends GameEntity implements Comparable<Player> {
}
public final boolean canLoseLife() {
return !hasLost() && !hasKeyword("Your life total can't change.");
return !hasLost() && !StaticAbilityCantGainLosePayLife.anyCantLosePayLife(this);
}
public final boolean canPayLife(final int lifePayment) {
if (lifePayment > 0 && life < lifePayment) {
return false;
}
return (lifePayment <= 0) || !hasKeyword("Your life total can't change.");
return (lifePayment <= 0) || !StaticAbilityCantGainLosePayLife.anyCantLosePayLife(this);
}
public final boolean payLife(final int lifePayment, final Card source) {

View File

@@ -0,0 +1,54 @@
package forge.game.staticability;
import forge.game.Game;
import forge.game.card.Card;
import forge.game.player.Player;
import forge.game.zone.ZoneType;
public class StaticAbilityCantGainLosePayLife {
static String MODE_CANT_GAIN_LIFE = "CantGainLife";
static String MODE_CANT_CHANGE_LIFE = "CantChangeLife";
public static boolean anyCantGainLife(final Player player) {
final Game game = player.getGame();
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
for (final StaticAbility stAb : ca.getStaticAbilities()) {
if (stAb.isSuppressed() || !stAb.checkConditions()) {
continue;
}
if (!(stAb.getParam("Mode").equals(MODE_CANT_GAIN_LIFE) || stAb.getParam("Mode").equals(MODE_CANT_CHANGE_LIFE))) {
continue;
}
if (applyCommonAbility(stAb, player)) {
return true;
}
}
}
return false;
}
public static boolean anyCantLosePayLife(final Player player) {
final Game game = player.getGame();
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
for (final StaticAbility stAb : ca.getStaticAbilities()) {
if (!stAb.getParam("Mode").equals(MODE_CANT_CHANGE_LIFE) || stAb.isSuppressed() || !stAb.checkConditions()) {
continue;
}
if (applyCommonAbility(stAb, player)) {
return true;
}
}
}
return false;
}
public static boolean applyCommonAbility(final StaticAbility stAb, final Player player) {
if (!stAb.matchesValidParam("ValidPlayer", player)) {
return false;
}
return true;
}
}

View File

@@ -3,7 +3,7 @@ ManaCost:6 B B
Types:Creature Demon
PT:6/6
K:Flying
S:Mode$ Continuous | Affected$ Player.Opponent | AddKeyword$ You can't gain life. | Description$ Your opponents can't gain life.
S:Mode$ CantGainLife | ValidPlayer$ Player.Opponent | Description$ Your opponents can't gain life.
T:Mode$ Phase | Phase$ End of Turn | TriggerZones$ Battlefield | Execute$ RepeatOpps | TriggerDescription$ At the beginning of each end step, each opponent loses life equal to the life they lost this turn. (Damage causes loss of life.)
SVar:RepeatOpps:DB$ RepeatEach | RepeatPlayers$ Player.Opponent | RepeatSubAbility$ TrigLoseLife
SVar:TrigLoseLife:DB$ LoseLife | Defined$ Remembered | LifeAmount$ X

View File

@@ -3,9 +3,8 @@ ManaCost:R G
Types:Instant
A:SP$ Charm | Cost$ R G | Choices$ DBNoLife,DBDamage,DBLand,DBPumpAll | CharmNum$ 2
SVar:DBNoLife:DB$ Effect | Name$ Atarka's Command Effect | StaticAbilities$ STCantGain | AILogic$ NoGain | SpellDescription$ Your opponents can't gain life this turn.
SVar:STCantGain:Mode$ Continuous | EffectZone$ Command | Affected$ Player.Opponent | AddKeyword$ You can't gain life. | Description$ Your opponents can't gain life.
SVar:STCantGain:Mode$ CantGainLife | ValidPlayer$ Player.Opponent | Description$ Your opponents can't gain life this turn.
SVar:DBDamage:DB$ DealDamage | Defined$ Player.Opponent | NumDmg$ 3 | AILogic$ Good | SpellDescription$ CARDNAME deals 3 damage to each opponent.
SVar:DBLand:DB$ ChangeZone | Origin$ Hand | Destination$ Battlefield | ChangeType$ Land | ChangeNum$ 1 | Optional$ You | SpellDescription$ You may put a land card from your hand onto the battlefield.
SVar:DBPumpAll:DB$ PumpAll | ValidCards$ Creature.YouCtrl | NumAtt$ +1 | NumDef$ +1 | KW$ Reach | SpellDescription$ Creatures you control get +1/+1 and gain reach until end of turn.
SVar:Picture:http://www.wizards.com/global/images/magic/general/atarkas_command.jpg
Oracle:Choose two —\n• Your opponents can't gain life this turn.\n• Atarka's Command deals 3 damage to each opponent.\n• You may put a land card from your hand onto the battlefield.\n• Creatures you control get +1/+1 and gain reach until end of turn.

View File

@@ -5,9 +5,8 @@ PT:5/7
K:Indestructible
S:Mode$ Continuous | Affected$ Card.Self | RemoveType$ Creature | CheckSVar$ X | SVarCompare$ LT5 | Description$ As long as your devotion to black is less than 5, CARDNAME isn't a creature. (Each {B} in the mana costs of permanents you control counts towards your devotion to black.)
SVar:X:Count$Devotion.Black
S:Mode$ Continuous | Affected$ Player.Opponent | AddKeyword$ You can't gain life. | Description$ Your opponents can't gain life.
S:Mode$ CantGainLife | ValidPlayer$ Player.Opponent | Description$ Your opponents can't gain life.
A:AB$ Draw | Cost$ 1 B PayLife<2> | NumCards$ 1 | SpellDescription$ Draw a card.
SVar:PlayMain1:TRUE
SVar:BuffedBy:Permanent.Black
SVar:Picture:http://www.wizards.com/global/images/magic/general/erebos_god_of_the_dead.jpg
Oracle:Indestructible\nAs long as your devotion to black is less than five, Erebos isn't a creature. (Each {B} in the mana costs of permanents you control counts toward your devotion to black.)\nYour opponents can't gain life.\n{1}{B}, Pay 2 life: Draw a card.

View File

@@ -1,7 +1,7 @@
Name:Everlasting Torment
ManaCost:2 BR
Types:Enchantment
S:Mode$ Continuous | Affected$ Player | AddKeyword$ You can't gain life. | Description$ Players can't gain life.
S:Mode$ CantGainLife | ValidPlayer$ Player | Description$ Players can't gain life.
S:Mode$ CantPreventDamage | Description$ Damage can't be prevented.
S:Mode$ Continuous | GlobalRule$ All damage is dealt as though its source had wither. | Description$ All damage is dealt as though its source had wither. (A source with wither deals damage to creatures in the form of -1/-1 counters.)
SVar:NonStackingEffect:True

View File

@@ -1,11 +1,10 @@
Name:Forsaken Wastes
ManaCost:2 B
Types:World Enchantment
S:Mode$ Continuous | Affected$ Player | AddKeyword$ You can't gain life. | Description$ Players can't gain life.
S:Mode$ CantGainLife | ValidPlayer$ Player | Description$ Players can't gain life.
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | Execute$ TrigLoseLife | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of each player's upkeep, that player loses 1 life.
T:Mode$ BecomesTarget | ValidTarget$ Card.Self | SourceType$ Spell | Execute$ TrigLoseLife5 | TriggerZones$ Battlefield | TriggerDescription$ Whenever CARDNAME becomes the target of a spell, that spell's controller loses 5 life.
SVar:TrigLoseLife:DB$ LoseLife | Defined$ TriggeredPlayer | LifeAmount$ 1
SVar:TrigLoseLife5:DB$ LoseLife | Defined$ TriggeredSourceController | LifeAmount$ 5
AI:RemoveDeck:Random
SVar:Picture:http://www.wizards.com/global/images/magic/general/forsaken_wastes.jpg
Oracle:Players can't gain life.\nAt the beginning of each player's upkeep, that player loses 1 life.\nWhenever Forsaken Wastes becomes the target of a spell, that spell's controller loses 5 life.

View File

@@ -1,10 +1,9 @@
Name:Havoc Festival
ManaCost:4 B R
Types:Enchantment
S:Mode$ Continuous | Affected$ Player | AddKeyword$ You can't gain life. | Description$ Players can't gain life.
S:Mode$ CantGainLife | ValidPlayer$ Player | Description$ Players can't gain life.
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | TriggerZones$ Battlefield | Execute$ TrigLoseLife | TriggerDescription$ At the beginning of each player's upkeep, that player loses half their life, rounded up.
SVar:TrigLoseLife:DB$ LoseLife | Defined$ TriggeredPlayer | LifeAmount$ HavocX
SVar:HavocX:TriggeredPlayer$LifeTotal/HalfUp
AI:RemoveDeck:Random
SVar:Picture:http://www.wizards.com/global/images/magic/general/havoc_festival.jpg
Oracle:Players can't gain life.\nAt the beginning of each player's upkeep, that player loses half their life, rounded up.

View File

@@ -3,9 +3,8 @@ ManaCost:2 R R
Types:Enchantment
K:MayEffectFromOpeningHand:FromHand
SVar:FromHand:DB$ ChangeZone | Defined$ Self | Origin$ Hand | Destination$ Battlefield | SpellDescription$ If CARDNAME is in your opening hand, you may begin the game with it on the battlefield.
S:Mode$ Continuous | Affected$ Player | AddKeyword$ You can't gain life. | Description$ Players can't gain life.
S:Mode$ CantGainLife | ValidPlayer$ Player | Description$ Players can't gain life.
S:Mode$ CantPreventDamage | Description$ Damage can't be prevented.
SVar:NonStackingEffect:True
AI:RemoveDeck:Random
SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_punishment.jpg
Oracle:If Leyline of Punishment is in your opening hand, you may begin the game with it on the battlefield.\nPlayers can't gain life.\nDamage can't be prevented.

View File

@@ -2,6 +2,5 @@ Name:Platinum Emperion
ManaCost:8
Types:Artifact Creature Golem
PT:8/8
S:Mode$ Continuous | Affected$ You | AddKeyword$ Your life total can't change. | Description$ Your life total can't change. (You can't gain or lose life. You can't pay any amount of life except 0.)
SVar:Picture:http://www.wizards.com/global/images/magic/general/platinum_emperion.jpg
S:Mode$ CantChangeLife | ValidPlayer$ You | Description$ Your life total can't change. (You can't gain or lose life. You can't pay any amount of life except 0.)
Oracle:Your life total can't change. (You can't gain or lose life. You can't pay any amount of life except 0.)

View File

@@ -2,7 +2,7 @@ Name:Quakebringer
ManaCost:3 R R
Types:Creature Giant Berserker
PT:5/4
S:Mode$ Continuous | Affected$ Player.Opponent | AddKeyword$ You can't gain life. | Description$ Your opponents can't gain life.
S:Mode$ CantGainLife | ValidPlayer$ Player.Opponent | Description$ Your opponents can't gain life.
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigDealDamage | TriggerDescription$ At the beginning of your upkeep, CARDNAME deals 2 damage to each opponent. This ability triggers only if CARDNAME is on the battlefield or if CARDNAME is in your graveyard and you control a Giant.
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Graveyard | IsPresent$ Creature.YouCtrl+Giant | Execute$ TrigDealDamage | Secondary$ True | TriggerDescription$ At the beginning of your upkeep, CARDNAME deals 2 damage to each opponent. This ability triggers only if CARDNAME is on the battlefield or if CARDNAME is in your graveyard and you control a Giant.
SVar:TrigDealDamage:DB$ DealDamage | NumDmg$ 2 | Defined$ Player.Opponent

View File

@@ -3,8 +3,7 @@ ManaCost:2 R
Types:Creature Dinosaur
PT:3/3
K:Menace
S:Mode$ Continuous | Affected$ Player | AddKeyword$ You can't gain life. | Description$ Players can't gain life.
S:Mode$ CantGainLife | ValidPlayer$ Player | Description$ Players can't gain life.
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Creature.Other | TriggerZones$ Battlefield | Execute$ TrigDamage | TriggerDescription$ Whenever another creature enters the battlefield, CARDNAME deals 1 damage to that creature's controller.
SVar:TrigDamage:DB$ DealDamage | Defined$ TriggeredCardController | NumDmg$ 1
SVar:Picture:http://mythicspoiler.com/ixa/cards/rampagingferocidon.jpg
Oracle:Menace\nPlayers can't gain life.\nWhenever another creature enters the battlefield, Rampaging Ferocidon deals 1 damage to that creature's controller.

View File

@@ -5,5 +5,6 @@ T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | Execute$ Trig1Damage | Tri
SVar:Trig1Damage:DB$ DealDamage | Defined$ TriggeredPlayer | NumDmg$ 1
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Player | TriggerZones$ Battlefield | Execute$ Trig5Damage | HasNoManaCost$ True | TriggerDescription$ Whenever a player casts a spell, if no mana was spent to cast that spell, CARDNAME deals 5 damage to that player.
SVar:Trig5Damage:DB$ DealDamage | Defined$ TriggeredCardController | NumDmg$ 5
A:AB$ Pump | Cost$ R | KW$ You can't gain life. | Defined$ Player.Opponent | StackDescription$ SpellDescription | SpellDescription$ Your opponents can't gain life this turn.
A:AB$ Effect | Cost$ R | Name$ Atarka's Command Effect | StaticAbilities$ STCantGain | AILogic$ NoGain | SpellDescription$ Your opponents can't gain life this turn.
SVar:STCantGain:Mode$ CantGainLife | ValidPlayer$ Player.Opponent | Description$ Your opponents can't gain life this turn.
Oracle:At the beginning of each player's upkeep, Roiling Vortex deals 1 damage to them.\nWhenever a player casts a spell, if no mana was spent to cast that spell, Roiling Vortex deals 5 damage to that player.\n{R}: Your opponents can't gain life this turn.

View File

@@ -2,7 +2,7 @@ Name:Skullcrack
ManaCost:1 R
Types:Instant
A:SP$ Effect | Cost$ 1 R | Name$ Skullcrack Effect | StaticAbilities$ STCantGain,STCantPrevent | AILogic$ Burn | SubAbility$ DBDamage | SpellDescription$ Players can't gain life this turn. Damage can't be prevented this turn. CARDNAME deals 3 damage to target player or planeswalker.
SVar:STCantGain:Mode$ Continuous | EffectZone$ Command | Affected$ Player | AddKeyword$ You can't gain life. | Description$ Players can't gain life.
SVar:STCantGain:Mode$ CantGainLife | ValidPlayer$ Player | Description$ Players can't gain life this turn.
SVar:STCantPrevent:Mode$ CantPreventDamage | EffectZone$ Command | Description$ Damage can't be prevented.
SVar:DBDamage:DB$ DealDamage | ValidTgts$ Player,Planeswalker | TgtPrompt$ Select target player or planeswalker | NumDmg$ 3 | NoPrevention$ True
SVar:Picture:http://www.wizards.com/global/images/magic/general/skullcrack.jpg

View File

@@ -5,6 +5,5 @@ PT:2/2
K:Wither
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | Execute$ TrigEffect | TriggerZones$ Battlefield | TriggerDescription$ Whenever CARDNAME deals damage to a player, that player can't gain life for the rest of the game.
SVar:TrigEffect:DB$ Effect | Name$ Stigma Lasher Effect | StaticAbilities$ CantGainLife | Duration$ Permanent | RememberObjects$ TriggeredTarget
SVar:CantGainLife:Mode$ Continuous | EffectZone$ Command | Affected$ Player.IsRemembered | AddKeyword$ You can't gain life. | Description$ The damaged player can't gain life for the rest of the game.
SVar:Picture:http://www.wizards.com/global/images/magic/general/stigma_lasher.jpg
SVar:CantGainLife:Mode$ CantGainLife | ValidPlayer$ Player.IsRemembered | Description$ The damaged player can't gain life for the rest of the game.
Oracle:Wither (This deals damage to creatures in the form of -1/-1 counters.)\nWhenever Stigma Lasher deals damage to a player, that player can't gain life for the rest of the game.

View File

@@ -1,7 +1,9 @@
Name:Teferi's Protection
ManaCost:2 W
Types:Instant
A:SP$ Pump | Cost$ 2 W | Duration$ UntilYourNextTurn | Defined$ You | KW$ Your life total can't change. & Protection from everything | SubAbility$ DBPhases | SpellDescription$ Until your next turn, your life total can't change and you gain protection from everything. All permanents you control phase out. (While they're phased out, they're treated as though they don't exist. They phase in before you untap during your untap step.) Exile Teferi's Protection.
A:SP$ Effect | Name$ Teferi's Protection Effect | StaticAbilities$ STCantChange | SpellDescription$ Until your next turn, your life total can't change and you gain protection from everything. All permanents you control phase out. (While they're phased out, they're treated as though they don't exist. They phase in before you untap during your untap step.) Exile CARDNAME.
SVar:DBPump:DB$ Pump | Defined$ You | KW$ Protection from everything | SubAbility$ DBPhases
STCantChange:Mode$ CantChangeLife | ValidPlayer$ You | Description$ Your life total can't change.
SVar:DBPhases:DB$ Phases | Defined$ Valid Permanent.YouCtrl | SubAbility$ DBChange
SVar:DBChange:DB$ ChangeZone | Origin$ Stack | Destination$ Exile
Oracle:Until your next turn, your life total can't change and you gain protection from everything. All permanents you control phase out. (While they're phased out, they're treated as though they don't exist. They phase in before you untap during your untap step.)\nExile Teferi's Protection.

View File

@@ -2,7 +2,7 @@ Name:Tibalt, Rakish Instigator
ManaCost:2 R
Types:Legendary Planeswalker Tibalt
Loyalty:5
S:Mode$ Continuous | Affected$ Player.Opponent | AddKeyword$ You can't gain life. | Description$ Your opponents can't gain life.
S:Mode$ CantGainLife | ValidPlayer$ Opponent | Description$ Your opponents can't gain life.
A:AB$ Token | Cost$ SubCounter<2/LOYALTY> | TokenAmount$ 1 | TokenScript$ r_1_1_devil_burn | TokenOwner$ You | LegacyImage$ r 1 1 devil burn war | Planeswalker$ True | SpellDescription$ Create a 1/1 red Devil creature token "When this creature dies, it deals 1 damage to any target."
DeckHas:Ability$Token
Oracle:Your opponents can't gain life.\n[2]: Create a 1/1 red Devil creature token with "When this creature dies, it deals 1 damage to any target."

View File

@@ -1,10 +1,9 @@
Name:Witch Hunt
ManaCost:4 R
Types:Enchantment
S:Mode$ Continuous | Affected$ Player | AddKeyword$ You can't gain life. | Description$ Players can't gain life.
S:Mode$ CantGainLife | ValidPlayer$ Player | Description$ Players can't gain life.
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigDmg | TriggerDescription$ At the beginning of your upkeep, CARDNAME deals 4 damage to you.
SVar:TrigDmg:DB$ DealDamage | Defined$ You | NumDmg$ 4
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigGainControl | TriggerDescription$ At the beginning of your end step, target opponent chosen at random gains control of CARDNAME.
SVar:TrigGainControl:DB$ GainControl | ValidTgts$ Opponent | TargetsAtRandom$ True | Defined$ Self
SVar:Picture:http://www.wizards.com/global/images/magic/general/witch_hunt.jpg
Oracle:Players can't gain life.\nAt the beginning of your upkeep, Witch Hunt deals 4 damage to you.\nAt the beginning of your end step, target opponent chosen at random gains control of Witch Hunt.