mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 20:29:19 -08: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,22 +95,34 @@ class QuenchableFireEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
//create delayed triggered ability
|
||||
QuenchableFireDelayedTriggeredAbility delayedAbility = new QuenchableFireDelayedTriggeredAbility();
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
delayedAbility.getTargets().addAll(source.getTargets());
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (sourceObject != null) {
|
||||
|
||||
//create special action
|
||||
QuenchableFireSpecialAction newAction = new QuenchableFireSpecialAction();
|
||||
|
||||
//create special action
|
||||
QuenchableFireSpecialAction newAction = new QuenchableFireSpecialAction(delayedAbility.getId());
|
||||
delayedAbility.setSpecialActionId(newAction.getId());
|
||||
newAction.setSourceId(source.getSourceId());
|
||||
newAction.setControllerId(source.getFirstTarget());
|
||||
newAction.getTargets().addAll(source.getTargets());
|
||||
game.getState().getSpecialActions().add(newAction);
|
||||
return true;
|
||||
//create delayed triggered ability
|
||||
QuenchableFireDelayedTriggeredAbility delayedAbility = new QuenchableFireDelayedTriggeredAbility();
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(sourceObject, game);
|
||||
delayedAbility.getTargets().addAll(source.getTargets());
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue