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; package mage.sets.judgment;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -36,8 +37,6 @@ import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPlayer; 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. // 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().addEffect(new BookBurningMillEffect());
this.getSpellAbility().addTarget(new TargetPlayer()); this.getSpellAbility().addTarget(new TargetPlayer());
} }
public BookBurning(final BookBurning card) { public BookBurning(final BookBurning card) {
@ -71,7 +69,7 @@ class BookBurningMillEffect extends OneShotEffect {
public BookBurningMillEffect() { public BookBurningMillEffect() {
super(Outcome.Detriment); 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) {
@ -83,37 +81,26 @@ class BookBurningMillEffect extends OneShotEffect {
return new BookBurningMillEffect(this); return new BookBurningMillEffect(this);
} }
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game);
if (controller == null) { if (sourceObject != null) {
return false; boolean millCards = true;
} for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
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)){
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
if (player != null && player.chooseUse(Outcome.Detriment, "Have " + spell.getLogName() + " deal 6 damage to you?", source, game)){ if (player != null && player.chooseUse(Outcome.Detriment, "Have " + sourceObject.getLogName() + " deal 6 damage to you?", source, game)) {
MillCards = false; millCards = false;
player.damage(6, source.getSourceId(), game, false, true); 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) { if (millCards) {
UUID targetPlayer = getTargetPointer().getFirst(game, source); Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
if (targetPlayer != null) { if (targetPlayer != null) {
Player player = game.getPlayer(targetPlayer); targetPlayer.moveCards(targetPlayer.getLibrary().getTopCards(game, 6), Zone.LIBRARY, Zone.GRAVEYARD, source, game);
player.moveCards(player.getLibrary().getTopCards(game, 6), Zone.LIBRARY, Zone.GRAVEYARD, source, game);
} }
} }
return MillCards; return true;
} }
return false; return false;
} }