mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Created LoseHalfLifeTargetEffect, DiscardedByOpponentTrigger and made some refactors
This commit is contained in:
parent
a5b2c9f8c0
commit
cff83aefb1
12 changed files with 205 additions and 457 deletions
|
@ -29,21 +29,16 @@ package mage.cards.e;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.LoseHalfLifeEffect;
|
||||
import mage.abilities.effects.common.LoseHalfLifeTargetEffect;
|
||||
import mage.abilities.keyword.MorphAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -52,7 +47,7 @@ import mage.players.Player;
|
|||
public class EbonbladeReaper extends CardImpl {
|
||||
|
||||
public EbonbladeReaper(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
|
||||
this.subtype.add("Human");
|
||||
this.subtype.add("Cleric");
|
||||
|
||||
|
@ -63,7 +58,7 @@ public class EbonbladeReaper extends CardImpl {
|
|||
this.addAbility(new AttacksTriggeredAbility(new LoseHalfLifeEffect(), false));
|
||||
|
||||
//Whenever Ebonblade Reaper deals combat damage to a player, that player loses half his or her life, rounded up.
|
||||
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new EbonbladeReaperEffect(), false, true));
|
||||
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new LoseHalfLifeTargetEffect(), false, true));
|
||||
|
||||
//Morph {3}{B}{B}
|
||||
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{3}{B}{B}")));
|
||||
|
@ -78,33 +73,3 @@ public class EbonbladeReaper extends CardImpl {
|
|||
return new EbonbladeReaper(this);
|
||||
}
|
||||
}
|
||||
|
||||
class EbonbladeReaperEffect extends OneShotEffect {
|
||||
|
||||
public EbonbladeReaperEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "that player loses half his or her life, rounded up";
|
||||
}
|
||||
|
||||
public EbonbladeReaperEffect(final EbonbladeReaperEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect copy() {
|
||||
return new EbonbladeReaperEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (player != null) {
|
||||
Integer amount = (int) Math.ceil(player.getLife() / 2f);
|
||||
if (amount > 0) {
|
||||
player.loseLife(amount, game, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,16 +28,12 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiscardedByOpponentTrigger;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
|
||||
/**
|
||||
|
@ -47,13 +43,16 @@ import mage.target.common.TargetCreatureOrPlayer;
|
|||
public class GuerrillaTactics extends CardImpl {
|
||||
|
||||
public GuerrillaTactics(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}");
|
||||
|
||||
// Guerrilla Tactics deals 2 damage to target creature or player.
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(2));
|
||||
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
|
||||
|
||||
// When a spell or ability an opponent controls causes you to discard Guerrilla Tactics, Guerrilla Tactics deals 4 damage to target creature or player.
|
||||
this.addAbility(new GuerrillaTacticsTriggeredAbility());
|
||||
Ability ability = new DiscardedByOpponentTrigger(new DamageTargetEffect(4));
|
||||
ability.addTarget(new TargetCreatureOrPlayer());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public GuerrillaTactics(final GuerrillaTactics card) {
|
||||
|
@ -65,41 +64,3 @@ public class GuerrillaTactics extends CardImpl {
|
|||
return new GuerrillaTactics(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GuerrillaTacticsTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
GuerrillaTacticsTriggeredAbility() {
|
||||
super(Zone.ALL, new DamageTargetEffect(4));
|
||||
this.addTarget(new TargetCreatureOrPlayer());
|
||||
}
|
||||
|
||||
GuerrillaTacticsTriggeredAbility(final GuerrillaTacticsTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuerrillaTacticsTriggeredAbility copy() {
|
||||
return new GuerrillaTacticsTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DISCARDED_CARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (getSourceId().equals(event.getTargetId())) {
|
||||
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackObject != null) {
|
||||
return game.getOpponents(this.getControllerId()).contains(stackObject.getControllerId());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When a spell or ability an opponent controls causes you to discard {this}, " + super.getRule();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,23 +25,18 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.cards.h;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.LoseHalfLifeTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.CantGainLifeAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -49,23 +44,18 @@ import mage.players.Player;
|
|||
*/
|
||||
public class HavocFestival extends CardImpl {
|
||||
|
||||
static final String rule = "Mana Bloom enters the battlefield with X charge counters on it";
|
||||
|
||||
public HavocFestival (UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{B}{R}");
|
||||
|
||||
public HavocFestival(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{B}{R}");
|
||||
|
||||
// Players can't gain life.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantGainLifeAllEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantGainLifeAllEffect()));
|
||||
|
||||
// At the beginning of each player's upkeep, that player loses half his or her life, rounded up.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new HavocFestivalLoseLifeEffect(), TargetController.ANY, false);
|
||||
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new LoseHalfLifeTargetEffect(), TargetController.ANY, false));
|
||||
|
||||
}
|
||||
|
||||
public HavocFestival (final HavocFestival card) {
|
||||
public HavocFestival(final HavocFestival card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -74,33 +64,3 @@ public class HavocFestival extends CardImpl {
|
|||
return new HavocFestival(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HavocFestivalLoseLifeEffect extends OneShotEffect {
|
||||
|
||||
public HavocFestivalLoseLifeEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = "that player loses half his or her life, rounded up";
|
||||
}
|
||||
|
||||
public HavocFestivalLoseLifeEffect(final HavocFestivalLoseLifeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HavocFestivalLoseLifeEffect copy() {
|
||||
return new HavocFestivalLoseLifeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
Integer amount = (int) Math.ceil(player.getLife() / 2f);
|
||||
if (amount > 0) {
|
||||
player.loseLife(amount, game, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ package mage.cards.m;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DiscardedByOpponentTrigger;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
@ -39,11 +39,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.stack.StackObject;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -52,10 +48,11 @@ import mage.game.stack.StackObject;
|
|||
public class Metrognome extends CardImpl {
|
||||
|
||||
public Metrognome(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
|
||||
|
||||
// When a spell or ability an opponent controls causes you to discard Metrognome, create four 1/1 colorless Gnome artifact creature tokens.
|
||||
this.addAbility(new MetrognomeTriggeredAbility());
|
||||
this.addAbility(new DiscardedByOpponentTrigger(new CreateTokenEffect(new GnomeToken(), 4)));
|
||||
|
||||
// {4}, {tap}: Create a 1/1 colorless Gnome artifact creature token.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new GnomeToken()), new ManaCostsImpl("{4}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
|
@ -72,43 +69,6 @@ public class Metrognome extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class MetrognomeTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
MetrognomeTriggeredAbility() {
|
||||
super(Zone.ALL, new CreateTokenEffect(new GnomeToken(), 4));
|
||||
}
|
||||
|
||||
MetrognomeTriggeredAbility(final MetrognomeTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetrognomeTriggeredAbility copy() {
|
||||
return new MetrognomeTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DISCARDED_CARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (getSourceId().equals(event.getTargetId())) {
|
||||
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackObject != null) {
|
||||
return game.getOpponents(this.getControllerId()).contains(stackObject.getControllerId());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When a spell or ability an opponent controls causes you to discard {this}, " + super.getRule();
|
||||
}
|
||||
}
|
||||
|
||||
class GnomeToken extends Token {
|
||||
|
||||
public GnomeToken() {
|
||||
|
|
|
@ -44,7 +44,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.permanent.token.HippoToken;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
|
@ -54,25 +54,26 @@ import mage.target.common.TargetOpponent;
|
|||
public class Phelddagrif extends CardImpl {
|
||||
|
||||
public Phelddagrif(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{W}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{W}{U}");
|
||||
this.supertype.add("Legendary");
|
||||
this.subtype.add("Phelddagrif");
|
||||
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// {G}: Phelddagrif gains trample until end of turn. Target opponent creates a 1/1 green Hippo creature token.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn),new ManaCostsImpl("{G}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{G}"));
|
||||
ability.addEffect(new CreateTokenTargetEffect(new HippoToken()));
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
||||
// {W}: Phelddagrif gains flying until end of turn. Target opponent gains 2 life.
|
||||
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn),new ManaCostsImpl("{W}"));
|
||||
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{W}"));
|
||||
ability.addEffect(new GainLifeTargetEffect(2));
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
||||
// {U}: Return Phelddagrif to its owner's hand. Target opponent may draw a card.
|
||||
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true),new ManaCostsImpl("{U}"));
|
||||
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), new ManaCostsImpl("{U}"));
|
||||
ability.addEffect(new DrawCardTargetEffect(1, true));
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
@ -87,15 +88,3 @@ public class Phelddagrif extends CardImpl {
|
|||
return new Phelddagrif(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HippoToken extends Token {
|
||||
|
||||
public HippoToken() {
|
||||
super("Hippo", "1/1 green Hippo creature token");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setGreen(true);
|
||||
subtype.add("Hippo");
|
||||
power = new MageInt(1);
|
||||
toughness = new MageInt(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,18 +29,13 @@ package mage.cards.q;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DiscardedByOpponentTrigger;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
import mage.abilities.keyword.ShroudAbility;
|
||||
import mage.abilities.keyword.SplitSecondAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.stack.StackObject;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -49,7 +44,7 @@ import mage.game.stack.StackObject;
|
|||
public class Quagnoth extends CardImpl {
|
||||
|
||||
public Quagnoth(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}");
|
||||
this.subtype.add("Beast");
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(5);
|
||||
|
@ -61,7 +56,7 @@ public class Quagnoth extends CardImpl {
|
|||
this.addAbility(ShroudAbility.getInstance());
|
||||
|
||||
// When a spell or ability an opponent controls causes you to discard Quagnoth, return it to your hand.
|
||||
this.addAbility(new QuagnothTriggeredAbility());
|
||||
this.addAbility(new DiscardedByOpponentTrigger(new ReturnToHandSourceEffect()));
|
||||
}
|
||||
|
||||
public Quagnoth(final Quagnoth card) {
|
||||
|
@ -73,40 +68,3 @@ public class Quagnoth extends CardImpl {
|
|||
return new Quagnoth(this);
|
||||
}
|
||||
}
|
||||
|
||||
class QuagnothTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
QuagnothTriggeredAbility() {
|
||||
super(Zone.GRAVEYARD, new ReturnToHandSourceEffect());
|
||||
}
|
||||
|
||||
QuagnothTriggeredAbility(final QuagnothTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuagnothTriggeredAbility copy() {
|
||||
return new QuagnothTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DISCARDED_CARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (getSourceId().equals(event.getTargetId())) {
|
||||
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackObject != null) {
|
||||
return game.getOpponents(this.getControllerId()).contains(stackObject.getControllerId());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When a spell or ability an opponent controls causes you to discard {this}, " + super.getRule();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ package mage.cards.q;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DiscardsACardOpponentTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
|
@ -51,14 +52,13 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public class QuestForTheNihilStone extends CardImpl {
|
||||
|
||||
public QuestForTheNihilStone(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{B}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}");
|
||||
|
||||
// Whenever an opponent discards a card, you may put a quest counter on Quest for the Nihil Stone.
|
||||
this.addAbility(new QuestForTheNihilStoneTriggeredAbility());
|
||||
this.addAbility(new DiscardsACardOpponentTriggeredAbility(new AddCountersSourceEffect(CounterType.QUEST.createInstance(), true), true));
|
||||
|
||||
// At the beginning of each opponent's upkeep, if that player has no cards in hand and Quest for the Nihil Stone has two or more quest counters on it, you may have that player lose 5 life.
|
||||
this.addAbility(new QuestForTheNihilStoneTriggeredAbility2());
|
||||
this.addAbility(new QuestForTheNihilStoneTriggeredAbility());
|
||||
}
|
||||
|
||||
public QuestForTheNihilStone(final QuestForTheNihilStone card) {
|
||||
|
@ -74,7 +74,7 @@ public class QuestForTheNihilStone extends CardImpl {
|
|||
class QuestForTheNihilStoneTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public QuestForTheNihilStoneTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.QUEST.createInstance(), true), true);
|
||||
super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(5), true);
|
||||
}
|
||||
|
||||
public QuestForTheNihilStoneTriggeredAbility(final QuestForTheNihilStoneTriggeredAbility ability) {
|
||||
|
@ -86,37 +86,6 @@ class QuestForTheNihilStoneTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return new QuestForTheNihilStoneTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DISCARDED_CARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return game.getOpponents(controllerId).contains(event.getPlayerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever an opponent discards a card, you may put a quest counter on {this}.";
|
||||
}
|
||||
}
|
||||
|
||||
class QuestForTheNihilStoneTriggeredAbility2 extends TriggeredAbilityImpl {
|
||||
|
||||
public QuestForTheNihilStoneTriggeredAbility2() {
|
||||
super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(5), true);
|
||||
}
|
||||
|
||||
public QuestForTheNihilStoneTriggeredAbility2(final QuestForTheNihilStoneTriggeredAbility2 ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuestForTheNihilStoneTriggeredAbility2 copy() {
|
||||
return new QuestForTheNihilStoneTriggeredAbility2(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.UPKEEP_STEP_PRE;
|
||||
|
|
|
@ -45,37 +45,39 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.permanent.token.HippoToken;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
|
||||
*
|
||||
*/
|
||||
public class QuestingPhelddagrif extends CardImpl {
|
||||
|
||||
public QuestingPhelddagrif(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{W}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{W}{U}");
|
||||
this.subtype.add("Phelddagrif");
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// {G}: Questing Phelddagrif gets +1/+1 until end of turn. Target opponent creates a 1/1 green Hippo creature token.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn),
|
||||
new ManaCostsImpl("{G}"));
|
||||
new ManaCostsImpl("{G}"));
|
||||
ability.addEffect(new CreateTokenTargetEffect(new HippoToken()));
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
||||
// {W}: Questing Phelddagrif gains protection from black and from red until end of turn. Target opponent gains 2 life.
|
||||
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(ProtectionAbility.from(ObjectColor.BLACK, ObjectColor.RED),
|
||||
Duration.EndOfTurn), new ManaCostsImpl("{W}"));
|
||||
Duration.EndOfTurn), new ManaCostsImpl("{W}"));
|
||||
ability.addEffect(new GainLifeTargetEffect(2));
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
||||
// {U}: Questing Phelddagrif gains flying until end of turn. Target opponent may draw a card.
|
||||
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(FlyingAbility.getInstance(),
|
||||
Duration.EndOfTurn), new ManaCostsImpl("{U}"));
|
||||
Duration.EndOfTurn), new ManaCostsImpl("{U}"));
|
||||
ability.addEffect(new DrawCardTargetEffect(1, true));
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
@ -90,14 +92,3 @@ public class QuestingPhelddagrif extends CardImpl {
|
|||
return new QuestingPhelddagrif(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HippoToken extends Token {
|
||||
public HippoToken() {
|
||||
super("Hippo", "1/1 green Hippo creature token");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setGreen(true);
|
||||
subtype.add("Hippo");
|
||||
power = new MageInt(1);
|
||||
toughness = new MageInt(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,12 +28,10 @@
|
|||
package mage.cards.q;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DealsDamageToAPlayerAttachedTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.LoseHalfLifeTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.DeathtouchAbility;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
|
@ -43,13 +41,6 @@ import mage.constants.AttachmentType;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -58,13 +49,15 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public class QuietusSpike extends CardImpl {
|
||||
|
||||
public QuietusSpike(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
this.subtype.add("Equipment");
|
||||
|
||||
// Equipped creature has deathtouch.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(DeathtouchAbility.getInstance(), AttachmentType.EQUIPMENT)));
|
||||
|
||||
// Whenever equipped creature deals combat damage to a player, that player loses half his or her life, rounded up.
|
||||
this.addAbility(new QuietusSpikeTriggeredAbility());
|
||||
this.addAbility(new DealsDamageToAPlayerAttachedTriggeredAbility(new LoseHalfLifeTargetEffect(), "equipped", false, true));
|
||||
|
||||
// Equip {3}
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3)));
|
||||
}
|
||||
|
@ -78,72 +71,3 @@ public class QuietusSpike extends CardImpl {
|
|||
return new QuietusSpike(this);
|
||||
}
|
||||
}
|
||||
|
||||
class QuietusSpikeTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public QuietusSpikeTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new QuietusSpikeEffect());
|
||||
}
|
||||
|
||||
public QuietusSpikeTriggeredAbility(final QuietusSpikeTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuietusSpikeTriggeredAbility copy() {
|
||||
return new QuietusSpikeTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DAMAGED_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
|
||||
Permanent p = game.getPermanent(event.getSourceId());
|
||||
if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever equipped creature deals combat damage to a player, " + super.getRule();
|
||||
}
|
||||
}
|
||||
|
||||
class QuietusSpikeEffect extends OneShotEffect {
|
||||
|
||||
public QuietusSpikeEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "that player loses half his or her life, rounded up";
|
||||
}
|
||||
|
||||
public QuietusSpikeEffect(final QuietusSpikeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuietusSpikeEffect copy() {
|
||||
return new QuietusSpikeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (player != null) {
|
||||
Integer amount = (int) Math.ceil(player.getLife() / 2f);
|
||||
if (amount > 0) {
|
||||
player.loseLife(amount, game, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,12 +28,10 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DealsDamageToAPlayerAttachedTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.LoseHalfLifeTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.abilities.keyword.LivingWeaponAbility;
|
||||
|
@ -42,13 +40,6 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -57,18 +48,18 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public class Scytheclaw extends CardImpl {
|
||||
|
||||
public Scytheclaw(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}");
|
||||
this.subtype.add("Equipment");
|
||||
|
||||
// Living weapon
|
||||
this.addAbility(new LivingWeaponAbility());
|
||||
|
||||
|
||||
// Equipped creature gets +1/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1)));
|
||||
|
||||
|
||||
// Whenever equipped creature deals combat damage to a player, that player loses half of his or her life, round up.
|
||||
this.addAbility(new ScytheclawTriggeredAbility());
|
||||
|
||||
this.addAbility(new DealsDamageToAPlayerAttachedTriggeredAbility(new LoseHalfLifeTargetEffect(), "equipped", false, true));
|
||||
|
||||
// Equip {3}
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3)));
|
||||
}
|
||||
|
@ -82,72 +73,3 @@ public class Scytheclaw extends CardImpl {
|
|||
return new Scytheclaw(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ScytheclawTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public ScytheclawTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new ScytheclawEffect());
|
||||
}
|
||||
|
||||
public ScytheclawTriggeredAbility(final ScytheclawTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScytheclawTriggeredAbility copy() {
|
||||
return new ScytheclawTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DAMAGED_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
|
||||
Permanent p = game.getPermanent(event.getSourceId());
|
||||
if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever equipped creature deals combat damage to a player, " + super.getRule();
|
||||
}
|
||||
}
|
||||
|
||||
class ScytheclawEffect extends OneShotEffect {
|
||||
|
||||
public ScytheclawEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "that player loses half his or her life, rounded up";
|
||||
}
|
||||
|
||||
public ScytheclawEffect(final ScytheclawEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScytheclawEffect copy() {
|
||||
return new ScytheclawEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (player != null) {
|
||||
Integer amount = (int) Math.ceil(player.getLife() / 2f);
|
||||
if (amount > 0) {
|
||||
player.loseLife(amount, game, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.stack.StackObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public class DiscardedByOpponentTrigger extends TriggeredAbilityImpl {
|
||||
|
||||
public DiscardedByOpponentTrigger(Effect effect) {
|
||||
this(effect, false);
|
||||
}
|
||||
|
||||
public DiscardedByOpponentTrigger(Effect effect, boolean optional) {
|
||||
super(Zone.GRAVEYARD, effect, optional);
|
||||
}
|
||||
|
||||
public DiscardedByOpponentTrigger(final DiscardedByOpponentTrigger ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiscardedByOpponentTrigger copy() {
|
||||
return new DiscardedByOpponentTrigger(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DISCARDED_CARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (getSourceId().equals(event.getTargetId())) {
|
||||
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackObject != null) {
|
||||
return game.getOpponents(this.getControllerId()).contains(stackObject.getControllerId());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When a spell or ability an opponent controls causes you to discard {this}, " + super.getRule();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public class LoseHalfLifeTargetEffect extends OneShotEffect {
|
||||
|
||||
public LoseHalfLifeTargetEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = "that player loses half his or her life, rounded up";
|
||||
}
|
||||
|
||||
public LoseHalfLifeTargetEffect(final LoseHalfLifeTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoseHalfLifeTargetEffect copy() {
|
||||
return new LoseHalfLifeTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
Integer amount = (int) Math.ceil(player.getLife() / 2f);
|
||||
if (amount > 0) {
|
||||
player.loseLife(amount, game, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue