public static bool Prefix(EntityAlive __instance, ref DamageSource _damageSource, ref int _strength, bool _criticalHit, float _impulseScale)
 {
     // Apply a damage boost if there is a head shot.
     if (__instance is EntityZombie)
     {
         if (_strength > 999)
         {
             AdvLogging.DisplayLog(AdvFeatureClass, " Massive Damage Detected. Falling back to base");
             return(true);
         }
         if (Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
         {
             EnumBodyPartHit bodyPart = _damageSource.GetEntityDamageBodyPart(__instance);
             if (bodyPart == EnumBodyPartHit.Head)
             {
                 AdvLogging.DisplayLog(AdvFeatureClass, " Headshot Mode Active: Headshot! ");
                 // Apply a damage multiplier for the head shot, and bump the dismember bonus for the head shot
                 // This will allow the heads to go explode off, which according to legend, if the only want to truly kill a zombie.
                 _damageSource.DamageMultiplier = 1f;
                 // _strength = 1;
                 _damageSource.DismemberChance = 0.8f;
             }
             // Reducing the damage to the torso will prevent the entity from being killed by torso shots, while also maintaining de-limbing.
             else
             {
                 AdvLogging.DisplayLog(AdvFeatureClass, " Headshot Mode Active: Non-Headshot");
                 _damageSource.DamageMultiplier = 0.1f;
                 _strength = 1;
             }
         }
     }
     return(true);
 }
Exemple #2
0
    public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale)
    {
        if (blHeadShotsMatter)
        {
            EnumBodyPartHit bodyPart = _damageSource.GetEntityDamageBodyPart(this);
            if (bodyPart == EnumBodyPartHit.Head)
            {
                // Apply a damage multiplier for the head shot, and bump the dismember bonus for the head shot
                // This will allow the heads to go explode off, which according to legend, if the only want to truly kill a zombie.
                _damageSource.DamageMultiplier = 1f;
                _damageSource.DismemberChance  = 0.08f;
            }
            // Reducing the damage to the torso will prevent the entity from being killed by torso shots, while also maintaining de-limbing.
            else if (bodyPart == EnumBodyPartHit.Torso)
            {
                _damageSource.DamageMultiplier = 0.1f;
            }
        }

        return(base.DamageEntity(_damageSource, _strength, _criticalHit, _impulseScale));
    }