* 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
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
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));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;
return true;
}
}
}
}

View file

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

View file

@ -129,7 +129,8 @@ class RingsOfBrighthearthEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
ManaCostsImpl cost = new ManaCostsImpl("{2}");
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)) {
StackAbility ability = (StackAbility) getValue("stackAbility");
Player controller = game.getPlayer(source.getControllerId());
@ -142,6 +143,7 @@ class RingsOfBrighthearthEffect extends OneShotEffect {
return false;
}
}
return true;
}
return false;
}

View file

@ -28,12 +28,12 @@
package mage.cards.r;
import java.util.UUID;
import mage.constants.CardType;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.effects.common.ManaEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.game.Game;
@ -46,8 +46,7 @@ import mage.players.Player;
public class RiteOfFlame extends CardImpl {
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.
this.getSpellAbility().addEffect(new RiteOfFlameManaEffect());
@ -64,6 +63,7 @@ public class RiteOfFlame extends CardImpl {
}
class RiteOfFlameManaEffect extends ManaEffect {
private static final FilterCard filter = new FilterCard();
static {
@ -82,14 +82,15 @@ class RiteOfFlameManaEffect extends ManaEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if(controller != null){
if (controller != null) {
int count = 0;
for(Player player : game.getPlayers().values()){
if(player != null){
for (Player player : game.getPlayers().values()) {
if (player != null) {
count += player.getGraveyard().count(filter, game);
}
}
controller.getManaPool().addMana(Mana.RedMana(count + 2), game, source);
return true;
}
return false;
}
@ -104,4 +105,4 @@ class RiteOfFlameManaEffect extends ManaEffect {
return null;
}
}
}

View file

@ -27,6 +27,7 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -46,8 +47,6 @@ import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author Plopman
@ -55,7 +54,7 @@ import java.util.UUID;
public class SaffiEriksdotter extends CardImpl {
public SaffiEriksdotter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{W}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add("Human");
this.subtype.add("Scout");
@ -100,7 +99,7 @@ class SaffiEriksdotterEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
DelayedTriggeredAbility delayedAbility = new SaffiEriksdotterDelayedTriggeredAbility(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
game.addDelayedTriggeredAbility(delayedAbility, source);
return false;
return true;
}
}

View file

@ -52,7 +52,7 @@ import mage.target.common.TargetCardInYourGraveyard;
public class SeasonsPast extends CardImpl {
public SeasonsPast(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}{G}");
// Return any number of cards with different converted mana costs from your graveyard to your hand. Put Seasons Past on the bottom of its owner's library.
this.getSpellAbility().addEffect(new SeasonsPastEffect());
@ -92,6 +92,7 @@ class SeasonsPastEffect extends OneShotEffect {
SeasonsPastTarget target = new SeasonsPastTarget();
controller.choose(outcome, target, source.getSourceId(), game);
controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
return true;
}
return false;
}

View file

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

View file

@ -25,9 +25,9 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -39,20 +39,18 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
*
* @author Loki
*/
public class SheoldredWhisperingOne extends CardImpl {
public SheoldredWhisperingOne (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{B}{B}");
public SheoldredWhisperingOne(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{B}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add("Praetor");
@ -68,11 +66,11 @@ public class SheoldredWhisperingOne extends CardImpl {
this.addAbility(ability);
// 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(ability);
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
new SacrificeEffect(StaticFilters.FILTER_PERMANENT_CREATURE, 1, "that player"), TargetController.OPPONENT, false));
}
public SheoldredWhisperingOne (final SheoldredWhisperingOne card) {
public SheoldredWhisperingOne(final SheoldredWhisperingOne card) {
super(card);
}

View file

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