- Fixed max hand size.

This commit is contained in:
Sloth
2012-11-28 12:52:27 +00:00
parent b7bfe6781e
commit 0019b72cc9
14 changed files with 40 additions and 17 deletions

View File

@@ -159,6 +159,9 @@ public class StaticEffects {
// modify players
for (final Player p : affectedPlayers) {
p.setUnlimitedHandSize(false);
p.setMaxHandSize(7);
if (params.containsKey("AddKeyword")) {
addKeywords = params.get("AddKeyword").split(" & ");
}

View File

@@ -285,12 +285,16 @@ public class StaticAbilityContinuous {
if (params.containsKey("SetMaxHandSize")) {
String mhs = params.get("SetMaxHandSize");
int max = mhs.matches("[0-9][0-9]?") ? Integer.parseInt(mhs)
: AbilityFactory.calculateAmount(hostCard, mhs, null);
p.setMaxHandSize(max);
if (mhs.equals("Unlimited")) {
p.setUnlimitedHandSize(true);
} else {
int max = mhs.matches("[0-9][0-9]?") ? Integer.parseInt(mhs)
: AbilityFactory.calculateAmount(hostCard, mhs, null);
p.setMaxHandSize(max);
}
}
if (params.containsKey("RaiseMaxHandSize") && p.getMaxHandSize() != -1) {
if (params.containsKey("RaiseMaxHandSize")) {
String rmhs = params.get("RaiseMaxHandSize");
int rmax = rmhs.matches("[0-9][0-9]?") ? Integer.parseInt(rmhs)
: AbilityFactory.calculateAmount(hostCard, rmhs, null);

View File

@@ -50,7 +50,7 @@ public class InputCleanup extends Input {
final int n = active.getCardsIn(ZoneType.Hand).size();
final int max = active.getMaxHandSize();
// goes to the next phase
if (n <= max || n <= 0) {
if (active.isUnlimitedHandSize() || n <= max || n <= 0) {
Singletons.getModel().getGame().getPhaseHandler().passPriority();
return;
}
@@ -84,7 +84,7 @@ public class InputCleanup extends Input {
public void aiCleanupDiscard(final Player ai) {
final int size = ai.getCardsIn(ZoneType.Hand).size();
if (ai.getMaxHandSize() != -1) {
if (!ai.isUnlimitedHandSize()) {
final int numDiscards = size - ai.getMaxHandSize();
ai.discard(numDiscards, null);
}

View File

@@ -20,7 +20,6 @@ import forge.CardPredicates;
import forge.CardUtil;
import forge.GameAction;
import forge.Singletons;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.trigger.TriggerHandler;
import forge.card.trigger.TriggerType;
import forge.control.input.InputControl;
@@ -34,7 +33,6 @@ import forge.game.player.Player;
import forge.game.zone.PlayerZone;
import forge.game.zone.ZoneType;
import forge.gui.match.views.VAntes;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.properties.ForgePreferences.FPref;
import forge.util.Aggregates;

View File

@@ -108,6 +108,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
/** The max hand size. */
private int maxHandSize = 7;
/** The unlimited hand size. */
private boolean unlimitedHandSize = false;
/** The last drawn card. */
private Card lastDrawnCard = null;
@@ -2520,6 +2523,21 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
maxHandSize = size;
}
/**
* @return the unlimitedHandSize
*/
public boolean isUnlimitedHandSize() {
return unlimitedHandSize;
}
/**
* @param unlimitedHandSize0 the unlimitedHandSize to set
*/
public void setUnlimitedHandSize(boolean unlimited) {
this.unlimitedHandSize = unlimited;
}
/**
* <p>
* Getter for the field <code>maxLandsToPlay</code>.

View File

@@ -325,7 +325,7 @@ public class VField implements IVDoc<CField> {
*/
public void updateZones(final Player p0) {
this.getLblHand().setText("" + p0.getZone(ZoneType.Hand).size());
final String handMaxToolTip = p0.getMaxHandSize() < 0
final String handMaxToolTip = p0.isUnlimitedHandSize()
? "no maximum hand size" : String.valueOf(p0.getMaxHandSize());
this.getLblHand().setToolTipText("Cards in hand (max: " + handMaxToolTip + ")");
this.getLblGraveyard().setText("" + p0.getZone(ZoneType.Graveyard).size());