示例#1
0
        /// <summary>
        /// Returns an evolution detail entry for the given evolution detail.
        /// </summary>
        private async Task <EvolutionDetailEntry> CreateEvolutionDetailEntry(EvolutionDetail evolutionDetail)
        {
            var item = await ItemService.Upsert(evolutionDetail.Item);

            var trigger = await EvolutionTriggerService.Upsert(evolutionDetail.Trigger);

            var heldItem = await ItemService.Upsert(evolutionDetail.HeldItem);

            var knownMove = await MoveService.Upsert(evolutionDetail.KnownMove);

            var knownMoveType = await TypeService.Upsert(evolutionDetail.KnownMoveType);

            var location = await LocationService.Upsert(evolutionDetail.Location);

            var partySpecies = await PokemonSpeciesService.Upsert(evolutionDetail.PartySpecies);

            var partyType = await TypeService.Upsert(evolutionDetail.PartyType);

            var tradeSpecies = await PokemonSpeciesService.Upsert(evolutionDetail.TradeSpecies);

            return(new EvolutionDetailEntry
            {
                Item = item?.ForEvolutionChain(),
                Trigger = trigger?.ForEvolutionChain(),
                Gender = evolutionDetail.Gender,
                HeldItem = heldItem?.ForEvolutionChain(),
                KnownMove = knownMove?.ForEvolutionChain(),
                KnownMoveType = knownMoveType?.ForEvolutionChain(),
                Location = location?.ForEvolutionChain(),
                MinLevel = evolutionDetail.MinLevel,
                MinHappiness = evolutionDetail.MinHappiness,
                MinBeauty = evolutionDetail.MinBeauty,
                MinAffection = evolutionDetail.MinAffection,
                NeedsOverworldRain = evolutionDetail.NeedsOverworldRain,
                PartySpecies = partySpecies?.ForEvolutionChain(),
                PartyType = partyType?.ForEvolutionChain(),
                RelativePhysicalStats = evolutionDetail.RelativePhysicalStats,
                TimeOfDay = !string.IsNullOrEmpty(evolutionDetail.TimeOfDay) ? evolutionDetail.TimeOfDay : null,
                TradeSpecies = tradeSpecies?.ForEvolutionChain(),
                TurnUpsideDown = evolutionDetail.TurnUpsideDown
            });
        }
示例#2
0
        /// <summary>
        /// Returns a move entry for the given move.
        /// </summary>
        protected override async Task <MoveEntry> ConvertToEntry(Move move)
        {
            var displayNames       = move.Names.Localise();
            var flavourTextEntries = await GetFlavourTextEntries(move);

            var type = await TypeService.Upsert(move.Type);

            var category = await MoveCategoryService.Upsert(move.Meta.Category);

            var damageClass = await MoveDamageClassService.Upsert(move.DamageClass);

            var target = await MoveTargetService.Upsert(move.Target);

            var machines = await GetMachines(move);

            return(new MoveEntry
            {
                Key = move.Id,
                Name = move.Name,
                DisplayNames = displayNames.ToList(),
                FlavourTextEntries = flavourTextEntries.ToList(),
                Type = new Type
                {
                    Id = type.TypeId,
                    Name = type.Name
                },
                Category = new MoveCategory
                {
                    Id = category.MoveCategoryId,
                    Name = category.Name
                },
                Power = move.Power,
                DamageClass = new MoveDamageClass
                {
                    Id = damageClass.MoveDamageClassId,
                    Name = damageClass.Name
                },
                Accuracy = move.Accuracy,
                PP = move.Pp,
                Priority = move.Priority,
                Target = new MoveTarget
                {
                    Id = target.MoveTargetId,
                    Name = target.Name
                },
                Machines = machines.ToList()
            });
        }
        /// <summary>
        /// Returns the efficacy of the Pokemon with the given ID in the version group with the
        /// given ID.
        /// </summary>
        public async Task <EfficacySet> GetTypeEfficacyByTypeId(int typeId, int versionGroupId)
        {
            var entry = await TypesService.Upsert(typeId);

            return(await TypesService.GetTypesEfficacySet(new[] { entry.TypeId }, versionGroupId));
        }