removed an unneeded parameter

This commit is contained in:
Maxmtg
2013-05-31 23:31:37 +00:00
parent e612c7f01a
commit ef6d584f0a
6 changed files with 27 additions and 23 deletions

View File

@@ -1115,7 +1115,7 @@ public class AbilityUtils {
} }
} else { } else {
// if it's paid by the AI already the human can pay, but it won't change anything // if it's paid by the AI already the human can pay, but it won't change anything
paid |= HumanPlay.payCostDuringAbilityResolve(ability, cost, sa, game); paid |= HumanPlay.payCostDuringAbilityResolve(ability, cost, sa);
} }
} }

View File

@@ -507,7 +507,7 @@ public class GameAction {
@Override @Override
public void resolve() { public void resolve() {
GameAction.this.moveToHand(recoverable);
} }
@Override @Override
@@ -531,19 +531,21 @@ public class GameAction {
@Override @Override
public void resolve() { public void resolve() {
Player p = recoverable.getController(); Player p = recoverable.getController();
boolean hasPaid = false;
if (p.isHuman()) { if (p.isHuman()) {
if ( HumanPlay.payCostDuringAbilityResolve(abRecover, abRecover.getPayCosts(), null, game) ) hasPaid = HumanPlay.payCostDuringAbilityResolve(abRecover, abRecover.getPayCosts(), null);
moveToHand(recoverable);
else
exile(recoverable);
} else { // computer } else { // computer
if (ComputerUtilCost.canPayCost(abRecover, p)) { if (ComputerUtilCost.canPayCost(abRecover, p)) {
ComputerUtil.playNoStack(p, abRecover, game); ComputerUtil.playNoStack(p, abRecover, game);
} else { hasPaid = true;
GameAction.this.exile(recoverable);
} }
} }
if (hasPaid)
moveToHand(recoverable);
else
exile(recoverable);
} }
}; };
recoverAbility.setStackDescription(sb.toString()); recoverAbility.setStackDescription(sb.toString());

View File

@@ -997,21 +997,23 @@ public class CombatUtil {
} }
} }
boolean hasPaid = attackCost.getTotalMana().isZero() && attackCost.isOnlyManaCost(); // true if needless to pay boolean needsToPay = !attackCost.getTotalMana().isZero() || !attackCost.isOnlyManaCost(); // true if needless to pay
if (!hasPaid) { boolean isPaid = !needsToPay;
if (needsToPay) {
final Ability ability = new AbilityStatic(c, attackCost, null) { @Override public void resolve() {} }; final Ability ability = new AbilityStatic(c, attackCost, null) { @Override public void resolve() {} };
ability.setActivatingPlayer(c.getController()); ability.setActivatingPlayer(c.getController());
if (c.getController().isHuman()) { if (c.getController().isHuman()) {
hasPaid = HumanPlay.payCostDuringAbilityResolve(ability, attackCost, null, game); isPaid = HumanPlay.payCostDuringAbilityResolve(ability, attackCost, null);
} else { // computer } else { // computer
if (ComputerUtilCost.canPayCost(ability, c.getController())) { if (ComputerUtilCost.canPayCost(ability, c.getController())) {
ComputerUtil.playNoStack(c.getController(), ability, game); ComputerUtil.playNoStack(c.getController(), ability, game);
hasPaid = true; isPaid = true;
} }
} }
} }
return hasPaid; return isPaid;
} }
/** /**

View File

@@ -181,7 +181,7 @@ public class PhaseUtil {
ability.setActivatingPlayer(blocker.getController()); ability.setActivatingPlayer(blocker.getController());
if (blocker.getController().isHuman()) { if (blocker.getController().isHuman()) {
hasPaid = HumanPlay.payCostDuringAbilityResolve(ability, blockCost, null, game); hasPaid = HumanPlay.payCostDuringAbilityResolve(ability, blockCost, null);
} else { // computer } else { // computer
if (ComputerUtilCost.canPayCost(ability, blocker.getController())) { if (ComputerUtilCost.canPayCost(ability, blocker.getController())) {
ComputerUtil.playNoStack(blocker.getController(), ability, game); ComputerUtil.playNoStack(blocker.getController(), ability, game);

View File

@@ -174,20 +174,20 @@ public class Upkeep extends Phase {
final Ability sacAbility = new Ability(c, ManaCost.ZERO) { final Ability sacAbility = new Ability(c, ManaCost.ZERO) {
@Override @Override
public void resolve() { public void resolve() {
boolean hasPaid = false;
Player controller = c.getController(); Player controller = c.getController();
if (controller.isHuman()) { if (controller.isHuman()) {
Cost cost = new Cost(c.getEchoCost().trim(), true); Cost cost = new Cost(c.getEchoCost().trim(), true);
if ( !HumanPlay.payCostDuringAbilityResolve(blankAbility, cost, null, game) ) hasPaid = HumanPlay.payCostDuringAbilityResolve(blankAbility, cost, null);
game.getAction().sacrifice(c, null);;
} else { // computer } else { // computer
if (ComputerUtilCost.canPayCost(blankAbility, controller)) { if (ComputerUtilCost.canPayCost(blankAbility, controller)) {
ComputerUtil.playNoStack(controller, blankAbility, game); ComputerUtil.playNoStack(controller, blankAbility, game);
} else { hasPaid = true;
game.getAction().sacrifice(c, null);
} }
} }
if (!hasPaid)
game.getAction().sacrifice(c, null);;
} }
}; };
sacAbility.setActivatingPlayer(c.getController()); sacAbility.setActivatingPlayer(c.getController());
@@ -279,7 +279,7 @@ public class Upkeep extends Phase {
@Override @Override
public void resolve() { public void resolve() {
if (controller.isHuman()) { if (controller.isHuman()) {
if ( !HumanPlay.payCostDuringAbilityResolve(blankAbility, blankAbility.getPayCosts(), this, game)) if ( !HumanPlay.payCostDuringAbilityResolve(blankAbility, blankAbility.getPayCosts(), this))
game.getAction().sacrifice(c, null); game.getAction().sacrifice(c, null);
} else { // computer } else { // computer
if (ComputerUtilCost.shouldPayCost(controller, c, upkeepCost) && ComputerUtilCost.canPayCost(blankAbility, controller)) { if (ComputerUtilCost.shouldPayCost(controller, c, upkeepCost) && ComputerUtilCost.canPayCost(blankAbility, controller)) {

View File

@@ -280,7 +280,7 @@ public class HumanPlay {
* a {@link forge.Command} object. * a {@link forge.Command} object.
* @param sourceAbility TODO * @param sourceAbility TODO
*/ */
public static boolean payCostDuringAbilityResolve(final SpellAbility ability, final Cost cost, SpellAbility sourceAbility, final Game game) { public static boolean payCostDuringAbilityResolve(final SpellAbility ability, final Cost cost, SpellAbility sourceAbility) {
// Only human player pays this way // Only human player pays this way
final Player p = ability.getActivatingPlayer(); final Player p = ability.getActivatingPlayer();