public void ChangeZone(IZone destination, Action <Card> add) { var source = _zone.Value; Asrt.False(destination == source, "Cannot change zones, when source zone and destination zone are the same."); source.Remove(this); _zone.Value = destination; add(this); if (destination.Name != source.Name) { Publish(new ZoneChangedEvent(this, source.Name, destination.Name)); // triggered abilities which trigger when permanent is in play only // are removed when AfterRemove is called so // we publish event first and then do the cleanup source.AfterRemove(this); destination.AfterAdd(this); } }
public void ChangeZone(IZone destination, Action<Card> add) { var source = _zone.Value; //Asrt.False(destination == source, // "Cannot change zones, when source zone and destination zone are the same."); source.Remove(this); _zone.Value = destination; add(this); if (destination.Name != source.Name) { Publish(new ZoneChangedEvent(this, source.Name, destination.Name)); // triggered abilities which trigger when permanent is in play only // are removed when AfterRemove is called so // we publish event first and then do the cleanup source.AfterRemove(this); destination.AfterAdd(this); } }