Пример #1
0
 private void architecture_OnHirePerson(PersonList personList)
 {
     if (personList.Count > 0)
     {
         Session.MainGame.mainGameScreen.ArchitectureHirePerson(personList);
     }
 }
Пример #2
0
 private void architecture_OnHirePerson(PersonList personList)
 {
     if (personList.Count > 0)
     {
         (personList[0] as Person).Scenario.GameScreen.ArchitectureHirePerson(personList);
     }
 }
Пример #3
0
 private void architecture_OnHirePerson(PersonList personList)
 {
     if (personList.Count > 0)
     {
         (personList[0] as Person).Scenario.GameScreen.ArchitectureHirePerson(personList);
     }
 }
Пример #4
0
 internal void CallInformation()
 {
     if (!this.InformationDestination.HasValue)
     {
         PersonList list = new PersonList();
         foreach (LinkNode node in this.WillArchitecture.AIAllLinkNodes.Values)
         {
             if ((((node.A.BelongedFaction == this.BelongedFaction) && node.A.BelongedSection != null &&
                   node.A.BelongedSection.AIDetail.AllowInvestigateTactics) && node.A.InformationAvail()) &&
                 (node.A.RecentlyAttacked <= 0))
             {
                 foreach (Person person in node.A.MovablePersons)
                 {
                     if (person.LocationArchitecture != null)
                     {
                         list.Add(person);
                     }
                 }
                 if (list.Count >= 10)
                 {
                     break;
                 }
             }
         }
         if (list.Count > 0)
         {
             Person person = list[GameObject.Random(list.Count)] as Person;
             InformationKindList availList = base.Scenario.GameCommonData.AllInformationKinds.GetAvailList(person.LocationArchitecture);
             if (availList.Count > 0)
             {
                 if (availList.Count > 1)
                 {
                     if (this.WillArchitecture.BelongedFaction == null)
                     {
                         availList.PropertyName = "CostFund";
                         availList.SmallToBig   = true;
                     }
                     else
                     {
                         availList.PropertyName = "FightingWeighing";
                     }
                     availList.IsNumber = true;
                     availList.ReSort();
                 }
                 this.SetInformationPosition();
                 if (this.InformationDestination.HasValue)
                 {
                     person.CurrentInformationKind = availList[GameObject.Random(availList.Count / 2)] as InformationKind;
                     person.GoForInformation(this.InformationDestination.Value);
                 }
             }
         }
     }
 }
Пример #5
0
 internal void CallInformation()
 {
     if (!this.InformationDestination.HasValue)
     {
         PersonList list = new PersonList();
         foreach (LinkNode node in this.WillArchitecture.AIAllLinkNodes.Values)
         {
             if ((((node.A.BelongedFaction == this.BelongedFaction) && node.A.BelongedSection != null && 
                 node.A.BelongedSection.AIDetail.AllowInvestigateTactics) && node.A.InformationAvail()) &&
                 (node.A.RecentlyAttacked <= 0))
             {
                 foreach (Person person in node.A.Persons)
                 {
                     if (person.LocationArchitecture != null)
                     {
                         list.Add(person);
                     }
                 }
                 if (list.Count >= 10)
                 {
                     break;
                 }
             }
         }
         if (list.Count > 0)
         {
             Person person = list[GameObject.Random(list.Count)] as Person;
             InformationKindList availList = base.Scenario.GameCommonData.AllInformationKinds.GetAvailList(person.LocationArchitecture);
             if (availList.Count > 0)
             {
                 if (availList.Count > 1)
                 {
                     if (this.WillArchitecture.BelongedFaction == null)
                     {
                         availList.PropertyName = "CostFund";
                         availList.SmallToBig = true;
                     }
                     else
                     {
                         availList.PropertyName = "FightingWeighing";
                     }
                     availList.IsNumber = true;
                     availList.ReSort();
                 }
                 this.SetInformationPosition();
                 if (this.InformationDestination.HasValue)
                 {
                     person.CurrentInformationKind = availList[GameObject.Random(availList.Count / 2)] as InformationKind;
                     person.GoForInformation(this.InformationDestination.Value);
                 }
             }
         }
     }
 }
Пример #6
0
        public void LoadPersonIdFromString(PersonList persons, string data)
        {
            char[]   separator = new char[] { ' ', '\n', '\r', '\t' };
            string[] strArray  = data.Split(separator, StringSplitOptions.RemoveEmptyEntries);

            this.person = new Dictionary <int, List <Person> >();
            for (int i = 0; i < strArray.Length; i += 2)
            {
                int n   = int.Parse(strArray[i]);
                int pid = int.Parse(strArray[i + 1]);
                if (!this.person.ContainsKey(n))
                {
                    this.person[n] = new List <Person>();
                }
                if (pid != -1)
                {
                    this.person[n].Add(persons.GetGameObject(pid) as Person);
                }
                else
                {
                    this.person[n].Add(null);
                }
            }
        }
Пример #7
0
 public virtual void TroopGetNewCaptive(Troop troop, PersonList personlist)
 {
 }
Пример #8
0
 public virtual void ArchitectureHirePerson(PersonList personList)
 {
 }
Пример #9
0
        private void AIHouGong()
        {
            if (base.Scenario.IsPlayer(this.BelongedFaction)) return;
            if (this.HasHostileTroopsInView()) return;
            if (GlobalVariables.getChildrenRate <= 0) return;
            Person leader = this.BelongedFaction.Leader;
            int uncruelty = leader.Uncruelty;
            //build hougong
            int unAmbition = Enum.GetNames(typeof(PersonAmbition)).Length - (int)leader.Ambition;
            if (this.BelongedFaction.meinvkongjian() - this.BelongedFaction.feiziCount() <= 0 && (this.BuildingFacility < 0) && (this.PlanFacilityKind == null || this.PlanFacilityKind.rongna <= 0)
                && GameObject.Random((int)(GameObject.Square(unAmbition) * Parameters.AIBuildHougongUnambitionProbWeight + GameObject.Square(this.BelongedFaction.meinvkongjian()) * unAmbition * Parameters.AIBuildHougongSpaceBuiltProbWeight)) == 0)
            {
                if (((!this.FrontLine && !this.noFactionFrontline) || GameObject.Chance(Parameters.AILeaveFrontlineForHougongChance))
                    && (!this.HostileLine || GameObject.Chance(Parameters.AILeaveHostilelineForHougongChance))
                    && this.Kind.FacilityPositionUnit > 0 &&
                    this.Agriculture >= this.AgricultureCeiling * 9 / 10 && this.Commerce >= this.CommerceCeiling * 9 / 10 &&
                    this.Technology >= this.TechnologyCeiling * 9 / 10 && this.Endurance >= this.EnduranceCeiling * 9 / 10 &&
                    this.Domination >= this.DominationCeiling * 9 / 10 && this.Morale >= this.MoraleCeiling * 9 / 10)
                {
                    int maxHgSize = (12 - uncruelty) + Math.Max(0, this.FacilityPositionCount / this.Kind.FacilityPositionUnit - 5) + Parameters.AIBuildHougongMaxSizeAdd;
                    FacilityKind hougong = null;
                    foreach (FacilityKind fk in base.Scenario.GameCommonData.AllFacilityKinds.FacilityKinds.Values)
                    {
                        if ((((!fk.PopulationRelated || this.Kind.HasPopulation) && ((this.Technology >= fk.TechnologyNeeded)))
                            && ((!fk.UniqueInArchitecture || !this.ArchitectureHasFacilityKind(kind.ID)) && (!fk.UniqueInFaction || !this.FactionHasFacilityKind(kind.ID)))))
                        {
                            if (fk.rongna > 0 && fk.rongna < maxHgSize && GameObject.Chance(Parameters.AIBuildHougongSkipSizeChance))
                            {
                                if (hougong == null || hougong.rongna < fk.rongna)
                                {
                                    hougong = fk;
                                }
                            }
                        }
                    }
                    if (hougong != null)
                    {
                        int facilityPositionLeft = this.FacilityPositionLeft;
                        if (facilityPositionLeft < hougong.PositionOccupied && this.FacilityPositionCount >= hougong.PositionOccupied)
                        {
                            FacilityList fl = new FacilityList();
                            foreach (Facility f in this.Facilities)
                            {
                                if (!f.Kind.bukechaichu)
                                {
                                    fl.Add(f);
                                }
                            }

                            int totalRemovableSpace = 0;
                            foreach (Facility f in fl)
                            {
                                totalRemovableSpace += f.PositionOccupied;
                            }

                            if (totalRemovableSpace >= hougong.PositionOccupied && this.BelongedSection.AIDetail.AllowFacilityRemoval)
                            {
                                fl.PropertyName = "AIValue";
                                fl.IsNumber = true;
                                fl.SmallToBig = true;
                                fl.ReSort();

                                while (this.FacilityPositionLeft < hougong.PositionOccupied && fl.Count > 0)
                                {
                                    Facility f = fl[0] as Facility;
                                    if (this.FacilityEnabled || f.MaintenanceCost <= 0)
                                    {
                                        f.Influences.PurifyInfluence(this, Applier.Facility, f.ID);
                                    }
                                    this.Facilities.Remove(f);
                                    base.Scenario.Facilities.Remove(f);
                                    fl.Remove(f);
                                }
                            }

                            /*foreach (Facility facility in this.Facilities.GetList())
                            {
                                if ((((this.Technology > facility.TechnologyNeeded) && this.FacilityIsPossibleOverTechnology(facility.TechnologyNeeded))
                                    && ((this.Fund > (facility.FundCost * 10)) && (this.BelongedFaction.TechniquePoint > (facility.PointCost * 10))))
                                    && (GameObject.Random(facility.Days * facility.PositionOccupied) < 20 * hougong.PositionOccupied)
                                    && !facility.Kind.bukechaichu)
                                {
                                    if (this.FacilityEnabled)
                                    {
                                        facility.Influences.PurifyInfluence(this);
                                    }
                                    this.Facilities.Remove(facility);
                                    base.Scenario.Facilities.Remove(facility);
                                }
                            }*/
                            facilityPositionLeft = this.FacilityPositionLeft;
                        }
                        if (facilityPositionLeft >= hougong.PositionOccupied)
                        {
                            if ((this.Fund >= hougong.FundCost) && ((this.BelongedFaction.TechniquePoint + this.BelongedFaction.TechniquePointForFacility) >= hougong.PointCost))
                            {
                                this.PlanFacilityKind = null;
                                this.BelongedFaction.DepositTechniquePointForFacility(hougong.PointCost);
                                this.BeginToBuildAFacility(hougong);
                            }
                            else
                            {
                                this.PlanFacilityKind = hougong;
                                if (GameObject.Chance(0x21) && ((this.BelongedFaction.TechniquePoint + this.BelongedFaction.TechniquePointForFacility) < this.PlanFacilityKind.PointCost))
                                {
                                    this.BelongedFaction.SaveTechniquePointForFacility(this.PlanFacilityKind.PointCost / this.PlanFacilityKind.Days);
                                }
                            }
                        }
                    }
                }
            }
            //nafei
            if (leader.WaitForFeiZi != null && leader.Status == PersonStatus.Normal)
            {
                if (this.Meinvkongjian - this.Feiziliebiao.Count <= 0 || !this.BelongedFaction.Leader.isLegalFeiZi(leader.WaitForFeiZi))
                {
                    leader.WaitForFeiZi.WaitForFeiZi = null;
                    leader.WaitForFeiZi = null;
                }
                else if (this.fund >= 50000)
                {
                    if (leader.LocationArchitecture == this && leader.Status == PersonStatus.Normal && this.nvxingwujiang().GameObjects.Contains(leader.WaitForFeiZi))
                    {
                        leader.XuanZeMeiNv(leader.WaitForFeiZi);
                        leader.WaitForFeiZi.WaitForFeiZi = null;
                        leader.WaitForFeiZi = null;
                    }
                    else if (leader.WaitForFeiZi.BelongedFaction != this.BelongedFaction)
                    {
                        leader.WaitForFeiZi.WaitForFeiZi = null;
                        leader.WaitForFeiZi = null;
                    }
                }
                else
                {
                    leader.WaitForFeiZi.WaitForFeiZi = null;
                    leader.WaitForFeiZi = null;
                }
            }
            else
            {
                if (!leader.IsCaptive && this.Meinvkongjian - this.Feiziliebiao.Count > 0 && leader.Status == PersonStatus.Normal &&
                    (
                    GameObject.Random(uncruelty - Parameters.AINafeiUncreultyProbAdd) == 0
                    ||
                    GameObject.Chance((int)Math.Round(Parameters.AIHougongArchitectureCountProbMultiply * Math.Pow(this.BelongedFaction.ArchitectureCount, Parameters.AIHougongArchitectureCountProbPower))))
                    && this.Fund > 75000
                    )
                {
                    if (leader.LocationArchitecture == this)
                    {
                        PersonList candidate = new PersonList();
                        foreach (Person p in this.BelongedFaction.Persons)
                        {
                            Person spousePerson = p.Spouse == null ? null : p.Spouse;
                            if (p.Merit > ((unAmbition - 1) * Parameters.AINafeiAbilityThresholdRate) && leader.isLegalFeiZi(p) && p.LocationArchitecture != null && !p.IsCaptive && !p.Hates(this.BelongedFaction.Leader) &&
                                (spousePerson == null || spousePerson.ID == leader.ID || !spousePerson.Alive || (leader.PersonalLoyalty < (int)PersonLoyalty.很高 && spousePerson.Merit < p.Merit * ((int)leader.PersonalLoyalty * Parameters.AINafeiStealSpouseThresholdRateMultiply + Parameters.AINafeiStealSpouseThresholdRateAdd))) &&
                                (!GlobalVariables.PersonNaturalDeath || (p.Age >= 16 && p.Age <= Parameters.AINafeiMaxAgeThresholdAdd + (int)leader.Ambition * Parameters.AINafeiMaxAgeThresholdMultiply)))
                            {
                                candidate.Add(p);
                            }
                        }
                        candidate.PropertyName = "Merit";
                        candidate.IsNumber = true;
                        candidate.SmallToBig = false;
                        candidate.ReSort();
                        Person toTake = null;
                        foreach (Person p in candidate)
                        {
                            if (p.Status == PersonStatus.Normal)
                            {
                                if ((!p.RecruitableBy(this.BelongedFaction, 0) && GameObject.Random((int)unAmbition) == 0) || GameObject.Chance((int)(Parameters.AINafeiSkipChanceAdd + (int)leader.Ambition * Parameters.AINafeiSkipChanceMultiply)))
                                {
                                    toTake = p;
                                    break;
                                }
                            }
                        }
                        if (toTake != null)
                        {
                            if (leader.LocationArchitecture.Meinvkongjian > this.Meinvkongjian)
                            {
                                if (toTake.LocationArchitecture == leader.LocationArchitecture && toTake.LocationArchitecture.Fund >= 50000)
                                {
                                    leader.XuanZeMeiNv(toTake);
                                    toTake.WaitForFeiZi = null;
                                    leader.WaitForFeiZi = null;
                                }
                                else
                                {
                                    toTake.MoveToArchitecture(leader.LocationArchitecture);
                                    toTake.WaitForFeiZi = leader;
                                    leader.WaitForFeiZi = toTake;
                                }
                            }
                            else
                            {
                                if (leader.LocationArchitecture != this)
                                {
                                    leader.MoveToArchitecture(this);
                                    leader.WaitForFeiZi = toTake;
                                }
                                if (toTake.LocationArchitecture == this)
                                {
                                    if (leader.LocationArchitecture == this && this.Fund >= 50000)
                                    {
                                        leader.XuanZeMeiNv(toTake);
                                        toTake.WaitForFeiZi = null;
                                        leader.WaitForFeiZi = null;
                                    }
                                    else
                                    {
                                        toTake.WaitForFeiZi = leader;
                                    }
                                }
                                else
                                {
                                    toTake.MoveToArchitecture(this);
                                    toTake.WaitForFeiZi = leader;
                                    leader.WaitForFeiZi = toTake;
                                }
                            }
                        }
                    }
                    else if (leader.LocationArchitecture != null &&
                        ((!leader.LocationArchitecture.HostileLine || GameObject.Chance(Parameters.AILeaveHostilelineForHougongChance) || (leader.LocationArchitecture == this && GameObject.Chance(Parameters.AIHostilelineHougongChance)))
                        && (!leader.LocationArchitecture.FrontLine || GameObject.Chance(Parameters.AILeaveFrontlineForHougongChance) || (leader.LocationArchitecture == this && GameObject.Chance(Parameters.AIFrontlineHougongChance))))
                        )
                    {
                        if (leader.LocationArchitecture.meifaxianhuaiyundefeiziliebiao().Count <= 0)
                        {
                            leader.MoveToArchitecture(this);
                        }
                    }
                }
            }
            //chongxing
            if (!leader.IsCaptive && !leader.huaiyun && meifaxianhuaiyundefeiziliebiao().Count > 0 && leader.LocationArchitecture != null &&
                this.BelongedFaction.Leader.WaitForFeiZi == null && leader.Status == PersonStatus.Normal &&

                (
                GameObject.Chance((int)((int)leader.Ambition * Parameters.AIChongxingChanceMultiply + Parameters.AIChongxingChanceAdd))
                ||
                GameObject.Chance((int)Math.Round(Parameters.AIHougongArchitectureCountProbMultiply * Math.Pow(this.BelongedFaction.ArchitectureCount, Parameters.AIHougongArchitectureCountProbPower)))
                )

                &&

                   (((!leader.LocationArchitecture.HostileLine || GameObject.Chance(Parameters.AILeaveHostilelineForHougongChance) || (leader.LocationArchitecture == this && GameObject.Chance(Parameters.AIHostilelineHougongChance)))
                    && (!leader.LocationArchitecture.FrontLine || GameObject.Chance(Parameters.AILeaveFrontlineForHougongChance) || (leader.LocationArchitecture == this && GameObject.Chance(Parameters.AIFrontlineHougongChance))))
                    )
                )
            {
                if (leader.LocationArchitecture != this)
                {
                    bool stay = false;
                    PersonList candidate = leader.LocationArchitecture.meifaxianhuaiyundefeiziliebiao();
                    candidate.PropertyName = "Merit";
                    candidate.IsNumber = true;
                    candidate.SmallToBig = false;
                    candidate.ReSort();
                    foreach (Person p in candidate)
                    {
                        if ((GameObject.Random(leader.NumberOfChildren * (GlobalVariables.PersonNaturalDeath ? 1 : 0) + p.NumberOfChildren * 2) == 0 || GameObject.Chance(p.pregnantChance)) && leader.isLegalFeiZi(p))
                        {
                            stay = true;
                            leader.GoForHouGong(p);
                            break;
                        }
                    }
                    if (!stay)
                    {
                        leader.MoveToArchitecture(this);
                    }
                }
                else
                {
                    PersonList candidate = meifaxianhuaiyundefeiziliebiao();
                    candidate.PropertyName = "Merit";
                    candidate.IsNumber = true;
                    candidate.SmallToBig = false;
                    candidate.ReSort();
                    foreach (Person p in candidate)
                    {
                        if (GameObject.Random(leader.NumberOfChildren * (GlobalVariables.PersonNaturalDeath ? 1 : 0) + p.NumberOfChildren * 2) == 0 && leader.isLegalFeiZi(p))
                        {
                            leader.GoForHouGong(p);
                            break;
                        }
                    }
                }
            }
        }
Пример #10
0
 private void troop_OnGetNewCaptive(Troop troop, PersonList personlist)
 {
     troop.Scenario.GameScreen.TroopGetNewCaptive(troop, personlist);
 }
Пример #11
0
 public PersonList yihuaiyundefeiziliebiao()
 {
     PersonList feiziliebiao = new PersonList();
     foreach (Person feizi in this.Feiziliebiao)
     {
         if (feizi.huaiyun)
         {
             feiziliebiao.Add(feizi);
         }
     }
     return feiziliebiao;
 }
Пример #12
0
 private void architecture_OnReleaseCaptiveAfterOccupied(Architecture architecture, PersonList persons)
 {
     architecture.Scenario.GameScreen.ArchitectureReleaseCaptiveAfterOccupied(architecture, persons);
 }
Пример #13
0
 public PersonList GetPersonStudyTitleList()
 {
     PersonList result = new PersonList();
     foreach (Person person in this.Persons)
     {
         if (person.HasLearnableTitle)
         {
             result.Add(person);
         }
     }
     PersonStudyTitleList = result;
     return result;
 }
Пример #14
0
        public void HireNoFactionPerson()
        {
            PersonList personList = new PersonList();
            PersonList recruitablePeople = new PersonList();
            foreach (Person person in this.NoFactionPersons.GetList())
            {
                if ((person.BelongedFaction != null) || (person.LocationArchitecture != this))
                {
                    //this.RemoveNoFactionPerson(person);
                }
                else
                {
                    int idealOffset = Person.GetIdealOffset(person, this.BelongedFaction.Leader);
                    if (
                            ((!GlobalVariables.IdealTendencyValid || (idealOffset <= person.IdealTendency.Offset + (double)this.BelongedFaction.Reputation / this.BelongedFaction.MaxPossibleReputation * 75))
                            && (!this.BelongedFaction.IsAlien || (int)person.PersonalLoyalty < 2)
                            && (!person.HatedPersons.Contains(this.BelongedFaction.LeaderID)))
                        || (!base.Scenario.IsPlayer(this.BelongedFaction) && GlobalVariables.AIAutoTakeNoFactionPerson)
                           )
                    {
                        recruitablePeople.Add(person);
                    }
                }
            }
            if (recruitablePeople.Count > 0)
            {
                foreach (Person toRecruit in recruitablePeople.GetRandomList())
                {
                    this.DecreaseFund(this.HirePersonFund);
                    if (!((toRecruit.BelongedFaction != null) || (toRecruit.LocationArchitecture != this)))
                    {
                        int idealOffset = Person.GetIdealOffset(toRecruit, this.BelongedFaction.Leader);
                        if (
                            ((!GlobalVariables.IdealTendencyValid || (idealOffset <= toRecruit.IdealTendency.Offset + (double)this.BelongedFaction.Reputation / this.BelongedFaction.MaxPossibleReputation * 75))
                            && (GameObject.Random(idealOffset * idealOffset + 100) < 100)
                            && (!this.BelongedFaction.IsAlien || (int)toRecruit.PersonalLoyalty < 2)
                            && (!toRecruit.HatedPersons.Contains(this.BelongedFaction.LeaderID)))
                        || (!base.Scenario.IsPlayer(this.BelongedFaction) && GlobalVariables.AIAutoTakeNoFactionPerson)
                           )
                        {
                            if (toRecruit.ProhibitedFactionID != this.BelongedFaction.ID)
                            {
                                personList.Add(toRecruit);
                            }
                        }
                    }
                    if (this.Fund < this.HirePersonFund)
                    {
                        break;
                    }
                    /*if (GameObject.Random(recruitablePeople.Count) < 0)
                    {
                        break;
                    }*/
                }
            }
            foreach (Person person in personList)
            {
                person.ChangeFaction(this.BelongedFaction);
                ExtensionInterface.call("HirePerson", new Object[] { this.Scenario, this, person });
                this.Scenario.GameScreen.xianshishijiantupian(person, this.Name, "ArchitectureHirePerson", "", "", this.BelongedFaction.Name, false);
            }
            if (personList.Count > 0)
            {
                /*
                if (this.OnHirePerson != null)
                {
                    this.OnHirePerson(personList);
                }
                */
                if (this.HasSpy)
                {
                    this.CreateHireNewPersonSpyMessage(personList[GameObject.Random(personList.Count)] as Person);
                }
            }
            else if (personList.Count == 0)
            {
                if ((this.Scenario.CurrentPlayer != null) && this.BelongedFaction == this.Scenario.CurrentPlayer)
                {
                    //this.shoudongluyongshibai = true;
                }

            }
            this.HireFinished = true;
        }
Пример #15
0
        public void LoadPersonIdFromString(PersonList persons, string data)
        {
            char[] separator = new char[] { ' ', '\n', '\r' };
            string[] strArray = data.Split(separator, StringSplitOptions.RemoveEmptyEntries);

            this.person = new Dictionary<int, List<Person>>();
            for (int i = 0; i < strArray.Length; i += 2)
            {
                int n = int.Parse(strArray[i]);
                int pid = int.Parse(strArray[i + 1]);
                if (!this.person.ContainsKey(n))
                {
                    this.person[n] = new List<Person>();
                }
                if (pid != -1)
                {
                    this.person[n].Add(persons.GetGameObject(pid) as Person);
                }
                else
                {
                    this.person[n].Add(null);
                }
            }
        }
Пример #16
0
 private void troop_OnReleaseCaptive(Troop troop, PersonList personlist)
 {
     Session.MainGame.mainGameScreen.TroopReleaseCaptive(troop, personlist);
 }
Пример #17
0
 private void troop_OnGetNewCaptive(Troop troop, PersonList personlist)
 {
     Session.MainGame.mainGameScreen.TroopGetNewCaptive(troop, personlist);
 }
Пример #18
0
 private void troop_OnReleaseCaptive(Troop troop, PersonList personlist)
 {
     troop.Scenario.GameScreen.TroopReleaseCaptive(troop, personlist);
 }
Пример #19
0
 public virtual void ArchitectureReleaseCaptiveAfterOccupied(Architecture architecture, PersonList persons)
 {
 }
Пример #20
0
 public PersonList meifaxianhuaiyundefeiziliebiao()
 {
     PersonList meihuailiebiao = new PersonList();
     foreach (Person person in this.Feiziliebiao)
     {
         if (!person.faxianhuaiyun && this.BelongedFaction.Leader.isLegalFeiZi(person))
             meihuailiebiao.Add(person);
     }
     return meihuailiebiao;
 }
Пример #21
0
 public virtual void TroopReleaseCaptive(Troop troop, PersonList personlist)
 {
 }
Пример #22
0
 private void architecture_OnReleaseCaptiveAfterOccupied(Architecture architecture, PersonList persons)
 {
     Session.MainGame.mainGameScreen.ArchitectureReleaseCaptiveAfterOccupied(architecture, persons);
 }
Пример #23
0
 public PersonList GetPersonListExceptLeader()
 {
     PersonList list = new PersonList();
     if (this.BelongedFaction != null)
     {
         foreach (Person person in this.Persons)
         {
             if (person != this.BelongedFaction.Leader)
             {
                 list.Add(person);
             }
         }
     }
     return list;
 }
Пример #24
0
 private Troop BuildTransportTroop(Architecture destination, Military military, int food, int fund)
 {
     Troop troop;
     int min = int.MaxValue;
     PersonList leader = new PersonList();
     foreach (Person p in this.Persons)
     {
         if (p.Merit < min)
         {
             leader.Clear();
             leader.Add(p);
             min = p.Merit;
         }
     }
     if (leader.Count <= 0) return null;
     troop = Troop.CreateSimulateTroop(leader, military, this.Position);
     Point? nullable = this.GetRandomStartingPosition(troop);
     if (!nullable.HasValue)
     {
         return null;
     }
     troop.Destroy(true, false);
     troop = this.CreateTroop(leader, leader[0] as Person, military, food, nullable.Value);
     troop.WillArchitecture = destination;
     troop.zijin = fund;
     this.Fund -= fund;
     Legion legion = this.BelongedFaction.GetLegion(destination);
     if (legion == null)
     {
         legion = this.CreateOffensiveLegion(destination);
     }
     legion.AddTroop(troop);
     this.PostCreateTroop(troop, false);
     return troop;
 }
Пример #25
0
 public bool HasUnavailablePerson(PersonList personlist)
 {
     foreach (Person person in personlist)
     {
         if (person.LocationArchitecture == null)
         {
             return true;
         }
     }
     return false;
 }
Пример #26
0
        private Troop BuildTroopForTransfer(Military military, Architecture destination, LinkKind linkkind)
        {
            if (linkkind == LinkKind.None)
            {
                return null;
            }
            if (!this.isArmyNavigableTo(linkkind, military))
            {
                return null;
            }
            if (this.Persons.Count == 0) return null;
            TroopList list = new TroopList();
            this.Persons.ClearSelected();
            if ((military.Scales > 5) && (military.Morale >= 80) && (military.Combativity >= 80) && (military.InjuryQuantity < military.Kind.MinScale) && !military.IsFewScaleNeedRetreat)
            {
                PersonList list2;
                Military military2 = military;
                if ((military2.FollowedLeader != null) && this.Persons.HasGameObject(military2.FollowedLeader) && military2.FollowedLeader.WaitForFeiZi == null && military2.FollowedLeader.LocationTroop == null)
                {
                    list2 = new PersonList();
                    list2.Add(military2.FollowedLeader);
                    military2.FollowedLeader.Selected = true;
                    Point? nullable = this.GetRandomStartingPosition(military2);
                    if (!nullable.HasValue)
                    {
                        return null;
                    }

                    Troop troop = this.CreateTroop(list2, military2.FollowedLeader, military2, -1, nullable.Value);
                    troop.WillArchitecture = destination;
                    Legion legion = this.BelongedFaction.GetLegion(destination);
                    if (legion == null)
                    {
                        legion = this.CreateOffensiveLegion(destination);
                    }
                    legion.AddTroop(troop);
                    return troop;
                }
                if ((((military2.Leader != null) && (military2.LeaderExperience >= 10)) && (((military2.Leader.Strength >= 80) || (military2.Leader.Command >= 80)) || military2.Leader.HasLeaderValidTitle))
                    && this.Persons.HasGameObject(military2.Leader) && military2.Leader.WaitForFeiZi == null && military2.Leader.LocationTroop == null)
                {
                    list2 = new PersonList();
                    list2.Add(military2.Leader);
                    military2.Leader.Selected = true;
                    Point? nullable = this.GetRandomStartingPosition(military2);
                    if (!nullable.HasValue)
                    {
                        return null;
                    }
                    Troop troop = this.CreateTroop(list2, military2.Leader, military2, -1, nullable.Value);
                    troop.WillArchitecture = destination;
                    Legion legion = this.BelongedFaction.GetLegion(destination);
                    if (legion == null)
                    {
                        legion = this.CreateOffensiveLegion(destination);
                    }
                    legion.AddTroop(troop);
                    return troop;
                }
                GameObjectList sortedList = this.Persons.GetList() as GameObjectList;
                sortedList.PropertyName = "FightingForce";
                sortedList.IsNumber = true;
                sortedList.SmallToBig = true;
                sortedList.ReSort();
                foreach (Person person in sortedList)
                {
                    if (!person.Selected && person.WaitForFeiZi == null && person.LocationTroop == null)
                    {
                        list2 = new PersonList();
                        list2.Add(person);
                        person.Selected = true;
                        Point? nullable = this.GetRandomStartingPosition(military2);
                        if (!nullable.HasValue)
                        {
                            break;
                        }
                        Troop troop = this.CreateTroop(list2, person, military2, -1, nullable.Value);
                        troop.WillArchitecture = destination;
                        Legion legion = this.BelongedFaction.GetLegion(destination);
                        if (legion == null)
                        {
                            legion = this.CreateOffensiveLegion(destination);
                        }
                        legion.AddTroop(troop);
                        return troop;
                    }
                }
            }
            return null;
        }
Пример #27
0
 /*
 private bool younvxingwujiang()
 {
     foreach (Person person in this.Persons)
     {
         if (person.Sex != person.BelongedFaction.Leader.Sex)
         {
             return true;
         }
     }
     return false;
 }
 */
 public PersonList nvxingwujiang()
 {
     PersonList nvxingwujiangliebiao = new PersonList();
     foreach (Person person in this.Persons)
     {
         if (person.BelongedFaction.Leader.isLegalFeiZi(person))
         {
             nvxingwujiangliebiao.Add(person);
         }
     }
     return nvxingwujiangliebiao;
 }
Пример #28
0
 private PersonList GetFirstHalfPersonList(string propertyName)
 {
     PersonList list = new PersonList();
     if (this.Persons.Count > 0)
     {
         foreach (Person p in this.Persons)
         {
             list.Add(p);
         }
         if (list.Count > 1)
         {
             list.PropertyName = propertyName;
             list.IsNumber = true;
             list.ReSort();
         }
         list.GameObjects.RemoveRange(list.Count / 2, list.Count - list.Count / 2);
         return (list);
     }
     return new PersonList();
 }
Пример #29
0
        internal bool IsSelfFoodEnoughForOffensive(LinkNode node, Routeway routeway)
        {
            MilitaryList cropConsumptionOrderedList = Militaries;
            cropConsumptionOrderedList.PropertyName = "FoodCostPerDay";
            cropConsumptionOrderedList.IsNumber = true;
            cropConsumptionOrderedList.ReSort();
            PersonList leaderablePersonList = new PersonList();
            foreach (Person p in this.Persons)
            {
                if (p.Command >= 40)
                {
                    leaderablePersonList.Add(p);
                }
            }
            switch (node.Kind)
            {
                case LinkKind.None:
                    return false;

                case LinkKind.Land:
                    {
                        int crop = 0;
                        int troopCnt = 0;
                        foreach (Military m in cropConsumptionOrderedList)
                        {
                            if ((((m.Scales >= 3) && (m.Morale >= 80)) && (m.Combativity >= 80)) && (m.InjuryQuantity < m.Kind.MinScale) && m.Kind.Type != MilitaryType.水军)
                            {
                                crop += m.FoodCostPerDay;
                                troopCnt++;
                                if (troopCnt >= leaderablePersonList.Count) break;
                            }
                        }
                        if (routeway.LastPoint == null) return false;
                        return (((this.Food * (1f - routeway.LastPoint.ConsumptionRate)) * base.Scenario.Date.GetFoodRateBySeason(base.Scenario.Date.GetSeason(routeway.Length))) >= (crop * (routeway.Length + 6)));
                    }

                case LinkKind.Water:
                    {
                        int crop = 0;
                        int troopCnt = 0;
                        foreach (Military m in cropConsumptionOrderedList)
                        {
                            if ((((m.Scales >= 3) && (m.Morale >= 80)) && (m.Combativity >= 80)) && (m.InjuryQuantity < m.Kind.MinScale) && m.Kind.Type == MilitaryType.水军)
                            {
                                crop += m.FoodCostPerDay;
                                troopCnt++;
                                if (troopCnt >= leaderablePersonList.Count) break;
                            }
                        }
                        if (routeway.LastPoint == null) return false;
                        return (((this.Food * (1f - routeway.LastPoint.ConsumptionRate)) * base.Scenario.Date.GetFoodRateBySeason(base.Scenario.Date.GetSeason(routeway.Length))) >= (crop * (routeway.Length + 6)));
                    }

                case LinkKind.Both:
                    {
                        int crop = 0;
                        int troopCnt = 0;
                        foreach (Military m in cropConsumptionOrderedList)
                        {
                            if ((((m.Scales >= 3) && (m.Morale >= 80)) && (m.Combativity >= 80)) && (m.InjuryQuantity < m.Kind.MinScale))
                            {
                                crop += m.FoodCostPerDay;
                                troopCnt++;
                                if (troopCnt >= leaderablePersonList.Count) break;
                            }
                        }
                        if (routeway.LastPoint == null) return false;
                        return (((this.Food * (1f - routeway.LastPoint.ConsumptionRate)) * base.Scenario.Date.GetFoodRateBySeason(base.Scenario.Date.GetSeason(routeway.Length))) >= (crop * ((routeway.Length + 6) - (this.ArmyScale / 8))));
                    }
            }
            return false;
        }
Пример #30
0
 private void ReleaseAllCaptive()
 {
     if (this.HasCaptive())
     {
         PersonList persons = new PersonList();
         foreach (Captive captive in this.Captives.GetList())
         {
             if (((captive.CaptivePerson != null) && (captive.CaptiveFaction != null)) && (captive.CaptiveFaction.Capital != null))
             {
                 Architecture moveTo = captive.CaptiveFaction.Capital;
                 persons.Add(captive.CaptivePerson);
                 Person p = captive.CaptivePerson;
                 captive.CaptivePerson.BelongedCaptive = null;
                 p.Status = PersonStatus.Normal;
                 p.MoveToArchitecture(moveTo);
             }
         }
         if ((persons.Count > 0) && (this.OnReleaseCaptiveAfterOccupied != null))
         {
             this.OnReleaseCaptiveAfterOccupied(this, persons);
         }
     }
 }
Пример #31
0
 private PersonList AISelectPersonIntoTroop_inner(Person leader, PersonList otherPersons, bool markSelected)
 {
     PersonList persons = new PersonList();
     persons.Add(leader);
     if (markSelected)
     {
         leader.Selected = true;
     }
     return persons;
 }
Пример #32
0
 private void ReSortAllWeighingList(PersonList zhenzaiPersons, PersonList agriculturePersons, PersonList commercePersons,
     PersonList technologyPersons, PersonList dominationPersons, PersonList moralePersons, PersonList endurancePersons,
     PersonList recruitmentPersons, PersonList trainingPersons, MilitaryList weighingMilitaries)
 {
     PersonList pl = this.Persons;
     zhenzaiPersons.Clear();
     if (this.kezhenzai())
     {
         foreach (Person person in pl)
         {
             zhenzaiPersons.Add(person);
         }
         zhenzaiPersons.IsNumber = true;
         zhenzaiPersons.PropertyName = "zhenzaiWeighing";
         zhenzaiPersons.ReSort();
     }
     agriculturePersons.Clear();
     if (this.Kind.HasAgriculture)
     {
         foreach (Person person in pl)
         {
             agriculturePersons.Add(person);
         }
         agriculturePersons.IsNumber = true;
         agriculturePersons.PropertyName = "AgricultureWeighing";
         agriculturePersons.ReSort();
     }
     commercePersons.Clear();
     if (this.Kind.HasCommerce)
     {
         foreach (Person person in pl)
         {
             commercePersons.Add(person);
         }
         commercePersons.IsNumber = true;
         commercePersons.PropertyName = "CommerceWeighing";
         commercePersons.ReSort();
     }
     technologyPersons.Clear();
     if (this.Kind.HasTechnology)
     {
         foreach (Person person in pl)
         {
             technologyPersons.Add(person);
         }
         technologyPersons.IsNumber = true;
         technologyPersons.PropertyName = "TechnologyWeighing";
         technologyPersons.ReSort();
     }
     dominationPersons.Clear();
     if (this.Kind.HasDomination)
     {
         foreach (Person person in pl)
         {
             dominationPersons.Add(person);
         }
         dominationPersons.IsNumber = true;
         dominationPersons.PropertyName = "DominationWeighing";
         dominationPersons.ReSort();
     }
     moralePersons.Clear();
     if (this.Kind.HasMorale)
     {
         foreach (Person person in pl)
         {
             moralePersons.Add(person);
         }
         moralePersons.IsNumber = true;
         moralePersons.PropertyName = "MoraleWeighing";
         moralePersons.ReSort();
     }
     endurancePersons.Clear();
     if (this.Kind.HasEndurance)
     {
         foreach (Person person in pl)
         {
             endurancePersons.Add(person);
         }
         endurancePersons.IsNumber = true;
         endurancePersons.PropertyName = "EnduranceWeighing";
         endurancePersons.ReSort();
     }
     trainingPersons.Clear();
     foreach (Person person in pl)
     {
         trainingPersons.Add(person);
     }
     trainingPersons.IsNumber = true;
     trainingPersons.PropertyName = "TrainingWeighing";
     trainingPersons.ReSort();
     recruitmentPersons.Clear();
     foreach (Person person in this.Persons)
     {
         recruitmentPersons.Add(person);
     }
     recruitmentPersons.IsNumber = true;
     recruitmentPersons.PropertyName = "RecruitmentWeighing";
     recruitmentPersons.ReSort();
     weighingMilitaries.Clear();
     foreach (Military military in this.Militaries)
     {
         weighingMilitaries.Add(military);
     }
     weighingMilitaries.IsNumber = true;
     weighingMilitaries.PropertyName = "Weighing";
     weighingMilitaries.ReSort();
 }
Пример #33
0
 public override void TroopReleaseCaptive(Troop troop, PersonList personlist)
 {
     if (((base.Scenario.CurrentPlayer == null) || base.Scenario.CurrentPlayer.IsPositionKnown(troop.Position)) || GlobalVariables.SkyEye)
     {
         Person person = personlist[StaticMethods.Random(personlist.Count)] as Person;
         troop.TextDestinationString = person.Name;
         this.Plugins.GameRecordPlugin.AddBranch(troop, "TroopReleaseCaptive", troop.Position);
     }
 }
Пример #34
0
 private PersonList SelectSubOfficersToTroop(Troop t)
 {
     int personCnt = 1;
     PersonList result = new PersonList();
     result.Add(t.Leader);
     if (t.TroopIntelligence < (0x4b - t.Leader.Calmness))
     {
         foreach (Person person in this.Persons)
         {
             if (person.WaitForFeiZi != null) continue;
             if ((!person.Selected && (person.Intelligence >= (0x4b - t.Leader.Calmness))) && (!t.Persons.HasGameObject(person) && ((((person.Strength < t.TroopStrength) && ((person.Intelligence - t.TroopIntelligence) >= 10)) && (person.FightingForce < t.Leader.FightingForce)) && !person.HasLeaderValidTitle)))
             {
                 person.Selected = true;
                 result.Add(person);
                 personCnt++;
                 break;
             }
         }
     }
     if (t.TroopStrength < 0x4b)
     {
         foreach (Person person in this.Persons)
         {
             if (person.WaitForFeiZi != null) continue;
             if (!person.Selected && person.Strength >= 0x4b && !t.Persons.HasGameObject(person) && person.Closes(t.Leader) &&
                 person.Strength - t.TroopStrength >= 10 && person.FightingForce < t.Leader.FightingForce &&
                 !person.HasLeaderValidTitle)
             {
                 person.Selected = true;
                 result.Add(person);
                 personCnt++;
                 break;
             }
         }
     }
     if (t.TroopCommand < 0x4b)
     {
         foreach (Person person in this.Persons)
         {
             if (person.WaitForFeiZi != null) continue;
             if (!person.Selected && person.Command >= 0x4b && !t.Persons.HasGameObject(person) && person.Closes(t.Leader) &&
                 person.Command - t.TroopCommand >= 10 && person.FightingForce < t.Leader.FightingForce &&
                 !person.HasLeaderValidTitle)
             {
                 person.Selected = true;
                 result.Add(person);
                 personCnt++;
                 break;
             }
         }
     }
     foreach (Person person in this.Persons)
     {
         if (person.WaitForFeiZi != null) continue;
         if ((!person.Selected && !t.Persons.HasGameObject(person)) && ((person.FightingForce < t.Leader.FightingForce) && !person.HasLeaderValidTitle))
         {
             int incrementPerDayOfCombativity = t.IncrementPerDayOfCombativity;
             bool immunityOfCaptive = t.ImmunityOfCaptive;
             int routIncrementOfCombativity = t.RoutIncrementOfCombativity;
             int attackDecrementOfCombativity = t.AttackDecrementOfCombativity;
             int count = t.CombatMethods.Count;
             int chanceIncrementOfCriticalStrike = t.ChanceIncrementOfCriticalStrike;
             int chanceDecrementOfCriticalStrike = t.ChanceDecrementOfCriticalStrike;
             int chanceIncrementOfChaosAfterCriticalStrike = t.ChanceIncrementOfChaosAfterCriticalStrike;
             int avoidSurroundedChance = t.AvoidSurroundedChance;
             int chaosAfterSurroundAttackChance = t.ChaosAfterSurroundAttackChance;
             int chanceIncrementOfStratagem = t.ChanceIncrementOfStratagem;
             int chanceDecrementOfStratagem = t.ChanceDecrementOfStratagem;
             int chanceIncrementOfChaosAfterStratagem = t.ChanceIncrementOfChaosAfterStratagem;
             foreach (Skill s in person.Skills.GetSkillList())
             {
                 s.Influences.PurifyInfluence(this, Applier.Skill, s.ID);
             }
             foreach (Title i in person.Titles)
             {
                 i.Influences.PurifyInfluence(this, Applier.Title, i.ID);
             }
             person.ApplySkills();
             person.ApplyTitles();
             if (((((((t.IncrementPerDayOfCombativity > incrementPerDayOfCombativity) || (t.ImmunityOfCaptive != immunityOfCaptive)) || ((t.RoutIncrementOfCombativity > routIncrementOfCombativity) || (t.AttackDecrementOfCombativity > attackDecrementOfCombativity))) || ((t.CombatMethods.Count > count) || (((t.TroopStrength >= 70) && (t.ChanceIncrementOfCriticalStrike > chanceIncrementOfCriticalStrike)) && (t.ChanceIncrementOfCriticalStrike <= 50)))) || (((((t.TroopCommand >= 70) && (t.ChanceDecrementOfCriticalStrike > chanceDecrementOfCriticalStrike)) && (t.ChanceDecrementOfCriticalStrike <= 50)) || (((t.ChanceIncrementOfCriticalStrike >= 10) && (t.ChanceIncrementOfChaosAfterCriticalStrike > chanceIncrementOfChaosAfterCriticalStrike)) && (t.ChanceIncrementOfChaosAfterCriticalStrike <= 100))) || (((t.AvoidSurroundedChance <= 80) && (t.AvoidSurroundedChance > avoidSurroundedChance)) || ((t.ChaosAfterSurroundAttackChance <= 20) && (t.ChaosAfterSurroundAttackChance > chaosAfterSurroundAttackChance))))) || ((((t.TroopIntelligence >= 70) && (t.ChanceIncrementOfStratagem > chanceIncrementOfStratagem)) && (t.ChanceIncrementOfStratagem <= 30)) || (((t.TroopIntelligence >= 70) && (t.ChanceDecrementOfStratagem > chanceDecrementOfStratagem)) && (t.ChanceDecrementOfStratagem <= 30)))) || (((t.TroopIntelligence >= 0x55) && (t.ChanceIncrementOfChaosAfterStratagem > chanceIncrementOfChaosAfterStratagem)) && (t.ChanceIncrementOfChaosAfterStratagem <= 100)))
             {
                 person.Selected = true;
                 result.Add(person);
                 personCnt++;
             }
         }
         if (personCnt >= 5) break;
     }
     return result;
 }
Пример #35
0
 public virtual void ArchitectureReleaseCaptiveAfterOccupied(Architecture architecture, PersonList persons)
 {
 }
Пример #36
0
        public PersonList CanKilledCaptives()
        {
            PersonList personList = new PersonList();
            foreach (Captive captive in this.Captives)
            {

                personList.Add(captive.CaptivePerson);

            }

            return personList;
        }
Пример #37
0
 public virtual void TroopReleaseCaptive(Troop troop, PersonList personlist)
 {
 }
Пример #38
0
        public PersonList CanKilledPersons()
        {
            PersonList personList = new PersonList();
            foreach (Person person in this.Persons)
            {
                if (person.ID != this.BelongedFaction.LeaderID)
                {
                    personList.Add(person);
                }
            }

            return personList;
        }
Пример #39
0
 public virtual void ArchitectureHirePerson(PersonList personList)
 {
 }
Пример #40
0
 public PersonList GetAllPersons()
 {
     PersonList list = new PersonList();
     foreach (Person person in this.Persons)
     {
         list.Add(person);
     }
     foreach (Person person in this.MovingPersons)
     {
         list.Add(person);
     }
     return list;
 }
Пример #41
0
 public virtual void TroopGetNewCaptive(Troop troop, PersonList personlist)
 {
 }
Пример #42
0
 public PersonList GetConvinceDestinationPersonList(Faction faction)
 {
     PersonList result = new PersonList();
     if (this.BelongedFaction == faction)
     {
         foreach (Captive captive in this.Captives)
         {
             result.Add(captive.CaptivePerson);
         }
     }
     else
     {
         foreach (Person person in this.Persons)
         {
             result.Add(person);
         }
     }
     foreach (Person person in this.NoFactionPersons)
     {
         result.Add(person);
     }
     ConvinceDestinationPersonList = result;
     return result;
 }
Пример #43
0
 public PersonList meichushengdehaiziliebiao()
 {
     PersonList haiziliebiao = new PersonList();
     foreach (Person person in this.Scenario.Persons)
     {
         if (person.Alive && !person.Available && person.Father == this.ID)
         {
             haiziliebiao.Add(person);
         }
     }
     haiziliebiao.PropertyName = "YearBorn";
     haiziliebiao.IsNumber = true;
     haiziliebiao.SmallToBig = true;
     haiziliebiao.ReSort();
     return haiziliebiao;
 }
Пример #44
0
 public PersonList GetPersonConveneList()
 {
     PersonList result = new PersonList();
     foreach (Architecture architecture in this.BelongedFaction.Architectures)
     {
         if (architecture != this)
         {
             foreach (Person person in architecture.Persons)
             {
                 result.Add(person);
             }
         }
     }
     PersonConveneList = result;
     return result;
 }