Esempio n. 1
0
    public override void ProcessAging()
    {
        base.ProcessAging();

        if (IsDead)
        {
            Zeus.QueueToOutput("You have died.");

            MajorEvents.Add(new MajorEvent("Died", Age,
                                           string.Format("You Died."),
                                           Zeus.Current.Player.IncrementLastIndexMajorEvent())
                            );

            // TODO: Disable elements.

            return;
        }

        ProcessVaccines();

        ProcessGuitarLearning();

        if (Age == 12 * 5)
        {
            AtSchool = true;
            Zeus.QueueToOutput("You started school.");
            Zeus.QueueToOutput();

            MajorEvents.Add(new MajorEvent("School", Age,
                                           string.Format("You started school."),
                                           Zeus.Current.Player.IncrementLastIndexMajorEvent())
                            );
        }

        if (Age == 12 * 16)
        {
            AtSchool = false;
        }

        if (AtSchool)
        {
            Intellect += Constants.SCHOOL_BACKGROUND_INTELLECT_GAIN_PER_MONTH;
            intellectModifier.ForEach(x => Intellect += x);
        }

        Zeus.QueueToOutput(OutputAge());
        Zeus.QueueToOutput();
    }
Esempio n. 2
0
    protected void ProcessDiseases(bool justBeenBorn = false)
    {
        // TODO: We need to add anything that happens from here into the main Label.
        // Check for diseases and add them if it is randomly chosen.
        foreach (Disease d in Diseases.List)
        {
            if (CheckIfLifeHasDisease(d.DiseaseName))
            {
                // Debug.Log (string.Format ("{0} already has {1} and so cannot get it again.", this, d.DiseaseName));
                continue;
            }

            if ((justBeenBorn && d.DiseaseType == DiseaseType.BORN) || (Age > 0 && d.DiseaseType == DiseaseType.CONTRACT))
            {
                float contractionChance = d.ChanceToContract / 100f, reducedChanceToContract = 1f;

                if (CheckIfLifeHasVaccination(d.DiseaseName, out reducedChanceToContract))
                {
                    contractionChance /= reducedChanceToContract;
                }

                float chanceToContractRand = Random.value;

                // Debug.Log (string.Format("chanceToContractRand: {0}, contractionChance: {1}", chanceToContractRand, contractionChance / 100f));

                if (chanceToContractRand < (contractionChance))
                {
                    Disease currentDiseaseToAdd = new Disease(d);

                    currentDiseaseToAdd.AgeContracted = this.Age;

                    CurrentDiseases.Add(currentDiseaseToAdd);
                    deathChanceModifier.Add(d.IncreasedChanceToDie);

                    if (this is Player)
                    {
                        string output = "";

                        output = (d.DiseaseType == DiseaseType.BORN)
                                                        ? string.Format("You were born with <b>{0}</b>.", d.DiseaseName)
                                                        : string.Format("You have contracted <b>{0}</b>!", d.DiseaseName);

                        Zeus.QueueToOutput(output);
                        Zeus.QueueToOutput();

                        string affectBodyParts = "";

                        foreach (string s in d.AffectedBodyParts)
                        {
                            affectBodyParts += s + ", ";
                        }

                        affectBodyParts = affectBodyParts.Remove(affectBodyParts.Length - 2);

                        Zeus.Current.Player.MajorEvents.Add(new MajorEvent(
                                                                string.Format("Contracted {0}", d.DiseaseName),
                                                                Age,
                                                                string.Format("You contracted {0}.\n\n<b>{0}</b>\n<i>{1}</i>\nAffected Body Parts: {3}.\n\n{2}",
                                                                              d.DiseaseName,
                                                                              d.LatinName,
                                                                              d.Description,
                                                                              affectBodyParts),
                                                                Zeus.Current.Player.IncrementLastIndexMajorEvent()
                                                                ));
                    }
                }
            }
        }

        List <Disease> currentDiseasesToRemove = new List <Disease> ();

        currentDiseasesToRemove.Clear();

        // Check for current diseases and remove if applicable.
        foreach (Disease d in CurrentDiseases)
        {
            if (!d.CanBeCured)
            {
                continue;
            }

            int   averageLengthOfDisease = d.AverageLength;
            int   ageOfDisease           = this.Age - d.AgeContracted;
            float coefficent             = 1.5f;

            // TODO: More play-testing is needed to determine if this is the correct formula.
            float chanceToBeCuredThisMonth = ((float)ageOfDisease / (float)averageLengthOfDisease) / coefficent;
            chanceToBeCuredThisMonth *= Random.Range(1f - (1f / averageLengthOfDisease), 1.01f);

            float chanceToRemoveDiseaseRan = Random.value;

            if (chanceToRemoveDiseaseRan < chanceToBeCuredThisMonth)
            {
                currentDiseasesToRemove.Add(d);
                deathChanceModifier.Remove(d.IncreasedChanceToDie);

                if (this is Player)
                {
                    Zeus.QueueToOutput(
                        string.Format("You no longer have {0}!", d.DiseaseName),
                        true);
                    Zeus.QueueToOutput();

                    Zeus.Current.Player.MajorEvents.Add(new MajorEvent(
                                                            string.Format("{0} Cured", d.DiseaseName),
                                                            Age,
                                                            string.Format("Your {0} was cured.",
                                                                          d.DiseaseName),
                                                            Zeus.Current.Player.IncrementLastIndexMajorEvent()
                                                            ));
                }
            }
        }

        currentDiseasesToRemove.ForEach(x => CurrentDiseases.Remove(x));
    }
Esempio n. 3
0
    public void ProcessVaccines()
    {
        // Check to see if a Vaccination has expired, if so, remove it from the Vaccine list.
        foreach (Vaccination vd in CurrentVaccines)
        {
            if (vd.Missed || vd.Expired)
            {
                continue;
            }

            if (Age == (vd.AgeImmunised + vd.MaxProtectionTime))
            {
                vd.Expired = true;
                // Debug.Log (string.Format ("Found vaccinaton: {0}, of which diseases: {1} has expired as it only lasts for {2} months",
                //	vd.Vaccine, vd.Disease, vd.MaxProtectionTime));
            }
        }

        // Check for new vaccines needed.
        // Iterate through all known vaccine routines
        foreach (Vaccination[] vaccine in Vaccinations.List)
        {
            int           i              = 0;
            bool          routineMissed  = false;
            bool          wasVaccination = false;
            string        _vaccine       = "";
            List <string> _vaccines      = new List <string>();

            // Iterate through all diseases in these routines
            foreach (Vaccination vld in vaccine)
            {
                // If our current Age is more or equal to the age at which you get the vaccine, then you will have a chance
                //	to get the vaccine.
                if (Age == vld.AgeImmunised)
                {
                    // TODO: This definitely needs tuning, there are some issues.
                    float intellectVaxModifier = Mathf.Clamp(1 / ((Mother.Intellect + Father.Intellect)), 0f, 1f);
                    bool  hasMissed            = !(Random.value >= intellectVaxModifier);

                    if (i == 0 && hasMissed)
                    {
                        routineMissed = true;
                    }

                    Vaccination currentVaccineToAdd = new Vaccination(vld);

                    currentVaccineToAdd.Missed = currentVaccineToAdd.Expired = routineMissed;

                    CurrentVaccines.Add(currentVaccineToAdd);

                    if (!hasMissed)
                    {
                        wasVaccination = true;
                        _vaccine       = currentVaccineToAdd.Vaccine;
                        _vaccines.Add(string.Format(currentVaccineToAdd.Disease + ((vld.MaxProtectionTime == 5000) ? " forever" : " for {0} months"), vld.MaxProtectionTime));
                    }
                }
            }


            if (wasVaccination)
            {
                string _vaccinesTemp = "";

                _vaccines.ForEach(x => _vaccinesTemp += "• " + x + ".\n");
                _vaccinesTemp = _vaccinesTemp.Remove(_vaccinesTemp.Length - 1);

                Zeus.QueueToOutput(string.Format("You had the {0} vaccination, you are now protected from the following diseases:\n{1}", _vaccine, _vaccinesTemp));
                Zeus.QueueToOutput();

                _vaccinesTemp = "";

                _vaccines.ForEach(x => _vaccinesTemp += x + ", ");
                _vaccinesTemp = _vaccinesTemp.Remove(_vaccinesTemp.Length - 2);
                MajorEvents.Add(new MajorEvent("Vaccinated", Age,
                                               string.Format("You were vaccinationed. You got the {0} vaccine, which protects you against {1}.",
                                                             _vaccine,
                                                             _vaccinesTemp),
                                               Zeus.Current.Player.IncrementLastIndexMajorEvent())
                                );
            }

            i++;
        }
    }
Esempio n. 4
0
    public void Create()
    {
        Mother = Zeus.Current.Mother;
        Father = Zeus.Current.Father;

        #region Sexuality
        Sexuality = Sexuality.NULL;
        Gender    = (Random.value > 0.5f) ? Gender.MALE : Gender.FEMALE;
        #endregion

        IsAdopted = (Zeus.Current.Mother.Gender == Zeus.Current.Father.Gender);

        #region Basic Stats
        Happiness  = 100f;
        Appearance = 50f;
        Fitness    = 5f;
        Intellect  = 5f;
        #endregion

        Age = -1;

        #region Nationalitiy
        Nationality = (Random.value > 0.5f) ? Mother.Nationality : Father.Nationality;
        #endregion

        Money = 100 * Nationality.CurrencyMultiplier;

        Money = 1000000000000;

        // Check
        // ProcessDiseases (true);

        Zeus.ResetOutput();

        Zeus.QueueToOutput("————————————————————");

        Zeus.QueueToOutput(string.Format("You are <b>{0} {1}</b>.", FirstName, LastName));
        Zeus.QueueToOutput(string.Format("You are born <b>{0}</b>.", Zeus.ToTitleCase(Gender.ToString().ToLower())));
        Zeus.QueueToOutput(string.Format("You were born in <b>{0}</b>, your nationality is <b>{1}</b>.", Nationality.CountryName, Nationality.Demonym));

        Zeus.QueueToOutput(string.Format("Your Mother is: <b>{0} {1}</b>, " + ((Mother.Gender == Gender.FEMALE) ? "her" : "his") + " nationality is <b>{2}</b>.", Mother.FirstName, Mother.LastName, Mother.Nationality.Demonym));
        Zeus.QueueToOutput(string.Format("Your Father is: <b>{0} {1}</b>, " + ((Father.Gender == Gender.FEMALE) ? "her" : "his") + " nationality is <b>{2}</b>.", Father.FirstName, Father.LastName, Father.Nationality.Demonym));
        if (IsAdopted)
        {
            Zeus.QueueToOutput(string.Format("<b>You are adopted.</b>"));
        }

        Zeus.QueueToOutput("————————————————————");
        Zeus.QueueToOutput();

        MajorEvents.Add(new MajorEvent("Born", 0,
                                       string.Format("You were born. You are a <b>{0}</b>. Your nationality is <b>{1}</b>. Your Mother is <b>{2}</b> and your Father is <b>{3}</b>.",
                                                     FirstName + " " + LastName,
                                                     Nationality.Demonym,
                                                     Mother.FirstName + " " + Mother.LastName,
                                                     Father.FirstName + " " + Father.LastName),
                                       Zeus.Current.Player.IncrementLastIndexMajorEvent())
                        );

        Houses.GenerateSomeHouses(21);

        ProcessAging();
    }