fixed embalm and eternalize sometimes giving the token to the wrong player

This commit is contained in:
Evan Kranzler 2017-10-11 13:00:06 -04:00
parent ab632ef1d0
commit 9b51694908
2 changed files with 41 additions and 39 deletions

View file

@ -105,8 +105,13 @@ class EmbalmEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && card != null) {
if (card == null) {
return false;
}
Player controller = game.getPlayer(card.getOwnerId());
if (controller == null) {
return false;
}
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(card); // needed so that entersBattlefied triggered abilities see the attributes (e.g. Master Biomancer)
token.getColor(game).setColor(ObjectColor.WHITE);
@ -115,13 +120,9 @@ class EmbalmEffect extends OneShotEffect {
}
token.getManaCost().clear();
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EMBALMED_CREATURE, token.getId(), source.getSourceId(), controller.getId()));
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), false, false, null);
token.putOntoBattlefield(1, game, source.getSourceId(), controller.getId(), false, false, null);
// Probably it makes sense to remove also the Embalm ability (it's not shown on the token cards).
// Also it can never get active or? But it's not mentioned in the reminder text.
return true;
}
return false;
}
}

View file

@ -110,8 +110,13 @@ class EternalizeEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && card != null) {
if (card == null) {
return false;
}
Player controller = game.getPlayer(card.getOwnerId());
if (controller == null) {
return false;
}
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(card); // needed so that entersBattlefied triggered abilities see the attributes (e.g. Master Biomancer)
token.getColor(game).setColor(ObjectColor.BLACK);
@ -123,13 +128,9 @@ class EternalizeEffect extends OneShotEffect {
token.getPower().modifyBaseValue(4);
token.getToughness().modifyBaseValue(4);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ETERNALIZED_CREATURE, token.getId(), source.getSourceId(), controller.getId()));
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), false, false, null);
token.putOntoBattlefield(1, game, source.getSourceId(), controller.getId(), false, false, null);
// Probably it makes sense to remove also the Eternalize ability (it's not shown on the token cards).
// Also it can never get active or? But it's not mentioned in the reminder text.
return true;
}
return false;
}
}