public DamageInfo(DamageDef def, float amount, float armorPenetration = 0f, float angle = -1f, Thing instigator = null, BodyPartRecord hitPart = null, ThingDef weapon = null, DamageInfo.SourceCategory category = DamageInfo.SourceCategory.ThingOrUnknown, Thing intendedTarget = null)
 {
     this.defInt              = def;
     this.amountInt           = amount;
     this.armorPenetrationInt = armorPenetration;
     if (angle < 0f)
     {
         this.angleInt = (float)Rand.RangeInclusive(0, 359);
     }
     else
     {
         this.angleInt = angle;
     }
     this.instigatorInt             = instigator;
     this.categoryInt               = category;
     this.hitPartInt                = hitPart;
     this.heightInt                 = BodyPartHeight.Undefined;
     this.depthInt                  = BodyPartDepth.Undefined;
     this.weaponInt                 = weapon;
     this.weaponBodyPartGroupInt    = null;
     this.weaponHediffInt           = null;
     this.instantPermanentInjuryInt = false;
     this.allowDamagePropagationInt = true;
     this.intendedTargetInt         = intendedTarget;
 }
Пример #2
0
 public DamageInfo(DamageDef def, float amount, float armorPenetration = 0f, float angle = -1f, Thing instigator = null, BodyPartRecord hitPart = null, ThingDef weapon = null, SourceCategory category = SourceCategory.ThingOrUnknown, Thing intendedTarget = null)
 {
     defInt              = def;
     amountInt           = amount;
     armorPenetrationInt = armorPenetration;
     if (angle < 0f)
     {
         angleInt = Rand.RangeInclusive(0, 359);
     }
     else
     {
         angleInt = angle;
     }
     instigatorInt                  = instigator;
     categoryInt                    = category;
     hitPartInt                     = hitPart;
     heightInt                      = BodyPartHeight.Undefined;
     depthInt                       = BodyPartDepth.Undefined;
     weaponInt                      = weapon;
     weaponBodyPartGroupInt         = null;
     weaponHediffInt                = null;
     instantPermanentInjuryInt      = false;
     allowDamagePropagationInt      = true;
     ignoreArmorInt                 = false;
     ignoreInstantKillProtectionInt = false;
     intendedTargetInt              = intendedTarget;
 }
Пример #3
0
 public bool IsInGroup(BodyPartGroupDef group)
 {
     for (int i = 0; i < this.groups.Count; i++)
     {
         if (this.groups[i] == group)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #4
0
 public DamageInfo(DamageInfo cloneSource)
 {
     this.defInt                    = cloneSource.defInt;
     this.amountInt                 = cloneSource.amountInt;
     this.angleInt                  = cloneSource.angleInt;
     this.instigatorInt             = cloneSource.instigatorInt;
     this.categoryInt               = cloneSource.categoryInt;
     this.hitPartInt                = cloneSource.hitPartInt;
     this.heightInt                 = cloneSource.heightInt;
     this.depthInt                  = cloneSource.depthInt;
     this.weaponInt                 = cloneSource.weaponInt;
     this.weaponBodyPartGroupInt    = cloneSource.weaponBodyPartGroupInt;
     this.weaponHediffInt           = cloneSource.weaponHediffInt;
     this.instantOldInjuryInt       = cloneSource.instantOldInjuryInt;
     this.allowDamagePropagationInt = cloneSource.allowDamagePropagationInt;
 }
Пример #5
0
 public DamageInfo(DamageInfo cloneSource)
 {
     defInt                    = cloneSource.defInt;
     amountInt                 = cloneSource.amountInt;
     armorPenetrationInt       = cloneSource.armorPenetrationInt;
     angleInt                  = cloneSource.angleInt;
     instigatorInt             = cloneSource.instigatorInt;
     categoryInt               = cloneSource.categoryInt;
     hitPartInt                = cloneSource.hitPartInt;
     heightInt                 = cloneSource.heightInt;
     depthInt                  = cloneSource.depthInt;
     weaponInt                 = cloneSource.weaponInt;
     weaponBodyPartGroupInt    = cloneSource.weaponBodyPartGroupInt;
     weaponHediffInt           = cloneSource.weaponHediffInt;
     instantPermanentInjuryInt = cloneSource.instantPermanentInjuryInt;
     allowDamagePropagationInt = cloneSource.allowDamagePropagationInt;
     intendedTargetInt         = cloneSource.intendedTargetInt;
 }
 public void SetWeaponBodyPartGroup(BodyPartGroupDef gr)
 {
     this.weaponBodyPartGroupInt = gr;
 }
Пример #7
0
        public static float CalculateNaturalPartsAverageEfficiency(HediffSet diffSet, BodyPartGroupDef bodyPartGroup)
        {
            float num  = 0f;
            int   num2 = 0;

            foreach (BodyPartRecord item in from x in diffSet.GetNotMissingParts()
                     where x.groups.Contains(bodyPartGroup)
                     select x)
            {
                if (!diffSet.PartOrAnyAncestorHasDirectlyAddedParts(item))
                {
                    num += CalculatePartEfficiency(diffSet, item);
                }
                num2++;
            }
            if (num2 == 0 || num < 0f)
            {
                return(0f);
            }
            return(num / (float)num2);
        }
        public static float CalculateNaturalPartsAverageEfficiency(HediffSet diffSet, BodyPartGroupDef bodyPartGroup)
        {
            float num  = 0f;
            int   num2 = 0;
            IEnumerable <BodyPartRecord> enumerable = from x in diffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined, null, null)
                                                      where x.groups.Contains(bodyPartGroup)
                                                      select x;

            foreach (BodyPartRecord current in enumerable)
            {
                if (!diffSet.PartOrAnyAncestorHasDirectlyAddedParts(current))
                {
                    num += PawnCapacityUtility.CalculatePartEfficiency(diffSet, current, false, null);
                }
                num2++;
            }
            if (num2 == 0 || num < 0f)
            {
                return(0f);
            }
            return(num / (float)num2);
        }