Hello.
For me, when I create an armor for torso of 5 additive modificator, my hit points given by enemy dramatically collapse.
I barely unbreakable.
here is my log during the fight:
.
The enemies who have no defence correctly lost there hit point but not me.
I precise I have this kind of result with or without armor modification.
with armor:
here is my armor resource :
For information Percentage modifier works correctly, by adding my player 20% more life.
here is the enemies progression:
so 5/8 = 0.625 as in the course.
And my code in fighter script:
private void Hit()
{
//Si on sort du combat avant la frame qui déclenche l'event hit, alors on ne lit pas la suite du code. Evite le message d'erreur NullReferenceException
if(target == null) {return;}
float damage = GetComponent<BaseStats>().GetStat(Stat.Damage);
BaseStats targetBaseStats = target.GetComponent<BaseStats>();
if(targetBaseStats != null)
{
float defence = targetBaseStats.GetStat(Stat.Defence);
damage /= 1 + defence / damage;
}
if(currentWeapon.value != null)
{
currentWeapon.value.OnHit();
}
if(currentWeaponConfig.HasProjectile())//Si l'arme actuelle est une arme à munitions
{
currentWeaponConfig.LaunchProjectile(rightHandTransform, leftHandTransform, target, gameObject, damage);
}else{
target.TakeDamage(gameObject, damage);//target étant relié directement au script Healt, on lance la méthode TakeDamage à chaque event hit.
}//gameObject represente la personne qui inflige les dégats.
}
Any Idea?
Thanks
François