* Fix NPE
This commit is contained in:
tool4ever
2023-02-22 17:45:26 +01:00
committed by GitHub
parent 1e7f658813
commit e9dfbf3c66
13 changed files with 21 additions and 21 deletions

View File

@@ -3164,7 +3164,7 @@ public class ComputerUtil {
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(c);
// don't need to bother with real LKI since this is a passive check and the card isn't going anywhere
repParams.put(AbilityKey.CardLKI, c);
repParams.put(AbilityKey.Origin, c.getZone().getZoneType());
repParams.put(AbilityKey.Origin, c.getLastKnownZone().getZoneType());
repParams.put(AbilityKey.Destination, ZoneType.Battlefield);
List<ReplacementEffect> list = c.getGame().getReplacementHandler().getReplacementList(ReplacementType.Moved, repParams, ReplacementLayer.CantHappen);
return !list.isEmpty();

View File

@@ -108,6 +108,8 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
safeMana += getAmountOfColor(c);
}
// TODO isPersistentMana
return totalMana() != safeMana; //won't lose floating mana if all mana is of colors that aren't going to be emptied
}
@@ -123,6 +125,7 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
Byte convertTo = null;
// TODO move this lower in case all mana would be persistent
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromAffected(owner);
runParams.put(AbilityKey.Mana, "C");
switch (owner.getGame().getReplacementHandler().run(ReplacementType.LoseMana, runParams)) {

View File

@@ -127,8 +127,11 @@ public class ReplacementHandler {
Zone lkiZone = game.getChangeZoneLKIInfo(c).getLastKnownZone();
// only when not prelist
if (c == crd && lkiZone.is(ZoneType.Battlefield) && event == ReplacementType.Moved &&
runParams.containsKey(AbilityKey.LastStateBattlefield) && runParams.get(AbilityKey.LastStateBattlefield) != null) {
boolean noLKIstate = c != crd || event != ReplacementType.Moved;
// might be inbound token
noLKIstate |= lkiZone == null || !lkiZone.is(ZoneType.Battlefield);
noLKIstate |= !runParams.containsKey(AbilityKey.LastStateBattlefield) || runParams.get(AbilityKey.LastStateBattlefield) == null;
if (!noLKIstate) {
Card lastState = ((CardCollectionView) runParams.get(AbilityKey.LastStateBattlefield)).get(crd);
// no LKI found for this card so it shouldn't apply, this can happen during simultaneous zone changes
if (lastState == crd) {

View File

@@ -4,7 +4,7 @@ Types:Legendary Creature Human Minion
PT:3/3
S:Mode$ Continuous | Affected$ Creature.Nightmare | AddPower$ 1 | AddToughness$ 1 | Description$ Nightmare creatures get +1/+1.
A:AB$ ChangeZone | Cost$ B B B PayLife<3> | Origin$ Graveyard | Destination$ Battlefield | GainControl$ True | TgtPrompt$ Select target creature card in a graveyard | ValidTgts$ Creature | ChangeNum$ 1 | AnimateSubAbility$ DBAnimate | SpellDescription$ Put target creature card from a graveyard onto the battlefield under your control. That creature is black and is a Nightmare in addition to its other creature types.
SVar:DBAnimate:DB$ Animate | Defined$ Targeted | Types$ Nightmare | Colors$ Black | Duration$ Permanent | OverwriteColors$ True
SVar:DBAnimate:DB$ Animate | Defined$ Remembered | Types$ Nightmare | Colors$ Black | Duration$ Permanent | OverwriteColors$ True
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.Self | Execute$ TrigExile | TriggerDescription$ When CARDNAME leaves the battlefield, exile all Nightmares.
SVar:TrigExile:DB$ ChangeZoneAll | Origin$ Battlefield | Destination$ Exile | ChangeType$ Nightmare
SVar:PlayMain1:TRUE

View File

@@ -4,10 +4,6 @@ Types:Legendary Creature Human Wizard
PT:2/3
T:Mode$ SpellCast | ValidCard$ Card.Blue | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | Execute$ ExileTop | TriggerDescription$ Whenever you cast a blue spell, exile the top card of target player's library.
T:Mode$ SpellCast | ValidCard$ Card.Black | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | Execute$ ExileTop | TriggerDescription$ Whenever you cast a black spell, exile the top card of target player's library.
SVar:ExileTop:DB$ Dig | DigNum$ 1 | ChangeNum$ All | ValidTgts$ Player | TgtPrompt$ Choose a player | DestinationZone$ Exile | RememberChanged$ True
S:Mode$ CantBeCast | ValidCard$ Card.nonLand+sharesNameWith Remembered.ExiledWithSource | Caster$ Opponent | Description$ Your opponents can't cast spells with the same name as a card exiled with CARDNAME.
T:Mode$ ChangesZone | Origin$ Exile | Destination$ Any | Static$ True | ValidCard$ Card.IsRemembered+ExiledWithSource | Execute$ DBForget
SVar:DBForget:DB$ Pump | ForgetObjects$ TriggeredCard
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | Static$ True | ValidCard$ Card.Self | Execute$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:ExileTop:DB$ Dig | DigNum$ 1 | ChangeNum$ All | ValidTgts$ Player | TgtPrompt$ Choose a player | DestinationZone$ Exile
S:Mode$ CantBeCast | ValidCard$ Card.nonLand+sharesNameWith ValidExile Card.ExiledWithSource | Caster$ Opponent | Description$ Your opponents can't cast spells with the same name as a card exiled with CARDNAME.
Oracle:Whenever you cast a blue spell, exile the top card of target player's library.\nWhenever you cast a black spell, exile the top card of target player's library.\nYour opponents can't cast spells with the same name as a card exiled with Circu, Dimir Lobotomist.

View File

@@ -4,6 +4,6 @@ Types:Land
K:Hideaway:4
K:CARDNAME enters the battlefield tapped.
A:AB$ Mana | Cost$ T | Produced$ B | SpellDescription$ Add {B}.
A:AB$ Play | Cost$ B T | Defined$ ExiledWith | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionZone$ Hand | ConditionPresent$ Card | ConditionCompare$ EQ0 | ForgetRemembered$ True | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if each player has no cards in hand.
A:AB$ Play | Cost$ B T | Defined$ ExiledWith | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionZone$ Hand | ConditionPresent$ Card | ConditionCompare$ EQ0 | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if each player has no cards in hand.
AI:RemoveDeck:Random
Oracle:Hideaway 4 (When this permanent enters the battlefield, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)\nHowltooth Hollow enters the battlefield tapped.\n{T}: Add {B}.\n{B}, {T}: You may play the exiled card without paying its mana cost if each player has no cards in hand.

View File

@@ -4,6 +4,6 @@ Types:Creature Goblin Wizard
PT:1/3
K:Haste
A:AB$ ChangeZone | Cost$ R T | Origin$ Graveyard | Destination$ Exile | ValidTgts$ Instant.YouCtrl,Sorcery.YouCtrl | TgtPrompt$ Select target instant or sorcery card in your graveyard | SpellDescription$ Exile target instant or sorcery card from your graveyard.
A:AB$ Play | Cost$ 1 R T Sac<1/CARDNAME> | Valid$ Instant.ExiledWithSource,Sorcery.ExiledWithSource | ValidZone$ Exile | WithoutManaCost$ True | Amount$ All | Controller$ You | Optional$ True | SpellDescription$ Cast any number of cards exiled with Izzet Chemister without paying their mana costs.
A:AB$ Play | Cost$ 1 R T Sac<1/CARDNAME> | Valid$ Instant.ExiledWithSource,Sorcery.ExiledWithSource | ValidZone$ Exile | WithoutManaCost$ True | Amount$ All | Controller$ You | Optional$ True | SpellDescription$ Cast any number of cards exiled with CARDNAME without paying their mana costs.
AI:RemoveDeck:All
Oracle:Haste\n{R}, {T}: Exile target instant or sorcery card from your graveyard.\n{1}{R}, {T}, Sacrifice Izzet Chemister: Cast any number of cards exiled with Izzet Chemister without paying their mana costs.

View File

@@ -4,6 +4,6 @@ Types:Land
K:Hideaway:4
K:CARDNAME enters the battlefield tapped.
A:AB$ Mana | Cost$ T | Produced$ G | SpellDescription$ Add {G}.
A:AB$ Play | Cost$ G T | Defined$ ExiledWith | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE10 | ForgetRemembered$ True | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if creatures you control have total power 10 or greater.
A:AB$ Play | Cost$ G T | Defined$ ExiledWith | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE10 | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if creatures you control have total power 10 or greater.
SVar:X:Count$SumPower_Creature.YouCtrl
Oracle:Hideaway 4 (When this permanent enters the battlefield, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)\nMosswort Bridge enters the battlefield tapped.\n{T}: Add {G}.\n{G}, {T}: You may play the exiled card without paying its mana cost if creatures you control have total power 10 or greater.

View File

@@ -4,7 +4,7 @@ Types:Land
K:Hideaway:4
K:CARDNAME enters the battlefield tapped.
A:AB$ Mana | Cost$ T | Produced$ U | SpellDescription$ Add {U}.
A:AB$ Play | Cost$ U T | Defined$ ExiledWith | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ LE20 | ForgetRemembered$ True | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if a library has twenty or fewer cards in it.
A:AB$ Play | Cost$ U T | Defined$ ExiledWith | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ LE20 | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if a library has twenty or fewer cards in it.
SVar:X:PlayerCountPlayers$LowestValidLibrary Card.YouOwn
AI:RemoveDeck:Random
Oracle:Hideaway 4 (When this permanent enters the battlefield, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)\nShelldock Isle enters the battlefield tapped.\n{T}: Add {U}.\n{U}, {T}: You may play the exiled card without paying its mana cost if a library has twenty or fewer cards in it.

View File

@@ -4,6 +4,6 @@ Types:Land
K:Hideaway:4
K:CARDNAME enters the battlefield tapped.
A:AB$ Mana | Cost$ T | Produced$ R | SpellDescription$ Add {R}.
A:AB$ Play | Cost$ R T | Defined$ ExiledWith | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE7 | ForgetRemembered$ True | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if an opponent was dealt 7 or more damage this turn.
A:AB$ Play | Cost$ R T | Defined$ ExiledWith | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE7 | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if an opponent was dealt 7 or more damage this turn.
SVar:X:Count$MaxOppDamageThisTurn
Oracle:Hideaway 4 (When this permanent enters the battlefield, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)\nSpinerock Knoll enters the battlefield tapped.\n{T}: Add {R}.\n{R}, {T}: You may play the exiled card without paying its mana cost if an opponent was dealt 7 or more damage this turn.

View File

@@ -4,6 +4,6 @@ Types:Land
K:Hideaway:4
K:CARDNAME enters the battlefield tapped.
A:AB$ Mana | Cost$ T | Produced$ W | SpellDescription$ Add {W}.
A:AB$ Play | Cost$ W T | Defined$ ExiledWith | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE3 | ForgetRemembered$ True | PlayerTurn$ True | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if you attacked with three or more creatures this turn.
A:AB$ Play | Cost$ W T | Defined$ ExiledWith | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE3 | PlayerTurn$ True | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if you attacked with three or more creatures this turn.
SVar:X:Count$AttackersDeclared
Oracle:Hideaway 4 (When this permanent enters the battlefield, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)\nWindbrisk Heights enters the battlefield tapped.\n{T}: Add {W}.\n{W}, {T}: You may play the exiled card without paying its mana cost if you attacked with three or more creatures this turn.

View File

@@ -68,10 +68,9 @@ public class HumanPlay {
FThreads.assertExecutedByEdt(false);
Card source = sa.getHostCard();
boolean isforetold = source.isForetold();
sa.setActivatingPlayer(p);
if (sa instanceof LandAbility) {
sa.setActivatingPlayer(p);
if (sa.canPlay()) {
sa.resolve();
p.getGame().updateLastStateForCard(source);
@@ -79,9 +78,8 @@ public class HumanPlay {
return false;
}
boolean isforetold = source.isForetold();
boolean castFaceDown = sa.isCastFaceDown();
sa.setActivatingPlayer(p);
boolean flippedToCast = sa.isSpell() && source.isFaceDown();
sa = chooseOptionalAdditionalCosts(p, sa);