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 void StartAnimationHit(EnumBodyPartHit _bodyPart, int _dir, int _hitDamage, bool _criticalHit, int _movementState, float _random, float _duration)
    {
        SetRandomIndex("PainIndex");
        SetTrigger("Pain");

        base.StartAnimationHit(_bodyPart, _dir, _hitDamage, _criticalHit, _movementState, _random, _duration);
    }
 public void StartAnimationHit(EnumBodyPartHit _bodyPart, int _dir, int _hitDamage, bool _criticalHit, int _movementState, float random)
 {
     //Debug.Log("Ouch my " + _bodyPart.ToString() + " hurts. Damage " + _hitDamage);
     if (!this.HasDied)
     {
         PlayAnimation(Pain);
     }
 }
 public override void StartAnimationHit(EnumBodyPartHit _bodyPart, int _dir, int _hitDamage, bool _criticalHit, int _movementState, float random)
 {
     //    Log("Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name + " hit: "+ _bodyPart.ToString());
     if (this.HasDied || !(bool)(this.ModelTransform.GetComponent <Animation>()[this.AnimationPain]))
     {
         return;
     }
     this.ModelTransform.GetComponent <Animation>().Play(this.AnimationPain);
 }
 public override void CrippleLimb(EnumBodyPartHit _bodyPart, bool restoreState)
 {
     if (_bodyPart.IsLeg() && !this.isCrippled && this.entity.GetWalkType() != 5 && this.entity.GetWalkType() != 4)
     {
         this.isCrippled = true;
         this.SetInt("WalkType", 5);
         this.SetTrigger("LegDamageTrigger");
     }
 }
Exemple #6
0
    public void StartAnimationHit(EnumBodyPartHit _bodyPart, int _dir, int _hitDamage, bool _criticalHit, int _movementState, float random)
    {
        // If it's dead, or if there's no Animation pain, don't do anything.
        if (this.HasDied)
        {
            return;
        }

        PlayAnimation(this.AnimationPain);
    }
 public override void StartAnimationHit(EnumBodyPartHit _bodyPart, int _dir, int _hitDamage, bool _criticalHit, int _movementState, float _random)
 {
     this.SetInt("BodyPartHit", (int)_bodyPart);
     this.SetInt("HitDirection", _dir);
     this.SetInt("HitDamage", _hitDamage);
     this.SetBool("CriticalHit", _criticalHit);
     this.SetInt("MovementState", _movementState);
     this.SetInt("Random", Mathf.FloorToInt(_random * 100f));
     this.SetRandomIndex("PainIndex");
     this.SetTrigger("Pain");
 }
    public override void BeginStun(EnumEntityStunType stun, EnumBodyPartHit _bodyPart, Utils.EnumHitDirection _hitDirection, bool _criticalHit, float random)
    {
        this.SetRandomIndex("StunIndex");
        this.SetBool("IsStunned", true);

        this.SetInt("StunType", (int)stun);
        this.SetInt("StunBodyPart", (int)_bodyPart);
        this.SetInt("HitDirection", (int)_hitDirection);
        this.SetBool("isCritical", _criticalHit);
        this.SetFloat("HitRandomValue", random);
        this.SetTrigger("BeginStunTrigger");
        this.ResetTrigger("EndStunTrigger");
    }
Exemple #9
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));
    }
Exemple #10
0
 // Starts the death animation
 public override void StartDeathAnimation(EnumBodyPartHit _bodyPart, int _movementState, float _random)
 {
     SetRandomIndex("DeathIndex");
     base.StartDeathAnimation(_bodyPart, _movementState, _random);
 }
 public override void CrippleLimb(EnumBodyPartHit _bodyPart, bool restoreState)
 {
 }
 public override void BeginStun(EnumEntityStunType stun, EnumBodyPartHit _bodyPart, bool _criticalHit, float random)
 {
     //  Log("Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name);
 }
 public new void StartDeathAnimation(EnumBodyPartHit _bodyPart, int _movementState, float random)
 {
     //    Log("Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name);
 }
 public override void RemoveLimb(EnumBodyPartHit _bodyPart, bool restoreState)
 {
     //  Log("Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name);
 }
Exemple #15
0
    public void RemoveLimb(EnumBodyPartHit _bodyPart, bool restoreState)
    {
        switch (_bodyPart)
        {
        case EnumBodyPartHit.Head:
            if (!headDismembered)
            {
                headDismembered = true;
                neck.localScale = Vector3.zero;
                SpawnLimbGore(neckGore, "Prefabs/HeadGore", restoreState);
            }

            break;

        case EnumBodyPartHit.LeftUpperArm:
            if (!leftUpperArmDismembered)
            {
                leftUpperArmDismembered = true;
                leftUpperArm.localScale = Vector3.zero;
                SpawnLimbGore(leftUpperArmGore, "Prefabs/UpperArmGore", restoreState);
            }

            break;

        case EnumBodyPartHit.RightUpperArm:
            if (!rightUpperArmDismembered)
            {
                rightUpperArmDismembered = true;
                rightUpperArm.localScale = Vector3.zero;
                SpawnLimbGore(rightUpperArmGore, "Prefabs/UpperArmGore", restoreState);
            }

            break;

        case EnumBodyPartHit.LeftUpperLeg:
            if (!leftUpperLegDismembered)
            {
                leftUpperLegDismembered = true;
                leftUpperLeg.localScale = Vector3.zero;
                SpawnLimbGore(leftUpperLegGore, "Prefabs/UpperLegGore", restoreState);
            }

            break;

        case EnumBodyPartHit.RightUpperLeg:
            if (!rightUpperLegDismembered)
            {
                rightUpperLegDismembered = true;
                rightUpperLeg.localScale = Vector3.zero;
                SpawnLimbGore(rightUpperLegGore, "Prefabs/UpperLegGore", restoreState);
            }

            break;

        case EnumBodyPartHit.LeftLowerArm:
            if (!leftLowerArmDismembered)
            {
                leftLowerArmDismembered = true;
                leftLowerArm.localScale = Vector3.zero;
                SpawnLimbGore(leftLowerArmGore, "Prefabs/LowerArmGore", restoreState);
            }

            break;

        case EnumBodyPartHit.RightLowerArm:
            if (!rightLowerArmDismembered)
            {
                rightLowerArmDismembered = true;
                rightLowerArm.localScale = Vector3.zero;
                SpawnLimbGore(rightLowerArmGore, "Prefabs/LowerArmGore", restoreState);
            }

            break;

        case EnumBodyPartHit.LeftLowerLeg:
            if (!leftLowerLegDismembered)
            {
                leftLowerLegDismembered = true;
                leftLowerLeg.localScale = Vector3.zero;
                SpawnLimbGore(leftLowerLegGore, "Prefabs/LowerLegGore", restoreState);
            }

            break;

        case EnumBodyPartHit.RightLowerLeg:
            if (!rightLowerLegDismembered)
            {
                rightLowerLegDismembered = true;
                rightLowerLeg.localScale = Vector3.zero;
                SpawnLimbGore(rightLowerLegGore, "Prefabs/LowerLegGore", restoreState);
            }

            break;
        }
    }
    public override void RemoveLimb(EnumBodyPartHit _bodyPart, bool restoreState)
    {
        switch (_bodyPart)
        {
        case EnumBodyPartHit.Head:
            if (!this.headDismembered)
            {
                this.headDismembered = true;
                this.neck.localScale = Vector3.zero;
                this.SpawnLimbGore(this.neckGore, "Prefabs/HeadGore", restoreState);
            }
            break;

        case EnumBodyPartHit.LeftUpperArm:
            if (!this.leftUpperArmDismembered)
            {
                this.leftUpperArmDismembered = true;
                this.leftUpperArm.localScale = Vector3.zero;
                this.SpawnLimbGore(this.leftUpperArmGore, "Prefabs/UpperArmGore", restoreState);
            }
            break;

        case EnumBodyPartHit.RightUpperArm:
            if (!this.rightUpperArmDismembered)
            {
                this.rightUpperArmDismembered = true;
                this.rightUpperArm.localScale = Vector3.zero;
                this.SpawnLimbGore(this.rightUpperArmGore, "Prefabs/UpperArmGore", restoreState);
            }
            break;

        case EnumBodyPartHit.LeftUpperLeg:
            if (!this.leftUpperLegDismembered)
            {
                this.leftUpperLegDismembered = true;
                this.leftUpperLeg.localScale = Vector3.zero;
                this.SpawnLimbGore(this.leftUpperLegGore, "Prefabs/UpperLegGore", restoreState);
            }
            break;

        case EnumBodyPartHit.RightUpperLeg:
            if (!this.rightUpperLegDismembered)
            {
                this.rightUpperLegDismembered = true;
                this.rightUpperLeg.localScale = Vector3.zero;
                this.SpawnLimbGore(this.rightUpperLegGore, "Prefabs/UpperLegGore", restoreState);
            }
            break;

        case EnumBodyPartHit.LeftLowerArm:
            if (!this.leftLowerArmDismembered)
            {
                this.leftLowerArmDismembered = true;
                this.leftLowerArm.localScale = Vector3.zero;
                this.SpawnLimbGore(this.leftLowerArmGore, "Prefabs/LowerArmGore", restoreState);
            }
            break;

        case EnumBodyPartHit.RightLowerArm:
            if (!this.rightLowerArmDismembered)
            {
                this.rightLowerArmDismembered = true;
                this.rightLowerArm.localScale = Vector3.zero;
                this.SpawnLimbGore(this.rightLowerArmGore, "Prefabs/LowerArmGore", restoreState);
            }
            break;

        case EnumBodyPartHit.LeftLowerLeg:
            if (!this.leftLowerLegDismembered)
            {
                this.leftLowerLegDismembered = true;
                this.leftLowerLeg.localScale = Vector3.zero;
                this.SpawnLimbGore(this.leftLowerLegGore, "Prefabs/LowerLegGore", restoreState);
            }
            break;

        case EnumBodyPartHit.RightLowerLeg:
            if (!this.rightLowerLegDismembered)
            {
                this.rightLowerLegDismembered = true;
                this.rightLowerLeg.localScale = Vector3.zero;
                this.SpawnLimbGore(this.rightLowerLegGore, "Prefabs/LowerLegGore", restoreState);
            }
            break;
        }
    }
