mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Fixed some possible exceptions.
This commit is contained in:
parent
8bdb6665d9
commit
0051f70b8a
6 changed files with 30 additions and 30 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
@ -75,7 +74,7 @@ class PathOfAncestryTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getSourceId().equals(getSourceId())) {
|
||||
if (getSourceId().equals(event.getSourceId())) {
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
boolean found = false;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -16,6 +15,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
|
@ -27,7 +27,7 @@ import mage.target.common.TargetCardInHand;
|
|||
public final class ScrollRack extends CardImpl {
|
||||
|
||||
public ScrollRack(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
// {1}, {tap}: Exile any number of cards from your hand face down. Put that many cards from the top of your library into your hand. Then look at the exiled cards and put them on top of your library in any order.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScrollRackEffect(), new GenericManaCost(1));
|
||||
|
@ -62,7 +62,6 @@ class ScrollRackEffect extends OneShotEffect {
|
|||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
FilterCard filter = new FilterCard("card in your hand to exile");
|
||||
// FilterCard filter2 = new FilterCard("(move the window) card exiled by " + sourceObject.getIdName() + " to put on top of library");
|
||||
TargetCardInHand target = new TargetCardInHand(0, controller.getHand().size(), filter);
|
||||
target.setRequired(false);
|
||||
int amountExiled = 0;
|
||||
|
@ -76,8 +75,11 @@ class ScrollRackEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
controller.moveCardsToExile(new CardsImpl(target.getTargets()).getCards(game), source, game, false, source.getSourceId(), sourceObject.getIdName());
|
||||
for (Card card : game.getExile().getExileZone(source.getSourceId()).getCards(game)) {
|
||||
card.setFaceDown(true, game);
|
||||
ExileZone exileZone = game.getExile().getExileZone(source.getSourceId());
|
||||
if (exileZone != null) {
|
||||
for (Card card : exileZone.getCards(game)) {
|
||||
card.setFaceDown(true, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
|
||||
package mage.cards.v;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.TapForManaAllTriggeredManaAbility;
|
||||
import mage.abilities.effects.mana.AddManaOfAnyTypeProducedEffect;
|
||||
import mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect;
|
||||
import mage.abilities.effects.common.ManaEffect;
|
||||
import mage.abilities.effects.mana.AddManaOfAnyTypeProducedEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
|
@ -30,7 +29,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public final class VorinclexVoiceOfHunger extends CardImpl {
|
||||
|
||||
public VorinclexVoiceOfHunger(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{6}{G}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{G}{G}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.PRAETOR);
|
||||
|
||||
|
@ -63,8 +62,6 @@ public final class VorinclexVoiceOfHunger extends CardImpl {
|
|||
|
||||
class VorinclexTriggeredAbility2 extends TriggeredAbilityImpl {
|
||||
|
||||
private static final String staticText = "Whenever an opponent taps a land for mana, that land doesn't untap during its controller's next untap step.";
|
||||
|
||||
public VorinclexTriggeredAbility2() {
|
||||
super(Zone.BATTLEFIELD, new DontUntapInControllersNextUntapStepTargetEffect());
|
||||
}
|
||||
|
@ -97,6 +94,6 @@ class VorinclexTriggeredAbility2 extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return staticText;
|
||||
return "Whenever an opponent taps a land for mana, that land doesn't untap during its controller's next untap step.";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.costs.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.players;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -492,18 +491,22 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
PlayerList players = game.getState().getPlayerList(playerId);
|
||||
for (int i = 0; i < range.getRange(); i++) {
|
||||
Player player = players.getNext(game);
|
||||
while (player.hasLeft()) {
|
||||
player = players.getNext(game);
|
||||
if (player != null) {
|
||||
while (player.hasLeft()) {
|
||||
player = players.getNext(game);
|
||||
}
|
||||
inRange.add(player.getId());
|
||||
}
|
||||
inRange.add(player.getId());
|
||||
}
|
||||
players = game.getState().getPlayerList(playerId);
|
||||
for (int i = 0; i < range.getRange(); i++) {
|
||||
Player player = players.getPrevious(game);
|
||||
while (player.hasLeft()) {
|
||||
player = players.getPrevious(game);
|
||||
if (player != null) {
|
||||
while (player.hasLeft()) {
|
||||
player = players.getPrevious(game);
|
||||
}
|
||||
inRange.add(player.getId());
|
||||
}
|
||||
inRange.add(player.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
|
||||
|
||||
package mage.target;
|
||||
|
||||
import mage.constants.Zone;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class TargetObject extends TargetImpl {
|
||||
|
||||
protected TargetObject() {}
|
||||
protected TargetObject() {
|
||||
}
|
||||
|
||||
public TargetObject(Zone zone) {
|
||||
this(1, 1, zone, false);
|
||||
|
@ -40,7 +38,7 @@ public abstract class TargetObject extends TargetImpl {
|
|||
@Override
|
||||
public String getTargetedName(Game game) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (UUID targetId: getTargets()) {
|
||||
for (UUID targetId : getTargets()) {
|
||||
MageObject object = game.getObject(targetId);
|
||||
if (object != null) {
|
||||
sb.append(object.getLogName()).append(' ');
|
||||
|
@ -52,7 +50,9 @@ public abstract class TargetObject extends TargetImpl {
|
|||
@Override
|
||||
public boolean canTarget(UUID id, Game game) {
|
||||
MageObject object = game.getObject(id);
|
||||
return object != null && game.getState().getZone(id).match(zone) && getFilter().match(object, game);
|
||||
return object != null
|
||||
&& zone != null && zone.match(game.getState().getZone(id))
|
||||
&& getFilter() != null && getFilter().match(object, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue