Пример #1
0
 private void CheckCaptiveBeforeRout(Troop troop)
 {
     if ((((this.BelongedFaction != null) && (troop.BelongedFaction != null)) && !troop.ImmunityOfCaptive) && ((this.BelongedFaction != troop.BelongedFaction) && !troop.IsInArchitecture))
     {
         PersonList personlist = new PersonList();
         foreach (Person person in troop.Persons)
         {
             if (!(person.ImmunityOfCaptive || (GameObject.Chance(person.ChanceOfNoCapture) || (GameObject.Random(this.CaptiveAblility) <= GameObject.Random(person.CaptiveAbility + 200)))))
             {
                 personlist.Add(person);
             }
         }
         if (personlist.Count > 0)
         {
             foreach (Person person in personlist)
             {
                 troop.RemovePerson(person);
                 Captive captive = Captive.Create(base.Scenario, person, this.BelongedFaction);
                 if (captive != null)
                 {
                     this.AddCaptive(captive);
                 }
             }
             if (this.OnGetNewCaptive != null)
             {
                 this.OnGetNewCaptive(this, personlist);
             }
         }
     }
 }