Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding origin information to Buffs #14

Open
sherpal opened this issue Dec 31, 2020 · 0 comments
Open

Adding origin information to Buffs #14

sherpal opened this issue Dec 31, 2020 · 0 comments

Comments

@sherpal
Copy link
Owner

sherpal commented Dec 31, 2020

Currently, a Buff on an entity does not bear any information on how this buff actually appeared.

This is annoying because it prevents for doing later things depending on the source (for example, who put the debuff/buff in the first place).

I believe this can be fixed by adding to Buff a type parameter Source representing the type of information representing the source. For exemple it could be Entity.Id to tell that the buff was placed by that entity. Then concrete implementations of Buffs should have a value source: Source.
We could also be a bit more restrictive and create an ADT with possible sources, and ask that as a parameter. This, I believe, will fulfil everything that we need and will ease many other implementations.

Such an ADT could look like

sealed trait Source

case class FromEntity(entityId: Entity.Id) extends Source
case object FromGame extends Source
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant