public float GetDamageFactorFor(Tool tool, Pawn attacker, HediffComp_VerbGiver hediffCompSource)
        {
            float num = 1f;

            if (attacker != null)
            {
                if (hediffCompSource != null)
                {
                    num *= PawnCapacityUtility.CalculatePartEfficiency(hediffCompSource.Pawn.health.hediffSet, hediffCompSource.parent.Part, ignoreAddedParts: true);
                }
                else if (attacker != null && AdjustedLinkedBodyPartsGroup(tool) != null)
                {
                    float num2 = PawnCapacityUtility.CalculateNaturalPartsAverageEfficiency(attacker.health.hediffSet, AdjustedLinkedBodyPartsGroup(tool));
                    if (AdjustedEnsureLinkedBodyPartsGroupAlwaysUsable(tool))
                    {
                        num2 = Mathf.Max(num2, 0.4f);
                    }
                    num *= num2;
                }
                if (attacker != null && IsMeleeAttack)
                {
                    num *= attacker.ageTracker.CurLifeStage.meleeDamageFactor;
                }
            }
            return(num);
        }
Exemple #2
0
        public float GetDamageFactorFor(Pawn pawn)
        {
            float num = 1f;

            if (pawn != null)
            {
                if (this.ownerHediffComp != null)
                {
                    num *= PawnCapacityUtility.CalculatePartEfficiency(this.ownerHediffComp.Pawn.health.hediffSet, this.ownerHediffComp.parent.Part, true, null);
                }
                else if (this.LinkedBodyPartsGroup != null)
                {
                    float num2 = PawnCapacityUtility.CalculateNaturalPartsAverageEfficiency(pawn.health.hediffSet, this.LinkedBodyPartsGroup);
                    if (this.EnsureLinkedBodyPartsGroupAlwaysUsable)
                    {
                        num2 = Mathf.Max(num2, 0.4f);
                    }
                    num *= num2;
                }
                if (this.IsMeleeAttack)
                {
                    num *= pawn.ageTracker.CurLifeStage.meleeDamageFactor;
                }
            }
            return(num);
        }
Exemple #3
0
 public float GetDamageFactorFor(Pawn pawn)
 {
     if (pawn != null)
     {
         if (this.ownerHediffComp != null)
         {
             return(PawnCapacityUtility.CalculatePartEfficiency(this.ownerHediffComp.Pawn.health.hediffSet, this.ownerHediffComp.parent.Part, true, null));
         }
         if (this.LinkedBodyPartsGroup != null)
         {
             return(PawnCapacityUtility.CalculateNaturalPartsAverageEfficiency(pawn.health.hediffSet, this.LinkedBodyPartsGroup));
         }
     }
     return(1f);
 }