* Some minor changes to return code handling.

This commit is contained in:
LevelX2 2017-07-23 14:57:06 +02:00
parent 647cd9bc6d
commit d5f4df7f54
9 changed files with 37 additions and 39 deletions

View file

@ -98,15 +98,14 @@ public class HazoretsFavor extends CardImpl {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget()); Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (creature != null) { if (creature != null) {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice boosted " + creature.getName(), source.getControllerId()); SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("Sacrifice boosted " + creature.getName(), source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(creature, game)); sacrificeEffect.setTargetPointer(new FixedTarget(creature, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
game.addDelayedTriggeredAbility(delayedAbility, source); game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true; return true;
} }
return false;
}
} }
} }

View file

@ -95,8 +95,8 @@ class NehebTheEternalManaEffect extends ManaEffect {
int amount = dynamicValue.calculate(game, source, this); int amount = dynamicValue.calculate(game, source, this);
if (amount > 0) { if (amount > 0) {
controller.getManaPool().addMana(Mana.RedMana(amount), game, source); controller.getManaPool().addMana(Mana.RedMana(amount), game, source);
return true;
} }
return true;
} }
return false; return false;
} }

View file

@ -129,7 +129,8 @@ class RingsOfBrighthearthEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
ManaCostsImpl cost = new ManaCostsImpl("{2}"); ManaCostsImpl cost = new ManaCostsImpl("{2}");
if (player != null) { if (player != null) {
if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? If you do, copy that ability. You may choose new targets for the copy.", source, game)) { if (cost.canPay(source, source.getSourceId(), player.getId(), game)
&& player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? If you do, copy that ability. You may choose new targets for the copy.", source, game)) {
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
StackAbility ability = (StackAbility) getValue("stackAbility"); StackAbility ability = (StackAbility) getValue("stackAbility");
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
@ -142,6 +143,7 @@ class RingsOfBrighthearthEffect extends OneShotEffect {
return false; return false;
} }
} }
return true;
} }
return false; return false;
} }

View file

@ -28,12 +28,12 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.common.ManaEffect; import mage.abilities.effects.common.ManaEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.mageobject.NamePredicate;
import mage.game.Game; import mage.game.Game;
@ -48,7 +48,6 @@ public class RiteOfFlame extends CardImpl {
public RiteOfFlame(UUID ownerId, CardSetInfo setInfo) { public RiteOfFlame(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{R}");
// Add {R}{R} to your mana pool, then add {R} to your mana pool for each card named Rite of Flame in each graveyard. // Add {R}{R} to your mana pool, then add {R} to your mana pool for each card named Rite of Flame in each graveyard.
this.getSpellAbility().addEffect(new RiteOfFlameManaEffect()); this.getSpellAbility().addEffect(new RiteOfFlameManaEffect());
} }
@ -64,6 +63,7 @@ public class RiteOfFlame extends CardImpl {
} }
class RiteOfFlameManaEffect extends ManaEffect { class RiteOfFlameManaEffect extends ManaEffect {
private static final FilterCard filter = new FilterCard(); private static final FilterCard filter = new FilterCard();
static { static {
@ -90,6 +90,7 @@ class RiteOfFlameManaEffect extends ManaEffect {
} }
} }
controller.getManaPool().addMana(Mana.RedMana(count + 2), game, source); controller.getManaPool().addMana(Mana.RedMana(count + 2), game, source);
return true;
} }
return false; return false;
} }

View file

@ -27,6 +27,7 @@
*/ */
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility; import mage.abilities.DelayedTriggeredAbility;
@ -46,8 +47,6 @@ import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
* *
* @author Plopman * @author Plopman
@ -100,7 +99,7 @@ class SaffiEriksdotterEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
DelayedTriggeredAbility delayedAbility = new SaffiEriksdotterDelayedTriggeredAbility(new FixedTarget(this.getTargetPointer().getFirst(game, source))); DelayedTriggeredAbility delayedAbility = new SaffiEriksdotterDelayedTriggeredAbility(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
game.addDelayedTriggeredAbility(delayedAbility, source); game.addDelayedTriggeredAbility(delayedAbility, source);
return false; return true;
} }
} }

View file

@ -92,6 +92,7 @@ class SeasonsPastEffect extends OneShotEffect {
SeasonsPastTarget target = new SeasonsPastTarget(); SeasonsPastTarget target = new SeasonsPastTarget();
controller.choose(outcome, target, source.getSourceId(), game); controller.choose(outcome, target, source.getSourceId(), game);
controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
return true;
} }
return false; return false;
} }

View file

@ -119,18 +119,17 @@ class SelvalaHeartOfTheWildsEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); Permanent permanent = game.getPermanentOrLKIBattlefield(targetPointer.getFirst(game, source));
if (permanent == null) { if (permanent != null) {
permanent = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.BATTLEFIELD); if (filter2.match(permanent, game)) {
}
if (permanent != null
&& filter2.match(permanent, game)) {
Player permanentController = game.getPlayer(permanent.getControllerId()); Player permanentController = game.getPlayer(permanent.getControllerId());
if (permanentController.chooseUse(Outcome.DrawCard, "Would you like to draw a card?", source, game)) { if (permanentController != null
&& permanentController.chooseUse(Outcome.DrawCard, "Would you like to draw a card?", source, game)) {
permanentController.drawCards(1, game); permanentController.drawCards(1, game);
return true;
} }
} }
return true;
}
return false; return false;
} }
} }

View file

@ -25,9 +25,9 @@
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -39,12 +39,10 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/** /**
* *
* @author Loki * @author Loki
@ -68,8 +66,8 @@ public class SheoldredWhisperingOne extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// At the beginning of each opponent's upkeep, that player sacrifices a creature. // At the beginning of each opponent's upkeep, that player sacrifices a creature.
ability = new BeginningOfUpkeepTriggeredAbility(new SacrificeEffect(new FilterCreaturePermanent(), 1, "that player "), TargetController.OPPONENT, false); this.addAbility(new BeginningOfUpkeepTriggeredAbility(
this.addAbility(ability); new SacrificeEffect(StaticFilters.FILTER_PERMANENT_CREATURE, 1, "that player"), TargetController.OPPONENT, false));
} }
public SheoldredWhisperingOne(final SheoldredWhisperingOne card) { public SheoldredWhisperingOne(final SheoldredWhisperingOne card) {

View file

@ -73,7 +73,6 @@ public class SacrificeEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source)); Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (player == null) { if (player == null) {
return false; return false;
} }