Fixed variable cost not working in ActivateOncePerTurnActivatedAbility.

This commit is contained in:
magenoxx 2011-07-31 19:13:55 +04:00
parent 1ccaf403a6
commit 1181988fd4
2 changed files with 14 additions and 5 deletions

View file

@ -35,7 +35,9 @@ import mage.Constants.Zone;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.Costs; import mage.abilities.costs.Costs;
import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.costs.mana.PhyrexianManaCost; import mage.abilities.costs.mana.PhyrexianManaCost;
import mage.abilities.costs.mana.VariableManaCost;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.Effects; import mage.abilities.effects.Effects;
import mage.cards.Card; import mage.cards.Card;
@ -98,6 +100,8 @@ public abstract class ActivatedAbilityImpl<T extends ActivatedAbilityImpl<T>> ex
if (cost != null) { if (cost != null) {
if (cost instanceof PhyrexianManaCost) { if (cost instanceof PhyrexianManaCost) {
this.addManaCost((PhyrexianManaCost)cost); this.addManaCost((PhyrexianManaCost)cost);
} else if (cost instanceof ManaCostsImpl) {
this.addManaCost((ManaCostsImpl) cost);
} else { } else {
this.addCost(cost); this.addCost(cost);
} }

View file

@ -32,6 +32,8 @@ import java.util.UUID;
import mage.Constants.Zone; import mage.Constants.Zone;
import mage.abilities.ActivatedAbilityImpl; import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.game.Game; import mage.game.Game;
@ -51,11 +53,14 @@ public class ActivateOncePerTurnActivatedAbility extends ActivatedAbilityImpl<Ac
@Override @Override
public boolean canActivate(UUID playerId, Game game) { public boolean canActivate(UUID playerId, Game game) {
Boolean activated = (Boolean)game.getState().getValue(this.originalId.toString() + "activated"); if (super.canActivate(playerId, game)) {
if (activated == null) Boolean activated = (Boolean)game.getState().getValue(this.originalId.toString() + "activated");
return true; if (activated == null)
else return true;
return !activated; else
return !activated;
}
return false;
} }
@Override @Override