* Molten Disaster - Fixed that Split Second ability did not work.

This commit is contained in:
LevelX2 2014-12-09 17:24:26 +01:00
parent 4e66dc56a8
commit cbdb5e2bc6
2 changed files with 35 additions and 18 deletions

View file

@ -29,14 +29,13 @@ package mage.sets.modernmasters;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.KickedCondition; 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.OneShotEffect;
import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.KickerAbility; import mage.abilities.keyword.KickerAbility;
import mage.abilities.keyword.SplitSecondAbility; import mage.abilities.mana.ManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
@ -64,7 +63,7 @@ public class MoltenDisaster extends CardImpl {
this.color.setRed(true); this.color.setRed(true);
// If Molten Disaster was kicked, it has split second. // 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); ability.setRuleAtTheTop(true);
this.addAbility(ability); this.addAbility(ability);
// Kicker {R} // Kicker {R}
@ -83,32 +82,48 @@ public class MoltenDisaster extends CardImpl {
} }
} }
class MoltenDisasterTriggeredAbility extends TriggeredAbilityImpl { class MoltenDisasterSplitSecondEffect extends ContinuousRuleModifiyingEffectImpl {
public MoltenDisasterTriggeredAbility() { MoltenDisasterSplitSecondEffect() {
super(Zone.HAND, new GainAbilitySourceEffect(new SplitSecondAbility(), Duration.WhileOnStack), false); super(Duration.WhileOnStack, Outcome.Detriment);
staticText ="If {this} was kicked, it has split second <i>(As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)</i>";
} }
public MoltenDisasterTriggeredAbility(final MoltenDisasterTriggeredAbility ability) { MoltenDisasterSplitSecondEffect(final MoltenDisasterSplitSecondEffect effect) {
super(ability); super(effect);
} }
@Override @Override
public MoltenDisasterTriggeredAbility copy() { public String getInfoMessage(Ability source, GameEvent event, Game game) {
return new MoltenDisasterTriggeredAbility(this); return "You can't cast spells or activate abilities that aren't mana abilities (Split second).";
} }
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.CAST_SPELL) && event.getSourceId().equals(this.getSourceId())) { if (event.getType() == GameEvent.EventType.CAST_SPELL) {
return true; 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; return false;
} }
@Override @Override
public String getRule() { public boolean apply(Game game, Ability source) {
return "If {this} was kicked, it has split second <i>(As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)</i>"; return false;
}
@Override
public MoltenDisasterSplitSecondEffect copy() {
return new MoltenDisasterSplitSecondEffect(this);
} }
} }
@ -149,4 +164,4 @@ class MoltenDisasterEffect extends OneShotEffect {
return true; return true;
} }
} }

View file

@ -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 { class SplitSecondEffect extends ContinuousRuleModifiyingEffectImpl {
SplitSecondEffect() { SplitSecondEffect() {