mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
- a bunch of small fixes
This commit is contained in:
parent
bab673adf7
commit
8826dd6f0f
9 changed files with 130 additions and 91 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -61,7 +60,7 @@ public final class BubblingCauldron extends CardImpl {
|
|||
class BubblingCauldronEffect extends OneShotEffect {
|
||||
|
||||
public BubblingCauldronEffect() {
|
||||
super(Outcome.Damage);
|
||||
super(Outcome.GainLife);
|
||||
staticText = "Each opponent loses 4 life. You gain life equal to the life lost this way";
|
||||
}
|
||||
|
||||
|
@ -71,16 +70,16 @@ class BubblingCauldronEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int damage = 0;
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
int lostLife = 0;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if(opponent != null) {
|
||||
damage += opponent.loseLife(4, game, false);
|
||||
if (opponent != null) {
|
||||
lostLife += opponent.loseLife(4, game, false);
|
||||
}
|
||||
}
|
||||
if(you != null){
|
||||
you.gainLife(damage, game, source);
|
||||
if (controller != null) {
|
||||
controller.gainLife(lostLife, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -27,7 +26,7 @@ import mage.target.common.TargetOpponent;
|
|||
public final class EbonyCharm extends CardImpl {
|
||||
|
||||
public EbonyCharm(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
|
||||
|
||||
// Choose one - Target opponent loses 1 life and you gain 1 life;
|
||||
this.getSpellAbility().addEffect(new EbonyCharmDrainEffect());
|
||||
|
@ -69,11 +68,13 @@ class EbonyCharmDrainEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
Player controllerPlayer = game.getPlayer(source.getControllerId());
|
||||
if (targetPlayer != null && controllerPlayer != null) {
|
||||
targetPlayer.damage(1, source.getSourceId(), game, false, true);
|
||||
controllerPlayer.gainLife(1, game, source);
|
||||
Player targetOpponent = game.getPlayer(source.getFirstTarget());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (targetOpponent != null
|
||||
&& controller != null) {
|
||||
targetOpponent.loseLife(1, game, false);
|
||||
controller.gainLife(1, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -88,17 +89,17 @@ class EbonyCharmDrainEffect extends OneShotEffect {
|
|||
class EbonyCharmExileEffect extends OneShotEffect {
|
||||
|
||||
public EbonyCharmExileEffect() {
|
||||
super(Outcome.Exile);
|
||||
this.staticText = "Exile up to three target cards from a single graveyard";
|
||||
super(Outcome.Exile);
|
||||
this.staticText = "Exile up to three target cards from a single graveyard";
|
||||
}
|
||||
|
||||
public EbonyCharmExileEffect(final EbonyCharmExileEffect effect) {
|
||||
super(effect);
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EbonyCharmExileEffect copy() {
|
||||
return new EbonyCharmExileEffect(this);
|
||||
return new EbonyCharmExileEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -57,10 +56,12 @@ class EssenceHarvestEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null && targetPlayer != null) {
|
||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, player.getId(), game);
|
||||
if (controller != null
|
||||
&& targetPlayer != null) {
|
||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), game);
|
||||
int amount = 0;
|
||||
for (Permanent creature : creatures) {
|
||||
int power = creature.getPower().getValue();
|
||||
|
@ -71,7 +72,7 @@ class EssenceHarvestEffect extends OneShotEffect {
|
|||
|
||||
if (amount > 0) {
|
||||
targetPlayer.loseLife(amount, game, false);
|
||||
player.gainLife(amount, game, source);
|
||||
controller.gainLife(amount, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -17,13 +15,13 @@ import mage.game.Game;
|
|||
*/
|
||||
public final class Exsanguinate extends CardImpl {
|
||||
|
||||
public Exsanguinate (UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{B}{B}");
|
||||
public Exsanguinate(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{B}{B}");
|
||||
|
||||
this.getSpellAbility().addEffect(new ExsanguinateEffect());
|
||||
}
|
||||
|
||||
public Exsanguinate (final Exsanguinate card) {
|
||||
public Exsanguinate(final Exsanguinate card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -35,8 +33,9 @@ public final class Exsanguinate extends CardImpl {
|
|||
}
|
||||
|
||||
class ExsanguinateEffect extends OneShotEffect {
|
||||
|
||||
public ExsanguinateEffect() {
|
||||
super(Outcome.Damage);
|
||||
super(Outcome.GainLife);
|
||||
staticText = "Each opponent loses X life. You gain life equal to the life lost this way";
|
||||
}
|
||||
|
||||
|
@ -46,13 +45,14 @@ class ExsanguinateEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int loseLife = 0;
|
||||
int damage = source.getManaCostsToPay().getX();
|
||||
int totalLostLife = 0;
|
||||
int loseLife = source.getManaCostsToPay().getX();
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
loseLife += game.getPlayer(opponentId).loseLife(damage, game, false);
|
||||
totalLostLife += game.getPlayer(opponentId).loseLife(loseLife, game, false);
|
||||
}
|
||||
if (totalLostLife > 0) {
|
||||
game.getPlayer(source.getControllerId()).gainLife(totalLostLife, game, source);
|
||||
}
|
||||
if (loseLife > 0)
|
||||
game.getPlayer(source.getControllerId()).gainLife(loseLife, game, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -43,8 +42,13 @@ public final class GhostCouncilOfOrzhova extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// {1}, Sacrifice a creature: Exile Ghost Council of Orzhova. Return it to the battlefield under its owner's control at the beginning of the next end step.
|
||||
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true), new GenericManaCost(1));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)));
|
||||
ability = new SimpleActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true),
|
||||
new GenericManaCost(1));
|
||||
ability.addCost(new SacrificeTargetCost(
|
||||
new TargetControlledCreaturePermanent(
|
||||
FILTER_CONTROLLED_CREATURE_SHORT_TEXT)));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
@ -62,7 +66,7 @@ public final class GhostCouncilOfOrzhova extends CardImpl {
|
|||
class GhostCouncilOfOrzhovaEffect extends OneShotEffect {
|
||||
|
||||
GhostCouncilOfOrzhovaEffect() {
|
||||
super(Outcome.Damage);
|
||||
super(Outcome.GainLife);
|
||||
staticText = "target opponent loses 1 life and you gain 1 life";
|
||||
}
|
||||
|
||||
|
@ -73,10 +77,12 @@ class GhostCouncilOfOrzhovaEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
Player controllerPlayer = game.getPlayer(source.getControllerId());
|
||||
if (targetPlayer != null && controllerPlayer != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (targetPlayer != null
|
||||
&& controller != null) {
|
||||
targetPlayer.loseLife(1, game, false);
|
||||
controllerPlayer.gainLife(1, game, source);
|
||||
controller.gainLife(1, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -19,6 +18,7 @@ import mage.constants.WatcherScope;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
|
@ -30,10 +30,14 @@ public final class GontisMachinations extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}");
|
||||
|
||||
// Whenever you lose life for the first time each turn, you get {E}.
|
||||
this.addAbility(new GontisMachinationsTriggeredAbility(), new GontisMachinationsFirstLostLifeThisTurnWatcher());
|
||||
this.addAbility(new GontisMachinationsTriggeredAbility(),
|
||||
new GontisMachinationsFirstLostLifeThisTurnWatcher());
|
||||
|
||||
// Pay {E}{E}, Sacrifice Gonti's Machinations: Each opponent loses 3 life. You gain life equal to the life lost this way.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GontisMachinationsEffect(), new PayEnergyCost(2));
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new GontisMachinationsEffect(),
|
||||
new PayEnergyCost(2));
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
@ -69,7 +73,8 @@ class GontisMachinationsTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (event.getPlayerId().equals(getControllerId())) {
|
||||
GontisMachinationsFirstLostLifeThisTurnWatcher watcher
|
||||
= game.getState().getWatcher(GontisMachinationsFirstLostLifeThisTurnWatcher.class);
|
||||
if (watcher != null && watcher.timesLostLifeThisTurn(event.getTargetId()) < 2) {
|
||||
if (watcher != null
|
||||
&& watcher.timesLostLifeThisTurn(event.getTargetId()) < 2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +134,7 @@ class GontisMachinationsFirstLostLifeThisTurnWatcher extends Watcher {
|
|||
class GontisMachinationsEffect extends OneShotEffect {
|
||||
|
||||
public GontisMachinationsEffect() {
|
||||
super(Outcome.Damage);
|
||||
super(Outcome.GainLife);
|
||||
staticText = "Each opponent loses 3 life. You gain life equal to the life lost this way";
|
||||
}
|
||||
|
||||
|
@ -139,12 +144,19 @@ class GontisMachinationsEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int damage = 0;
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
damage += game.getPlayer(opponentId).loseLife(3, game, false);
|
||||
int totalLostLife = 0;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
totalLostLife += game.getPlayer(opponentId).loseLife(3, game, false);
|
||||
}
|
||||
}
|
||||
game.getPlayer(source.getControllerId()).gainLife(totalLostLife, game, source);
|
||||
return true;
|
||||
}
|
||||
game.getPlayer(source.getControllerId()).gainLife(damage, game, source);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,7 +30,9 @@ public final class GrayMerchantOfAsphodel extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// When Gray Merchant of Asphodel enters the battlefield, each opponent loses X life, where X is your devotion to black. You gain life equal to the life lost this way.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new GrayMerchantOfAsphodelEffect(), false));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(
|
||||
new GrayMerchantOfAsphodelEffect(),
|
||||
false));
|
||||
}
|
||||
|
||||
public GrayMerchantOfAsphodel(final GrayMerchantOfAsphodel card) {
|
||||
|
@ -46,8 +48,11 @@ public final class GrayMerchantOfAsphodel extends CardImpl {
|
|||
class GrayMerchantOfAsphodelEffect extends OneShotEffect {
|
||||
|
||||
public GrayMerchantOfAsphodelEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "each opponent loses X life, where X is your devotion to black. You gain life equal to the life lost this way. <i>(Each {B} in the mana costs of permanents you control counts towards your devotion to black.)</i>";
|
||||
super(Outcome.GainLife);
|
||||
this.staticText = "each opponent loses X life, where X is your devotion to black. "
|
||||
+ "You gain life equal to the life lost this way. "
|
||||
+ "<i>(Each {B} in the mana costs of permanents you control "
|
||||
+ "counts towards your devotion to black.)</i>";
|
||||
}
|
||||
|
||||
public GrayMerchantOfAsphodelEffect(final GrayMerchantOfAsphodelEffect effect) {
|
||||
|
@ -63,17 +68,17 @@ class GrayMerchantOfAsphodelEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
int lifeLost = 0;
|
||||
int damage = new DevotionCount(ColoredManaSymbol.B).calculate(game, source, this);
|
||||
if (damage > 0) {
|
||||
int totalLifeLost = 0;
|
||||
int lifeLost = new DevotionCount(ColoredManaSymbol.B).calculate(game, source, this);
|
||||
if (lifeLost > 0) {
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
Player opponent = game.getPlayer(playerId);
|
||||
if (opponent != null) {
|
||||
lifeLost += opponent.loseLife(damage, game, false);
|
||||
totalLifeLost += opponent.loseLife(lifeLost, game, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
controller.gainLife(lifeLost, game, source);
|
||||
controller.gainLife(totalLifeLost, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.h;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -11,6 +10,7 @@ import mage.abilities.condition.Condition;
|
|||
import mage.abilities.condition.common.CardsInHandCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
@ -23,6 +23,7 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -33,7 +34,7 @@ public final class HollowbornBarghest extends CardImpl {
|
|||
private static final String rule = "At the beginning of your upkeep, if you have no cards in hand, each opponent loses 2 life.";
|
||||
|
||||
public HollowbornBarghest(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{B}");
|
||||
this.subtype.add(SubType.DEMON);
|
||||
this.subtype.add(SubType.HOUND);
|
||||
|
||||
|
@ -42,8 +43,14 @@ public final class HollowbornBarghest extends CardImpl {
|
|||
|
||||
// At the beginning of your upkeep, if you have no cards in hand, each opponent loses 2 life.
|
||||
Condition condition = new CardsInHandCondition(ComparisonType.EQUAL_TO, 0);
|
||||
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new HollowbornBarghestEffect(), TargetController.YOU, false);
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, condition, rule));
|
||||
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(
|
||||
new HollowbornBarghestEffect(),
|
||||
TargetController.YOU,
|
||||
false);
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
ability,
|
||||
condition,
|
||||
rule));
|
||||
|
||||
// At the beginning of each opponent's upkeep, if that player has no cards in hand, he or she loses 2 life.
|
||||
this.addAbility(new HollowbornBarghestTriggeredAbility());
|
||||
|
@ -62,7 +69,7 @@ public final class HollowbornBarghest extends CardImpl {
|
|||
class HollowbornBarghestEffect extends OneShotEffect {
|
||||
|
||||
public HollowbornBarghestEffect() {
|
||||
super(Outcome.Damage);
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Each opponent loses 2 life";
|
||||
}
|
||||
|
||||
|
@ -73,7 +80,10 @@ class HollowbornBarghestEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
game.getPlayer(opponentId).loseLife(2, game, false);
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
game.getPlayer(opponentId).loseLife(2, game, false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -88,7 +98,7 @@ class HollowbornBarghestEffect extends OneShotEffect {
|
|||
class HollowbornBarghestTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public HollowbornBarghestTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, null);
|
||||
super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(2));
|
||||
}
|
||||
|
||||
public HollowbornBarghestTriggeredAbility(final HollowbornBarghestTriggeredAbility ability) {
|
||||
|
@ -102,17 +112,17 @@ class HollowbornBarghestTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.UPKEEP_STEP_PRE;
|
||||
return event.getType() == EventType.UPKEEP_STEP_PRE
|
||||
&& game.getOpponents(controllerId).contains(event.getPlayerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
|
||||
Player opponent = game.getPlayer(event.getPlayerId());
|
||||
if (opponent != null && opponent.getHand().isEmpty()) {
|
||||
opponent.loseLife(2, game, false);
|
||||
return true;
|
||||
}
|
||||
Player opponent = game.getPlayer(event.getPlayerId());
|
||||
if (opponent != null
|
||||
&& opponent.getHand().isEmpty()) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(opponent.getId()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -24,14 +23,14 @@ import mage.filter.common.FilterControlledPermanent;
|
|||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.players.Players;
|
||||
|
||||
/**
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class LeechriddenSwamp extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("you control two or more black permanents");
|
||||
private static final FilterControlledPermanent filter =
|
||||
new FilterControlledPermanent("you control two or more black permanents");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
|
@ -48,10 +47,14 @@ public final class LeechriddenSwamp extends CardImpl {
|
|||
this.addAbility(new EntersBattlefieldTappedAbility());
|
||||
|
||||
// {B}, {tap}: Each opponent loses 1 life. Activate this ability only if you control two or more black permanents.
|
||||
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD,
|
||||
Ability ability = new ActivateIfConditionActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new LeechriddenSwampLoseLifeEffect(),
|
||||
new ManaCostsImpl("{B}"),
|
||||
new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1));
|
||||
new PermanentsOnTheBattlefieldCondition(
|
||||
filter,
|
||||
ComparisonType.MORE_THAN,
|
||||
1));
|
||||
ability.addCost(new TapSourceCost());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -68,11 +71,9 @@ public final class LeechriddenSwamp extends CardImpl {
|
|||
|
||||
class LeechriddenSwampLoseLifeEffect extends OneShotEffect {
|
||||
|
||||
private static final String effectText = "each opponent loses 1 life";
|
||||
|
||||
LeechriddenSwampLoseLifeEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = effectText;
|
||||
super(Outcome.Benefit);
|
||||
staticText = "each opponent loses 1 life";
|
||||
}
|
||||
|
||||
LeechriddenSwampLoseLifeEffect(LeechriddenSwampLoseLifeEffect effect) {
|
||||
|
@ -81,13 +82,17 @@ class LeechriddenSwampLoseLifeEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Players players = game.getPlayers();
|
||||
for (Player player : players.values()) {
|
||||
if (!player.getId().equals(source.getControllerId())) {
|
||||
player.loseLife(1, game, false);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID opponentId : game.getOpponents(controller.getId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
opponent.loseLife(1, game, false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue