forked from External/mage
* Fixed target hadnling of PreventDamageBySourceEffect (fixes #952).
This commit is contained in:
parent
1f44e1a592
commit
6403fff12b
4 changed files with 168 additions and 7 deletions
|
|
@ -32,6 +32,7 @@ import java.util.UUID;
|
|||
import mage.cards.Card;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
|
||||
/**
|
||||
* A object reference that takes zone changes into account.
|
||||
|
|
@ -61,7 +62,7 @@ public class MageObjectReference implements Comparable<MageObjectReference> {
|
|||
this.zoneChangeCounter = zoneChangeCounter;
|
||||
}
|
||||
|
||||
public MageObjectReference(UUID sourceId, Game game) {
|
||||
public MageObjectReference(UUID sourceId, Game game) {
|
||||
this.sourceId = sourceId;
|
||||
MageObject mageObject = game.getObject(sourceId);
|
||||
if (mageObject != null) {
|
||||
|
|
@ -110,6 +111,9 @@ public class MageObjectReference implements Comparable<MageObjectReference> {
|
|||
|
||||
public boolean refersTo(MageObject mageObject, Game game) {
|
||||
if (mageObject != null) {
|
||||
if (mageObject instanceof Spell) {
|
||||
return ((Spell)mageObject).getSourceId().equals(sourceId) && this.zoneChangeCounter == mageObject.getZoneChangeCounter(game);
|
||||
}
|
||||
return mageObject.getId().equals(sourceId) && this.zoneChangeCounter == mageObject.getZoneChangeCounter(game);
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue