This Announcements library implements a relatively simple extension of the observer pattern for permitting the observers of an event to communicate amongst eachother and with the publisher of the event.
Many implementations of the observer pattern use fixed strings as events,
but Announcements uses objects.
Indeed,
any object can be announced,
and each observer can call whichever methods on that object that it wishes.

The hello world of announcements is observing a value that changes.
So let's walk through such an implementation.
You'll probably be adding announcements to existing code only once you discover that you need the observer pattern,
so let's start with something whose values changes and then add announcement logic to it.

Say we want to track whether the character has ever teleported. Because teleportation can be used to escape from difficult fights, you could have a special challenge for beating the game without teleporting. We could implement this by changing the teleport function.

But instead let's write it as an announcement so that we can decouple the teleportation logic from the conduct logic. The first step is to declare an announcement class that represents the "we are about to teleport" event.

Teleports always send you to a random spot on the map. But say you want to implement an artifact that grants teleport control. If the character is holding this artifact and is teleported, then the player can pick the teleport's destination.

Some levels in our game forbid teleportation for various reasons. Let's say we want to implement that behavior as an announcement to avoid polluting the character's teleport method with "are we on a level that blocks teleportation?" logic.