Esempio n. 1
0
    public override void OnTakeDamage(DamageInfo info)
    {
        base.OnTakeDamage(info);
        if (info.m_FromInjury)
        {
            return;
        }
        Limb limb = EnumTools.ConvertInjuryPlaceToLimb(info.m_InjuryPlace);

        if (limb == Limb.None)
        {
            limb = Limb.LArm;
        }
        if (this.m_LimbMap[(int)limb].m_ArmorType == ArmorType.None || this.m_LimbMap[(int)limb].IsArmorDestroyed())
        {
            return;
        }
        this.m_ScheduleTakeDamage = true;
        this.m_DamageToTake       = info.m_Damage * this.GetAbsorption(limb);
        if (info.m_DamageType == DamageType.SnakePoison || info.m_DamageType == DamageType.VenomPoison)
        {
            this.m_DamageToTake *= this.m_PoisonDamageMul;
        }
        this.m_DamageLimb = limb;
    }
Esempio n. 2
0
    public bool NoArmorAfterDamage(DamageInfo damage_info)
    {
        Limb limb = EnumTools.ConvertInjuryPlaceToLimb(damage_info.m_InjuryPlace);

        if (limb == Limb.None)
        {
            return(true);
        }
        if (this.m_LimbMap[(int)limb].m_ArmorType == ArmorType.None || this.m_LimbMap[(int)limb].IsArmorDestroyed())
        {
            return(true);
        }
        float num = damage_info.m_Damage * this.GetAbsorption(limb);

        if (damage_info.m_DamageType == DamageType.SnakePoison || damage_info.m_DamageType == DamageType.VenomPoison)
        {
            num *= this.m_PoisonDamageMul;
        }
        return(num >= this.m_LimbMap[(int)limb].m_AttachedArmor.m_Info.m_Health);
    }
Esempio n. 3
0
 public override bool CanInsertItem(Item item)
 {
     if (this.m_Injury == null)
     {
         return(false);
     }
     if (this.m_Injury.m_ParentInjury != null)
     {
         return(false);
     }
     if (PlayerArmorModule.Get().IsArmorActive(EnumTools.ConvertInjuryPlaceToLimb(this.m_InjuryPlace)) && HUDBodyInspection.Get().m_ArmorEnabled)
     {
         return(false);
     }
     if (this.m_Injury.m_State == InjuryState.Infected)
     {
         return(!(this.m_Injury.m_Bandage != null) && this.m_Injury.m_Slot.m_Maggots == null && (item.m_Info.m_ID == ItemID.Maggots || item.m_Info.m_ID == ItemID.Honey_Dressing));
     }
     if (this.m_Injury.m_Type == InjuryType.SmallWoundAbrassion || this.m_Injury.m_Type == InjuryType.SmallWoundScratch || this.m_Injury.m_Type == InjuryType.WormHole)
     {
         if (this.m_Injury.m_Type == InjuryType.WormHole && this.m_Injury.m_State == InjuryState.WormInside && (item.m_Info.m_ID == ItemID.Fish_Bone || item.m_Info.m_ID == ItemID.Bone_Needle))
         {
             return(true);
         }
         if (this.m_Injury.m_Bandage != null)
         {
             return(false);
         }
         if (item.m_Info.m_Type == ItemType.Dressing)
         {
             return(true);
         }
     }
     else if (this.m_Injury.m_Type == InjuryType.Worm || (this.m_Injury.m_Type == InjuryType.WormHole && this.m_Injury.m_State == InjuryState.WormInside))
     {
         if (item.m_Info.m_ID == ItemID.Fish_Bone || item.m_Info.m_ID == ItemID.Bone_Needle)
         {
             return(true);
         }
     }
     else if (this.m_Injury.m_Type == InjuryType.VenomBite || this.m_Injury.m_Type == InjuryType.SnakeBite)
     {
         if (item.m_Info.m_ID == ItemID.Tabaco_Dressing || item.m_Info.m_ID == ItemID.lily_dressing)
         {
             return(true);
         }
     }
     else if ((this.m_Injury.m_Type == InjuryType.Laceration || this.m_Injury.m_Type == InjuryType.LacerationCat) && (this.m_Injury.m_State == InjuryState.Bleeding || this.m_Injury.m_State == InjuryState.Open))
     {
         if (item.m_Info.m_ID == ItemID.Ants)
         {
             return(true);
         }
         if (item.m_Info.m_ID == ItemID.ash_dressing || item.m_Info.m_ID == ItemID.Goliath_dressing || item.m_Info.m_ID == ItemID.Honey_Dressing || item.m_Info.m_ID == ItemID.Leaf_Bandage)
         {
             return(true);
         }
     }
     if (this.m_Injury.m_Type == InjuryType.Rash)
     {
         if (this.m_Injury.m_Bandage != null)
         {
             return(false);
         }
         if (item.m_Info.m_ID == ItemID.lily_dressing || item.m_Info.m_ID == ItemID.Honey_Dressing)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 4
0
    public override void OnTakeDamage(DamageInfo info)
    {
        base.OnTakeDamage(info);
        if (info.m_Blocked)
        {
            return;
        }
        float num = info.m_Damage;

        info.m_InjuryPlace = this.GetInjuryPlaceFromHit(info);
        if (!info.m_FromInjury)
        {
            Limb limb = EnumTools.ConvertInjuryPlaceToLimb(info.m_InjuryPlace);
            if (limb == Limb.None)
            {
                limb = Limb.LArm;
            }
            if (info.m_DamageType != DamageType.Fall && info.m_DamageType != DamageType.SnakePoison && info.m_DamageType != DamageType.VenomPoison && info.m_DamageType != DamageType.Insects && info.m_DamageType != DamageType.Infection)
            {
                num = info.m_Damage * (1f - PlayerArmorModule.Get().GetAbsorption(limb));
            }
            PlayerArmorModule.Get().SetPhaseCompleted(ArmorTakeDamagePhase.InjuryModule);
        }
        float num2 = 5f;

        if ((num > num2 && PlayerArmorModule.Get().NoArmorAfterDamage(info)) || info.m_DamageType == DamageType.Insects || info.m_DamageType == DamageType.SnakePoison || info.m_DamageType == DamageType.VenomPoison || info.m_DamageType == DamageType.Fall || info.m_DamageType == DamageType.Infection)
        {
            BIWoundSlot biwoundSlot = null;
            DamageType  damageType  = info.m_DamageType;
            InjuryType  injuryType;
            if (damageType <= DamageType.Claws)
            {
                if (damageType <= DamageType.Melee)
                {
                    if (damageType - DamageType.Cut > 1)
                    {
                        if (damageType == DamageType.Melee)
                        {
                            injuryType = InjuryType.SmallWoundAbrassion;
                            goto IL_17F;
                        }
                    }
                    else
                    {
                        if (info.m_CriticalHit)
                        {
                            injuryType = InjuryType.Laceration;
                            goto IL_17F;
                        }
                        injuryType = InjuryType.SmallWoundScratch;
                        goto IL_17F;
                    }
                }
                else
                {
                    if (damageType == DamageType.VenomPoison)
                    {
                        injuryType = InjuryType.VenomBite;
                        goto IL_17F;
                    }
                    if (damageType == DamageType.Claws)
                    {
                        injuryType = InjuryType.LacerationCat;
                        goto IL_17F;
                    }
                }
            }
            else if (damageType <= DamageType.Fall)
            {
                if (damageType == DamageType.Insects)
                {
                    injuryType = InjuryType.Rash;
                    goto IL_17F;
                }
                if (damageType == DamageType.Fall)
                {
                    injuryType = InjuryType.SmallWoundAbrassion;
                    goto IL_17F;
                }
            }
            else
            {
                if (damageType == DamageType.Critical)
                {
                    injuryType = InjuryType.Laceration;
                    goto IL_17F;
                }
                if (damageType == DamageType.SnakePoison)
                {
                    injuryType = InjuryType.SnakeBite;
                    goto IL_17F;
                }
            }
            injuryType = InjuryType.SmallWoundAbrassion;
IL_17F:
            if (!info.m_FromInjury && (injuryType == InjuryType.VenomBite || injuryType == InjuryType.SnakeBite))
            {
                Disease disease = PlayerDiseasesModule.Get().GetDisease(ConsumeEffect.Fever);
                if (disease != null && disease.IsActive())
                {
                    disease.IncreaseLevel(1);
                }
                else
                {
                    PlayerDiseasesModule.Get().RequestDisease(ConsumeEffect.Fever, 0f, 1);
                }
            }
            if (info.m_DamageType == DamageType.Insects && GreenHellGame.TWITCH_DEMO)
            {
                biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.LHand, injuryType, true);
            }
            else if (info.m_InjuryPlace == InjuryPlace.LLeg)
            {
                biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.LLeg, injuryType, true);
            }
            else if (info.m_InjuryPlace == InjuryPlace.RLeg)
            {
                biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.RLeg, injuryType, true);
            }
            else if (info.m_InjuryPlace == InjuryPlace.LHand)
            {
                biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.LHand, injuryType, true);
            }
            else if (info.m_InjuryPlace == InjuryPlace.RHand)
            {
                biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.RHand, injuryType, true);
            }
            if (biwoundSlot != null)
            {
                InjuryState state = InjuryState.Open;
                if (injuryType == InjuryType.Laceration || injuryType == InjuryType.LacerationCat)
                {
                    state = InjuryState.Bleeding;
                }
                else if (injuryType == InjuryType.WormHole)
                {
                    state = InjuryState.WormInside;
                }
                this.AddInjury(injuryType, biwoundSlot.m_InjuryPlace, biwoundSlot, state, info.m_PoisonLevel, null, info);
                return;
            }
            if (info.m_DamageType == DamageType.VenomPoison)
            {
                for (int i = 0; i < this.m_Injuries.Count; i++)
                {
                    if (this.m_Injuries[i].m_Type == InjuryType.VenomBite)
                    {
                        this.m_Injuries[i].m_PoisonLevel += info.m_PoisonLevel;
                        return;
                    }
                }
                return;
            }
            if (info.m_DamageType == DamageType.SnakePoison)
            {
                for (int j = 0; j < this.m_Injuries.Count; j++)
                {
                    if (this.m_Injuries[j].m_Type == InjuryType.SnakeBite)
                    {
                        this.m_Injuries[j].m_PoisonLevel += info.m_PoisonLevel;
                        return;
                    }
                }
            }
        }
    }
Esempio n. 5
0
    private void UpdateWoundSlots(SlotData data)
    {
        if (!Inventory3DManager.Get().isActiveAndEnabled || !BodyInspectionController.Get().IsActive())
        {
            data.obj.gameObject.SetActive(false);
            return;
        }
        if (GreenHellGame.IsPCControllerActive() && (Inventory3DManager.Get().m_CarriedItem == null || !data.slot.CanInsertItem(Inventory3DManager.Get().m_CarriedItem)))
        {
            data.obj.gameObject.SetActive(false);
            return;
        }
        BIWoundSlot biwoundSlot = (BIWoundSlot)data.slot;

        if (biwoundSlot == null || biwoundSlot.m_Injury == null)
        {
            data.obj.gameObject.SetActive(false);
            return;
        }
        if (biwoundSlot.m_Injury.m_Type == InjuryType.Leech)
        {
            data.obj.gameObject.SetActive(false);
            return;
        }
        if (!data.obj.gameObject.activeSelf)
        {
            data.obj.gameObject.SetActive(true);
        }
        Vector3 screenPoint = data.slot.GetScreenPoint();

        if (screenPoint.z <= 0f)
        {
            data.icon.enabled = false;
            return;
        }
        data.icon.rectTransform.position = screenPoint;
        if (biwoundSlot.GetInjury() != null && BodyInspectionController.Get() != null && BodyInspectionController.Get().enabled&& EnumTools.ConvertInjuryPlaceToLimb(biwoundSlot.GetInjury().m_Place) == HUDBodyInspection.Get().GetSelectedLimb() && biwoundSlot.GetInjury().m_Bandage == null && biwoundSlot.m_Maggots == null && biwoundSlot.GetInjury().m_ParentInjury == null)
        {
            data.icon.enabled       = true;
            this.m_SelectedSlotData = data;
            return;
        }
        data.icon.enabled = false;
    }