示例#1
0
        public static Military Create(GameScenario scenario, Architecture architecture, MilitaryKind kind)
        {
            Military military = new Military();

            military.Scenario = scenario;
            military.KindID   = kind.ID;
            military.ID       = scenario.Militaries.GetFreeGameObjectID();
            if (kind.Unique)
            {
                military.Name = kind.Name;
            }
            else
            {
                military.Name = kind.Name + "队";
            }
            architecture.AddMilitary(military);
            architecture.BelongedFaction.AddMilitary(military);
            scenario.Militaries.AddMilitary(military);
            architecture.DecreaseFund((int)(kind.CreateCost * kind.GetRateOfNewMilitary(architecture)));
            if (kind.IsTransport)
            {
                military.Quantity    = kind.MaxScale;
                military.Morale      = military.MoraleCeiling;
                military.Combativity = military.CombativityCeiling;
            }
            return(military);
        }
示例#2
0
 public static Military Create(GameScenario scenario, Architecture architecture, MilitaryKind kind)
 {
     Military military = new Military();
     military.Scenario = scenario;
     military.KindID = kind.ID;
     military.ID = scenario.Militaries.GetFreeGameObjectID();
     if (kind.RecruitLimit == 1)
     {
         military.Name = kind.Name;
     }
     else
     {
         military.Name = kind.Name + "队";
     }
     architecture.AddMilitary(military);
     architecture.BelongedFaction.AddMilitary(military);
     scenario.Militaries.AddMilitary(military);
     architecture.DecreaseFund((int) (kind.CreateCost * kind.GetRateOfNewMilitary(architecture)));
     if (kind.IsTransport)
     {
         military.Quantity = kind.MaxScale;
         military.Morale = military.MoraleCeiling;
         military.Combativity = military.CombativityCeiling;
     }
     return military;
 }
示例#3
0
 public void SetShelledMilitary(Military military)
 {
     if (this.ShelledMilitary != null)
     {
         this.ShelledMilitary.ShellingMilitary = null;
     }
     this.ShelledMilitary = military;
     if (military != null)
     {
         military.ShellingMilitary = this;
     }
 }
示例#4
0
        public static Military SimCreate(GameScenario scenario, Architecture architecture, MilitaryKind kind)
        {
            Military military = new Military();

            military.Scenario = scenario;
            military.KindID   = kind.ID;
            military.ID       = scenario.Militaries.GetFreeGameObjectID();
            if (kind.Unique)
            {
                military.Name = kind.Name;
                return(military);
            }
            military.Name = kind.Name + "队";
            return(military);
        }
示例#5
0
 public static Troop CreateSimulateTroop(GameObjectList persons, Military military, Point startPosition)
 {
     Troop troop = new Troop();
     troop.Scenario = military.Scenario;
     troop.Simulating = true;
     if (persons != null)
     {
         foreach (Person person in persons)
         {
             troop.AddPerson(person);
         }
         troop.SetLeader(persons[0] as Person);
         troop.BackupArmyLeaderID = (military.Leader != null) ? military.Leader.ID : -1;
         troop.BackupArmyLeaderExperience = military.LeaderExperience;
         troop.BackupArmyLeader = military.Leader;
         troop.Army = military;
         troop.SimulateInitializePosition(startPosition);
         foreach (Person person in persons)
         {
             person.LocationTroop = null;
         }
     }
     troop.Simulating = false;
     military.Leader = troop.BackupArmyLeader;
     military.LeaderExperience = troop.BackupArmyLeaderExperience;
     military.LeaderID = troop.BackupArmyLeaderID;
     return troop;
 }
 private TroopList AISelectPersonIntoTroop(Architecture from, Military military)
 {
     TroopList result = new TroopList();
     if ((military.FollowedLeader != null) && from.Persons.HasGameObject(military.FollowedLeader) && military.FollowedLeader.LocationTroop == null)
     {
         result.Add(Troop.CreateSimulateTroop(this.AISelectPersonIntoTroop_inner(military.FollowedLeader, from.Persons, true), military, from.Position));
     }
     else if ((((military.Leader != null) && (military.LeaderExperience >= 10)) && (((military.Leader.Strength >= 80) || (military.Leader.Command >= 80)) || military.Leader.HasLeaderValidCombatTitle))
         && from.Persons.HasGameObject(military.Leader) && military.Leader.LocationTroop == null)
     {
         result.Add(Troop.CreateSimulateTroop(this.AISelectPersonIntoTroop_inner(military.Leader, from.Persons, true), military, from.Position));
     }
     else
     {
         foreach (Person person in from.Persons)
         {
             if (!person.Selected)
             {
                 if ((this.BelongedFaction.AvailableMilitaryKinds.GetMilitaryKindList().GameObjects.Contains(military.Kind) && !military.Kind.Unique) ||
                     person.FightingForce >= Parameters.AIUniqueTroopFightingForceThreshold || this.Endurance < 30)
                 {
                     result.Add(Troop.CreateSimulateTroop(this.AISelectPersonIntoTroop_inner(person, from.Persons, false), military, from.Position));
                 }
             }
         }
     }
     return result;
 }
 public void RemoveMilitary(Military military)
 {
     this.Militaries.Remove(military);
     military.StopRecruitment();
     military.BelongedArchitecture = null;
 }
 private void AddMessageToTodayNewMilitarySpyMessage(Military m)
 {
     if (this.TodayNewMilitarySpyMessage == null)
     {
         this.TodayNewMilitarySpyMessage = this.CreateNewMilitarySpyMessage(m);
     }
     else
     {
         this.TodayNewMilitarySpyMessage.Message3 = this.TodayNewMilitarySpyMessage.Message3 + "," + m.Name;
     }
 }
 public bool IsMilitaryUnavailable(Military military)
 {
     return (military.BelongedArchitecture == null);
 }
