Minor changes to Book Burning.

This commit is contained in:
LevelX2 2015-09-19 12:04:31 +02:00
parent a08a6f5136
commit aa78456aca

View file

@ -28,6 +28,7 @@
package mage.sets.judgment;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
@ -36,8 +37,6 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.TargetPlayer;
@ -54,7 +53,6 @@ public class BookBurning extends CardImpl {
// Any player may have Book Burning deal 6 damage to him or her. If no one does, target player puts the top six cards of his or her library into his or her graveyard.
this.getSpellAbility().addEffect(new BookBurningMillEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
public BookBurning(final BookBurning card) {
@ -68,53 +66,42 @@ public class BookBurning extends CardImpl {
}
class BookBurningMillEffect extends OneShotEffect {
public BookBurningMillEffect() {
public BookBurningMillEffect() {
super(Outcome.Detriment);
staticText = "Any player may have {source} deal 6 damage to him or her. If no one does, target player puts the top six cards of his or her library into his or her graveyard.";
staticText = "Any player may have {source} deal 6 damage to him or her. If no one does, target player puts the top six cards of his or her library into his or her graveyard";
}
public BookBurningMillEffect(final BookBurningMillEffect effect) {
public BookBurningMillEffect(final BookBurningMillEffect effect) {
super(effect);
}
@Override
public BookBurningMillEffect copy() {
return new BookBurningMillEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
StackObject spell = null;
for(StackObject object : game.getStack()){
if(object instanceof Spell && object.getSourceId().equals(source.getSourceId())){
spell = object;
}
}
if(spell != null){
boolean MillCards = true;
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)){
MageObject sourceObject = source.getSourceObject(game);
if (sourceObject != null) {
boolean millCards = true;
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null && player.chooseUse(Outcome.Detriment, "Have " + spell.getLogName() + " deal 6 damage to you?", source, game)){
MillCards = false;
if (player != null && player.chooseUse(Outcome.Detriment, "Have " + sourceObject.getLogName() + " deal 6 damage to you?", source, game)) {
millCards = false;
player.damage(6, source.getSourceId(), game, false, true);
game.informPlayers(player.getLogName() + " has " + spell.getLogName() + " deal 6 to him or her");
game.informPlayers(player.getLogName() + " has " + sourceObject.getLogName() + " deal 6 damage to him or her");
}
}
if (MillCards) {
UUID targetPlayer = getTargetPointer().getFirst(game, source);
if (millCards) {
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
if (targetPlayer != null) {
Player player = game.getPlayer(targetPlayer);
player.moveCards(player.getLibrary().getTopCards(game, 6), Zone.LIBRARY, Zone.GRAVEYARD, source, game);
targetPlayer.moveCards(targetPlayer.getLibrary().getTopCards(game, 6), Zone.LIBRARY, Zone.GRAVEYARD, source, game);
}
}
return MillCards;
}
return true;
}
return false;
}
}
}