From cbdb5e2bc6086178a5f839c46b62576275043290 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 9 Dec 2014 17:24:26 +0100 Subject: [PATCH] * Molten Disaster - Fixed that Split Second ability did not work. --- .../sets/modernmasters/MoltenDisaster.java | 51 ++++++++++++------- .../abilities/keyword/SplitSecondAbility.java | 2 + 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/Mage.Sets/src/mage/sets/modernmasters/MoltenDisaster.java b/Mage.Sets/src/mage/sets/modernmasters/MoltenDisaster.java index 0487ca2946..b7361bf9a9 100644 --- a/Mage.Sets/src/mage/sets/modernmasters/MoltenDisaster.java +++ b/Mage.Sets/src/mage/sets/modernmasters/MoltenDisaster.java @@ -29,14 +29,13 @@ package mage.sets.modernmasters; import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.KickedCondition; -import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.continious.GainAbilitySourceEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.KickerAbility; -import mage.abilities.keyword.SplitSecondAbility; +import mage.abilities.mana.ManaAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; @@ -64,7 +63,7 @@ public class MoltenDisaster extends CardImpl { this.color.setRed(true); // If Molten Disaster was kicked, it has split second. - Ability ability = new ConditionalTriggeredAbility(new MoltenDisasterTriggeredAbility(), KickedCondition.getInstance(), ""); + Ability ability = new SimpleStaticAbility(Zone.STACK, new MoltenDisasterSplitSecondEffect()); ability.setRuleAtTheTop(true); this.addAbility(ability); // Kicker {R} @@ -83,32 +82,48 @@ public class MoltenDisaster extends CardImpl { } } -class MoltenDisasterTriggeredAbility extends TriggeredAbilityImpl { +class MoltenDisasterSplitSecondEffect extends ContinuousRuleModifiyingEffectImpl { - public MoltenDisasterTriggeredAbility() { - super(Zone.HAND, new GainAbilitySourceEffect(new SplitSecondAbility(), Duration.WhileOnStack), false); + MoltenDisasterSplitSecondEffect() { + super(Duration.WhileOnStack, Outcome.Detriment); + staticText ="If {this} was kicked, it has split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)"; } - public MoltenDisasterTriggeredAbility(final MoltenDisasterTriggeredAbility ability) { - super(ability); + MoltenDisasterSplitSecondEffect(final MoltenDisasterSplitSecondEffect effect) { + super(effect); } @Override - public MoltenDisasterTriggeredAbility copy() { - return new MoltenDisasterTriggeredAbility(this); + public String getInfoMessage(Ability source, GameEvent event, Game game) { + return "You can't cast spells or activate abilities that aren't mana abilities (Split second)."; } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.CAST_SPELL) && event.getSourceId().equals(this.getSourceId())) { - return true; + public boolean applies(GameEvent event, Ability source, Game game) { + if (event.getType() == GameEvent.EventType.CAST_SPELL) { + if (KickedCondition.getInstance().apply(game, source)) { + return true; + } + } + if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) { + Ability ability = game.getAbility(event.getTargetId(), event.getSourceId()); + if (ability != null && !(ability instanceof ManaAbility)) { + if (KickedCondition.getInstance().apply(game, source)) { + return true; + } + } } return false; } @Override - public String getRule() { - return "If {this} was kicked, it has split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)"; + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public MoltenDisasterSplitSecondEffect copy() { + return new MoltenDisasterSplitSecondEffect(this); } } @@ -149,4 +164,4 @@ class MoltenDisasterEffect extends OneShotEffect { return true; } -} \ No newline at end of file +} diff --git a/Mage/src/mage/abilities/keyword/SplitSecondAbility.java b/Mage/src/mage/abilities/keyword/SplitSecondAbility.java index b80939aadc..8e583142db 100644 --- a/Mage/src/mage/abilities/keyword/SplitSecondAbility.java +++ b/Mage/src/mage/abilities/keyword/SplitSecondAbility.java @@ -38,6 +38,8 @@ public class SplitSecondAbility extends SimpleStaticAbility { } } +// Molten Disaster has a copy of this effect in it's class, so in case this effect has to be changed check also there + class SplitSecondEffect extends ContinuousRuleModifiyingEffectImpl { SplitSecondEffect() {