Ejemplo n.º 1
0
 public static int GetTicksPerMove(Caravan caravan, StringBuilder explanation = null)
 {
     if (caravan == null)
     {
         if (explanation != null)
         {
             CaravanTicksPerMoveUtility.AppendUsingDefaultTicksPerMoveInfo(explanation);
         }
         return(3300);
     }
     return(CaravanTicksPerMoveUtility.GetTicksPerMove(new CaravanTicksPerMoveUtility.CaravanInfo(caravan), explanation));
 }
        public static int GetTicksPerMove(Caravan caravan, StringBuilder explanation = null)
        {
            int result;

            if (caravan == null)
            {
                if (explanation != null)
                {
                    CaravanTicksPerMoveUtility.AppendUsingDefaultTicksPerMoveInfo(explanation);
                }
                result = 3500;
            }
            else
            {
                result = CaravanTicksPerMoveUtility.GetTicksPerMove(new CaravanTicksPerMoveUtility.CaravanInfo(caravan), explanation);
            }
            return(result);
        }
Ejemplo n.º 3
0
 public static int GetTicksPerMove(List <Pawn> pawns, float massUsage, float massCapacity, StringBuilder explanation = null)
 {
     if (pawns.Any <Pawn>())
     {
         if (explanation != null)
         {
             explanation.Append("CaravanMovementSpeedFull".Translate() + ":");
         }
         float num = 0f;
         for (int i = 0; i < pawns.Count; i++)
         {
             float num2 = (float)((!pawns[i].Downed && !pawns[i].CarriedByCaravan()) ? pawns[i].TicksPerMoveCardinal : 450);
             num2 = Mathf.Min(num2, 150f) * 340f;
             float num3 = 60000f / num2;
             if (explanation != null)
             {
                 explanation.AppendLine();
                 explanation.Append(string.Concat(new string[]
                 {
                     "  - ",
                     pawns[i].LabelShortCap,
                     ": ",
                     num3.ToString("0.#"),
                     " ",
                     "TilesPerDay".Translate()
                 }));
                 if (pawns[i].Downed)
                 {
                     explanation.Append(" (" + "DownedLower".Translate() + ")");
                 }
                 else if (pawns[i].CarriedByCaravan())
                 {
                     explanation.Append(" (" + "Carried".Translate() + ")");
                 }
             }
             num += num2 / (float)pawns.Count;
         }
         float moveSpeedFactorFromMass = CaravanTicksPerMoveUtility.GetMoveSpeedFactorFromMass(massUsage, massCapacity);
         if (explanation != null)
         {
             float num4 = 60000f / num;
             explanation.AppendLine();
             explanation.Append(string.Concat(new string[]
             {
                 "  ",
                 "Average".Translate(),
                 ": ",
                 num4.ToString("0.#"),
                 " ",
                 "TilesPerDay".Translate()
             }));
             explanation.AppendLine();
             explanation.Append("  " + "MultiplierForCarriedMass".Translate(new object[]
             {
                 moveSpeedFactorFromMass.ToStringPercent()
             }));
         }
         int num5 = Mathf.Max(Mathf.RoundToInt(num / moveSpeedFactorFromMass), 1);
         if (explanation != null)
         {
             float num6 = 60000f / (float)num5;
             explanation.AppendLine();
             explanation.Append(string.Concat(new string[]
             {
                 "  ",
                 "FinalCaravanPawnsMovementSpeed".Translate(),
                 ": ",
                 num6.ToString("0.#"),
                 " ",
                 "TilesPerDay".Translate()
             }));
         }
         return(num5);
     }
     if (explanation != null)
     {
         CaravanTicksPerMoveUtility.AppendUsingDefaultTicksPerMoveInfo(explanation);
     }
     return(3300);
 }