Merge origin/master

This commit is contained in:
Temba 2015-03-19 18:41:21 +02:00
commit e9d03c83fd
10 changed files with 100 additions and 37 deletions

View file

@ -60,7 +60,7 @@ public class DragonlordKolaghan extends CardImpl {
this.supertype.add("Legendary");
this.subtype.add("Elder");
this.subtype.add("Dragon");
this.power = new MageInt(5);
this.power = new MageInt(6);
this.toughness = new MageInt(5);
// Flying

View file

@ -66,7 +66,7 @@ public class OjutaisSummons extends CardImpl {
class DjinnMonkToken extends Token {
DjinnMonkToken() {
super("Djinn Monk", "2/2 blue Djinn Monk creature token");
super("Djinn Monk", "2/2 blue Djinn Monk creature token with flying");
cardType.add(CardType.CREATURE);
color.setBlue(true);
subtype.add("Djinn");

View file

@ -61,7 +61,7 @@ public class SurrakTheHuntCaller extends CardImpl {
Ability ability = new ConditionalTriggeredAbility(
new BeginningOfCombatTriggeredAbility(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn), TargetController.YOU, false),
FormidableCondition.getInstance(),
"<i>Formidable</i> &mdash; Whenever {this} attacks, if creatures you control have total power 8 or greater, creatures you control gain trample until end of turn.");
"<i>Formidable</i> &mdash; Whenever {this} attacks, if creatures you control have total power 8 or greater, target creature you control gains haste until end of turn.");
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
}

View file

@ -54,17 +54,18 @@ public class JaceBeleren extends CardImpl {
this.color.setBlue(true);
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
// +2: Each player draws a card.
this.addAbility(new LoyaltyAbility(new DrawCardAllEffect(1), 2));
// -1: Target player draws a card.
LoyaltyAbility ability1 = new LoyaltyAbility(new DrawCardTargetEffect(1), -1);
ability1.addTarget(new TargetPlayer());
this.addAbility(ability1);
// -10: Target player puts the top twenty cards of his or her library into his or her graveyard.
LoyaltyAbility ability2 = new LoyaltyAbility(new PutLibraryIntoGraveTargetEffect(20), -10);
ability2.addTarget(new TargetPlayer());
this.addAbility(ability2);
}
public JaceBeleren(final JaceBeleren card) {

View file

@ -35,7 +35,6 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.players.Player;
@ -50,7 +49,7 @@ public class Traumatize extends CardImpl {
public Traumatize(UUID ownerId) {
super(ownerId, 119, "Traumatize", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{U}{U}");
this.expansionSetCode = "10E";
this.color.setBlue(true);
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addEffect(new TraumatizeEffect());
}
@ -79,17 +78,12 @@ class TraumatizeEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
Card card;
int amount = player.getLibrary().size() / 2;
for (int i = 0; i < amount; i++) {
card = player.getLibrary().removeFromTop(game);
if (card != null) {
card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, false);
} else {
break;
}
if (player != null) {
int amount = player.getLibrary().size() / 2;
player.moveCardsToGraveyardWithInfo(player.getLibrary().getTopCards(game, amount), source, game, Zone.LIBRARY);
return true;
}
return true;
return false;
}
@Override
@ -97,4 +91,4 @@ class TraumatizeEffect extends OneShotEffect {
return new TraumatizeEffect(this);
}
}
}

View file

@ -35,7 +35,6 @@ import mage.abilities.Mode;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
@ -77,15 +76,7 @@ public class PutLibraryIntoGraveTargetEffect extends OneShotEffect {
if (player != null) {
// putting cards to grave shouldn't end the game, so getting minimun available
int cardsCount = Math.min(amount.calculate(game, source, this), player.getLibrary().size());
for (int i = 0; i < cardsCount; i++) {
Card card = player.getLibrary().getFromTop(game);
if (card != null) {
player.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
}
else {
break;
}
}
player.moveCardsToGraveyardWithInfo(player.getLibrary().getTopCards(game, cardsCount), source, game, Zone.LIBRARY);
return true;
}
return false;
@ -98,7 +89,7 @@ public class PutLibraryIntoGraveTargetEffect extends OneShotEffect {
sb.append("Target ").append(mode.getTargets().get(0).getTargetName());
sb.append(" puts the top ");
if (message.isEmpty()) {
if (message.isEmpty()) {
if (amount.toString().equals("1")) {
sb.append("card ");
} else {

View file

@ -31,6 +31,8 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
@ -98,12 +100,9 @@ class DredgeEffect extends ReplacementEffectImpl {
&& player.chooseUse(outcome, new StringBuilder("Dredge ").append(sourceCard.getName()).
append("? (").append(amount).append(" cards go from top of library to graveyard)").toString(), game)) {
game.informPlayers(new StringBuilder(player.getName()).append(" dreges ").append(sourceCard.getName()).toString());
for (int i = 0; i < amount; i++) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
player.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
}
}
Cards cardsToGrave = new CardsImpl();
cardsToGrave.addAll(player.getLibrary().getTopCards(game, amount));
player.moveCardsToGraveyardWithInfo(cardsToGrave, source, game, Zone.LIBRARY);
player.moveCardToHandWithInfo(sourceCard, source.getSourceId(), game, Zone.GRAVEYARD);
return true;
}

View file

@ -60,7 +60,7 @@ public enum CardRepository {
// raise this if db structure was changed
private static final long CARD_DB_VERSION = 36;
// raise this if new cards were added to the server
private static final long CARD_CONTENT_VERSION = 7;
private static final long CARD_CONTENT_VERSION = 8;
private final Random random = new Random();
private Dao<CardInfo, Object> cardDao;

View file

@ -461,6 +461,22 @@ public interface Player extends MageItem, Copyable<Player> {
*/
boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone);
/**
* Moves 1 to n cards to the graveyard. The owner of the cards may determine the order,
* if more than one card is moved to graveyard.
* Uses card.moveToZone and posts a inform message about moving the card to graveyard
* into the game log
*
* @param cards
* @param source
* @param game
* @param fromZone if null, this info isn't postet
* @return
*/
boolean moveCardsToGraveyardWithInfo(Cards cards, Ability source, Game game, Zone fromZone);
boolean moveCardsToGraveyardWithInfo(List<Card> cards, Ability source, Game game, Zone fromZone);
/**
* Uses card.moveToZone and posts a inform message about moving the card to graveyard
* into the game log

View file

@ -2764,7 +2764,69 @@ public abstract class PlayerImpl implements Player, Serializable {
}
return result;
}
@Override
public boolean moveCardsToGraveyardWithInfo(Cards allCards, Ability source, Game game, Zone fromZone) {
ArrayList<Card> cards = new ArrayList<>();
cards.addAll(allCards.getCards(game));
return moveCardsToGraveyardWithInfo(cards, source, game, fromZone);
}
@Override
public boolean moveCardsToGraveyardWithInfo(List<Card> allCards, Ability source, Game game, Zone fromZone) {
while (!allCards.isEmpty()) {
// identify cards from one owner
Cards cards = new CardsImpl();
UUID ownerId = null;
for (Card card: allCards) {
if (cards.isEmpty()) {
ownerId = card.getOwnerId();
}
if (card.getOwnerId().equals(ownerId)) {
cards.add(card);
}
}
allCards.removeAll(cards);
// move cards ot graveyard in order the owner decides
if (cards.size() != 0) {
TargetCard target = new TargetCard(fromZone, new FilterCard("card to put on the top of your graveyard (last one chosen will be topmost)"));
target.setRequired(true);
Player choosingPlayer = this;
if (ownerId != this.getId()) {
choosingPlayer = game.getPlayer(ownerId);
}
if (choosingPlayer == null) {
continue;
}
boolean chooseOrder = true;
if (cards.size() > 2) {
chooseOrder = choosingPlayer.chooseUse(Outcome.Neutral, "Do you like to choose the order the cards go to graveyard?", game);
}
if (chooseOrder) {
while (choosingPlayer.isInGame() && cards.size() > 1) {
choosingPlayer.chooseTarget(Outcome.Neutral, cards, target, source, game);
UUID targetObjectId = target.getFirstTarget();
Card card = cards.get(targetObjectId, game);
cards.remove(targetObjectId);
if (card != null) {
choosingPlayer.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, fromZone);
}
target.clearChosen();
}
if (cards.size() == 1) {
choosingPlayer.moveCardToGraveyardWithInfo(cards.getCards(game).iterator().next(), source.getSourceId(), game, fromZone);
}
} else {
for (Card card : cards.getCards(game)) {
choosingPlayer.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, fromZone);
}
}
}
}
return true;
}
@Override
public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) {
boolean result = false;