Added card "Betray" and its abilities and effects

This commit is contained in:
Daniel Eberhard 2022-12-14 12:28:59 +01:00
parent 44370eac08
commit 43075f7088
2 changed files with 67 additions and 2 deletions

View file

@ -20,6 +20,9 @@ import mage.target.common.TargetPlayerOrPlaneswalker;
import java.util.Set;
import java.util.UUID;
/**
* @author Merlingilb
*/
public class BenSolo extends CardImpl {
public BenSolo(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R/W}{W}");
@ -36,7 +39,7 @@ public class BenSolo extends CardImpl {
this.addAbility(new BenSoloTriggeredAbility());
}
public BenSolo(CardImpl card) {
public BenSolo(final BenSolo card) {
super(card);
}

View file

@ -1,4 +1,66 @@
package mage.cards.b;
public class Betray {
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author Merlingilb
*/
public class Betray extends CardImpl {
public Betray(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
//Target creature an opponent controls deals damage to its controller equal to that creature's power.
this.getSpellAbility().addEffect(new BetrayEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(1, 1,
StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE, false));
}
public Betray(final Betray card) {
super(card);
}
@Override
public Card copy() {
return new Betray(this);
}
}
class BetrayEffect extends OneShotEffect {
BetrayEffect() {
super(Outcome.Benefit);
staticText = "Target creature an opponent controls deals damage to its controller equal to that creature's power.";
}
private BetrayEffect(final BetrayEffect effect) {
super(effect);
}
@Override
public BetrayEffect copy() {
return new BetrayEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
Player player = game.getPlayer(permanent.getControllerId());
return player.damage(permanent.getPower().getValue(), permanent.getId(), source, game) > 0;
}
}