mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Some clean up to discard handling.
This commit is contained in:
parent
3c98258e97
commit
a1928ce95a
1 changed files with 3 additions and 5 deletions
|
@ -560,7 +560,6 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
@Override
|
||||
public void discard(int amount, Ability source, Game game) {
|
||||
if (amount >= hand.size()) {
|
||||
int discardAmount = hand.size();
|
||||
while (hand.size() > 0) {
|
||||
discard(hand.get(hand.iterator().next(), game), source, game);
|
||||
}
|
||||
|
@ -574,7 +573,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
TargetDiscard target = new TargetDiscard(playerId);
|
||||
choose(Outcome.Discard, target, source.getSourceId(), game);
|
||||
Card card = hand.get(target.getFirstTarget(), game);
|
||||
if (card != null && discard(card, source, game)) {
|
||||
if (discard(card, source, game)) {
|
||||
numDiscarded++;
|
||||
}
|
||||
}
|
||||
|
@ -583,9 +582,8 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
@Override
|
||||
public boolean discard(Card card, Ability source, Game game) {
|
||||
//20100716 - 701.7
|
||||
if (card != null) {
|
||||
removeFromHand(card, game);
|
||||
card.moveToZone(Zone.GRAVEYARD, source==null?null:source.getId(), game, false);
|
||||
if (card != null
|
||||
&& card.moveToZone(Zone.GRAVEYARD, source==null?null:source.getSourceId(), game, false)) {
|
||||
game.informPlayers(new StringBuilder(name).append(" discards ").append(card.getName()).toString());
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARD, card.getId(), source==null?null:source.getId(), playerId));
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue