Exemple #1
0
 public static string QuickInfoOneFood(Species species, int level, double tamingSpeedMultiplier, double tamingFoodRateMultiplier,
                                       string foodName, int foodAmount, string foodDisplayName)
 {
     TamingTimes(species, level, tamingSpeedMultiplier, tamingFoodRateMultiplier, foodName, foodAmount,
                 out List <int> foodAmountUsed, out TimeSpan duration, out _, out _, out int narcotics, out _, out double te,
                 out double hunger, out int bonusLevel, out _);
     return($"{string.Format(Loc.S("WithXFoodTamingTakesTime"), foodAmountUsed[0], foodDisplayName, Utils.DurationUntil(duration))}\n" +
            $"{Loc.S("Narcotics")}: {narcotics}\n" +
            $"{Loc.S("TamingEffectiveness_Abb")}: {Math.Round(100 * te, 1)} %\n" +
            $"{Loc.S("BonusLevel")}: +{(level + bonusLevel)}\n" +
            $"{string.Format(Loc.S("FoodHasToDropUnits"), Math.Round(hunger, 1))}");
 }
        private void UpdateTamingData()
        {
            if (!updateCalculation || selectedSpecies == null)
            {
                return;
            }
            if (selectedSpecies.taming == null)
            {
                NoTamingData();
                return;
            }

            this.Enabled = true;
            UpdateKOCounting();

            TimeSpan duration = new TimeSpan();
            int      narcoBerries = 0, ascerbicMushrooms = 0, narcotics = 0, bioToxines = 0, bonusLevel = 0;
            double   te = 0;

            neededHunger = 0;
            bool enoughFood     = false;
            var  usedFood       = new List <string>();
            var  foodAmount     = new List <int>();
            var  foodAmountUsed = new List <int>();

            quickTamingInfos = "n/a";
            int  level    = (int)nudLevel.Value;
            bool tameable = selectedSpecies.taming.nonViolent || selectedSpecies.taming.violent;

            if (tameable && selectedSpecies.taming.eats != null)
            {
                int foodCounter = selectedSpecies.taming.eats.Length;
                foreach (TamingFoodControl tfc in foodControls)
                {
                    if (foodCounter == 0)
                    {
                        break;
                    }
                    foodCounter--;

                    usedFood.Add(tfc.FoodName);
                    foodAmount.Add(tfc.amount);
                    tfc.maxFood        = Taming.FoodAmountNeeded(selectedSpecies, level, tamingSpeedMultiplier, tfc.FoodName, selectedSpecies.taming.nonViolent);
                    tfc.tamingDuration = Taming.TamingDuration(selectedSpecies, tfc.maxFood, tfc.FoodName, tamingFoodRateMultiplier, selectedSpecies.taming.nonViolent);
                }
                Taming.TamingTimes(selectedSpecies, level, tamingSpeedMultiplier, tamingFoodRateMultiplier, usedFood, foodAmount, out foodAmountUsed, out duration, out narcoBerries, out ascerbicMushrooms, out narcotics, out bioToxines, out te, out neededHunger, out bonusLevel, out enoughFood);

                for (int f = 0; f < foodAmountUsed.Count; f++)
                {
                    foodControls[f].foodUsed = foodAmountUsed[f];
                }
            }

            labelResult.ForeColor = SystemColors.ControlText;
            if (!tameable)
            {
                labelResult.Text      = Loc.S("speciesNotTameable");
                labelResult.ForeColor = Color.Red;
            }
            else if (enoughFood)
            {
                labelResult.Text = $"It takes {Utils.DurationUntil(duration)} to tame the {selectedSpecies.name}.\n\n" +
                                   $"Taming Effectiveness: {Math.Round(100 * te, 1)} %\n" +
                                   $"Bonus-Level: +{bonusLevel} (total level after Taming: {(nudLevel.Value + bonusLevel)})\n\n" +
                                   $"Food has to drop by {neededHunger:F1} units.\n\n" +
                                   $"{narcoBerries} Narcoberries or\n" +
                                   $"{ascerbicMushrooms} Ascerbic Mushrooms or\n" +
                                   $"{narcotics} Narcotics or\n" +
                                   $"{bioToxines} Bio Toxines are needed{firstFeedingWaiting}";

                labelResult.Text += kibbleRecipe;
            }
            else if (foodAmountUsed.Count == 0)
            {
                labelResult.Text = Loc.S("noTamingData");
            }
            else
            {
                labelResult.Text = Loc.S("notEnoughFoodToTame");
            }

            numericUpDownCurrentTorpor.ValueSave = (decimal)(selectedSpecies.stats[(int)StatNames.Torpidity].BaseValue * (1 + selectedSpecies.stats[(int)StatNames.Torpidity].IncPerWildLevel * (level - 1)));

            nudTotalFood.Value   = (decimal)(selectedSpecies.stats[(int)StatNames.Food].BaseValue * (1 + selectedSpecies.stats[(int)StatNames.Food].IncPerWildLevel * (level / 7))); // approximating the food level
            nudCurrentFood.Value = nudTotalFood.Value;
            UpdateTimeToFeedAll(enoughFood);

            //// quicktame infos
            if (foodAmountUsed.Any())
            {
                quickTamingInfos = Taming.QuickInfoOneFood(selectedSpecies, level, tamingSpeedMultiplier, tamingFoodRateMultiplier, foodControls[0].FoodName, foodControls[0].maxFood, foodControls[0].foodNameDisplay);
                // show raw meat or mejoberries as alternative (often used)
                for (int i = 1; i < usedFood.Count; i++)
                {
                    if (usedFood[i] == "Raw Meat" || usedFood[i] == "Mejoberry")
                    {
                        quickTamingInfos += "\n\n" + Taming.QuickInfoOneFood(selectedSpecies, level, tamingSpeedMultiplier, tamingFoodRateMultiplier, foodControls[i].FoodName, foodControls[i].maxFood, foodControls[i].foodNameDisplay);
                        break;
                    }
                }

                quickTamingInfos += "\n\n" + koNumbers
                                    + "\n\n" + boneDamageAdjustersImmobilization
                                    + firstFeedingWaiting
                                    + kibbleRecipe;
            }
        }
Exemple #3
0
        public static string KnockoutInfo(Species species, int level, double longneck, double crossbow, double bow, double slingshot,
                                          double club, double prod, double harpoon, double boneDamageAdjuster, out bool knockoutNeeded, out string koNumbers)
        {
            koNumbers      = string.Empty;
            knockoutNeeded = false;
            if (species?.taming != null)
            {
                //total torpor for level
                double totalTorpor = species.stats[(int)StatNames.Torpidity].BaseValue * (1 + species.stats[(int)StatNames.Torpidity].IncPerWildLevel * (level - 1));
                // torpor depletion per second for level
                double torporDeplPS = TorporDepletionPS(species.taming.torporDepletionPS0, level);

                knockoutNeeded = species.taming.violent;
                string warning = string.Empty;
                if (!knockoutNeeded)
                {
                    warning = "+++ Creature must not be knocked out for taming! +++\n\n";
                }

                // print needed tranq arrows needed to ko creature.
                // wooden club: 10 torpor
                // slingshot: 14 dmg, stone - tranq - mult: 1.75 ==> 24.5 torpor
                // Bow - arrow causes 20 dmg, tranqMultiplier are 2 + 2.5 = 4.5 ==> 90 Torpor / arrow.
                // crossbow 35 dmg * 4.5 ==> 157.5 torpor
                // longneck dart: 26 * 8.5 = 221
                // shocking tranq dart: 26*17 = 442
                // electric prod: 226

                koNumbers = (harpoon > 0 ? Math.Ceiling(totalTorpor / (306 * boneDamageAdjuster * harpoon)) + " × " + Loc.S("TranqSpearBolts") + "\n" : string.Empty)
                            + (longneck > 0 ? Math.Ceiling(totalTorpor / (442 * boneDamageAdjuster * longneck)) + " × " + Loc.S("ShockingTranqDarts") + "\n" : string.Empty)
                            + (longneck > 0 ? Math.Ceiling(totalTorpor / (221 * boneDamageAdjuster * longneck)) + " × " + Loc.S("TranqDarts") + "\n" : string.Empty)
                            + (prod > 0 ? Math.Ceiling(totalTorpor / (226 * boneDamageAdjuster * prod)) + " × " + Loc.S("ElectricProdHits") + "\n" : string.Empty)
                            + (crossbow > 0 ? Math.Ceiling(totalTorpor / (157.5 * boneDamageAdjuster * crossbow)) + " × " + Loc.S("TranqArrowsCrossBow") + "\n" : string.Empty)
                            + (bow > 0 ? Math.Ceiling(totalTorpor / (90 * boneDamageAdjuster * bow)) + " × " + Loc.S("TranqArrowsBow") + "\n" : string.Empty)
                            + (slingshot > 0 ? Math.Ceiling(totalTorpor / (24.5 * boneDamageAdjuster * slingshot)) + " × " + Loc.S("SlingshotHits") + "\n" : string.Empty)
                            + (club > 0 ? Math.Ceiling(totalTorpor / (10 * boneDamageAdjuster * club)) + " × " + Loc.S("WoodenClubHits") + "\n" : string.Empty);

                // torpor depletion per s
                string torporDepletion = string.Empty;
                if (torporDeplPS > 0)
                {
                    torporDepletion = "\n" + Loc.S("TimeUntilTorporDepleted") + ": " + Utils.DurationUntil(new TimeSpan(0, 0, (int)Math.Round(totalTorpor / torporDeplPS)))
                                      + "\n" + Loc.S("TorporDepletion") + ": " + Math.Round(torporDeplPS, 2)
                                      + " / s;\n" + Loc.S("ApproxOneNarcoberryEvery") + " " + Math.Round(7.5 / torporDeplPS + 3, 1)
                                      + " s " + Loc.S("OrOneAscerbicMushroom") + " " + Math.Round(25 / torporDeplPS + 3, 1)
                                      + " s " + Loc.S("OrOneNarcoticEvery") + " " + Math.Round(40 / torporDeplPS + 8, 1)
                                      + " s " + Loc.S("OrOneBioToxinEvery") + " " + Math.Round(80 / torporDeplPS + 16, 1) + " s";
                }

                return(warning + koNumbers + torporDepletion);
            }
            return(string.Empty);
        }