try to fix crash in BoostPowerXSourceEffect

This commit is contained in:
Loki 2011-02-12 09:57:42 +02:00
parent d217d332b6
commit 76537b0c66

View file

@ -42,6 +42,7 @@ import mage.game.permanent.Permanent;
* @author BetaSteward_at_googlemail.com
*/
public class BoostPowerXSourceEffect extends ContinuousEffectImpl<BoostPowerXSourceEffect> {
private int amount = -1;
public BoostPowerXSourceEffect(Duration duration) {
super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
@ -58,7 +59,8 @@ public class BoostPowerXSourceEffect extends ContinuousEffectImpl<BoostPowerXSou
@Override
public boolean apply(Game game, Ability source) {
int amount = source.getCosts().getVariableCosts().get(0).getAmount();
if (amount < 0)
amount = source.getCosts().getVariableCosts().get(0).getAmount();
Permanent target = (Permanent) game.getPermanent(source.getSourceId());
if (target != null) {
target.addPower(amount);