Example #1
0
    public void AddWorm(string place)
    {
        InjuryPlace place2        = (InjuryPlace)Enum.Parse(typeof(InjuryPlace), place);
        BIWoundSlot freeWoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(place2, InjuryType.Worm, true);

        this.AddInjury(InjuryType.Worm, place2, freeWoundSlot, InjuryState.Open, 0, null, null);
    }
Example #2
0
 public Injury(InjuryType type, InjuryPlace place, BIWoundSlot slot, InjuryState state, int poison_level = 0, Injury parent_injury = null)
 {
     this.m_Type  = type;
     this.m_Place = place;
     slot.SetInjury(this);
     this.m_Slot = slot;
     this.m_StartTimeInMinutes = MainLevel.Instance.GetCurrentTimeMinutes();
     this.m_PoisonLevel        = poison_level;
     this.m_TimeToInfect       = this.m_DefaultTimeToInfect;
     this.m_ParentInjury       = parent_injury;
     if (type == InjuryType.VenomBite || type == InjuryType.SnakeBite)
     {
         Player.Get().GetComponent <PlayerDiseasesModule>().RequestDisease(ConsumeEffect.Fever, 0f, 1);
     }
     this.m_State = state;
     this.UpdateHealthDecreasePerSec();
     this.SetWoundMaterial(this.m_Slot.m_Wound);
     if (slot.m_AdditionalMeshes != null)
     {
         for (int i = 0; i < slot.m_AdditionalMeshes.Count; i++)
         {
             this.SetWoundMaterial(slot.m_AdditionalMeshes[i]);
         }
     }
     this.SetAdditionalInjury(this);
     Injury.s_NumInjuries++;
 }
Example #3
0
    public void Load()
    {
        this.ResetInjuries();
        int num = SaveGame.LoadIVal("InjuriesCount");

        for (int i = 0; i < num; i++)
        {
            InjuryType  injuryType  = (InjuryType)SaveGame.LoadIVal("InjuryType" + i);
            InjuryPlace place       = (InjuryPlace)SaveGame.LoadIVal("InjuryPlace" + i);
            InjuryState injuryState = (InjuryState)SaveGame.LoadIVal("InjuryState" + i);
            if (injuryType != InjuryType.WormHole || injuryState != InjuryState.WormInside)
            {
                BIWoundSlot woundSlot    = BodyInspectionController.Get().GetWoundSlot(place, SaveGame.LoadSVal("InjurySlot" + i));
                int         poison_level = SaveGame.LoadIVal("InjuryPoisonLevel" + i);
                Injury      injury       = this.AddInjury(injuryType, place, woundSlot, injuryState, poison_level, null, null);
                if (injury != null)
                {
                    if (injuryState == InjuryState.Infected)
                    {
                        injury.Infect();
                    }
                    else if (injuryState == InjuryState.Closed)
                    {
                        injury.CloseWound();
                    }
                    injury.Load(i);
                }
            }
        }
    }
Example #4
0
    public void ScenarioAddInjury(string type, string place, string state)
    {
        InjuryType  injuryType    = (InjuryType)Enum.Parse(typeof(InjuryType), type);
        InjuryPlace place2        = (InjuryPlace)Enum.Parse(typeof(InjuryPlace), place);
        InjuryState state2        = (InjuryState)Enum.Parse(typeof(InjuryState), state);
        BIWoundSlot freeWoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(place2, injuryType, true);
        Injury      injury        = null;

        if (freeWoundSlot != null)
        {
            injury = this.AddInjury(injuryType, place2, freeWoundSlot, state2, 0, null, null);
        }
        if (injury != null)
        {
            switch (state2)
            {
            case InjuryState.Open:
                injury.OpenWound();
                return;

            case InjuryState.Infected:
                injury.Infect();
                return;

            case InjuryState.Closed:
                injury.CloseWound();
                break;

            default:
                return;
            }
        }
    }
    public void ScenarioAddInjury(string type, string place, string state)
    {
        InjuryType  injuryType    = (InjuryType)Enum.Parse(typeof(InjuryType), type);
        InjuryPlace place2        = (InjuryPlace)Enum.Parse(typeof(InjuryPlace), place);
        InjuryState injuryState   = (InjuryState)Enum.Parse(typeof(InjuryState), state);
        BIWoundSlot freeWoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(place2, injuryType);
        Injury      injury        = null;

        if (freeWoundSlot != null)
        {
            injury = this.AddInjury(injuryType, place2, freeWoundSlot, injuryState, 0, null);
        }
        if (injuryState != InjuryState.Open)
        {
            if (injuryState != InjuryState.Infected)
            {
                if (injuryState == InjuryState.Closed)
                {
                    injury.CloseWound();
                }
            }
            else
            {
                injury.Infect();
            }
        }
        else
        {
            injury.OpenWound();
        }
    }
Example #6
0
 public Injury(InjuryType type, InjuryPlace place, BIWoundSlot slot, InjuryState state, int poison_level = 0, Injury parent_injury = null, DamageInfo damage_info = null)
 {
     this.m_Type  = type;
     this.m_Place = place;
     slot.SetInjury(this);
     this.m_Slot = slot;
     this.m_StartTimeInMinutes = MainLevel.Instance.GetCurrentTimeMinutes();
     this.m_PoisonLevel        = poison_level;
     this.m_TimeToInfect       = this.m_DefaultTimeToInfect;
     this.m_ParentInjury       = parent_injury;
     if (damage_info != null && damage_info.m_Damager != null)
     {
         AI component = damage_info.m_Damager.GetComponent <AI>();
         if (component != null)
         {
             this.m_AIDamager = component.m_ID;
         }
     }
     this.m_State = state;
     this.UpdateHealthDecreasePerSec();
     this.SetWoundMaterial(this.m_Slot.m_Wound);
     if (slot.m_AdditionalMeshes != null)
     {
         for (int i = 0; i < slot.m_AdditionalMeshes.Count; i++)
         {
             this.SetWoundMaterial(slot.m_AdditionalMeshes[i]);
         }
     }
     this.SetAdditionalInjury(this);
     Injury.s_NumInjuries++;
 }
    public Injury AddInjury(InjuryType type, InjuryPlace place, BIWoundSlot slot, InjuryState state, int poison_level = 0, Injury parent_injury = null)
    {
        if (!slot || PlayerConditionModule.Get().GetParameterLossBlocked())
        {
            return(null);
        }
        if (type == InjuryType.Leech && this.GetAllInjuries(type).Count == 0 && PlayerSanityModule.Get())
        {
            PlayerSanityModule.Get().ResetEventCooldown(PlayerSanityModule.SanityEventType.Leech);
        }
        Debug.Log("AddInjury");
        Injury injury = new Injury(type, place, slot, state, poison_level, parent_injury);

        this.m_Injuries.Add(injury);
        this.OnAddInjury(type);
        return(injury);
    }
Example #8
0
 public static Limb ConvertInjuryPlaceToLimb(InjuryPlace place)
 {
     if (place == InjuryPlace.LHand)
     {
         return(Limb.LArm);
     }
     if (place == InjuryPlace.RHand)
     {
         return(Limb.RArm);
     }
     if (place == InjuryPlace.LLeg)
     {
         return(Limb.LLeg);
     }
     if (place == InjuryPlace.RLeg)
     {
         return(Limb.RLeg);
     }
     return(Limb.None);
 }
Example #9
0
    public Injury AddInjury(InjuryType type, InjuryPlace place, BIWoundSlot slot, InjuryState state, int poison_level = 0, Injury parent_injury = null, DamageInfo damage_info = null)
    {
        if (!slot || PlayerConditionModule.Get().GetParameterLossBlocked())
        {
            return(null);
        }
        if (DifficultySettings.GetActivePresetType() == DifficultySettings.PresetType.Tourist && !MainLevel.Instance.m_Tutorial)
        {
            return(null);
        }
        if (type == InjuryType.Leech && this.GetAllInjuries(type).Count == 0 && PlayerSanityModule.Get())
        {
            PlayerSanityModule.Get().ResetEventCooldown(PlayerSanityModule.SanityEventType.Leech);
        }
        Debug.Log("AddInjury");
        Injury injury = new Injury(type, place, slot, state, poison_level, parent_injury, damage_info);

        this.m_Injuries.Add(injury);
        this.OnAddInjury(type);
        return(injury);
    }
Example #10
0
 public static bool Equal(InjuryPlace place, Limb limb)
 {
     return((place == InjuryPlace.LHand && limb == Limb.LArm) || (place == InjuryPlace.RHand && limb == Limb.RArm) || (place == InjuryPlace.LLeg && limb == Limb.LLeg) || (place == InjuryPlace.RLeg && limb == Limb.RLeg));
 }