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
|
|
@ -718,6 +718,24 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return discardedCards;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cards discard(Cards cards, Ability source, Game game) {
|
||||
Cards discardedCards = new CardsImpl();
|
||||
for (Card card : cards.getCards(game)) {
|
||||
if (doDiscard(card, source, game, false)) {
|
||||
discardedCards.add(card);
|
||||
}
|
||||
}
|
||||
if (!discardedCards.isEmpty()) {
|
||||
UUID sourceId = source == null ? null : source.getSourceId();
|
||||
game.fireEvent(GameEvent.getEvent(
|
||||
GameEvent.EventType.DISCARDED_CARDS, sourceId,
|
||||
sourceId, playerId, discardedCards.size()
|
||||
));
|
||||
}
|
||||
return discardedCards;
|
||||
}
|
||||
|
||||
private Cards doDiscard(int amount, boolean random, Ability source, Game game) {
|
||||
Cards discardedCards = new CardsImpl();
|
||||
if (amount <= 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue