Beispiel #1
0
    private void UpdateMorale()
    {
        int num = 0;

        foreach (KeyValuePair <string, bool> item in MasteryBySkillID)
        {
            if (item.Value)
            {
                Skill skill = Db.Get().Skills.Get(item.Key);
                float value = 0f;
                if (AptitudeBySkillGroup.TryGetValue(new HashedString(skill.skillGroup), out value))
                {
                    num += (int)value;
                }
            }
        }
        AttributeInstance attributeInstance = Db.Get().Attributes.QualityOfLife.Lookup(this);

        if (skillsMoraleModifier != null)
        {
            attributeInstance.Remove(skillsMoraleModifier);
            skillsMoraleModifier = null;
        }
        if (num > 0)
        {
            skillsMoraleModifier = new AttributeModifier(attributeInstance.Id, (float)num, DUPLICANTS.NEEDS.QUALITYOFLIFE.APTITUDE_SKILLS_MOD_NAME, false, false, true);
            attributeInstance.Add(skillsMoraleModifier);
        }
    }
Beispiel #2
0
    private void UpdateExpectations()
    {
        int num = 0;

        foreach (KeyValuePair <string, bool> item in MasteryBySkillID)
        {
            if (item.Value)
            {
                Skill skill = Db.Get().Skills.Get(item.Key);
                num += skill.tier + 1;
            }
        }
        AttributeInstance attributeInstance = Db.Get().Attributes.QualityOfLifeExpectation.Lookup(this);

        if (skillsMoraleExpectationModifier != null)
        {
            attributeInstance.Remove(skillsMoraleExpectationModifier);
            skillsMoraleExpectationModifier = null;
        }
        if (num > 0)
        {
            skillsMoraleExpectationModifier = new AttributeModifier(attributeInstance.Id, (float)num, DUPLICANTS.NEEDS.QUALITYOFLIFE.EXPECTATION_MOD_NAME, false, false, true);
            attributeInstance.Add(skillsMoraleExpectationModifier);
        }
    }