diff options
author | Joel Kronqvist <joel.kronqvist@iki.fi> | 2024-11-17 22:32:25 +0200 |
---|---|---|
committer | Joel Kronqvist <joel.kronqvist@iki.fi> | 2024-11-17 22:32:25 +0200 |
commit | a98f089035dbcc94c14c9cd6246c3150bee84241 (patch) | |
tree | 228ffa0d5e4a3e86c454cd297644c97abc994ef3 /src/scalevalapokalypsi/Model/Event.scala | |
parent | c954ca4d1ec677a34a6d787a23f9d01396f7e585 (diff) | |
download | scalevalapokalypsi-a98f089035dbcc94c14c9cd6246c3150bee84241.tar.gz scalevalapokalypsi-a98f089035dbcc94c14c9cd6246c3150bee84241.zip |
Improved client recovery from singing & added better logic for observations
The logic should still be implemented for all observations
Diffstat (limited to 'src/scalevalapokalypsi/Model/Event.scala')
-rw-r--r-- | src/scalevalapokalypsi/Model/Event.scala | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/scalevalapokalypsi/Model/Event.scala b/src/scalevalapokalypsi/Model/Event.scala new file mode 100644 index 0000000..cba611d --- /dev/null +++ b/src/scalevalapokalypsi/Model/Event.scala @@ -0,0 +1,28 @@ +package scalevalapokalypsi.Model + +import scalevalapokalypsi.Model.Entities.Entity + +/** A description of an action. + * + * @param target the entity that was as a target in this event + * @param inFirstPerson textual description of the event in first person + * @param inThirdPerson textual description of the event in third person + */ +class Event( + val target: Entity, + val inFirstPerson: String, + val inThirdPerson: String +): + + /** Gets the description of this event as seen by the given + * entity. Note that this method does no checks whether the given entity + * could even see the event, only what it would have looked like to them. + * + * @param entity the entity whose perspective to use + * @return a textual description of the event + */ + def descriptionFor(entity: Entity): String = + if entity == target then inFirstPerson + else inThirdPerson + +end Event
\ No newline at end of file |