remove nullcheck as this happens in the method itself

This commit is contained in:
Ingmar Goudt 2019-07-09 22:30:40 +02:00
parent 34444f5616
commit 464e9c67c4
28 changed files with 123 additions and 180 deletions

View file

@ -40,9 +40,8 @@ public class DiscardSourceCost extends CostImpl {
Player player = game.getPlayer(controllerId);
if (player != null) {
Card card = player.getHand().get(sourceId, game);
if (card != null) {
paid = player.discard(card, null, game);
}
paid = player.discard(card, null, game);
}
return paid;
}

View file

@ -134,10 +134,8 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
if (controller.choose(Outcome.Benefit, revealedCards, target, game)) {
for (UUID targetId : target.getTargets()) {
Card card = revealedCards.get(targetId, game);
if (card != null) {
if (!player.discard(card, source, game)) {
result = false;
}
if (!player.discard(card, source, game)) {
result = false;
}
}
}

View file

@ -12,7 +12,6 @@ import mage.players.Player;
import mage.util.CardUtil;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class DiscardControllerEffect extends OneShotEffect {
@ -59,9 +58,8 @@ public class DiscardControllerEffect extends OneShotEffect {
int maxAmount = Math.min(amount.calculate(game, source, this), player.getHand().size());
for (int i = 0; i < maxAmount; i++) {
Card card = player.getHand().getRandom(game);
if (card != null) {
result |= player.discard(card, source, game);
}
result |= player.discard(card, source, game);
}
} else {
player.discard(amount.calculate(game, source, this), false, source, game);

View file

@ -1,7 +1,5 @@
package mage.abilities.effects.common.discard;
import java.util.HashMap;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.dynamicvalue.DynamicValue;
@ -19,6 +17,9 @@ import mage.target.Target;
import mage.target.common.TargetDiscard;
import mage.util.CardUtil;
import java.util.HashMap;
import java.util.UUID;
public class DiscardEachPlayerEffect extends OneShotEffect {
protected DynamicValue amount;
@ -102,9 +103,8 @@ public class DiscardEachPlayerEffect extends OneShotEffect {
if (cardsPlayer != null) {
for (UUID cardId : cardsPlayer) {
Card card = game.getCard(cardId);
if (card != null) {
player.discard(card, source, game);
}
player.discard(card, source, game);
}
}
}