mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
made canPay calculate life when it's defined
This commit is contained in:
@@ -73,8 +73,16 @@ public class CostPayLife extends CostPart {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final boolean canPay(final SpellAbility ability) {
|
public final boolean canPay(final SpellAbility ability) {
|
||||||
final Integer amount = this.convertAmount();
|
Integer amount = this.convertAmount();
|
||||||
Player activator = ability.getActivatingPlayer();
|
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)) {
|
if ((amount != null) && !activator.canPayLife(amount)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public enum VPlayers implements IVDoc<CPlayers> {
|
|||||||
/** @param p0 {@link forge.game.player.Player} */
|
/** @param p0 {@link forge.game.player.Player} */
|
||||||
public void updatePlayerLabels(final Player p0) {
|
public void updatePlayerLabels(final Player p0) {
|
||||||
// No need to update if this panel isn't showing
|
// 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);
|
final JLabel[] temp = this.infoLBLs.get(p0);
|
||||||
temp[1].setText("Life: " + String.valueOf(p0.getLife()) + " | Poison counters: "
|
temp[1].setText("Life: " + String.valueOf(p0.getLife()) + " | Poison counters: "
|
||||||
|
|||||||
Reference in New Issue
Block a user