/// <summary> /// Turns this body part into ash while protecting items inside of that cannot be ashed. /// </summary> private void AshBodyPart() { if (currentBurnDamageLevel >= TraumaDamageLevel.CRITICAL) { if (this.BodyPartType == BodyPartType.Chest || this.BodyPartType == BodyPartType.Head) { return; //TODO is temporary weighting on Trauma discussion } IEnumerable <ItemSlot> internalItemList = OrganStorage.GetItemSlots(); foreach (ItemSlot item in internalItemList) { Integrity itemObject = item.ItemObject.OrNull()?.GetComponent <Integrity>(); if (itemObject != null) //Incase this is an empty slot { if (itemObject.Resistances.FireProof || itemObject.Resistances.Indestructable) { Inventory.ServerDrop(item); } } } _ = Spawn.ServerPrefab(OrganStorage.AshPrefab, HealthMaster.RegisterTile.WorldPosition); HealthMaster.DismemberBodyPart(this); _ = Despawn.ServerSingle(gameObject); } }
/// <summary> /// Checks if the cut is big enough for the contained organs to escape. /// If the cut isn't big enough or has failed a chance check, apply internal damage + bleeding. /// </summary> private void Disembowel() { BodyPart randomBodyPart = ContainBodyParts.GetRandom(); float chance = UnityEngine.Random.Range(0.0f, 1.0f); if (chance >= spillChanceWhenCutPresent) { foreach (var bodyPart in ContainBodyParts) { chance = UnityEngine.Random.Range(0.0f, 1.0f); if (chance >= spillChanceWhenCutPresent) { HealthMaster.DismemberBodyPart(bodyPart); } } } else { randomBodyPart.ApplyInternalDamage(); } if (currentPierceDamageLevel >= TraumaDamageLevel.SMALL && isBleedingExternally == false && IsSurface) { StartCoroutine(ExternalBleedingLogic()); } }
/// <summary> /// Checks if the cut is big enough for the contained organs to escape. /// If the cut isn't big enough or has failed a chance check, apply internal damage + bleeding. /// </summary> private void Disembowel() { BodyPart randomBodyPart = OrganList.GetRandom().GetComponent <BodyPart>(); BodyPart randomCustomBodyPart = OptionalOrgans.GetRandom(); float chance = UnityEngine.Random.Range(0.0f, 1.0f); if (chance >= spillChanceWhenCutPresent) { HealthMaster.DismemberBodyPart(randomBodyPart); if (randomCustomBodyPart != null) { HealthMaster.DismemberBodyPart(randomCustomBodyPart); } } else { randomBodyPart.ApplyInternalDamage(); if (randomCustomBodyPart != null) { randomCustomBodyPart.ApplyInternalDamage(); } } if (currentPierceDamageLevel >= TraumaDamageLevel.SMALL && isBleedingExternally == false && IsSurface) { StartCoroutine(ExternalBleedingLogic()); } }
/// <summary> /// Checks if the player is lucky enough and is wearing enough protective armor to avoid getting his bodypart removed. /// </summary> private void DismemberBodyPartWithChance() { if (GibChance == 0) { return; } var armorChanceModifer = GibChance - SelfArmor.DismembermentProtectionChance; if (Severity == DamageSeverity.Max) { armorChanceModifer += 25; //Make it more likely that the bodypart can be gibbed in it's worst condition. } var chance = UnityEngine.Random.Range(0, 100); if (chance < armorChanceModifer) { HealthMaster.DismemberBodyPart(this); } }
/// <summary> /// Checks if the player is lucky enough and is wearing enough protective armor to avoid getting his bodypart removed. /// </summary> private void DismemberBodyPartWithChance() { if (GibChance == 0) { return; } var armorChanceModifer = GibChance - SelfArmor.DismembermentProtectionChance; if (Severity == DamageSeverity.Max) { armorChanceModifer += 25; //Make it more likely that the bodypart can be gibbed in it's worst condition. } var chance = UnityEngine.Random.Range(0, 100); if (chance < armorChanceModifer) { if (this.BodyPartType == BodyPartType.Chest || this.BodyPartType == BodyPartType.Head) { return; //TODO is temporary weighting on Trauma discussion } HealthMaster.DismemberBodyPart(this); } }