made max hand size changeable by continuous effect
parent
9c70b4e641
commit
04a81659fc
|
@ -57,6 +57,7 @@ public class MagicPlayer implements MagicTarget {
|
|||
private int preventDamage;
|
||||
private int extraTurns;
|
||||
private int drawnCards;
|
||||
private int maxHandSize;
|
||||
private final MagicCardList hand;
|
||||
private final MagicCardList library;
|
||||
private final MagicCardList graveyard;
|
||||
|
@ -98,6 +99,7 @@ public class MagicPlayer implements MagicTarget {
|
|||
preventDamage=sourcePlayer.preventDamage;
|
||||
extraTurns=sourcePlayer.extraTurns;
|
||||
drawnCards=sourcePlayer.drawnCards;
|
||||
maxHandSize=sourcePlayer.maxHandSize;
|
||||
hand=new MagicCardList(copyMap, sourcePlayer.hand);
|
||||
library=new MagicCardList(copyMap, sourcePlayer.library);
|
||||
graveyard=new MagicCardList(copyMap, sourcePlayer.graveyard);
|
||||
|
@ -135,6 +137,8 @@ public class MagicPlayer implements MagicTarget {
|
|||
stateFlags,
|
||||
preventDamage,
|
||||
extraTurns,
|
||||
drawnCards,
|
||||
maxHandSize,
|
||||
hand.getSortedCardsId(),
|
||||
library.getCardsId(),
|
||||
graveyard.getCardsId(),
|
||||
|
@ -238,6 +242,14 @@ public class MagicPlayer implements MagicTarget {
|
|||
return hand.size();
|
||||
}
|
||||
|
||||
public boolean handSizeExceedMax() {
|
||||
return getHandSize() > maxHandSize;
|
||||
}
|
||||
|
||||
public void noMaxHandSize() {
|
||||
maxHandSize = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public MagicCardList getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
@ -572,6 +584,7 @@ public class MagicPlayer implements MagicTarget {
|
|||
case Player:
|
||||
cachedAbilityFlags = MagicAbility.noneOf();
|
||||
stateFlags = 0;
|
||||
maxHandSize = 7;
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("No case for " + layer + " in MagicPlayer.apply");
|
||||
|
|
|
@ -34,7 +34,7 @@ public class MagicCleanupPhase extends MagicPhase {
|
|||
private static void nextTurn(final MagicGame game) {
|
||||
MagicPlayer turnPlayer=game.getTurnPlayer();
|
||||
// discard down to 7 cards
|
||||
if (turnPlayer.getHandSize() > 7) {
|
||||
if (turnPlayer.handSizeExceedMax()) {
|
||||
final int amount = turnPlayer.getHandSize() - 7;
|
||||
game.addEvent(new MagicDiscardEvent(MagicEvent.NO_SOURCE,turnPlayer,amount,false));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue