forked from External/mage
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:
parent
2739391b1d
commit
75577cdbe9
68 changed files with 1290 additions and 1953 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue