* Some minor changes to Misfortune's Gain and Path of Peace.

This commit is contained in:
LevelX2 2017-05-04 10:26:34 +02:00
parent 418bf2f569
commit 2832cb9335
2 changed files with 26 additions and 24 deletions

View file

@ -33,8 +33,8 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.Game;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
@ -47,10 +47,9 @@ public class MisfortunesGain extends CardImpl {
public MisfortunesGain(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{W}");
// Destroy target creature. Its owner gains 4 life.
this.getSpellAbility().addEffect(new PathOfPeaceEffect());
this.getSpellAbility().addEffect(new MisfortunesGainEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
@ -65,30 +64,32 @@ public class MisfortunesGain extends CardImpl {
}
class MisfortunesGainEffect extends OneShotEffect {
public MisfortunesGainEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "Destroy target creature. Its owner gains 4 life.";
this.staticText = "Destroy target creature. Its owner gains 4 life";
}
public MisfortunesGainEffect(final MisfortunesGainEffect effect) {
super(effect);
}
@Override
public MisfortunesGainEffect copy() {
return new MisfortunesGainEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent target = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null && target != null) {
target.destroy(source.getSourceId(), game, false);
Player player = game.getPlayer(target.getOwnerId());
player.gainLife(4, game);
return true;
Player owner = game.getPlayer(target.getOwnerId());
if (owner != null) {
owner.gainLife(4, game);
}
return true;
}
return false;
}

View file

@ -33,8 +33,8 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.Game;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
@ -47,11 +47,10 @@ public class PathOfPeace extends CardImpl {
public PathOfPeace(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{W}");
// Destroy target creature. Its owner gains 4 life.
this.getSpellAbility().addEffect(new PathOfPeaceEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public PathOfPeace(final PathOfPeace card) {
@ -65,30 +64,32 @@ public class PathOfPeace extends CardImpl {
}
class PathOfPeaceEffect extends OneShotEffect {
public PathOfPeaceEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "Destroy target creature. Its owner gains 4 life.";
this.staticText = "Destroy target creature. Its owner gains 4 life";
}
public PathOfPeaceEffect(final PathOfPeaceEffect effect) {
super(effect);
}
@Override
public PathOfPeaceEffect copy() {
return new PathOfPeaceEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent target = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null && target != null) {
target.destroy(source.getSourceId(), game, false);
Player player = game.getPlayer(target.getOwnerId());
player.gainLife(4, game);
return true;
Player owner = game.getPlayer(target.getOwnerId());
if (owner != null) {
owner.gainLife(4, game);
}
return true;
}
return false;
}