Exemple #17
0
 // Starts the death animation
 public void StartDeathAnimation(EnumBodyPartHit _bodyPart, int _movementState, float _random)
 {
     SetRandomIndex("DeathIndex");
     anim.SetBool("IsDead", true);
 }
Exemple #18
0
 // starts the Stun Animation
 public void BeginStun(EnumEntityStunType stun, EnumBodyPartHit _bodyPart, bool _criticalHit,
                       float random)
 {
     SetRandomIndex("StunIndex");
     anim.SetBool("IsStunned", true);
 }
Exemple #19
0
 public override void BeginStun(EnumEntityStunType stun, EnumBodyPartHit _bodyPart, Utils.EnumHitDirection _hitDirection, bool _criticalHit, float random)
 {
     SetRandomIndex("StunIndex");
     SetBool("IsStunned", true);
 }
Exemple #20
0
 // ANimation for when the entity gets hit
 public void StartAnimationHit(EnumBodyPartHit _bodyPart, int _dir, int _hitDamage, bool _criticalHit,
                               int _movementState, float _random)
 {
     SetRandomIndex("PainIndex");
     anim.SetTrigger("Pain");
 }
Exemple #21
0
 // starts the Stun Animation
 public override void BeginStun(EnumEntityStunType stun, EnumBodyPartHit _bodyPart, Utils.EnumHitDirection _hitDirection, bool _criticalHit,
                                float random)
 {
     SetRandomIndex("StunIndex");
     base.BeginStun(stun, _bodyPart, _hitDirection, _criticalHit, random);
 }
 public void BeginStun(EnumEntityStunType stun, EnumBodyPartHit _bodyPart, bool _criticalHit, float random)
 {
     // throw new NotImplementedException();
 }
 public void StartDeathAnimation(EnumBodyPartHit _bodyPart, int _movementState, float random)
 {
     PlayAnimation(Death);
 }
 public void CrippleLimb(EnumBodyPartHit _bodyPart, bool restoreState)
 {
     //  throw new NotImplementedException();
 }
 public void RemoveLimb(EnumBodyPartHit _bodyPart, bool restoreState)
 {
 }