rbreslow / zs

Fork of JetBoom's Zombie Survival for the "Hot Dad" Garry's Mod community.
Other
1 stars 1 forks source link

Modify Bullet Knockback Per Zombie Base HP #58

Open johnnymoe opened 4 years ago

johnnymoe commented 4 years ago

Preface:

Currently— weapon knockback is a great feature of these weapons but is overly powerful against larger zombies. We need to add a modifier for zombie classes where the higher the base HP of the zombie, the less knockback they receive. Per Homonovus "use EntityTakeDamage, you can modify the force given per bullet with the CTakeDamageInfo object." This should be implemented per each zombie class.

Body:

The amount of knockback reduction per base HP should be handled as such:

For the default zombie class:

int zombieHealth = 225;

double zombieKnockback = ((zombieHealth * 10) / 100) -100;

double zombieKnockbackInverse = abs(zombieKnockback); // take the absolute value of zombieKnockback

Closing:

Therefore the zombie would only receive 77.5% of the knockback from any weapon blast. This only needs to be calculated once. I'm not entirely sure but this may need to be represented as a decimal instead of a percentage, so .775 out of 1.

This also means any zombie with over 1000 health, aka most bosses, will receive no knockback whatsoever.

Ultimately the percentage will probably need to be tweaked and trialed. This is just a starting point.