rle.core.player.event
Class PlayerEvent
java.lang.Object
rle.core.player.event.PlayerEvent
public class PlayerEvent
- extends java.lang.Object
Receives notification of events caused by actions the player takes and things that
happen to the player. These are high level events intended to convey that certain
things have occurred, not necessarily supply the details.
Examples of possible events fired by common situations:
1. Player quaffs a potion of speed; speed goes from 10 to 20
Event Type: player/events/item-use
Source: the item
Note: This event would NOT be fired to actually cause whatever action the
item causes to occur. It is merely notifying interested listeners
that the item HAS BEEN USED. Anticipated uses along this line are for
item flags such as {tried}.
Event Type: player/events/observe-item-action
Source: the item
Note that there would also be associated RuntimeDataEvents and DisposalEvents,
but these are low level events with details outside the scope of a PlayerEvent.
2. Player is chased into a corner gets hit by 2 of 3 blows from a monster.
Event Type: player/events/observe-creature-movement
Source: the monster
Note: This event would be fired to indicate that a creature's movement
abilities had been observed. This would include if the creature
had been seen to be incapable of movement. Observing movement
would probably imply knowledge of speed as well.
Event Type: player/events/observe-creature-melee
Source: the monster
Params: blows=claw1,bite
Note: The blows parameter is an example of a possible implementation. Assuming that monsters
blows are defined in the VM as child nodes, the monster in question might have blows
at the path monster/dragon/young-red/blows, with the id's claw1, claw2, and bite. The
params in this case indicate that the first and third attacks succeeded, and were
therefore observed. By tradition, "misses" have not been observed by Monster Memories
in Angband.
These events deal with item id, where implementations might use listeners to affect item
memory, thereby effectively using the listener to complete the action. This is a design
choice; I do not know yet whether it would be good or bad.
3. Player uses an identify scroll on an item.
Event Type: player/events/item-id
Source: the item
Params: type=identify
Event Type: player/events/item-use
Source: the identify scroll
Note: this is just like above with the potion of speed.
Event Type: player/events/observe-item-action
Source: the identify scroll
Note: An implementation could decide that posting an observe-item-action
event obviates the need for an item-use event.
4. Player pseudo-ids a piece of armor.
Event Type: player/events/item-id
Source: the item
Params: type=pseudo
5. Player tries to destroy an item, but fails because it is an artifact.
Event Type: player/events/item-id
Source: the item
Params: type=destructability
6. Player enters a new level
Event Type: player/events/level-enter
Source: the level
Note: Events of this type might notify a class to evaluate the level's rating
and possibly show a message indicating a "level feeling" as in Angband.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PlayerEvent
public PlayerEvent()