Exemplo n.º 1
0
        public static string GetGeneralConditionLabel(Pawn pawn, bool shortVersion = false)
        {
            if (pawn.health.Dead)
            {
                return("Dead".Translate());
            }
            if (!pawn.health.capacities.CanBeAwake)
            {
                return("Unconscious".Translate());
            }
            if (pawn.health.InPainShock)
            {
                return((!shortVersion || !"PainShockShort".CanTranslate()) ? "PainShock".Translate() : "PainShockShort".Translate());
            }
            if (pawn.Downed)
            {
                return("Incapacitated".Translate());
            }
            bool flag = false;

            for (int i = 0; i < pawn.health.hediffSet.hediffs.Count; i++)
            {
                Hediff_Injury hediff_Injury = pawn.health.hediffSet.hediffs[i] as Hediff_Injury;
                if (hediff_Injury != null)
                {
                    if (!hediff_Injury.IsOld())
                    {
                        flag = true;
                    }
                }
            }
            if (flag)
            {
                return("Injured".Translate());
            }
            if (pawn.health.hediffSet.PainTotal > 0.3f)
            {
                return("InPain".Translate());
            }
            return("Healthy".Translate());
        }
Exemplo n.º 2
0
        public override bool TryMergeWith(Hediff other)
        {
            Hediff_Injury hediff_Injury = other as Hediff_Injury;

            return(hediff_Injury != null && hediff_Injury.def == this.def && hediff_Injury.Part == base.Part && !hediff_Injury.IsTended() && !hediff_Injury.IsOld() && !this.IsTended() && !this.IsOld() && this.def.injuryProps.canMerge && base.TryMergeWith(other));
        }
Exemplo n.º 3
0
        private void CalculateOldInjuryDamageThreshold(Pawn pawn, Hediff_Injury injury)
        {
            HediffCompProperties_GetsOld hediffCompProperties_GetsOld = injury.def.CompProps <HediffCompProperties_GetsOld>();

            if (hediffCompProperties_GetsOld != null && !injury.Part.def.IsSolid(injury.Part, pawn.health.hediffSet.hediffs) && !pawn.health.hediffSet.PartOrAnyAncestorHasDirectlyAddedParts(injury.Part) && !injury.IsOld() && !(injury.Part.def.oldInjuryBaseChance < 9.9999997473787516E-06))
            {
                bool isDelicate = injury.Part.def.IsDelicate;
                if ((!(Rand.Value <= injury.Part.def.oldInjuryBaseChance * hediffCompProperties_GetsOld.becomeOldChance) || !(injury.Severity >= injury.Part.def.GetMaxHealth(pawn) * 0.25) || !(injury.Severity >= 7.0)) && !isDelicate)
                {
                    return;
                }
                HediffComp_GetsOld hediffComp_GetsOld = injury.TryGetComp <HediffComp_GetsOld>();
                float num  = 1f;
                float num2 = (float)(injury.Severity / 2.0);
                if (num <= num2)
                {
                    hediffComp_GetsOld.oldDamageThreshold = Rand.Range(num, num2);
                }
                if (isDelicate)
                {
                    hediffComp_GetsOld.oldDamageThreshold = injury.Severity;
                    hediffComp_GetsOld.IsOld = true;
                }
            }
        }
Exemplo n.º 4
0
        private void CalculateOldInjuryDamageThreshold(Pawn pawn, Hediff_Injury injury)
        {
            HediffCompProperties_GetsOld hediffCompProperties_GetsOld = injury.def.CompProps <HediffCompProperties_GetsOld>();

            if (hediffCompProperties_GetsOld == null)
            {
                return;
            }
            if (injury.Part.def.IsSolid(injury.Part, pawn.health.hediffSet.hediffs) || pawn.health.hediffSet.PartOrAnyAncestorHasDirectlyAddedParts(injury.Part) || injury.IsOld() || injury.Part.def.oldInjuryBaseChance < 1E-05f)
            {
                return;
            }
            bool isDelicate = injury.Part.def.IsDelicate;

            if ((Rand.Value <= injury.Part.def.oldInjuryBaseChance * hediffCompProperties_GetsOld.becomeOldChance && injury.Severity >= injury.Part.def.GetMaxHealth(pawn) * 0.25f && injury.Severity >= 7f) || isDelicate)
            {
                HediffComp_GetsOld hediffComp_GetsOld = injury.TryGetComp <HediffComp_GetsOld>();
                float num  = 1f;
                float num2 = injury.Severity / 2f;
                if (num <= num2)
                {
                    hediffComp_GetsOld.oldDamageThreshold = Rand.Range(num, num2);
                }
                if (isDelicate)
                {
                    hediffComp_GetsOld.oldDamageThreshold = injury.Severity;
                    hediffComp_GetsOld.IsOld = true;
                }
            }
        }
Exemplo n.º 5
0
 public static bool CanHealNaturally(this Hediff_Injury hd)
 {
     return(!hd.IsOld());
 }
Exemplo n.º 6
0
 public static bool CanHealFromTending(this Hediff_Injury hd)
 {
     return(hd.IsTended() && !hd.IsOld());
 }