mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Misfortune's Gain
implemented misfortune's gain
This commit is contained in:
parent
61e3166492
commit
f88876d137
1 changed files with 40 additions and 1 deletions
|
@ -28,13 +28,20 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
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.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author anonymous
|
||||
* @author Scott-Crawford
|
||||
*/
|
||||
public class MisfortunesGain extends CardImpl {
|
||||
|
||||
|
@ -43,6 +50,8 @@ public class MisfortunesGain extends CardImpl {
|
|||
|
||||
|
||||
// Destroy target creature. Its owner gains 4 life.
|
||||
this.getSpellAbility().addEffect(new PathOfPeaceEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
public MisfortunesGain(final MisfortunesGain card) {
|
||||
|
@ -54,3 +63,33 @@ public class MisfortunesGain extends CardImpl {
|
|||
return new MisfortunesGain(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MisfortunesGainEffect extends OneShotEffect {
|
||||
|
||||
public MisfortunesGainEffect() {
|
||||
super(Outcome.DestroyPermanent);
|
||||
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));
|
||||
if (controller != null && target != null) {
|
||||
target.destroy(source.getSourceId(), game, false);
|
||||
Player player = game.getPlayer(target.getOwnerId());
|
||||
player.gainLife(4, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue