- Fixed Orim's Thunder.

This commit is contained in:
jeffwadsworth 2013-03-01 11:58:07 -06:00
parent b320da88d5
commit 6fabe1413b

View file

@ -28,11 +28,15 @@
package mage.sets.apocalypse; package mage.sets.apocalypse;
import java.util.UUID; import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Outcome; import mage.Constants.Outcome;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.condition.common.KickedCondition; import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.KickerAbility; import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -70,10 +74,22 @@ public class OrimsThunder extends CardImpl<OrimsThunder> {
// Destroy target artifact or enchantment. If Orim's Thunder was kicked, it deals damage equal to that permanent's converted mana cost to target creature. // Destroy target artifact or enchantment. If Orim's Thunder was kicked, it deals damage equal to that permanent's converted mana cost to target creature.
this.getSpellAbility().addEffect(new OrimsThunderEffect()); this.getSpellAbility().addEffect(new OrimsThunderEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter)); this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new OrimsThunderEffect2(),
KickedCondition.getInstance(),
"If Orim's Thunder was kicked, it deals damage equal to that permanent's converted mana cost to target creature"));
} }
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof SpellAbility) {
if (KickedCondition.getInstance().apply(game, ability)) {
ability.addTarget(new TargetCreaturePermanent());
}
}
}
public OrimsThunder(final OrimsThunder card) { public OrimsThunder(final OrimsThunder card) {
super(card); super(card);
} }
@ -84,11 +100,43 @@ public class OrimsThunder extends CardImpl<OrimsThunder> {
} }
} }
class OrimsThunderEffect2 extends OneShotEffect<OrimsThunderEffect2> {
OrimsThunderEffect2() {
super(Outcome.Damage);
}
OrimsThunderEffect2(final OrimsThunderEffect2 effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
int damage = 0;
MageObject firstTarget = game.getLastKnownInformation(source.getFirstTarget(), Constants.Zone.BATTLEFIELD);
Permanent secondTarget = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (firstTarget != null) {
damage = firstTarget.getManaCost().convertedManaCost();
}
boolean kicked = KickedCondition.getInstance().apply(game, source);
if (kicked && secondTarget != null) {
secondTarget.damage(damage, source.getId(), game, true, false);
return true;
}
return false;
}
@Override
public OrimsThunderEffect2 copy() {
return new OrimsThunderEffect2(this);
}
}
class OrimsThunderEffect extends OneShotEffect<OrimsThunderEffect> { class OrimsThunderEffect extends OneShotEffect<OrimsThunderEffect> {
OrimsThunderEffect() { OrimsThunderEffect() {
super(Outcome.DestroyPermanent); super(Outcome.DestroyPermanent);
staticText = "Destroy target artifact or enchantment. If Orim's Thunder was kicked, it deals damage equal to that permanent's converted mana cost to target creature"; staticText = "Destroy target artifact or enchantment";
} }
OrimsThunderEffect(final OrimsThunderEffect effect) { OrimsThunderEffect(final OrimsThunderEffect effect) {
@ -97,20 +145,11 @@ class OrimsThunderEffect extends OneShotEffect<OrimsThunderEffect> {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int damage = 0; Permanent target = game.getPermanent(source.getFirstTarget());
boolean successful = false; if (target != null) {
Permanent first = game.getPermanent(source.getFirstTarget()); return target.destroy(source.getId(), game, false);
Permanent second = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (first != null) {
damage = first.getManaCost().convertedManaCost();
first.destroy(source.getSourceId(), game, false);
successful = true;
} }
boolean kicked = KickedCondition.getInstance().apply(game, source); return false;
if (kicked && second != null && successful) {
second.damage(damage, id, game, true, false);
}
return successful;
} }
@Override @Override