Design - In Practice
This covers some things you may want to do in practice.
Once you add the Attributes and Vitals components to some Avatar/Agent you have in your game then you can start interacting with the data that they hold. You will need to put formulas somewhere, perhaps inline in your classes that interface with attributes, which will calculate results based on the attributes of some character(s).
Here are some common use cases and how they might work.
Add one level to the character.
myAttributesClass.AddLevel(1);
Multiply some 'base damage' by the current strength. (This is a huge, unrealistic increase)
int myDmgOutput = (int)(myBaseDamage * myAttributesClass.GetBase(AttType.Strength));
Reduce incoming damage by the Endurance (This is a huge, unrealistic decrease)
int reducedDamage = (int)(incomingDamage / myAttributesClass.Get(AttType.Endurance));
Requires an
AttributeModifierPreset
. Design an appropriate modifier preset in Vault, then reference it from a class. Feel free to design your own modifiers.public AttributeModifierPreset EffectModifier; // select your "weaken" effect here, for example.
public virtual void Cast(IAttributesUser source, IAttributesUser target)
{
// simply tell the attributes system to attach it, and it'll do the rest.
target.Attributes.AttachModifier(EffectModifier, source);
}
Last modified 1yr ago