示例#10
0
 public void LevelUpMilitary(Military m)
 {
     MilitaryKind militaryKind = base.Scenario.GameCommonData.AllMilitaryKinds.GetMilitaryKind(m.Kind.LevelUpKindID);
     if ((militaryKind != null) && (!m.BelongedFaction.IsMilitaryKindOverLimit(militaryKind.ID)))
     {
         int num = (m.Quantity * militaryKind.MinScale) / m.Kind.MinScale;
         int num2 = ((m.Experience - m.Kind.LevelUpExperience) * militaryKind.MinScale) / m.Kind.MinScale;
         this.IncreasePopulation(m.Quantity - num);
         m.Kind = militaryKind;
         m.Quantity = num;
         m.Experience = num2;
         m.Name = m.Kind.Name + "队";
         ExtensionInterface.call("LevelUpMilitary", new Object[] { this.Scenario, this, m });
     }
 }
示例#11
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;
 }
示例#12
0
 public MilitaryList GetBeMergedMilitaryList(Military military)
 {
     this.BeMergedMilitaryList.Clear();
     foreach (Military military2 in this.MergeMilitaryList)
     {
         if ((military2 != military) && (military2.Kind == military.Kind))
         {
             this.BeMergedMilitaryList.Add(military2);
         }
     }
     return this.BeMergedMilitaryList;
 }
示例#13
0
 public static Military SimCreate(GameScenario scenario, Architecture architecture, MilitaryKind kind)
 {
     Military military = new Military();
     military.Scenario = scenario;
     military.KindID = kind.ID;
     military.ID = scenario.Militaries.GetFreeGameObjectID();
     if (kind.RecruitLimit == 1)
     {
         military.Name = kind.Name;
         return military;
     }
     military.Name = kind.Name + "队";
     return military;
 }
示例#14
0
 public void SetShelledMilitary(Military military)
 {
     if (this.ShelledMilitary != null)
     {
         this.ShelledMilitary.ShellingMilitary = null;
     }
     this.ShelledMilitary = military;
     if (military != null)
     {
         military.ShellingMilitary = this;
     }
 }
 // 补充
 private void FrameFunction_Architecture_AfterGetRecruitmentMilitary()
 {
     GameObjectList selectedList = this.CurrentArchitecture.RecruitmentMilitaryList.GetSelectedList();
     if ((selectedList != null) && (selectedList.Count == 1))
     {
         this.CurrentMilitary = selectedList[0] as Military;
         this.mainGameScreen.ShowTabListInFrame(UndoneWorkKind.Frame, FrameKind.Work, FrameFunction.GetRecruitmentPerson, false, true, true, false, this.CurrentArchitecture.Persons, null, "补充", "补充");
     }
 }
 private void FrameFunction_Architecture_AfterGetMergeMilitary()
 {
     GameObjectList selectedList = this.CurrentArchitecture.MergeMilitaryList.GetSelectedList();
     if ((selectedList != null) && (selectedList.Count == 1))
     {
         this.CurrentMilitary = selectedList[0] as Military;
         this.mainGameScreen.ShowTabListInFrame(UndoneWorkKind.Frame, FrameKind.Military, FrameFunction.GetBeMergedMilitaries, false, true, true, false, this.CurrentArchitecture.GetBeMergedMilitaryList(this.CurrentMilitary), null, "选择编队", "");
     }
 }
 private void FrameFunction_Architecture_AfterGetLevelUpMilitaries()
 {
     if (this.CurrentArchitecture != null)
     {
         this.CurrentGameObjects = this.CurrentArchitecture.LevelUpMilitaryList.GetSelectedList();
         if ((this.CurrentGameObjects != null) && (this.CurrentGameObjects.Count == 1))
         {
             this.CurrentMilitary = (Military) this.CurrentGameObjects[0];
             this.mainGameScreen.ShowTabListInFrame(UndoneWorkKind.Frame, FrameKind.MilitaryKind, FrameFunction.GetLevelUpMiliaryKind, true, true, true, false, this.CurrentArchitecture.GetUpgradableMilitaryKindList(this.CurrentMilitary), null, "编队升级", "编队升级");
         }
     }
 }
示例#18
0
 public Troop CreateTroop(GameObjectList persons, Person leader, Military military, int food, Point position)
 {
     return Troop.Create(this, persons, leader, military, food, position);
 }
示例#19
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;
        }
示例#20
0
 public void DisbandMilitary(Military m)
 {
     if (!m.IsTransport)
     {
         this.IncreasePopulation(m.Quantity);
     }
     this.RemoveMilitary(m);
     this.BelongedFaction.RemoveMilitary(m);
     base.Scenario.Militaries.Remove(m);
     ExtensionInterface.call("DisbandMilitary", new Object[] { this.Scenario, this, m });
 }
示例#21
0
 private SpyMessage CreateNewMilitarySpyMessage(Military m)
 {
     SpyMessage message = new SpyMessage();
     message.Scenario = base.Scenario;
     message.ID = message.Scenario.SpyMessages.GetFreeGameObjectID();
     message.Kind = SpyMessageKind.NewMilitary;
     message.MessageFaction = this.BelongedFaction;
     message.MessageArchitecture = this;
     message.Message1 = this.BelongedFaction.Name;
     message.Message2 = base.Name;
     message.Message3 = m.Name;
     message.Message4 = base.Scenario.Date.ToDateString();
     message.Scenario.SpyMessages.AddMessageWithEvent(message);
     foreach (SpyPack pack in this.SpyPacks)
     {
         int singleWayDays = base.Scenario.GetSingleWayDays(pack.SpyPerson.Position, this.ArchitectureArea);
         message.AddPersonPack(pack.SpyPerson, singleWayDays);
     }
     return message;
 }
示例#22
0
 public GameArea GetMilitaryCampaignArea(Military military)
 {
     GameArea allAvailableArea = this.GetAllAvailableArea(false);
     military.ModifyAreaByTerrainAdaptablity(allAvailableArea);
     return allAvailableArea;
 }
示例#23
0
 private Point? GetRandomStartingPosition(Military m)
 {
     GameArea allAvailableArea = this.GetAllAvailableArea(false);
     m.ModifyAreaByTerrainAdaptablity(allAvailableArea);
     if (allAvailableArea.Count == 0)
     {
         return null;
     }
     return allAvailableArea[GameObject.Random(allAvailableArea.Count)];
 }
示例#24
0
 public bool IsOffensiveMilitary(Military m)
 {
     return ((((m.Scales >= 3) && (m.Morale >= 80)) && (m.Combativity >= 80)) && (m.InjuryQuantity <= m.Kind.MinScale));
 }
示例#25
0
 private bool isArmyNavigableTo(LinkNode targetNode, Military military)
 {
     return GlobalVariables.LandArmyCanGoDownWater ||
         ((targetNode.Kind == LinkKind.Land && military.Kind.Type != MilitaryType.水军) || (targetNode.Kind == LinkKind.Water && military.Kind.Type == MilitaryType.水军) || targetNode.Kind == LinkKind.Both);
 }
