Added new method for discarding cards to handle batch triggers (ready for review) (#6489)

* added new discard method

* started refactoring to use new discard method

* refactored A through I

* fixed some issues

* separated balance effect into its own class

* refactored J through R

* refactored S through Z

* applied requested changes
This commit is contained in:
Evan Kranzler 2020-05-03 14:35:26 -04:00 committed by GitHub
parent 2739391b1d
commit 75577cdbe9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 1290 additions and 1953 deletions

View file

@ -1,27 +1,23 @@
package mage.abilities.costs.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.cards.Card;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class DiscardHandCost extends CostImpl {
public DiscardHandCost() {
}
public DiscardHandCost(final DiscardHandCost cost) {
private DiscardHandCost(final DiscardHandCost cost) {
super(cost);
}
@ -38,12 +34,11 @@ public class DiscardHandCost extends CostImpl {
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
Player player = game.getPlayer(controllerId);
if (player != null) {
for (Card card : player.getHand().getCards(game)) {
player.discard(card, ability, game);
}
paid = true;
if (player == null) {
return paid;
}
player.discard(player.getHand(), ability, game);
paid = true;
return paid;
}