Example #1
0
    // Check to see if the surivor is wounded/dies return false for failing the mission, true for continuing
    public bool WoundCheck(Shelter s, Report r, int successChance, string tasking, string task, ref wound sWound)
    {
        sWound = wound.Uninjured;
        bool invulnerable = Health > 1;

        //Chance of getting wounded, if the wound is severe enough, do not continue scouting
        if (successChance + Random.Range(0, 10) < 6)
        {
            sWound = (wound)Random.Range(0, (int)wound.Count);
            switch (sWound)
            {
            case wound.Uninjured:
                break;

            case wound.Minor:
                Health -= Random.Range(0, 1);     //1 being a papercut
                break;

            case wound.Moderate:
                Health -= Random.Range(1, 3);     //1 being a papercut
                break;

            case wound.Severe:
                Health -= Random.Range(3, 5);     //1 being a papercut
                break;

            case wound.Grievous:
                Health -= Random.Range(5, 7);     //1 being a papercut
                break;
            }
        }

        if (Health < 0 && false == invulnerable)
        {
            r.SetMessage(_name + " sustained a " + sWound.ToString() + " wound " + tasking + " and is severely injured.");
            s.KillSurvivor(this.Name);
            return(false);
        }
        else if (sWound == wound.Severe || sWound == wound.Grievous)
        {
            if (invulnerable && Health < 0)
            {
                Health = 1;
            }
            r.SetMessage(_name + " attempted to " + task + " but wound up sustaining a " + sWound.ToString() + " wound.");
            return(false);
        }
        return(true);
    }
Example #2
0
    // =================================================== tasks
    // scout
    public ArrayList Scout(Shelter s)
    {
        int boost = 0;

        if (s.ConsumeFood(1))
        {
            boost++;
        }

        Report rTemporary = new Report();

        int spillover = 0;

        if (Fatigue < 0)
        {
            spillover = Mathf.Abs(Fatigue);
        }
        int fatigueModifier = -Fatigue / 10;

        int proficiency = GetProficiency(task.Scout) + 10 + fatigueModifier;

        wound sWound = wound.Uninjured;

        ArrayList NewReps = new ArrayList();

        if (WoundCheck(s, rTemporary, proficiency, "scouting", "scout", ref sWound))
        {
            int locationBonus = (int)Mathf.Pow(Random.Range(1.0f, 4.0f) * proficiency, .36f);


            _gameWorld.AddScoutingBonus(locationBonus);
            if (sWound == wound.Uninjured)
            {
                rTemporary.SetMessage(_name + " successfully scouted and helped to locate a scavenging target.");
            }
            else
            {
                rTemporary.SetMessage(_name + " sustained a " + sWound.ToString() + " wound while scouting but still helped to locate a scavenging target.");
            }
            //Look for enemy camps
            NewReps = _gameWorld.ScoutForShelters(proficiency + boost);
        }
        if (rTemporary.IsInitialized())
        {
            NewReps.Add(rTemporary);
        }
        return(NewReps);
    }