* Mana Effects - Started to move choices to resolving. Allowed to cancel choices of some mana effects to cancel the mana ability activation.

This commit is contained in:
LevelX2 2014-09-06 16:22:45 +02:00
parent 1db5df220c
commit 5b34b46eac
18 changed files with 23 additions and 37 deletions

View file

@ -155,14 +155,16 @@ public abstract class AbilityImpl implements Ability {
boolean effectResult = effect.apply(game, this);
result &= effectResult;
if (logger.isDebugEnabled()) {
if (!effectResult) {
if (this.getSourceId() != null) {
MageObject mageObject = game.getObject(this.getSourceId());
if (mageObject != null) {
logger.debug("AbilityImpl.resolve: object: " + mageObject.getName());
if (!this.getAbilityType().equals(AbilityType.MANA)) {
if (!effectResult) {
if (this.getSourceId() != null) {
MageObject mageObject = game.getObject(this.getSourceId());
if (mageObject != null) {
logger.debug("AbilityImpl.resolve: object: " + mageObject.getName());
}
}
logger.debug("AbilityImpl.resolve: effect returned false -" + effect.getText(this.getModes().getMode()));
}
logger.debug("AbilityImpl.resolve: effect returned false -" + effect.getText(this.getModes().getMode()));
}
}
}

View file

@ -30,7 +30,6 @@ package mage.abilities.mana;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.choices.ChoiceColor;
import mage.constants.Zone;
public class AnyColorManaAbility extends ManaAbility {
@ -40,7 +39,6 @@ public class AnyColorManaAbility extends ManaAbility {
public AnyColorManaAbility(Cost cost) {
super(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), cost);
this.addChoice(new ChoiceColor());
this.netMana.setAny(1);
}

View file

@ -37,7 +37,11 @@ import mage.ObjectColor;
public class ChoiceColor extends ChoiceImpl {
public ChoiceColor() {
super(true);
this(true);
}
public ChoiceColor(boolean required) {
super(required);
this.choices.add("Black");
this.choices.add("Blue");
this.choices.add("Green");

View file

@ -853,13 +853,12 @@ public abstract class PlayerImpl implements Player, Serializable {
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATE_ABILITY, ability.getId(), ability.getSourceId(), playerId))) {
int bookmark = game.bookmarkState();
if (ability.activate(game, false)) {
ability.resolve(game);
// #169
if (storedBookmark == -1 || storedBookmark > bookmark) { // e.g. userfull for undo Nykthos, Shrine to Nyx
setStoredBookmark(bookmark);
if (ability.resolve(game)) {
if (storedBookmark == -1 || storedBookmark > bookmark) { // e.g. usefull for undo Nykthos, Shrine to Nyx
setStoredBookmark(bookmark);
}
return true;
}
//game.removeBookmark(bookmark);
return true;
}
game.restoreState(bookmark);
}