PlayerImpl fix

This commit is contained in:
magenoxx 2011-02-12 11:46:20 +03:00
parent 76537b0c66
commit 4b2a9cd203
8 changed files with 53 additions and 35 deletions

View file

@ -33,10 +33,13 @@ import mage.Constants.Layer;
import mage.Constants.Outcome;
import mage.Constants.SubLayer;
import mage.abilities.Ability;
import mage.abilities.costs.VariableCost;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.List;
/**
*
* @author BetaSteward_at_googlemail.com
@ -50,6 +53,7 @@ public class BoostPowerXSourceEffect extends ContinuousEffectImpl<BoostPowerXSou
public BoostPowerXSourceEffect(final BoostPowerXSourceEffect effect) {
super(effect);
this.amount = effect.amount;
}
@Override
@ -59,8 +63,15 @@ public class BoostPowerXSourceEffect extends ContinuousEffectImpl<BoostPowerXSou
@Override
public boolean apply(Game game, Ability source) {
if (amount < 0)
amount = source.getCosts().getVariableCosts().get(0).getAmount();
if (amount < 0) {
List<VariableCost> varCost = source.getCosts().getVariableCosts();
if (varCost.size() > 0) {
amount = varCost.get(0).getAmount();
} else {
amount = 0;
return false;
}
}
Permanent target = (Permanent) game.getPermanent(source.getSourceId());
if (target != null) {
target.addPower(amount);

View file

@ -962,7 +962,9 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
for (UUID targetId: option.getTargets().getUnchosen().get(targetNum).possibleTargets(option.getSourceId(), playerId, game)) {
Ability newOption = option.copy();
newOption.getTargets().get(targetNum).addTarget(targetId, option, game);
if (targetNum < option.getTargets().size() - 1) {
if (targetNum < option.getTargets().size() - 2) {
//addTargetOptions(options, newOption, targetNum + 1, game);
// ayrat: bug fix
addTargetOptions(options, newOption, targetNum + 1, game);
}
else {