Ejemplo n.º 1
0
 public override int GetCreditWithPosition(Troop source, out Point? position)
 {
     //position = 0;
     position = new Point(0, 0);
     TroopList hostileTroopsInView = source.GetHostileTroopsInView();
     TroopList list2 = new TroopList();
     foreach (Troop troop in hostileTroopsInView)
     {
         if ((troop.IsInArchitecture || !troop.DaysToReachPosition(source.Position, 1)) || (troop.Army.Kind.Type == MilitaryType.水军))
         {
             list2.Add(troop);
         }
     }
     foreach (Troop troop in list2)
     {
         hostileTroopsInView.Remove(troop);
     }
     if (hostileTroopsInView.Count == 0)
     {
         return 0;
     }
     List<Point> orientations = new List<Point>();
     int num = 0;
     foreach (Troop troop in hostileTroopsInView)
     {
         orientations.Add(troop.Position);
         num += troop.FightingForce;
     }
     int num2 = 0;
     int fightingForce = source.FightingForce;
     int num4 = source.TroopIntelligence + source.ChanceIncrementOfStratagem;
     if (num4 > 100)
     {
         num4 = 100;
     }
     num2 = (((GameObject.Square(num4) / 60) * num) / fightingForce) / 100;
     if (num2 > 0)
     {
         GameArea area = new GameArea();
         foreach (Point point in source.GetStratagemArea(source.Position).Area)
         {
             if (!source.Scenario.PositionIsOnFire(point) && (source.Scenario.IsPositionEmpty(point) && source.Scenario.IsFireVaild(point, false, MilitaryType.步兵)))
             {
                 area.Area.Add(point);
             }
         }
         if (area.Count > 0)
         {
             position = source.Scenario.GetClosestPosition(area, orientations);
         }
         else
         {
             num2 = 0;
         }
     }
     return num2;
 }
Ejemplo n.º 2
0
 public override int GetCreditWithPosition(Troop source, out Point? position)
 {
     //position = 0;
     position = new Point(0, 0);
     int num = 0;
     if (((source.BelongedLegion == null) || source.Scenario.PositionIsOnFireNoCheck(source.Position)) || (GameObject.Random(source.BelongedLegion.Troops.Count) <= 0))
     {
         int pureFightingForce = source.PureFightingForce;
         int num3 = source.TroopIntelligence + source.ChanceIncrementOfStratagem;
         if (num3 > 100)
         {
             num3 = 100;
         }
         num3 = GameObject.Square(num3) / 60;
         if (num3 > 0)
         {
             List<Point> list = new List<Point>();
             foreach (Point point in source.GetStratagemArea(source.Position).Area)
             {
                 if (source.Scenario.PositionIsOnFire(point))
                 {
                     num += num3 / 40;
                     list.Add(point);
                     Troop troopByPosition = source.Scenario.GetTroopByPosition(point);
                     if (troopByPosition == source)
                     {
                         num += num3 * 3;
                     }
                     else if (troopByPosition != null)
                     {
                         if (source.IsFriendly(troopByPosition.BelongedFaction))
                         {
                             num += (num3 * troopByPosition.FightingForce) / pureFightingForce;
                         }
                         else
                         {
                             num -= (num3 * troopByPosition.FightingForce) / pureFightingForce;
                         }
                     }
                 }
             }
             if (num > 0)
             {
                 position = new Point?(source.Position);
             }
         }
     }
     return num;
 }