[FIX] Fixes issue 310.

This commit is contained in:
maurer.it 2011-10-22 10:48:51 -04:00
parent adb495f33a
commit ffadc3be45

View file

@ -30,6 +30,8 @@ package mage.abilities.effects.common;
import java.util.UUID; import java.util.UUID;
import mage.Constants; import mage.Constants;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
@ -39,16 +41,21 @@ import mage.players.Player;
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class DamagePlayersEffect extends OneShotEffect<DamagePlayersEffect> { public class DamagePlayersEffect extends OneShotEffect<DamagePlayersEffect> {
private int amount; private DynamicValue amount;
public DamagePlayersEffect(int amount) { public DamagePlayersEffect(int amount) {
super(Constants.Outcome.Damage); this(Constants.Outcome.Damage, new StaticValue(amount));
}
public DamagePlayersEffect(Constants.Outcome outcome, DynamicValue amount) {
super(outcome);
this.amount = amount; this.amount = amount;
staticText = "{source} deals " + amount + " damage to each player"; staticText = "{source} deals " + amount + " damage to each player";
} }
public DamagePlayersEffect(final DamagePlayersEffect effect) { public DamagePlayersEffect(final DamagePlayersEffect effect) {
super(effect); super(effect);
this.amount = effect.amount;
} }
@Override @Override
@ -56,7 +63,7 @@ public class DamagePlayersEffect extends OneShotEffect<DamagePlayersEffect> {
for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) { for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
if (player != null) if (player != null)
player.damage(amount, source.getId(), game, false, true); player.damage(amount.calculate(game, source), source.getId(), game, false, true);
} }
return true; return true;
} }