public async Task <GotchiStats> GetBaseStatsAsync(Gotchi gotchi)
        {
            GotchiStats result = new GotchiStats();

            int denominator = 0;

            GotchiType[] gotchiTypes = await Context.TypeRegistry.GetTypesAsync(gotchi);

            if (gotchiTypes.Count() > 0)
            {
                // Include the average of all types of this species.

                result.MaxHp = gotchiTypes.Sum(x => x.BaseHp);
                result.Atk   = gotchiTypes.Sum(x => x.BaseAtk);
                result.Def   = gotchiTypes.Sum(x => x.BaseDef);
                result.Spd   = gotchiTypes.Sum(x => x.BaseSpd);

                denominator += gotchiTypes.Count();
            }

            long[] ancestor_ids = await SpeciesUtils.GetAncestorIdsAsync(gotchi.SpeciesId);

            // Factor in the base stats of this species' ancestor (which will, in turn, factor in all other ancestors).

            if (ancestor_ids.Count() > 0)
            {
                GotchiStats ancestor_stats = await GetBaseStatsAsync(new Gotchi { SpeciesId = ancestor_ids.Last() });

                result.MaxHp += ancestor_stats.MaxHp;
                result.Atk   += ancestor_stats.Atk;
                result.Def   += ancestor_stats.Def;
                result.Spd   += ancestor_stats.Spd;

                denominator += 1;
            }

            // Add 20 points if this species has an ancestor (this effect will be compounded by the previous loop).

            if (ancestor_ids.Count() > 0)
            {
                result.MaxHp += 20;
                result.Atk   += 20;
                result.Def   += 20;
                result.Spd   += 20;
            }

            // Get the average of each base stat.

            denominator = Math.Max(denominator, 1);

            result.MaxHp /= denominator;
            result.Atk   /= denominator;
            result.Def   /= denominator;
            result.Spd   /= denominator;

            // Add 0.5 points for every week the gotchi has been alive.

            int age_bonus = (int)(0.5 * (gotchi.Age / 7));

            result.MaxHp += age_bonus;
            result.Atk   += age_bonus;
            result.Def   += age_bonus;
            result.Spd   += age_bonus;

            // Add or remove stats based on the species' description.
            await _calculateDescriptionBasedBaseStats(gotchi, result);

            return(result);
        }