示例#26
0
 public void RecruitmentMilitary(Military military, float scale)
 {
     if ((((this.MilitaryPopulation != 0) && (this.Population != 0) && (!GlobalVariables.PopulationRecruitmentLimit || (this.ArmyQuantity <= this.Population))) && ((this.Domination >= Parameters.RecruitmentDomination) && (this.Morale >= Parameters.RecruitmentMorale))) && (military.Quantity < military.Kind.MaxScale))
     {
         int decrement = (int)(military.Kind.MinScale * scale);
         int populationDecrement;
         if ((decrement + military.Quantity) > military.Kind.MaxScale)
         {
             decrement = military.Kind.MaxScale - military.Quantity;
         }
         if ((decrement * military.Kind.PointsPerSoldier) > military.BelongedFaction.TechniquePoint)
         {
             if (!(((this.BelongedSection == null) || (this.BelongedSection.AIDetail == null)) || this.BelongedSection.AIDetail.AutoRun))
             {
                 military.BelongedFaction.DepositTechniquePointForTechnique(decrement * military.Kind.PointsPerSoldier);
             }
             decrement = military.BelongedFaction.TechniquePoint / military.Kind.PointsPerSoldier;
         }
         populationDecrement = decrement;
         if (!base.Scenario.IsPlayer(this.BelongedFaction))
         {
             decrement = (int)(decrement * Parameters.AIRecruitmentSpeedRate);
         }
         if (decrement > 0)
         {
             if (populationDecrement > this.MilitaryPopulation)
             {
                 populationDecrement = this.MilitaryPopulation;
                 decrement = populationDecrement;
             }
             if (populationDecrement > this.Population)
             {
                 populationDecrement = this.Population;
                 decrement = populationDecrement;
             }
             this.DecreaseMilitaryPopulation(populationDecrement);
             this.DecreasePopulation(populationDecrement);
             int scales = military.Scales;
             military.IncreaseQuantity(decrement, this.MoraleOfRecruitment, this.CombativityOfRecruitment, 0, 0);
             if (this.HasSpy && ((military.Scales / 10) > (scales / 10)))
             {
                 this.AddMessageToTodayMilitaryScaleSpyMessage(military);
             }
             if (this.Population < this.RecruitmentPopulationBoundary)
             {
                 this.DecreaseDomination(GameObject.Random(6));
                 this.DecreaseMorale(GameObject.Random(6) * 2);
             }
             else
             {
                 this.DecreaseDomination(GameObject.Random(2));
                 this.DecreaseMorale(GameObject.Random(2) * 2);
             }
             this.BelongedFaction.DecreaseTechniquePoint(decrement * military.Kind.PointsPerSoldier);
             int randomValue = StaticMethods.GetRandomValue(decrement * 10, military.Kind.MinScale);
             if (randomValue > 0)
             {
                 military.BelongedFaction.IncreaseReputation(randomValue * 2);
                 military.BelongedFaction.IncreaseTechniquePoint(randomValue * 100);
             }
         }
     }
 }
示例#27
0
 public static Troop CreateSimulateTroop(Architecture architecture, GameObjectList persons, Person Leader, Military military, int rationdays, Point startPosition)
 {
     Troop troop = new Troop();
     troop.Scenario = architecture.Scenario;
     troop.BelongedFaction = architecture.BelongedFaction;
     troop.Simulating = true;
     troop.TechnologyIncrement = architecture.Technology / 50;
     troop.StartingArchitecture = architecture;
     if (persons != null)
     {
         foreach (Person person in persons)
         {
             troop.AddPerson(person);
         }
         troop.SetLeader(Leader);
     }
     if (military != null)
     {
         troop.BackupArmyLeaderID = (military.Leader != null) ? military.Leader.ID : -1;
         troop.BackupArmyLeaderExperience = military.LeaderExperience;
         troop.BackupArmyLeader = military.Leader;
         troop.Army = military;
         troop.Food = military.FoodCostPerDay * rationdays;
     }
     if (persons != null)
     {
         troop.SimulateInitializePosition(startPosition);
         foreach (Person person in persons)
         {
             person.LocationTroop = null;
         }
     }
     troop.Simulating = false;
     if (military != null)
     {
         military.Leader = troop.BackupArmyLeader;
         military.LeaderExperience = troop.BackupArmyLeaderExperience;
         military.LeaderID = troop.BackupArmyLeaderID;
     }
     return troop;
 }
