mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Quenchable Fire - Fixed that the delayed triggered effect could not be removed by the special action.
This commit is contained in:
parent
002cd21809
commit
ad186480a3
3 changed files with 35 additions and 22 deletions
|
@ -29,6 +29,7 @@
|
|||
package mage.sets.conflux;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
|
@ -36,6 +37,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.SpecialAction;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.RemoveDelayedTriggeredAbilityEffect;
|
||||
|
@ -78,7 +80,8 @@ class QuenchableFireEffect extends OneShotEffect {
|
|||
|
||||
public QuenchableFireEffect() {
|
||||
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) {
|
||||
|
@ -92,23 +95,35 @@ class QuenchableFireEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
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
|
||||
QuenchableFireDelayedTriggeredAbility delayedAbility = new QuenchableFireDelayedTriggeredAbility();
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
delayedAbility.setSourceObject(sourceObject, game);
|
||||
delayedAbility.getTargets().addAll(source.getTargets());
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
|
||||
//create special action
|
||||
QuenchableFireSpecialAction newAction = new QuenchableFireSpecialAction(delayedAbility.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.setControllerId(source.getFirstTarget());
|
||||
newAction.getTargets().addAll(source.getTargets());
|
||||
game.getState().getSpecialActions().add(newAction);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -151,11 +166,8 @@ class QuenchableFireDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
|||
|
||||
class QuenchableFireSpecialAction extends SpecialAction {
|
||||
|
||||
public QuenchableFireSpecialAction(UUID effectId) {
|
||||
public QuenchableFireSpecialAction() {
|
||||
super();
|
||||
this.addCost(new ManaCostsImpl("{U}"));
|
||||
this.addEffect(new RemoveDelayedTriggeredAbilityEffect(effectId));
|
||||
this.addEffect(new RemoveSpecialActionEffect(this.getId()));
|
||||
}
|
||||
|
||||
public QuenchableFireSpecialAction(final QuenchableFireSpecialAction ability) {
|
||||
|
|
|
@ -253,7 +253,7 @@ public interface Game extends MageItem, Serializable {
|
|||
Card copyCard(Card cardToCopy, Ability source, UUID newController);
|
||||
|
||||
void addTriggeredAbility(TriggeredAbility ability);
|
||||
void addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility);
|
||||
UUID addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility);
|
||||
void applyEffects();
|
||||
boolean checkStateAndTriggered();
|
||||
void playPriority(UUID activePlayerId, boolean resuming);
|
||||
|
|
|
@ -1383,11 +1383,12 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility) {
|
||||
public UUID addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility) {
|
||||
DelayedTriggeredAbility newAbility = delayedAbility.copy();
|
||||
newAbility.newId();
|
||||
newAbility.init(this);
|
||||
state.addDelayedTriggeredAbility(newAbility);
|
||||
return newAbility.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue