예제 #1
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();
 }
예제 #2
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;
 }
예제 #3
0
        private void ClearWork()
        {
            PersonList renwuliebiao = new PersonList();

            if (this.Agriculture >= this.AgricultureCeiling)
            {

                foreach (Person person in this.AgricultureWorkingPersons)
                {
                    renwuliebiao.Add(person);
                }
                foreach (Person person in renwuliebiao)
                {
                    this.RemovePersonFromWorkingList(person);
                }
                renwuliebiao.Clear();
            }
            if (this.Commerce >= this.CommerceCeiling)
            {
                foreach (Person person in this.CommerceWorkingPersons)
                {
                    renwuliebiao.Add(person);
                }

                foreach (Person person in renwuliebiao )
                {
                    this.RemovePersonFromWorkingList(person);
                }
                renwuliebiao.Clear();
            }
            if (this.Technology >= this.TechnologyCeiling)
            {
                foreach (Person person in this.TechnologyWorkingPersons)
                {
                    renwuliebiao.Add(person);
                }
                foreach (Person person in renwuliebiao)
                {
                    this.RemovePersonFromWorkingList(person);
                }
                renwuliebiao.Clear();
            }
            /*        统治到顶时不停止工作
            if (this.Domination >= this.DominationCeiling)
            {
                foreach (Person person in this.DominationWorkingPersons)
                {
                    this.RemovePersonFromWorkingList(person);
                }
            }
            */
            if (this.Morale >= this.MoraleCeiling)
            {
                foreach (Person person in this.MoraleWorkingPersons)
                {
                    renwuliebiao.Add(person);
                }
                foreach (Person person in renwuliebiao)
                {
                    this.RemovePersonFromWorkingList(person);
                }
                renwuliebiao.Clear();
            }
            if (this.Endurance >= this.EnduranceCeiling)
            {
                foreach (Person person in this.EnduranceWorkingPersons)
                {
                    renwuliebiao.Add(person);
                }
                foreach (Person person in renwuliebiao)
                {
                    this.RemovePersonFromWorkingList(person);
                }
                renwuliebiao.Clear();
            }
            
            foreach (Military military in this.Militaries)
            {
                if ((military.Morale >= military.MoraleCeiling) && (military.Combativity >= military.CombativityCeiling))
                {
                    military.StopTraining();
                    
                }
                if (military.Quantity >= military.Kind.MaxScale)
                {
                    military.StopRecruitment();
                    
                }
            }
        }
예제 #4
0
        private void tingzhizhenzai()
        {
            PersonList renwuliebiao = new PersonList();

            foreach (Person person in this.zhenzaiWorkingPersons)
            {
                renwuliebiao.Add(person);
            }
            foreach (Person person in renwuliebiao)
            {
                this.RemovePersonFromWorkingList(person);
            }
            renwuliebiao.Clear();
        }
예제 #5
0
 public Faction ChangeLeaderAfterLeaderDeath()
 {
     Person leader = this.Leader;
     Architecture locationArchitecture = this.Leader.LocationArchitecture;
     this.Leader.Status = GameObjects.PersonDetail.PersonStatus.None;
     this.Leader.Available = false;
     //base.Scenario.Persons.Remove(this.Leader);
     base.Scenario.AvailablePersons.Remove(this.Leader);
     Person person2 = null;
     PersonList list = new PersonList();
     if (person2 == null)
     {
         foreach (Person person3 in this.Persons)
         {
             if ((person3.Father >= 0) && (person3.Sex == this.Leader.Sex) && ((this.Leader.Father == person3.Father) || (person3.Father == this.Leader.ID)))
             {
                 list.Add(person3);
             }
         }
         if (list.Count > 0)
         {
             if (list.Count > 1)
             {
                 list.PropertyName = "YearBorn";
                 list.IsNumber = true;
                 list.SmallToBig = true;
                 list.ReSort();
             }
             person2 = list[0] as Person;
         }
     }
     if (person2 == null)
     {
         list.Clear();
         foreach (Person person3 in this.Persons)
         {
             if ((person3.Strain >= 0) && (person3.Sex == this.Leader.Sex) && (this.Leader.Strain == person3.Strain))
             {
                 list.Add(person3);
             }
         }
         if (list.Count > 0)
         {
             if (list.Count > 1)
             {
                 list.PropertyName = "YearBorn";
                 list.IsNumber = true;
                 list.SmallToBig = true;
                 list.ReSort();
             }
             person2 = list[0] as Person;
         }
     }
     if (person2 == null)
     {
         list.Clear();
         foreach (Person person3 in this.Persons)
         {
             if ((person3.Brother >= 0) && (person3.Sex == this.Leader.Sex) && (this.Leader.Brother == person3.Brother))
             {
                 list.Add(person3);
             }
         }
         if (list.Count > 0)
         {
             if (list.Count > 1)
             {
                 list.PropertyName = "Glamour";
                 list.IsNumber = true;
                 list.ReSort();
             }
             person2 = list[0] as Person;
         }
     }
     if (person2 == null)
     {
         foreach (Person person3 in this.Persons)
         {
             if ((person3.Mother >= 0) && (person3.Sex == this.Leader.Sex) && ((this.Leader.Mother == person3.Mother) || (person3.Mother == this.Leader.ID)))
             {
                 list.Add(person3);
             }
         }
         if (list.Count > 0)
         {
             if (list.Count > 1)
             {
                 list.PropertyName = "YearBorn";
                 list.IsNumber = true;
                 list.SmallToBig = true;
                 list.ReSort();
             }
             person2 = list[0] as Person;
         }
     }
     if (GlobalVariables.PermitFactionMerge)
     {
         Faction maxFriendlyDiplomaticRelation = this.MaxFriendlyDiplomaticRelation;
         if (maxFriendlyDiplomaticRelation != null)
         {
             base.Scenario.YearTable.addChangeFactionEntry(base.Scenario.Date, this, maxFriendlyDiplomaticRelation);
             this.ChangeFaction(maxFriendlyDiplomaticRelation);
             foreach (Treasure treasure in leader.Treasures.GetList())
             {
                 treasure.HidePlace = locationArchitecture;
                 leader.LoseTreasure(treasure);
                 treasure.Available = false;
             }
             return maxFriendlyDiplomaticRelation;
         }
     }
     if (person2 == null)
     {
         list.Clear();
         foreach (Person person3 in this.Persons)
         {
             if ((this.Leader.Ideal == person3.Ideal) && (person3.Sex == this.Leader.Sex) && ((person3.Brother < 0) || (person3.Brother == person3.ID)))
             {
                 list.Add(person3);
             }
         }
         if (list.Count > 0)
         {
             if (list.Count > 1)
             {
                 list.PropertyName = "Merit";
                 list.IsNumber = true;
                 list.ReSort();
             }
             person2 = list[0] as Person;
         }
     }
     if (person2 == null)
     {
         list.Clear();
         foreach (Person person3 in this.Persons)
         {
             if ((person3.Sex == this.Leader.Sex) && (person3.Brother < 0) || (person3.Brother == person3.ID))
             {
                 list.Add(person3);
             }
         }
         if (list.Count > 0)
         {
             if (list.Count > 1)
             {
                 list.PropertyName = "Merit";
                 list.IsNumber = true;
                 list.ReSort();
             }
             person2 = list[0] as Person;
         }
     }
     if (person2 == null)
     {
         list.Clear();
         foreach (Person person3 in this.Persons)
         {
             if ((person3.Brother < 0) || (person3.Brother == person3.ID))
             {
                 list.Add(person3);
             }
         }
         if (list.Count > 0)
         {
             if (list.Count > 1)
             {
                 list.PropertyName = "Merit";
                 list.IsNumber = true;
                 list.ReSort();
             }
             person2 = list[0] as Person;
         }
     }
     if (person2 != null)
     {
         this.Leader = person2;
         this.Leader.Loyalty = 100;
         if (!((this.Leader.LocationTroop == null) || this.Leader.IsCaptive))
         {
             this.Leader.LocationTroop.RefreshWithPersonList(this.Leader.LocationTroop.Persons.GetList());
         }
         foreach (Treasure treasure in leader.Treasures.GetList())
         {
             leader.LoseTreasure(treasure);
             this.Leader.ReceiveTreasure(treasure);
         }
         ExtensionInterface.call("ChangeKing", new Object[] { this.Scenario, this });
         base.Scenario.YearTable.addChangeKingEntry(base.Scenario.Date, this.Leader);
         return this;
     }
     foreach (Treasure treasure in leader.Treasures.GetList())
     {
         treasure.HidePlace = locationArchitecture;
         leader.LoseTreasure(treasure);
         treasure.Available = false;
     }
     return null;
 }