Implement Attribute System #2
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is super rough just to get ideas on the page. Will be much clearer with a proof of concept.
As with all roguelike rpgs, we need some way to describe an Attribute Set (hp, str, dex, etc) along with ways to provide temporary or permenant changes to these attributes. To do this we need to create an Attribute system that has the following core ideas:
Attribute
AttributeSet
Effect
AttributeSystem
- Stored on a character or other object with attributes
- Can contain many AttributeSets
- Entry point for applying Effects
- Manages lifecycle of applied Effects
Lets say we pickup an item that gives our units 20% more health for 10 seconds. We would grab all the units, apply an Effect to their AttributeSystem. The attribute system will then start managing the lifecycle of the Effect. Each tick, the AttributeSystem will go through all its active Effects, reprocess them and update the current value of the attributes, remove effects no longer valid.
Just a note: "a float" won't really be able to capture the idle game spirit. I think we'll want some variety of arbitrary precision number. Doubles may suffice, depending on final balancing, but I'm hesitant to include the possibility of infinities.
Since duders and enemies have different stats, is the idea to make AttributeSet an interface with a
public Attribute Get(someAttrEnum)
?Attribute and Effect are implemented, at least to an extent. AttributeSet and AttributeSystem are not. I feel like we can hold off on those for a while and go ahead with #3.
Sounds good to me.