mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Some changes to framework objects.
This commit is contained in:
parent
839076755f
commit
8bf72382e4
6 changed files with 82 additions and 54 deletions
|
@ -25,7 +25,6 @@
|
||||||
* 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.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
|
@ -49,7 +49,6 @@ import mage.util.CardUtil;
|
||||||
public class ScryEffect extends OneShotEffect {
|
public class ScryEffect extends OneShotEffect {
|
||||||
|
|
||||||
protected static FilterCard filter1 = new FilterCard("card to put on the bottom of your library");
|
protected static FilterCard filter1 = new FilterCard("card to put on the bottom of your library");
|
||||||
protected static FilterCard filter2 = new FilterCard("card to put on the top of your library (last chosen will be on top)");
|
|
||||||
|
|
||||||
protected int scryNumber;
|
protected int scryNumber;
|
||||||
|
|
||||||
|
@ -91,22 +90,7 @@ public class ScryEffect extends OneShotEffect {
|
||||||
target1.clearChosen();
|
target1.clearChosen();
|
||||||
}
|
}
|
||||||
// move cards to the top of the library
|
// move cards to the top of the library
|
||||||
if (cards.size() > 1) {
|
player.putCardsOnTopOfLibrary(cards, game, source, true);
|
||||||
TargetCard target2 = new TargetCard(Zone.LIBRARY, filter2);
|
|
||||||
while (player.isInGame() && cards.size() > 1) {
|
|
||||||
player.choose(Outcome.Benefit, cards, target2, game);
|
|
||||||
Card card = cards.get(target2.getFirstTarget(), game);
|
|
||||||
if (card != null) {
|
|
||||||
cards.remove(card);
|
|
||||||
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false);
|
|
||||||
}
|
|
||||||
target2.clearChosen();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cards.size() == 1) {
|
|
||||||
Card card = cards.get(cards.iterator().next(), game);
|
|
||||||
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false);
|
|
||||||
}
|
|
||||||
game.fireEvent(new GameEvent(GameEvent.EventType.SCRY, source.getControllerId(), source.getSourceId(), source.getControllerId()));
|
game.fireEvent(new GameEvent(GameEvent.EventType.SCRY, source.getControllerId(), source.getSourceId(), source.getControllerId()));
|
||||||
player.setTopCardRevealed(revealed);
|
player.setTopCardRevealed(revealed);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -74,8 +74,8 @@ public abstract class DraftCube {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int boosterSize = 15;
|
private final int boosterSize = 15;
|
||||||
|
|
||||||
protected List<CardIdentity> cubeCards = new ArrayList<CardIdentity>();
|
protected List<CardIdentity> cubeCards = new ArrayList<>();
|
||||||
protected List<CardIdentity> leftCubeCards = new ArrayList<CardIdentity>();
|
protected List<CardIdentity> leftCubeCards = new ArrayList<>();
|
||||||
|
|
||||||
public DraftCube(String name) {
|
public DraftCube(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -90,7 +90,7 @@ public abstract class DraftCube {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Card> createBooster() {
|
public List<Card> createBooster() {
|
||||||
List<Card> booster = new ArrayList<Card>();
|
List<Card> booster = new ArrayList<>();
|
||||||
if (leftCubeCards.isEmpty()) {
|
if (leftCubeCards.isEmpty()) {
|
||||||
leftCubeCards.addAll(cubeCards);
|
leftCubeCards.addAll(cubeCards);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
package mage.game.draft;
|
package mage.game.draft;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
|
@ -297,7 +297,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
boolean playMana(ManaCost unpaid, Game game);
|
boolean playMana(ManaCost unpaid, Game game);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves the cards form <cards> to the bottom of the players library.
|
* Moves the cards from cards to the bottom of the players library.
|
||||||
*
|
*
|
||||||
* @param cards - list of cards that have to be moved
|
* @param cards - list of cards that have to be moved
|
||||||
* @param game - game
|
* @param game - game
|
||||||
|
@ -307,6 +307,17 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
*/
|
*/
|
||||||
boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder);
|
boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves the cards from cards to the top of players library.
|
||||||
|
*
|
||||||
|
* @param cards - list of cards that have to be moved
|
||||||
|
* @param game - game
|
||||||
|
* @param anyOrder - true if player can determine the order of the cards
|
||||||
|
* @param source - source ability
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean putCardsOnTopOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder);
|
||||||
|
|
||||||
// set the value for X mana spells and abilities
|
// set the value for X mana spells and abilities
|
||||||
int announceXMana(int min, int max, String message, Game game, Ability ability);
|
int announceXMana(int min, int max, String message, Game game, Ability ability);
|
||||||
|
|
||||||
|
|
|
@ -804,6 +804,41 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean putCardsOnTopOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder) {
|
||||||
|
if (cards.size() != 0) {
|
||||||
|
if (!anyOrder) {
|
||||||
|
for (UUID cardId : cards) {
|
||||||
|
Card card =game.getCard(cardId);
|
||||||
|
|
||||||
|
if (card != null) {
|
||||||
|
Zone fromZone = game.getState().getZone(cardId);
|
||||||
|
this.moveCardToLibraryWithInfo(card, source.getSourceId(), game, fromZone, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the top of your library (last one chosen will be topmost)"));
|
||||||
|
target.setRequired(true);
|
||||||
|
while (isInGame() && cards.size() > 1) {
|
||||||
|
this.choose(Outcome.Neutral, cards, target, game);
|
||||||
|
Card chosenCard = cards.get(target.getFirstTarget(), game);
|
||||||
|
if (chosenCard != null) {
|
||||||
|
cards.remove(chosenCard);
|
||||||
|
Zone fromZone = game.getState().getZone(chosenCard.getId());
|
||||||
|
this.moveCardToLibraryWithInfo(chosenCard, source.getSourceId(), game, fromZone, true, false);
|
||||||
|
}
|
||||||
|
target.clearChosen();
|
||||||
|
}
|
||||||
|
if (cards.size() == 1) {
|
||||||
|
Card chosenCard = cards.get(cards.iterator().next(), game);
|
||||||
|
Zone fromZone = game.getState().getZone(chosenCard.getId());
|
||||||
|
this.moveCardToLibraryWithInfo(chosenCard, source.getSourceId(), game, fromZone, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCastSourceIdWithoutMana(UUID sourceId) {
|
public void setCastSourceIdWithoutMana(UUID sourceId) {
|
||||||
castSourceIdWithoutMana = sourceId;
|
castSourceIdWithoutMana = sourceId;
|
||||||
|
|
Loading…
Reference in a new issue