示例#28
0
 private void AddMessageToTodayMilitaryScaleSpyMessage(Military m)
 {
     this.CreateMilitaryScaleSpyMessage(m);
 }
示例#29
0
 public void AddMilitary(Military military)
 {
     base.GameObjects.Add(military);
 }
示例#30
0
 private TroopList AISelectPersonIntoTroop(Architecture from, Military military)
 {
     TroopList result = new TroopList();
     if (military.FollowedLeader != null && from.Persons.HasGameObject(military.FollowedLeader) && military.FollowedLeader.LocationTroop == null)
     {
         result.Add(Troop.CreateSimulateTroop(this.AISelectPersonIntoTroop_inner(military.FollowedLeader, from.Persons, true), military, from.Position));
     }
     else if (military.Leader != null && military.LeaderExperience >= 10 && (military.Leader.Strength >= 80 || military.Leader.Command >= 80 || military.Leader.HasLeaderValidTitle)
         && from.Persons.HasGameObject(military.Leader) && military.Leader.LocationTroop == null)
     {
         result.Add(Troop.CreateSimulateTroop(this.AISelectPersonIntoTroop_inner(military.Leader, from.Persons, true), military, from.Position));
     }
     else
     {
         GameObjectList pl = from.Persons.GetList();
         pl.PropertyName = "FightingForce";
         pl.IsNumber = true;
         pl.SmallToBig = false;
         pl.ReSort();
         foreach (Person person in pl)
         {
             if (!person.Selected)
             {
                 if (person.HasMilitaryKindTitle(military.Kind))
                 {
                     result.Add(Troop.CreateSimulateTroop(this.AISelectPersonIntoTroop_inner(person, from.Persons, false), military, from.Position));
                 }
                 else if (person.HasMilitaryTypeTitle(military.Kind.Type))
                 {
                     result.Add(Troop.CreateSimulateTroop(this.AISelectPersonIntoTroop_inner(person, from.Persons, false), military, from.Position));
                 }
                 else if ((this.BelongedFaction.AvailableMilitaryKinds.GetMilitaryKindList().GameObjects.Contains(military.Kind) && military.Kind.RecruitLimit > 10) ||
                     person.FightingForce >= Parameters.AIUniqueTroopFightingForceThreshold || this.Endurance < 30)
                 {
                     result.Add(Troop.CreateSimulateTroop(this.AISelectPersonIntoTroop_inner(person, from.Persons, false), military, from.Position));
                 }
             }
         }
     }
     return result;
 }
示例#31
0
 public void CreateRobberTroop(Point position)
 {
     Military military = new Military();
     military.Scenario = base.Scenario;
     military.ID = base.Scenario.Militaries.GetFreeGameObjectID();
     base.Scenario.Militaries.AddMilitary(military);
     military.Kind = base.Scenario.GameCommonData.AllMilitaryKinds.GetMilitaryKind(0x15);
     military.Name = military.Kind.Name;
     military.Morale = military.MoraleCeiling;
     military.Combativity = military.CombativityCeiling;
     military.Quantity = (military.Kind.MinScale + (this.Population / 100)) * ((this.AreaCount / 2) + 2);
     if (military.Quantity > military.Kind.MaxScale)
     {
         military.Quantity = military.Kind.MaxScale;
     }
     GameObjectList persons = new GameObjectList();
     Person gameObject = base.Scenario.Persons.GetGameObject(0x1bc4) as Person;
     persons.Add(gameObject);
     Troop troop = this.CreateTroop(persons, gameObject, military, 0, position);
     troop.WillArchitecture = this;
     this.RobberTroop = troop;
     ExtensionInterface.call("CreateRobberTroop", new Object[] { this.Scenario, this, troop });
 }
示例#32
0
        private void RecruitmentMilitary(Military military)
        {
            if ((((this.MilitaryPopulation != 0) && (this.Population != 0) && (!GlobalVariables.PopulationRecruitmentLimit || (this.ArmyQuantity <= this.Population))) && ((this.Fund >= (Parameters.RecruitmentFundCost * this.AreaCount * (this.CanRecruitMilitary(military.Kind) ? 1 : 10))) && (this.Domination >= Parameters.RecruitmentDomination))) && (((this.Morale >= Parameters.RecruitmentMorale) && ((military.RecruitmentPerson != null) && (military.RecruitmentPerson.BelongedFaction != null))) && (military.Quantity < military.Kind.MaxScale)) && (military.BelongedFaction != null))
            {
                int randomValue = StaticMethods.GetRandomValue((int)((military.RecruitmentPerson.RecruitmentAbility * military.Kind.MinScale) * Parameters.RecruitmentRate), 0x7d0);
                int populationDecrement;

                if ((randomValue + military.Quantity) > military.Kind.MaxScale)
                {
                    randomValue = military.Kind.MaxScale - military.Quantity;
                }
                if ((randomValue * military.Kind.PointsPerSoldier) > military.BelongedFaction.TechniquePoint && military.Kind.PointsPerSoldier != 0)
                {
                    if (!(((this.BelongedSection == null) || (this.BelongedSection.AIDetail == null)) || this.BelongedSection.AIDetail.AutoRun))
                    {
                        military.BelongedFaction.DepositTechniquePointForTechnique(randomValue * military.Kind.PointsPerSoldier);
                    }
                    randomValue = military.BelongedFaction.TechniquePoint / military.Kind.PointsPerSoldier;
                }
                populationDecrement = randomValue;
                if (!base.Scenario.IsPlayer(this.BelongedFaction))
                {
                    randomValue = (int)(randomValue * Parameters.AIRecruitmentSpeedRate);
                }
                if (randomValue > 0)
                {
                    this.DecreaseFund(Parameters.RecruitmentFundCost * this.AreaCount * (this.CanRecruitMilitary(military.Kind) ? 1 : 10));
                    if (populationDecrement > this.MilitaryPopulation)
                    {
                        populationDecrement = this.MilitaryPopulation;
                        randomValue = populationDecrement;
                    }
                    if (populationDecrement > this.Population)
                    {
                        populationDecrement = this.Population;
                        randomValue = populationDecrement;
                    }
                    this.DecreaseMilitaryPopulation(populationDecrement);
                    this.DecreasePopulation(populationDecrement);

                    int scales = military.Scales;
                    military.IncreaseQuantity(randomValue, this.MoraleOfRecruitment, this.CombativityOfRecruitment, 0, 0);
                    if (this.HasSpy && ((military.Scales / 10) > (scales / 10)))
                    {
                        this.AddMessageToTodayMilitaryScaleSpyMessage(military);
                    }
                    if (this.Population < this.RecruitmentPopulationBoundary)
                    {
                        this.DecreaseDomination(GameObject.Random(6));
                        this.DecreaseMorale(GameObject.Random(6) * 2);
                    }
                    else
                    {
                        this.DecreaseDomination(GameObject.Random(2));
                        this.DecreaseMorale(GameObject.Random(2) * 2);
                    }
                    this.BelongedFaction.DecreaseTechniquePoint(randomValue * military.Kind.PointsPerSoldier);
                    int increment = StaticMethods.GetRandomValue(randomValue * 10, military.Kind.MinScale);
                    if (increment > 0)
                    {
                        military.RecruitmentPerson.AddRecruitmentExperience(increment);
                        military.RecruitmentPerson.AddCommandExperience(increment);
                        military.RecruitmentPerson.AddGlamourExperience(increment);
                        military.RecruitmentPerson.IncreaseReputation(increment * 4);
                        military.RecruitmentPerson.BelongedFaction.IncreaseReputation(increment * 2);
                        military.RecruitmentPerson.BelongedFaction.IncreaseTechniquePoint(increment * 100);
                    }
                }
            }
            else
            {
                if (military.RecruitmentPerson != null)
                {
                    military.StopRecruitment();
                }
            }
        }
示例#33
0
 public void SetArmy(Military m)
 {
     this.army = m;
 }
示例#34
0
 public virtual void TransferMilitaryArrivesAtArchitecture(Military m, Architecture a)
 {
 }
示例#35
0
 public void AddMilitary(Military military)
 {
     this.Militaries.AddMilitary(military);
     military.BelongedArchitecture = this;
 }