Fix #3481 - Swans of Bryn Argoll didn't realize an emblem can deal damage to it, so it couldn't find the source of the damage when Chandra, Torch of Defiance's emblem deals damage.

This commit is contained in:
Will Hall 2017-06-09 20:34:14 -07:00
parent df35f03d2d
commit 9247d34d8a

View file

@ -42,6 +42,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.command.CommandObject;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
@ -100,6 +101,7 @@ class SwansOfBrynArgollEffect extends PreventionEffectImpl {
if (sourceOfDamage != null) {
Spell spell = game.getStack().getSpell(sourceOfDamage.getId());
Permanent permanent = game.getPermanentOrLKIBattlefield(sourceOfDamage.getId());
CommandObject emblem = (CommandObject)game.getEmblem(sourceOfDamage.getId());
if (spell != null) {
Player controllerOfSpell = game.getPlayer(spell.getControllerId());
controllerOfSpell.drawCards(preventionEffectData.getPreventedDamage(), game);
@ -110,6 +112,11 @@ class SwansOfBrynArgollEffect extends PreventionEffectImpl {
controllerOfPermanent.drawCards(preventionEffectData.getPreventedDamage(), game);
passed = true;
}
if (emblem != null) {
Player controllerOfEmblem = game.getPlayer(emblem.getControllerId());
controllerOfEmblem.drawCards(preventionEffectData.getPreventedDamage(), game);
passed = true;
}
if (!passed) {
// Needed for cards that do damage from hand e.g. Gempalm Incinerator
Card cardSource = game.getCard(event.getSourceId());