mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* 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:
parent
1db5df220c
commit
5b34b46eac
18 changed files with 23 additions and 37 deletions
|
@ -58,8 +58,7 @@ public class DruidsRepository extends CardImpl {
|
|||
this.addAbility(new AttacksCreatureYourControlTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance())));
|
||||
|
||||
// Remove a charge counter from Druids' Repository: Add one mana of any color to your mana pool.
|
||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
|
||||
ability.addChoice(new ChoiceColor());
|
||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,6 @@ public class GoldToken extends Token {
|
|||
this.setOriginalExpansionSetCode("BNG");
|
||||
cardType.add(CardType.ARTIFACT);
|
||||
|
||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), new SacrificeSourceCost());
|
||||
ability.addChoice(new ChoiceColor());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), new SacrificeSourceCost()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,9 +55,7 @@ public class QuirionSentinel extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// When Quirion Sentinel enters the battlefield, add one mana of any color to your mana pool.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new AddManaOfAnyColorEffect());
|
||||
ability.addChoice(new ChoiceColor());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new AddManaOfAnyColorEffect()));
|
||||
}
|
||||
|
||||
public QuirionSentinel(final QuirionSentinel card) {
|
||||
|
|
|
@ -52,7 +52,6 @@ public class BlackLotus extends CardImpl {
|
|||
// {tap}, Sacrifice Black Lotus: Add three mana of any one color to your mana pool.
|
||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(3), new TapSourceCost());
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addChoice(new ChoiceColor());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ public class GildedLotus extends CardImpl {
|
|||
|
||||
// {tap}: Add three mana of any one color to your mana pool.
|
||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(3), new TapSourceCost());
|
||||
ability.addChoice(new ChoiceColor());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,8 +72,6 @@ class LionsEyeDiamondAbility extends ManaAbility {
|
|||
public LionsEyeDiamondAbility() {
|
||||
super(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(3), new SacrificeSourceCost());
|
||||
this.addCost(new DiscardHandCost());
|
||||
this.addChoice(new ChoiceColor());
|
||||
this.timing = TimingRule.INSTANT;
|
||||
}
|
||||
|
||||
public LionsEyeDiamondAbility(Zone zone, Mana mana, Cost cost) {
|
||||
|
|
|
@ -77,7 +77,6 @@ public class DeathriteShaman extends CardImpl {
|
|||
// {T}: Exile target land card from a graveyard. Add one mana of any color to your mana pool.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetEffect(), new TapSourceCost());
|
||||
ability.addEffect(new AddManaOfAnyColorEffect());
|
||||
ability.addChoice(new ChoiceColor());
|
||||
ability.addTarget(new TargetCardInGraveyard(new FilterLandCard("land card from a graveyard")));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ public class ManaBloom extends CardImpl {
|
|||
|
||||
// Remove a charge counter from Mana Bloom: Add one mana of any color to your mana pool. Activate this ability only once each turn.
|
||||
Ability ability = new ActivateOncePerTurnManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
|
||||
ability.addChoice(new ChoiceColor());
|
||||
this.addAbility(ability);
|
||||
|
||||
// At the beginning of your upkeep, if Mana Bloom has no charge counters on it, return it to its owner's hand.
|
||||
|
|
|
@ -79,7 +79,6 @@ public class MulDayaChannelers extends CardImpl {
|
|||
|
||||
// As long as the top card of your library is a land card, Mul Daya Channelers has "T: Add two mana of any one color to your mana pool."
|
||||
SimpleManaAbility manaAbility = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(2), new TapSourceCost());
|
||||
manaAbility.addChoice(new ChoiceColor());
|
||||
effect = new ConditionalContinousEffect(new GainAbilitySourceEffect(manaAbility, Duration.WhileOnBattlefield),
|
||||
new TopLibraryCardTypeCondition(TopLibraryCardTypeCondition.CheckType.LAND),
|
||||
"As long as the top card of your library is a land card, Mul Daya Channelers has \"{T}: Add two mana of any one color to your mana pool.\"");
|
||||
|
|
|
@ -96,7 +96,7 @@ class ReflectingPoolEffect extends ManaEffect {
|
|||
types.add(ability.getNetMana(game));
|
||||
}
|
||||
}
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Choice choice = new ChoiceImpl(false);
|
||||
choice.setMessage("Pick a mana color");
|
||||
if (types.getBlack() > 0) {
|
||||
choice.getChoices().add("Black");
|
||||
|
|
|
@ -58,7 +58,6 @@ public class LotusBloom extends CardImpl {
|
|||
// {tap}, Sacrifice Lotus Bloom: Add three mana of any one color to your mana pool.
|
||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(3), new TapSourceCost());
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addChoice(new ChoiceColor());
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
|
|
@ -83,7 +83,6 @@ class FertileGroundTriggeredAbility extends TriggeredManaAbility {
|
|||
|
||||
public FertileGroundTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect());
|
||||
this.addChoice(new ChoiceColor());
|
||||
}
|
||||
|
||||
public FertileGroundTriggeredAbility(FertileGroundTriggeredAbility ability) {
|
||||
|
|
|
@ -67,7 +67,6 @@ public class KhalniGem extends CardImpl {
|
|||
this.addAbility(etbAbility);
|
||||
// {tap}: Add two mana of any one color to your mana pool.
|
||||
SimpleManaAbility ability = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(2), new TapSourceCost());
|
||||
ability.addChoice(new ChoiceColor());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,9 +52,7 @@ public class LotusCobra extends CardImpl {
|
|||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
LandfallAbility ability = new LandfallAbility(new AddManaOfAnyColorEffect(), false);
|
||||
ability.addChoice(new ChoiceColor());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new LandfallAbility(new AddManaOfAnyColorEffect(), false));
|
||||
}
|
||||
|
||||
public LotusCobra(final LotusCobra card) {
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue