* Fixed that calling the destroy method for an object of the class permanent did move the card in game but shouldn't (#6571).

This commit is contained in:
LevelX2 2020-06-03 15:06:12 +02:00
parent 47af865bc3
commit f65f4a4344

View file

@ -1112,14 +1112,18 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@Override
public boolean destroy(UUID sourceId, Game game, boolean noRegen) {
// Only permanets on the battlefield can be destroyed
if (!game.getState().getZone(getId()).equals(Zone.BATTLEFIELD)) {
return false;
}
//20091005 - 701.6
if (abilities.containsKey(IndestructibleAbility.getInstance().getId())) {
return false;
}
if (!game.replaceEvent(GameEvent.getEvent(EventType.DESTROY_PERMANENT, objectId, sourceId, controllerId, noRegen ? 1 : 0))) {
// this means destroy was successful, if object movement to graveyard will be replaced (e.g. commander to command zone) its still
// is handled as successful destroying (but not as sucessful "dies this way" for destroying).
// this means destroy was successful, if object movement to graveyard will be replaced (e.g. commander to command zone) it's still
// handled as successful destroying (but not as sucessful "dies this way" for destroying).
if (moveToZone(Zone.GRAVEYARD, sourceId, game, false)) {
if (!game.isSimulation()) {
String logName;