Esempio n. 1
0
        public int GetResultingMoral(GameDatabase gamedb, MoralEvent me, int player, int moral)
        {
            bool flag1 = false;
            bool flag2 = false;

            if (this.AllMoralEffects.Keys.Any <EffectAvailability>((Func <EffectAvailability, bool>)(x =>
            {
                if (x != EffectAvailability.Peace)
                {
                    return(x == EffectAvailability.War);
                }
                return(true);
            })))
            {
                flag1 = GovernmentEffects.IsPlayerAtWar(gamedb, player);
                flag2 = true;
                if (flag1 && this.AllMoralEffects.ContainsKey(EffectAvailability.War))
                {
                    moral = this.GetValueWithImmunity(this.AllMoralEffects[EffectAvailability.War], moral);
                }
                else if (!flag1 && this.AllMoralEffects.ContainsKey(EffectAvailability.Peace))
                {
                    moral = this.GetValueWithImmunity(this.AllMoralEffects[EffectAvailability.Peace], moral);
                }
            }
            Dictionary <EffectAvailability, GovMoralEffects.MoralEffect> dictionary = new Dictionary <EffectAvailability, GovMoralEffects.MoralEffect>();

            if (this.MoralEffects.TryGetValue(me, out dictionary))
            {
                if (dictionary.Keys.Any <EffectAvailability>((Func <EffectAvailability, bool>)(x =>
                {
                    if (x != EffectAvailability.Peace)
                    {
                        return(x == EffectAvailability.War);
                    }
                    return(true);
                })))
                {
                    if (!flag2)
                    {
                        flag1 = GovernmentEffects.IsPlayerAtWar(gamedb, player);
                    }
                    if (flag1 && dictionary.ContainsKey(EffectAvailability.War))
                    {
                        moral = this.GetValueWithImmunity(dictionary[EffectAvailability.War], moral);
                    }
                    else if (!flag1 && dictionary.ContainsKey(EffectAvailability.Peace))
                    {
                        moral = this.GetValueWithImmunity(dictionary[EffectAvailability.Peace], moral);
                    }
                }
                else if (dictionary.ContainsKey(EffectAvailability.All))
                {
                    moral = this.GetValueWithImmunity(dictionary[EffectAvailability.All], moral);
                }
            }
            return(moral);
        }
Esempio n. 2
0
        public int GetMoralValue(GovernmentInfo.GovernmentType gt, MoralEvent me, int originalValue)
        {
            Dictionary <MoralEvent, int> dictionary;

            if (this._factionSpecificMoral.TryGetValue(gt, out dictionary))
            {
                int num = 0;
                if (this._factionSpecificMoral[gt].TryGetValue(me, out num))
                {
                    return(num);
                }
            }
            return(originalValue);
        }
Esempio n. 3
0
        public int GetMoralTotal(
            GameDatabase gamedb,
            GovernmentInfo.GovernmentType gt,
            MoralEvent me,
            int player,
            int moral)
        {
            GovEffectCollection effectCollection;

            if (this.DiplomaticEffects.TryGetValue(gt, out effectCollection))
            {
                return(effectCollection.MoralEffects.GetResultingMoral(gamedb, me, player, moral));
            }
            return(moral);
        }