コード例 #1
0
        /// <summary>
        /// Applies trauma damage to the body part, checks if it has enough protective armor to cancel the trauma damage
        /// </summary>
        public void ApplyTraumaDamage(TraumaticDamageTypes damageType = TraumaticDamageTypes.SLASH, bool ignoreSeverityCheck = false)
        {
            if (Severity < DamageSeverity.Bad && ignoreSeverityCheck == false)
            {
                return;
            }
            //We use dismember protection chance because it's the most logical value.
            if (DMMath.Prob(SelfArmor.DismembermentProtectionChance) == false)
            {
                if (damageType == TraumaticDamageTypes.SLASH)
                {
                    currentSlashDamageLevel += 1;
                }
                if (damageType == TraumaticDamageTypes.PIERCE)
                {
                    currentPierceDamageLevel += 1;
                }
            }
            //Burn and blunt damage checks for it's own armor damage type.
            if (damageType == TraumaticDamageTypes.BURN)
            {
                TakeBurnDamage();
            }

            if (damageType == TraumaticDamageTypes.BLUNT && DMMath.Prob(SelfArmor.Melee * 100) == false)
            {
                TakeBluntDamage();
            }
        }
コード例 #2
0
 private void TakeBurnDamage(float burnDamage)
 {
     if (SelfArmor.Fire < burnDamage)
     {
         currentBurnDamage     += burnDamage;
         currentBurnDamageLevel = CheckTraumaDamageLevels(currentBurnDamage);
         CheckCharredBodyPart();
     }
 }
コード例 #3
0
 /// <summary>
 /// Checks how big is the cut is right now.
 /// Additonally ensures that all Trauma damage levels are updated to make sure cut size logic is correct everywhere.
 /// </summary>
 private void CheckCutSize()
 {
     currentBurnDamageLevel   = CheckTraumaDamageLevels(currentBurnDamage);
     currentSlashDamageLevel  = CheckTraumaDamageLevels(currentSlashCutDamage);
     currentPierceDamageLevel = CheckTraumaDamageLevels(currentPierceDamage);
     CheckCharredBodyPart();
     currentCutSize = GetCutSize(currentSlashDamageLevel);
     currentCutSize = GetCutSize(currentPierceDamageLevel);
 }
コード例 #4
0
 private void TakeBurnDamage()
 {
     if (SelfArmor.Fire < TotalDamage)
     {
         currentBurnDamageLevel += 1;
         CheckCharredBodyPart();
         AshBodyPart();
     }
 }
コード例 #5
0
 public void TakeBluntLogic(LivingHealthMasterBase healthmaster, BodyPart containedIn)
 {
     if (currentBluntDamageLevel == TraumaDamageLevel.SMALL && DMMath.Prob(dislocationAutoHealPercent))
     {
         currentBluntDamageLevel = TraumaDamageLevel.NONE;
         AnnounceJointHealEvent(healthmaster, containedIn);
         return;
     }
     currentBluntDamageLevel += 1;
     AnnounceJointDislocationEvent(healthmaster, containedIn);
 }
コード例 #6
0
 private void CheckCharredBodyPart()
 {
     if (currentBurnDamage >= 75)
     {
         if (currentBurnDamageLevel != TraumaDamageLevel.CRITICAL)                //So we can do this once.
         {
             foreach (var sprite in RelatedPresentSprites)
             {
                 sprite.baseSpriteHandler.SetColor(bodyPartColorWhenCharred);
             }
         }
         currentBurnDamageLevel = TraumaDamageLevel.CRITICAL;
         AshBodyPart();
     }
 }
コード例 #7
0
 public void HealTraumaticDamage(TraumaticDamageTypes damageTypeToHeal)
 {
     if (damageTypeToHeal == TraumaticDamageTypes.BURN)
     {
         currentBurnDamageLevel -= 1;
     }
     if (damageTypeToHeal == TraumaticDamageTypes.SLASH)
     {
         currentSlashDamageLevel -= 1;
     }
     if (damageTypeToHeal == TraumaticDamageTypes.PIERCE)
     {
         currentPierceDamageLevel -= 1;
     }
 }
コード例 #8
0
        /// <summary>
        /// Returns cut size level based on trauma damage levels.
        /// </summary>
        /// <param name="traumaLevel">TraumaDamageLevel current[trauma]level</param>
        /// <returns>BodyPartCutSize</returns>
        private BodyPartCutSize GetCutSize(TraumaDamageLevel traumaLevel)
        {
            switch (traumaLevel)
            {
            case TraumaDamageLevel.NONE:
                return(BodyPartCutSize.NONE);

            case TraumaDamageLevel.SMALL:
                return(BodyPartCutSize.SMALL);

            case TraumaDamageLevel.SERIOUS:
                return(BodyPartCutSize.MEDIUM);

            case TraumaDamageLevel.CRITICAL:
                return(BodyPartCutSize.LARGE);

            default:
                Logger.LogError(
                    $"Unexpected cut size on: {gameObject}, {currentCutSize}");
                return(BodyPartCutSize.NONE);
            }
        }