Added Volrath's Shapeshifter.

The Graveyard was modified to become its own class, as the top card of
your graveyard matters for this card, and graveyard order matters for
some other old card. Note that due how Volrath's Shapeshifter's ability
works, it is applied in layer 3, after control effects. This is so it
can look at it's current controllers graveyard, instead of it's owner,
as it would if the copy effect was at layer 1.
This commit is contained in:
Nathaniel Brandes 2015-04-30 19:10:50 -07:00
parent 9b3eff603c
commit b25c4aac77
7 changed files with 350 additions and 20 deletions

View file

@ -90,7 +90,7 @@ public class DiscardControllerEffect extends OneShotEffect {
}
}
} else {
player.discard(amount.calculate(game, source, this), source, game);
player.discard(amount.calculate(game, source, this), false, source, game);
result = true;
}
}

View file

@ -0,0 +1,32 @@
package mage.game;
import java.util.UUID;
import mage.cards.Card;
import mage.cards.CardsImpl;
import mage.constants.Zone;
public class Graveyard extends CardsImpl {
public Graveyard() {
super(Zone.GRAVEYARD);
}
public Graveyard(final Graveyard graveyard) {
super(graveyard);
}
@Override
public Graveyard copy() {
return new Graveyard(this);
}
public Card getTopCard(Game game) {
UUID card = null;
for (UUID cardId : this) {
card = cardId;
}
return card != null ? game.getCard(card) : null;
}
}

View file

@ -28,9 +28,22 @@
package mage.players;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import mage.MageItem;
import mage.MageObject;
import mage.abilities.*;
import mage.abilities.Abilities;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.Mode;
import mage.abilities.Modes;
import mage.abilities.SpellAbility;
import mage.abilities.TriggeredAbility;
import mage.abilities.costs.AlternativeSourceCosts;
import mage.abilities.costs.VariableCost;
import mage.abilities.costs.mana.ManaCost;
@ -40,14 +53,18 @@ import mage.cards.decks.Deck;
import mage.choices.Choice;
import mage.constants.ManaType;
import mage.constants.Outcome;
import mage.constants.PlayerAction;
import mage.constants.RangeOfInfluence;
import mage.constants.Zone;
import mage.counters.Counter;
import mage.counters.Counters;
import mage.game.Game;
import mage.game.Graveyard;
import mage.game.Table;
import mage.game.combat.CombatGroup;
import mage.game.draft.Draft;
import mage.game.match.Match;
import mage.game.match.MatchPlayer;
import mage.game.permanent.Permanent;
import mage.game.tournament.Tournament;
import mage.players.net.UserData;
@ -57,12 +74,6 @@ import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
import mage.util.Copyable;
import java.io.Serializable;
import java.util.*;
import mage.constants.PlayerAction;
import mage.game.combat.CombatGroup;
import mage.game.match.MatchPlayer;
/**
*
* @author BetaSteward_at_googlemail.com
@ -74,7 +85,7 @@ public interface Player extends MageItem, Copyable<Player> {
RangeOfInfluence getRange();
Library getLibrary();
Cards getSideboard();
Cards getGraveyard();
Graveyard getGraveyard();
Abilities<Ability> getAbilities();
void addAbility(Ability ability);
Counters getCounters();

View file

@ -41,6 +41,7 @@ import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.Mana;
import mage.abilities.Abilities;
@ -88,14 +89,6 @@ import mage.constants.ManaType;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
import mage.constants.PlayerAction;
import static mage.constants.PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS;
import static mage.constants.PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN;
import static mage.constants.PlayerAction.PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE;
import static mage.constants.PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN;
import static mage.constants.PlayerAction.PASS_PRIORITY_UNTIL_STACK_RESOLVED;
import static mage.constants.PlayerAction.PASS_PRIORITY_UNTIL_TURN_END_STEP;
import static mage.constants.PlayerAction.PERMISSION_REQUESTS_ALLOWED_OFF;
import static mage.constants.PlayerAction.PERMISSION_REQUESTS_ALLOWED_ON;
import mage.constants.RangeOfInfluence;
import mage.constants.SpellAbilityType;
import mage.constants.TimingRule;
@ -111,6 +104,7 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.ExileZone;
import mage.game.Game;
import mage.game.Graveyard;
import mage.game.Table;
import mage.game.combat.CombatGroup;
import mage.game.command.CommandObject;
@ -134,6 +128,7 @@ import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetDiscard;
import mage.util.CardUtil;
import mage.watchers.common.BloodthirstWatcher;
import org.apache.log4j.Logger;
public abstract class PlayerImpl implements Player, Serializable {
@ -156,7 +151,7 @@ public abstract class PlayerImpl implements Player, Serializable {
protected Library library;
protected Cards sideboard;
protected Cards hand;
protected Cards graveyard;
protected Graveyard graveyard;
protected UUID commanderId;
protected Abilities<Ability> abilities;
protected Counters counters;
@ -245,7 +240,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.name = name;
this.range = range;
hand = new CardsImpl(Zone.HAND);
graveyard = new CardsImpl(Zone.GRAVEYARD);
graveyard = new Graveyard();
abilities = new AbilitiesImpl<>();
counters = new Counters();
manaPool = new ManaPool(playerId);
@ -1485,7 +1480,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
@Override
public Cards getGraveyard() {
public Graveyard getGraveyard() {
return graveyard;
}