private static float GetWillingnessForTroop(Willingness willingness, MobileParty party, CharacterObject troop)
        {
            var troopWillingness = willingness.Generic;

            if (troop.Culture.IsBandit)
            {
                troopWillingness += willingness.Bandit;
            }

            if (troop.Tier > 4)
            {
                troopWillingness += willingness.Skilled;
            }
            else
            {
                troopWillingness += willingness.Unskilled;
            }

            if (troop.Culture == party.Leader.Culture)
            {
                troopWillingness += willingness.OwnCulture;
            }
            else
            {
                troopWillingness += willingness.OtherCulture;
            }

            return(troopWillingness);
        }
Exemplo n.º 2
0
        public DeveloperPreference(long id, long developerId, Willingness willingness, WorkTime workTime) : base(id)
        {
            DeveloperId = developerId;
            Willingness = willingness;
            WorkTime    = workTime;

            Validate();
        }
Exemplo n.º 3
0
 public void ApplyWillingness(Willingness willingness)
 {
     Willingness = willingness;
 }
        private static Willingness GetPartyWillingness(MobileParty party)
        {
            var leader      = party.Leader;
            var willingness = new Willingness {
                Generic      = 0f,
                Bandit       = 0f,
                Unskilled    = 0f,
                Skilled      = 0f,
                OwnCulture   = 1f,
                OtherCulture = 0f,
            };

            if (party == MobileParty.MainParty)
            {
                willingness.Generic += 1;
            }

            // Cautious leaders don't trust former enemies
            var valor = leader.GetTraitLevel(DefaultTraits.Valor);

            if (valor < 0)
            {
                willingness.Generic      += valor;
                willingness.Bandit       += valor;
                willingness.Unskilled    += valor;
                willingness.Skilled      += valor;
                willingness.OwnCulture   += valor;
                willingness.OtherCulture += valor;
            }

            // Merciful leaders are willing to let anyone redeem themselves
            var mercy = leader.GetTraitLevel(DefaultTraits.Mercy);

            if (mercy > 0)
            {
                willingness.Generic += mercy;
                willingness.Bandit  -= mercy * 0.1f;
            }
            else
            {
                willingness.OtherCulture += mercy;
            }

            // Honorable leaders like to free people who fought well
            // Dishonorable ones are perfectly fine hiring bandits but others of their own culture wont like them
            var honor = leader.GetTraitLevel(DefaultTraits.Honor);

            if (honor > 0)
            {
                willingness.Skilled += honor * 0.5f;
                willingness.Bandit  -= honor;
            }
            else
            {
                willingness.Bandit     -= honor;
                willingness.OwnCulture += honor * -0.5f;
            }

            // Generous leaders are willing to help those less fortunate than themselves
            var generosity = leader.GetTraitLevel(DefaultTraits.Generosity);

            if (generosity > 0)
            {
                willingness.Unskilled += generosity * 0.5f;
                willingness.Bandit    += generosity * 0.25f;
            }

            return(willingness);
        }