Beispiel #1
0
        public static bool Prefix(int sacrificedMenCount)
        {
            bool flag = sacrificedMenCount >= 1;

            if (flag)
            {
                Support.LogMessage("The troops left behind march bravely to their fates.");
                bool player_trait_skill_gain_enabled = Support.settings.player_trait_skill_gain_enabled;
                if (player_trait_skill_gain_enabled)
                {
                    Campaign.Current.PlayerTraitDeveloper.AddTraitXp(DefaultTraits.Mercy, -(3 * sacrificedMenCount));
                    Campaign.Current.PlayerTraitDeveloper.AddTraitXp(DefaultTraits.Honor, -sacrificedMenCount);
                }
                List <Hero> heroesInMainParty = Support.GetHeroesInMainParty();
                int         num   = sacrificedMenCount / 5;
                bool        flag2 = num < 2;
                if (flag2)
                {
                    num = 2;
                }
                int num2 = num / 2;
                for (int i = 0; i < heroesInMainParty.Count; i++)
                {
                    bool flag3 = (Support.settings.battle_companions_bad_reputation_enabled && heroesInMainParty[i].IsPlayerCompanion) || (Support.settings.battle_family_bad_reputation_enabled && !heroesInMainParty[i].IsPlayerCompanion);
                    if (flag3)
                    {
                        CharacterTraits heroTraits = heroesInMainParty[i].GetHeroTraits();
                        int             num3       = Support.EvaluatePersonality(heroTraits);
                        int             num4       = num3;
                        if (num4 != 1)
                        {
                            if (num4 == 4)
                            {
                                Support.ChangeRelation(Hero.MainHero, heroesInMainParty[i], Support.Random(-num2, 0));
                            }
                        }
                        else
                        {
                            Support.ChangeRelation(Hero.MainHero, heroesInMainParty[i], Support.Random(-num, 0));
                        }
                    }
                }
            }
            return(false);
        }
        public static bool Prefix()
        {
            bool flag = MobileParty.MainParty != null;

            if (flag)
            {
                bool flag2 = MobileParty.MainParty.Party != null;
                if (flag2)
                {
                    bool flag3 = !CompanionBanter.CheckForConfrontation();
                    if (flag3)
                    {
                        bool flag4      = false;
                        bool flag5      = false;
                        bool isStarving = PartyBase.MainParty.IsStarving;
                        if (isStarving)
                        {
                            Support.LogMessage("Your soldiers are starving.");
                            flag4 = true;
                            bool player_trait_skill_gain_enabled = Support.settings.player_trait_skill_gain_enabled;
                            if (player_trait_skill_gain_enabled)
                            {
                                Campaign.Current.PlayerTraitDeveloper.AddTraitXp(DefaultTraits.Mercy, -MobileParty.MainParty.Party.NumberOfAllMembers);
                                Campaign.Current.PlayerTraitDeveloper.AddTraitXp(DefaultTraits.Generosity, -MobileParty.MainParty.Party.NumberOfAllMembers);
                                Campaign.Current.PlayerTraitDeveloper.AddTraitXp(DefaultTraits.Honor, -MobileParty.MainParty.Party.NumberOfAllMembers);
                            }
                        }
                        bool flag6 = (double)MobileParty.MainParty.HasUnpaidWages > 0.0;
                        if (flag6)
                        {
                            Support.LogMessage("With no pay in sight, the men speak of desertion.");
                            flag5 = true;
                            bool player_trait_skill_gain_enabled2 = Support.settings.player_trait_skill_gain_enabled;
                            if (player_trait_skill_gain_enabled2)
                            {
                                Campaign.Current.PlayerTraitDeveloper.AddTraitXp(DefaultTraits.Generosity, -(2 * MobileParty.MainParty.Party.NumberOfAllMembers));
                                Campaign.Current.PlayerTraitDeveloper.AddTraitXp(DefaultTraits.Honor, -MobileParty.MainParty.Party.NumberOfAllMembers);
                            }
                        }
                        bool flag7 = flag4 || flag5;
                        if (flag7)
                        {
                            List <Hero> heroesInMainParty = Support.GetHeroesInMainParty();
                            for (int i = 0; i < heroesInMainParty.Count; i++)
                            {
                                bool flag8 = (Support.settings.battle_companions_bad_reputation_enabled && heroesInMainParty[i].IsPlayerCompanion) || (Support.settings.battle_family_bad_reputation_enabled && !heroesInMainParty[i].IsPlayerCompanion);
                                if (flag8)
                                {
                                    CharacterTraits heroTraits = heroesInMainParty[i].GetHeroTraits();
                                    bool            flag9      = flag4;
                                    if (flag9)
                                    {
                                        switch (Support.EvaluatePersonality(heroTraits))
                                        {
                                        case 1:
                                            Support.ChangeRelation(Hero.MainHero, heroesInMainParty[i], Support.Random(-2, 0));
                                            break;

                                        case 2:
                                            Support.ChangeRelation(Hero.MainHero, heroesInMainParty[i], Support.Random(-4, -1));
                                            break;

                                        case 3:
                                            Support.ChangeRelation(Hero.MainHero, heroesInMainParty[i], Support.Random(-3, 0));
                                            break;

                                        default:
                                            Support.ChangeRelation(Hero.MainHero, heroesInMainParty[i], Support.Chance(-2, -1));
                                            break;
                                        }
                                    }
                                    bool flag10 = flag5;
                                    if (flag10)
                                    {
                                        switch (Support.EvaluatePersonality(heroTraits))
                                        {
                                        case 1:
                                            Support.ChangeRelation(Hero.MainHero, heroesInMainParty[i], Support.Chance(-1, 0));
                                            break;

                                        case 2:
                                            Support.ChangeRelation(Hero.MainHero, heroesInMainParty[i], Support.Random(-7, -3));
                                            break;

                                        case 3:
                                            Support.ChangeRelation(Hero.MainHero, heroesInMainParty[i], Support.Chance(-4, -1));
                                            break;

                                        default:
                                            Support.ChangeRelation(Hero.MainHero, heroesInMainParty[i], Support.Chance(-2, -1));
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(false);
        }
Beispiel #3
0
        public static void Postfix(CharacterObject winner, Town town)
        {
            bool flag = winner != null && town != null;

            if (flag)
            {
                bool flag2 = winner.IsHero && winner.HeroObject == Hero.MainHero && Support.settings.tournament_bonus_enabled;
                if (flag2)
                {
                    int  num   = 1;
                    int  num2  = 4;
                    bool flag3 = town.Owner != null;
                    if (flag3)
                    {
                        Hero hero  = Support.FindHero(town.Owner);
                        bool flag4 = hero != null;
                        if (flag4)
                        {
                            CharacterTraits heroTraits = hero.GetHeroTraits();
                            bool            flag5      = heroTraits.Honor > 0;
                            if (flag5)
                            {
                                num++;
                                num2++;
                            }
                            bool flag6 = heroTraits.Valor > 0;
                            if (flag6)
                            {
                                num++;
                                num2++;
                            }
                            bool flag7 = heroTraits.Generosity > 0;
                            if (flag7)
                            {
                                int  num3  = Support.Random(100, 1000);
                                bool flag8 = hero.Gold >= num3 * 3;
                                if (flag8)
                                {
                                    GiveGoldAction.ApplyBetweenCharacters(hero, Hero.MainHero, num3, false);
                                    Support.LogFriendlyMessage(hero.Name.ToString() + " has sent you a pouch of gold to congratulate you on your triumph.");
                                }
                            }
                            Support.ChangeRelation(Hero.MainHero, hero, Support.Random(num, num2));
                            Support.ChangeFamilyRelation(Hero.MainHero, hero, num2 / 3, 0);
                        }
                    }
                    bool flag9 = town.Settlement != null;
                    if (flag9)
                    {
                        bool flag10 = town.Settlement.Notables != null;
                        if (flag10)
                        {
                            bool flag11 = town.Settlement.Notables.Any <Hero>();
                            if (flag11)
                            {
                                for (int i = 0; i < 3; i++)
                                {
                                    Support.ChangeRelation(Hero.MainHero, town.Settlement.Notables.GetRandomElement <Hero>(), Support.Chance(1, 2));
                                }
                            }
                        }
                    }
                    List <Hero> heroesInMainParty = Support.GetHeroesInMainParty();
                    for (int j = 0; j < heroesInMainParty.Count; j++)
                    {
                        bool flag12 = (Support.settings.battle_companions_good_reputation_enabled && heroesInMainParty[j].IsPlayerCompanion) || (Support.settings.battle_leaders_good_reputation_enabled && !heroesInMainParty[j].IsPlayerCompanion);
                        if (flag12)
                        {
                            num  = 0;
                            num2 = 1;
                            bool flag13 = heroesInMainParty[j].GetHeroTraits().Valor > 0;
                            if (flag13)
                            {
                                num2++;
                            }
                            bool flag14 = heroesInMainParty[j].GetHeroTraits().Honor > 0;
                            if (flag14)
                            {
                                num2++;
                            }
                        }
                        Support.ChangeRelation(Hero.MainHero, heroesInMainParty[j], Support.Chance(num, num2));
                    }
                    Campaign.Current.PlayerTraitDeveloper.AddTraitXp(DefaultTraits.Valor, Support.Random(10, 40));
                    Hero.MainHero.AddSkillXp(DefaultSkills.Charm, (float)Support.Random(20, 100));
                    Support.LogMessage(Hero.MainHero.Name.ToString() + " has shown great valor in the tournament.");
                }
            }

            //InformationManager.DisplayMessage(new InformationMessage("Triggered EndPostFix", Color.ConvertStringToColor("#FF0042FF")));
        }