StatModifiers are handled by the StatsComponent and they have the ability to change the value of a player Stat.
Player Stats are : Resistances, States, Attribut. And in addition modifiers can modify : Health, Stamina, AttackSpeed and MoveSpeed.
Two functions resides inside the StatModifier : The ApplyModifier() function will apply the modifier to given StatsComponent and the UnapplyModifier() will remove the modifier from the StatsComponent.
Note : You can see an example of that when we equip weapons and armors : The weapons and armors can add modifiers to the Player.
Effects are handled by an EffectHandler Component.
Effects are of two kinds : DamageEffects damage a target (potentially over time), and StatsModifierEffects wrap a StatModifier. Each time a StatsModifierEffect is applied to an EffectHandler, the StatModifier handled by the Effect will be applied to the target (Note : The Target is the StatsComponent handled by the TargetComponent referenced inside the EffectHandler. You initialize it in the Init() function), and will be removed once the Effects is destroyed.
Effects are designed to be automatically handled by the EffectHandler Component. You can setup the EffectDuration variable of an effect. After this duration, the Effect is automatically destroyed. If you want an effect to remain active forever, then you can set a negative value for its EffectDuration variable. With a value of 0, the EffectHandler will launch the effect once and will immediatly destroy it after that. It doesn't realy make sens for StatsModifierEffects but it is usefull for DamageEffect if you want such an effect to damage a target immediatly and not over the time.
There are different kind of Damage. They are enumerated inside the EDamageType enumeration :
The three Components which handle Damages are : the StatsComponent (Which stores Health), the TargetComponent (Which is the "physical" representation of a generic target in the world), and the DamageDealerComponent (Which stores Damages that he will use to damage the target, via the DealDamageToTarget() function).
The DamageDealerComponent stores the main damage it will use to damage the target, but also additional infos :
Note : Weapons have a DamageDealerComponent which is responsible for dealing damage to the weapon target. You can directly setup values inside this component but you can also use the Data Driven approach and use data tables to initialise the weapon variables.
Damages are countered by Resistances. The damage computation is performed inside the TakeDamage() function of the StatsComponent. It uses the IsDamageCounteredByResistance() and the GetResistanceValueForDamage() functions in addition to the DamageToResistanceMapping map.
If you modify the resistances, don't forget to modify this map and the IsDamageCounteredByResitance() function !