forked from External/mage
* Fixed a bug were abilities could trigger when a permanent was moved to graveyard but the triggering ability from the moved permanent were removed at that time.
This commit is contained in:
parent
bb9dd1600e
commit
ee6aa7a1e2
2 changed files with 26 additions and 29 deletions
|
|
@ -637,10 +637,8 @@ public abstract class AbilityImpl implements Ability {
|
|||
public void setSourceId(UUID sourceId) {
|
||||
if (this.sourceId == null) {
|
||||
this.sourceId = sourceId;
|
||||
} else {
|
||||
if (!(this instanceof MageSingleton)) {
|
||||
this.sourceId = sourceId;
|
||||
}
|
||||
} else if (!(this instanceof MageSingleton)) {
|
||||
this.sourceId = sourceId;
|
||||
}
|
||||
if (subAbilities != null) {
|
||||
for (Ability subAbility : subAbilities) {
|
||||
|
|
@ -970,10 +968,13 @@ public abstract class AbilityImpl implements Ability {
|
|||
object = game.getObject(getSourceId());
|
||||
}
|
||||
}
|
||||
if (object != null && !object.getAbilities().contains(this)) {
|
||||
if (object != null) {
|
||||
if (object instanceof Permanent) {
|
||||
return false;
|
||||
} else {
|
||||
if (!((Permanent) object).getAbilities(game).contains(this)) {
|
||||
return false;
|
||||
}
|
||||
return ((Permanent) object).isPhasedIn();
|
||||
} else if (!object.getAbilities().contains(this)) {
|
||||
// check if it's an ability that is temporary gained to a card
|
||||
Abilities<Ability> otherAbilities = game.getState().getAllOtherAbilities(this.getSourceId());
|
||||
if (otherAbilities == null || !otherAbilities.contains(this)) {
|
||||
|
|
@ -981,9 +982,6 @@ public abstract class AbilityImpl implements Ability {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (object instanceof Permanent) {
|
||||
return ((Permanent) object).isPhasedIn();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1060,18 +1058,16 @@ public abstract class AbilityImpl implements Ability {
|
|||
} else {
|
||||
sb.append(GameLog.getColoredObjectIdName(object));
|
||||
}
|
||||
} else {
|
||||
if (object instanceof Spell) {
|
||||
Spell spell = (Spell) object;
|
||||
String castText = spell.getSpellCastText(game);
|
||||
sb.append((castText.startsWith("Cast ") ? castText.substring(5) : castText));
|
||||
if (spell.getFromZone() == Zone.GRAVEYARD) {
|
||||
sb.append(" from graveyard");
|
||||
}
|
||||
sb.append(getOptionalTextSuffix(game, spell));
|
||||
} else {
|
||||
sb.append(GameLog.getColoredObjectIdName(object));
|
||||
} else if (object instanceof Spell) {
|
||||
Spell spell = (Spell) object;
|
||||
String castText = spell.getSpellCastText(game);
|
||||
sb.append((castText.startsWith("Cast ") ? castText.substring(5) : castText));
|
||||
if (spell.getFromZone() == Zone.GRAVEYARD) {
|
||||
sb.append(" from graveyard");
|
||||
}
|
||||
sb.append(getOptionalTextSuffix(game, spell));
|
||||
} else {
|
||||
sb.append(GameLog.getColoredObjectIdName(object));
|
||||
}
|
||||
} else {
|
||||
sb.append("unknown");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue