* Quenchable Fire - Fixed that the delayed triggered effect could not be removed by the special action.

This commit is contained in:
LevelX2 2015-06-13 00:18:32 +02:00
parent 002cd21809
commit ad186480a3
3 changed files with 35 additions and 22 deletions

View file

@ -29,6 +29,7 @@
package mage.sets.conflux; package mage.sets.conflux;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
@ -36,6 +37,7 @@ import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility; import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.SpecialAction; import mage.abilities.SpecialAction;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.RemoveDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.RemoveDelayedTriggeredAbilityEffect;
@ -78,7 +80,8 @@ class QuenchableFireEffect extends OneShotEffect {
public QuenchableFireEffect() { public QuenchableFireEffect() {
super(Outcome.Damage); super(Outcome.Damage);
staticText = "{this} deals an additional 3 damage to that player at the beginning of your next upkeep step unless he or she pays {U} before that step"; staticText = "{this} deals an additional 3 damage to that player at the beginning of your next upkeep step unless he or she pays {U} before that step."
+ "<br><i>Use the Special button to pay the {U} with a special action before the beginning of your next upkeep step.</i>";
} }
public QuenchableFireEffect(final QuenchableFireEffect effect) { public QuenchableFireEffect(final QuenchableFireEffect effect) {
@ -92,23 +95,35 @@ class QuenchableFireEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
MageObject sourceObject = source.getSourceObject(game);
if (sourceObject != null) {
//create special action
QuenchableFireSpecialAction newAction = new QuenchableFireSpecialAction();
//create delayed triggered ability //create delayed triggered ability
QuenchableFireDelayedTriggeredAbility delayedAbility = new QuenchableFireDelayedTriggeredAbility(); QuenchableFireDelayedTriggeredAbility delayedAbility = new QuenchableFireDelayedTriggeredAbility();
delayedAbility.setSourceId(source.getSourceId()); delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId()); delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game); delayedAbility.setSourceObject(sourceObject, game);
delayedAbility.getTargets().addAll(source.getTargets()); delayedAbility.getTargets().addAll(source.getTargets());
game.addDelayedTriggeredAbility(delayedAbility);
//create special action
QuenchableFireSpecialAction newAction = new QuenchableFireSpecialAction(delayedAbility.getId());
delayedAbility.setSpecialActionId(newAction.getId()); delayedAbility.setSpecialActionId(newAction.getId());
UUID delayedAbilityId = game.addDelayedTriggeredAbility(delayedAbility);
// update special action
newAction.addCost(new ManaCostsImpl("{U}"));
Effect effect = new RemoveDelayedTriggeredAbilityEffect(delayedAbilityId);
newAction.addEffect(effect);
effect.setText(sourceObject.getIdName() + " - Pay {U} to remove the triggered ability that deals 3 damage to you at the beginning of your next upkeep step");
newAction.addEffect(new RemoveSpecialActionEffect(newAction.getId()));
newAction.setSourceId(source.getSourceId()); newAction.setSourceId(source.getSourceId());
newAction.setControllerId(source.getFirstTarget()); newAction.setControllerId(source.getFirstTarget());
newAction.getTargets().addAll(source.getTargets()); newAction.getTargets().addAll(source.getTargets());
game.getState().getSpecialActions().add(newAction); game.getState().getSpecialActions().add(newAction);
return true; return true;
} }
return false;
}
} }
@ -151,11 +166,8 @@ class QuenchableFireDelayedTriggeredAbility extends DelayedTriggeredAbility {
class QuenchableFireSpecialAction extends SpecialAction { class QuenchableFireSpecialAction extends SpecialAction {
public QuenchableFireSpecialAction(UUID effectId) { public QuenchableFireSpecialAction() {
super(); super();
this.addCost(new ManaCostsImpl("{U}"));
this.addEffect(new RemoveDelayedTriggeredAbilityEffect(effectId));
this.addEffect(new RemoveSpecialActionEffect(this.getId()));
} }
public QuenchableFireSpecialAction(final QuenchableFireSpecialAction ability) { public QuenchableFireSpecialAction(final QuenchableFireSpecialAction ability) {

View file

@ -253,7 +253,7 @@ public interface Game extends MageItem, Serializable {
Card copyCard(Card cardToCopy, Ability source, UUID newController); Card copyCard(Card cardToCopy, Ability source, UUID newController);
void addTriggeredAbility(TriggeredAbility ability); void addTriggeredAbility(TriggeredAbility ability);
void addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility); UUID addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility);
void applyEffects(); void applyEffects();
boolean checkStateAndTriggered(); boolean checkStateAndTriggered();
void playPriority(UUID activePlayerId, boolean resuming); void playPriority(UUID activePlayerId, boolean resuming);

View file

@ -1383,11 +1383,12 @@ public abstract class GameImpl implements Game, Serializable {
} }
@Override @Override
public void addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility) { public UUID addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility) {
DelayedTriggeredAbility newAbility = delayedAbility.copy(); DelayedTriggeredAbility newAbility = delayedAbility.copy();
newAbility.newId(); newAbility.newId();
newAbility.init(this); newAbility.init(this);
state.addDelayedTriggeredAbility(newAbility); state.addDelayedTriggeredAbility(newAbility);
return newAbility.getId();
} }
/** /**