Fixed PayEnergyCost.pay to check counters amount available.

This commit is contained in:
LevelX2 2016-09-16 22:29:59 +02:00
parent aa661e6ac3
commit 18e771ccd5

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.costs.common;
import java.util.UUID;
@ -63,7 +62,7 @@ public class PayEnergyCost extends CostImpl {
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
Player player = game.getPlayer(controllerId);
if (player != null) {
if (player != null && player.getCounters().getCount(CounterType.ENERGY) >= amount) {
player.getCounters().removeCounter(CounterType.ENERGY, amount);
paid = true;
}