Example #1
0
        public SkillType GetRandomTalent()
        {
            SkillTypeList talents = this.GetTalents();

            if (talents.Count > 0)
            {
                return(talents[Constants.Random(talents.Count)]);
            }
            return(null);
        }
Example #2
0
        public SkillTypeList GetTalents()
        {
            SkillTypeList talents = new SkillTypeList();

            foreach (Skill skill in this.Skills)
            {
                if (skill.Type.BasedOn == null)
                {
                    talents.Add(skill.Type);
                }
            }
            return(talents);
        }
Example #3
0
        private static void WritePerson(Person p, Faction f, int indent)
        {
            Lang lng = faction.Options.Lang;

            string s = "";

            if (p.Faction == f)
            {
                s = "* ";
            }
            else
            {
                s = "- ";
            }
            for (int i = 0; i < indent; i++)
            {
                s = "  " + s;
            }
            s += p.ToString(lng);

            if (p.Faction == f || !p.HideFaction)
            {
                s += ", " + p.Faction.ToString(lng);
            }

            if (p.IsDangerouslyInsane())
            {
                s += (lng == Lang.En ? ", insane" : ", безумен");
            }
            if (p.Chosen)
            {
                s += (lng == Lang.En ? ", chosen one" : ", избранный");
            }
            if (p.Patrolling)
            {
                s += (lng == Lang.En ? ", patrolling" : ", патрулирует");
            }
            if (p.Age <= Constants.ChildTurns)
            {
                s += (lng == Lang.En ? ", child" : ", ребёнок");
            }

            if (p.Faction == f)
            {
                if (p.Avoiding)
                {
                    s += (lng == Lang.En ? ", avoiding" : ", избегает боя");
                }
                if (p.Greedy)
                {
                    s += (lng == Lang.En ? ", greedy" : ", не делится");
                }
                if (p.Hide)
                {
                    s += (lng == Lang.En ? ", hiding" : ", скрывается");
                }
                else if (p.HideFaction)
                {
                    s += (lng == Lang.En ? ", hiding faction" : ", скрывает фракцию");
                }
            }

            if (p.Faction == faction)
            {
                s += ", " + p.Items.ToString(lng);
            }
            else
            {
                ItemList items = new ItemList();
                foreach (Item itm in p.Items)
                {
                    if (itm.Type.Weight > 0)
                    {
                        items.Add(itm);
                    }
                }
                s += ", " + items.ToString(lng);
            }

            if (p.Faction == f)
            {
                int weight = p.GetWeight();
                if (p.Man != null)
                {
                    weight -= p.Man.Weight;
                }

                s += (lng == Lang.En ? " Load: " : " Груз: ") +
                     weight.ToString() + ((lng == Lang.En) ? " kg." : " кг.");
                s += (lng == Lang.En ? " Skills: " : " Навыки: ") +
                     p.Skills.ToString(lng);

                if (p.Consume.Count > 0)
                {
                    s += (lng == Lang.En ? " Consuming: " : " Еда: ") +
                         p.Consume.ToString(lng);
                }
                if (p.Burn.Count > 0)
                {
                    s += (lng == Lang.En ? " Burning: " : " Топливо: ") +
                         p.Burn.ToString(lng);
                }
                if (p.Equipment.Count > 0)
                {
                    s += (lng == Lang.En ? " Equipment: " : " Снаряжение: ") +
                         p.Equipment.ToString(lng);
                }
                if (p.Spoils.Count > 0)
                {
                    s += (lng == Lang.En ? " Wanted spoils: " : " Желаемые трофеи: ") +
                         p.Spoils.ToString(lng);
                }

                s += (lng == Lang.En ? " Insanity: " : " Безумие: ") +
                     p.Insanity.ToString() + ".";

                int hire = p.GetHireAmount();
                if (hire == 1)
                {
                    s += (lng == Lang.En ? " Hire demand: day ration." : " Найм: дневной рацион.");
                }
                else if (hire > 1)
                {
                    s += String.Format((lng == Lang.En ? " Hire demand: {0} day rations." :
                                        " Найм: {0} рационов."), hire);
                }

                int rad_danger   = Math.Abs(p.RadiationDanger(true));
                int tempr_danger = p.TemperatureDanger(true);

                if (rad_danger > 0 || tempr_danger > 0)
                {
                    s += (lng == Lang.En ? " Danger:" : " Опасность:");
                    if (rad_danger > 0)
                    {
                        s += " " + rad_danger.ToString() + (lng == Lang.En ? " mR/h" : " мР/ч");
                    }
                    if (tempr_danger > 0)
                    {
                        if (rad_danger > 0)
                        {
                            s += ",";
                        }
                        s += " " + tempr_danger.ToString() + (lng == Lang.En ? "°C" : "°C");
                    }
                    s += ".";
                }
            }
            else if (!f.IsNPC)
            {
                // Show talents of other factions' persons if Chosen in region
                Person chosen = f.GetChosen();
                if (chosen != null && p.Region == chosen.Region)
                {
                    SkillTypeList talents = new SkillTypeList();
                    foreach (Skill sk in p.Skills)
                    {
                        if (sk.Type.BasedOn == null)
                        {
                            talents.Add(sk.Type);
                        }
                    }
                    s += (lng == Lang.En ? " Skills: " : " Навыки: ") +
                         talents.ToString(lng);
                }
            }

            if (p.TradeOrder != null)
            {
                Person receiver = null;
                if (p.TradeOrder.PersonNum != 0)
                {
                    receiver = p.Region.Persons.GetByNumber(p.TradeOrder.PersonNum);
                }
                if (p.TradeOrder.PersonNum == 0 || (receiver != null && receiver.Faction == f))
                {
                    if (lng == Lang.En)
                    {
                        s += " Trade: sells " + p.TradeOrder.SellWhat.ToString(p.TradeOrder.SellAmount, Lang.En) +
                             " for " + p.TradeOrder.BuyWhat.ToString(p.TradeOrder.BuyAmount, Lang.En);
                        if (receiver != null)
                        {
                            s += " to " + receiver.ToString(Lang.En);
                        }
                        s += ".";
                    }
                    else
                    {
                        s += " Бартер: предлагает: " + p.TradeOrder.SellWhat.ToString(p.TradeOrder.SellAmount, Lang.Ru) +
                             ", просит: " + p.TradeOrder.BuyWhat.ToString(p.TradeOrder.BuyAmount, Lang.Ru);
                        if (receiver != null)
                        {
                            s += ", покупатель:  " + receiver.ToString(Lang.Ru);
                        }
                        s += ".";
                    }
                }
            }

            if (p.Description != "")
            {
                if (lng == Lang.En)
                {
                    s = s.Substring(0, s.Length - 1) + "; " + MyStrings.Translit(p.Description);
                }
                else
                {
                    s = s.Substring(0, s.Length - 1) + "; " + p.Description;
                }
            }

            Write(s);
        }