* Fix NPE

* TapsForMana Fix
This commit is contained in:
tool4ever
2023-04-05 23:51:40 +02:00
committed by GitHub
parent 8bd479dbf1
commit 2adff27044
6 changed files with 19 additions and 19 deletions

View File

@@ -245,7 +245,7 @@ public class ManaEffect extends SpellAbilityEffect {
producedMana.append(abMana.produceMana(mana, p, sa)); producedMana.append(abMana.produceMana(mana, p, sa));
} }
abMana.tapsForMana(sa, producedMana.toString()); abMana.tapsForMana(sa.getRootAbility(), producedMana.toString());
// Only clear express choice after mana has been produced // Only clear express choice after mana has been produced
abMana.clearExpressChoice(); abMana.clearExpressChoice();

View File

@@ -33,7 +33,7 @@ public class ManaReflectedEffect extends SpellAbilityEffect {
producedMana.append(ma.produceMana(generated, player, sa)); producedMana.append(ma.produceMana(generated, player, sa));
} }
ma.tapsForMana(sa, producedMana.toString()); ma.tapsForMana(sa.getRootAbility(), producedMana.toString());
} }
// *************** Utility Functions ********************** // *************** Utility Functions **********************

View File

@@ -989,6 +989,18 @@ public class CardProperty {
if (card.getTurnInZone() <= sourceController.getLastTurnNr()) { if (card.getTurnInZone() <= sourceController.getLastTurnNr()) {
return false; return false;
} }
} else if (property.startsWith("ThisTurnEnteredFrom")) {
final String restrictions = property.split("ThisTurnEnteredFrom_")[1];
final String[] res = restrictions.split("_");
final ZoneType origin = ZoneType.smartValueOf(res[0]);
if (card.getTurnInZone() != game.getPhaseHandler().getTurn()) {
return false;
}
if (!card.getZone().isCardAddedThisTurn(card, origin)) {
return false;
}
} else if (property.startsWith("ThisTurnEntered")) { } else if (property.startsWith("ThisTurnEntered")) {
// only check if it entered the Zone this turn // only check if it entered the Zone this turn
if (card.getTurnInZone() != game.getPhaseHandler().getTurn()) { if (card.getTurnInZone() != game.getPhaseHandler().getTurn()) {
@@ -1012,18 +1024,6 @@ public class CardProperty {
if (card.getTurnInZone() == game.getPhaseHandler().getTurn()) { if (card.getTurnInZone() == game.getPhaseHandler().getTurn()) {
return false; return false;
} }
} else if (property.startsWith("ThisTurnEnteredFrom")) {
final String restrictions = property.split("ThisTurnEnteredFrom_")[1];
final String[] res = restrictions.split("_");
final ZoneType origin = ZoneType.smartValueOf(res[0]);
if (card.getTurnInZone() != game.getPhaseHandler().getTurn()) {
return false;
}
if (!card.getZone().isCardAddedThisTurn(card, origin)) {
return false;
}
} else if (property.equals("DiscardedThisTurn")) { } else if (property.equals("DiscardedThisTurn")) {
if (card.getTurnInZone() != game.getPhaseHandler().getTurn()) { if (card.getTurnInZone() != game.getPhaseHandler().getTurn()) {
return false; return false;

View File

@@ -2,9 +2,9 @@ Name:Bridge from Below
ManaCost:B B B ManaCost:B B B
Types:Enchantment Types:Enchantment
A:SP$ PermanentNoncreature | Cost$ B B B | AILogic$ DontCast A:SP$ PermanentNoncreature | Cost$ B B B | AILogic$ DontCast
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.nonToken+YouOwn | Execute$ TrigToken | TriggerZones$ Graveyard | TriggerDescription$ Whenever a nontoken creature is put into your graveyard from the battlefield, if CARDNAME is in your graveyard, create a 2/2 black Zombie creature token. T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.nonToken+YouOwn | Execute$ TrigToken | IsPresent$ Card.StrictlySelf | PresentZone$ Graveyard | TriggerZones$ Graveyard | TriggerDescription$ Whenever a nontoken creature is put into your graveyard from the battlefield, if CARDNAME is in your graveyard, create a 2/2 black Zombie creature token.
SVar:TrigToken:DB$ Token | TokenAmount$ 1 | TokenScript$ b_2_2_zombie | TokenOwner$ You SVar:TrigToken:DB$ Token | TokenAmount$ 1 | TokenScript$ b_2_2_zombie | TokenOwner$ You
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | TriggerZones$ Graveyard | ValidCard$ Creature.OppOwn | Execute$ TrigChange | TriggerDescription$ When a creature is put into an opponent's graveyard from the battlefield, if CARDNAME is in your graveyard, exile CARDNAME. T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.OppOwn | Execute$ TrigChange | IsPresent$ Card.StrictlySelf | PresentZone$ Graveyard | TriggerZones$ Graveyard | TriggerDescription$ When a creature is put into an opponent's graveyard from the battlefield, if CARDNAME is in your graveyard, exile CARDNAME.
SVar:TrigChange:DB$ ChangeZone | Origin$ Graveyard | Destination$ Exile SVar:TrigChange:DB$ ChangeZone | Origin$ Graveyard | Destination$ Exile
AI:RemoveDeck:Random AI:RemoveDeck:Random
SVar:DiscardMe:5 SVar:DiscardMe:5

View File

@@ -2,7 +2,7 @@ Name:Genesis
ManaCost:4 G ManaCost:4 G
Types:Creature Incarnation Types:Creature Incarnation
PT:4/4 PT:4/4
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Graveyard | Execute$ TrigChange | TriggerDescription$ At the beginning of your upkeep, if CARDNAME is in your graveyard, you may pay {2}{G}. If you do, return target creature card from your graveyard to your hand. T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Graveyard | PresentZone$ Graveyard | IsPresent$ Card.StrictlySelf | Execute$ TrigChange | TriggerDescription$ At the beginning of your upkeep, if CARDNAME is in your graveyard, you may pay {2}{G}. If you do, return target creature card from your graveyard to your hand.
SVar:TrigChange:AB$ ChangeZone | Cost$ 2 G | Origin$ Graveyard | Destination$ Hand | ValidTgts$ Creature.YouCtrl SVar:TrigChange:AB$ ChangeZone | Cost$ 2 G | Origin$ Graveyard | Destination$ Hand | ValidTgts$ Creature.YouCtrl
SVar:DiscardMe:2 SVar:DiscardMe:2
Oracle:At the beginning of your upkeep, if Genesis is in your graveyard, you may pay {2}{G}. If you do, return target creature card from your graveyard to your hand. Oracle:At the beginning of your upkeep, if Genesis is in your graveyard, you may pay {2}{G}. If you do, return target creature card from your graveyard to your hand.

View File

@@ -2,6 +2,6 @@ Name:Thunderblade Charge
ManaCost:1 R R ManaCost:1 R R
Types:Sorcery Types:Sorcery
A:SP$ DealDamage | Cost$ 1 R R | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | NumDmg$ 3 | SpellDescription$ CARDNAME deals 3 damage to any target. A:SP$ DealDamage | Cost$ 1 R R | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | NumDmg$ 3 | SpellDescription$ CARDNAME deals 3 damage to any target.
T:Mode$ DamageDoneOnce | CombatDamage$ True | ValidSource$ Creature.YouCtrl | TriggerZones$ Graveyard | ValidTarget$ Player | Execute$ TrigPlay | TriggerDescription$ Whenever one or more creatures you control deal combat damage to a player, if CARDNAME is in your graveyard, you may pay {2}{R}{R}{R}. If you do, you may cast it without paying its mana cost. T:Mode$ DamageDoneOnce | CombatDamage$ True | ValidSource$ Creature.YouCtrl | ValidTarget$ Player | TriggerZones$ Graveyard | PresentZone$ Graveyard | IsPresent$ Card.StrictlySelf| Execute$ TrigPlay | TriggerDescription$ Whenever one or more creatures you control deal combat damage to a player, if CARDNAME is in your graveyard, you may pay {2}{R}{R}{R}. If you do, you may cast it without paying its mana cost.
SVar:TrigPlay:AB$ Play | Cost$ 2 R R R | ActivationZone$ Graveyard | WithoutManaCost$ True | Optional$ True SVar:TrigPlay:AB$ Play | Cost$ 2 R R R | WithoutManaCost$ True | Optional$ True
Oracle:Thunderblade Charge deals 3 damage to any target.\nWhenever one or more creatures you control deal combat damage to a player, if Thunderblade Charge is in your graveyard, you may pay {2}{R}{R}{R}. If you do, you may cast it without paying its mana cost. Oracle:Thunderblade Charge deals 3 damage to any target.\nWhenever one or more creatures you control deal combat damage to a player, if Thunderblade Charge is in your graveyard, you may pay {2}{R}{R}{R}. If you do, you may cast it without paying its mana cost.