mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
Merge pull request #3014 from drmDev/bug/sphereCosts
fixes #3012 manaCosts not null check and way to retrieve it
This commit is contained in:
commit
1a9c5fa469
2 changed files with 163 additions and 7 deletions
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.abilities.effects;
|
||||
|
||||
import java.util.Iterator;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.Costs;
|
||||
|
|
@ -43,9 +44,6 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
|
@ -72,7 +70,6 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm
|
|||
|
||||
protected final Cost cost;
|
||||
protected final ManaCosts manaCosts;
|
||||
|
||||
protected final RestrictType restrictType;
|
||||
|
||||
public PayCostToAttackBlockEffectImpl(Duration duration, Outcome outcome, RestrictType restrictType) {
|
||||
|
|
@ -149,7 +146,9 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm
|
|||
attackBlockManaTax.clearPaid();
|
||||
if (attackBlockManaTax.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& player.chooseUse(Outcome.Neutral, chooseText, source, game)) {
|
||||
handlePhyrexianManaCosts(manaCosts, player, source, game);
|
||||
|
||||
handlePhyrexianManaCosts(getManaCostToPay(event, source, game), player, source, game);
|
||||
|
||||
if (attackBlockManaTax instanceof ManaCostsImpl) {
|
||||
if (attackBlockManaTax.payOrRollback(source, game, source.getSourceId(), event.getPlayerId())) {
|
||||
return false;
|
||||
|
|
@ -162,6 +161,9 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm
|
|||
}
|
||||
|
||||
private void handlePhyrexianManaCosts(ManaCosts<ManaCost> manaCosts, Player player, Ability source, Game game) {
|
||||
|
||||
if (manaCosts == null) return; // nothing to be done without any mana costs. prevents NRE from occurring here
|
||||
|
||||
Iterator<ManaCost> manaCostIterator = manaCosts.iterator();
|
||||
Costs<PayLifeCost> costs = new CostsImpl<>();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue