made canPay calculate life when it's defined

This commit is contained in:
Maxmtg
2013-04-11 05:06:01 +00:00
parent 9f6d1f5247
commit 5fed7ec93a
2 changed files with 10 additions and 2 deletions

View File

@@ -73,8 +73,16 @@ public class CostPayLife extends CostPart {
*/
@Override
public final boolean canPay(final SpellAbility ability) {
final Integer amount = this.convertAmount();
Integer amount = this.convertAmount();
Player activator = ability.getActivatingPlayer();
if(amount == null) { // try to calculate when it's defined.
String sAmount = getAmount();
String sVar = ability.getSVar(sAmount);
if(!sVar.startsWith("XChoice")) {
amount = AbilityUtils.calculateAmount(ability.getSourceCard(), getAmount(), ability);
}
}
if ((amount != null) && !activator.canPayLife(amount)) {
return false;
}

View File

@@ -145,7 +145,7 @@ public enum VPlayers implements IVDoc<CPlayers> {
/** @param p0 {@link forge.game.player.Player} */
public void updatePlayerLabels(final Player p0) {
// No need to update if this panel isn't showing
if (!parentCell.getSelected().equals(this)) { return; }
if (!this.equals(parentCell.getSelected())) { return; }
final JLabel[] temp = this.infoLBLs.get(p0);
temp[1].setText("Life: " + String.valueOf(p0.getLife()) + " | Poison counters: "