public static Stats GetHinderedStat(Natures nature) { if (nature == Natures.Bold || nature == Natures.Timid || nature == Natures.Modest || nature == Natures.Calm) { return(Stats.Attack); } else if (nature == Natures.Lonely || nature == Natures.Hasty || nature == Natures.Mild || nature == Natures.Gentle) { return(Stats.Defense); } else if (nature == Natures.Adamant || nature == Natures.Impish || nature == Natures.Jolly || nature == Natures.Careful) { return(Stats.SpecialAttack); } else if (nature == Natures.Naughty || nature == Natures.Lax || nature == Natures.Naive || nature == Natures.Rash) { return(Stats.SpecialDefense); } else if (nature == Natures.Brave || nature == Natures.Relaxed || nature == Natures.Quiet || nature == Natures.Sassy) { return(Stats.Speed); } else { return(Stats.None); } }
public void CreateNature(Natures nature) { using (var conn = NewConnection) { conn.Insert(nature); } }
static BasePokemon GetPokemon(PokemonData PokemonData, PlaceData Place) { BasePokemon Pokemon = new BasePokemon { Monster = PokemonData.GeneralInformation.Monster, Name = PokemonData.GeneralInformation.Name, Nature = Natures.GetRandomNature(), Level = GetLevel(Place, PokemonData), Ability = GetRandomAbility(PokemonData), isShiny = CheckForShiny(), Happiness = PokemonData.Breeding.BaseHappiness, Gender = GetRandomGender(PokemonData), TrainerInfo = new P_Trainer() { Place = Place.Place,//, //Time TrainerName = TrainerData.GetData().Name, TrainerID = TrainerData.GetData().ID }, EValues = new EffortValues(), DValues = GetGenes() }; Pokemon.Moves = GetMoveList(Pokemon); Pokemon.Experience = Experience.GetExperience(PokemonData.Breeding.LvlRate, Pokemon.Level); Pokemon.Stats = GetStats(Pokemon); ResetLiveStats(Pokemon); return(Pokemon); }
public async Task <IActionResult> PutNatures([FromRoute] int id, [FromBody] Natures natures) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != natures.Id) { return(BadRequest()); } _context.Entry(natures).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NaturesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private void GiveStatsToEvolvedForm(bool thisIsSetup, bool thisIsCaptured, GameObject thisTrainer, string thisTrainersName, string thisNickName, bool thisIsFromTrade, int thisLevel, Genders thisGender, Natures thisNature, int thisHPIV, int thisATKIV, int thisDEFIV, int thisSPATKIV, int thisSPDEFIV, int thisSPDIV, int thisHPEV, int thisATKEV, int thisDEFEV, int thisSPATKEV, int thisSPDEFEV, int thisSPDEV, List <string> ThisKnownMoves, Move thisLastMoveUsed, _Item thisEquippedItem, bool thisIsInBattle, int thisOrigin, bool thisIsShiny) { isSetup = thisIsSetup; isCaptured = thisIsCaptured; trainer = thisTrainer; trainersName = thisTrainersName; nickName = thisNickName; isFromTrade = thisIsFromTrade; level = thisLevel; gender = thisGender; nature = thisNature; hpIV = thisHPIV; atkIV = thisATKIV; defIV = thisDEFIV; spatkIV = thisSPATKIV; spdefIV = thisSPDEFIV; spdIV = thisSPDIV; hpEV = thisHPEV; atkEV = thisATKEV; defEV = thisDEFEV; spatkEV = thisSPATKEV; spdefEV = thisSPDEFEV; spdEV = thisSPDEV; KnownMovesNames = ThisKnownMoves; lastMoveUsed = thisLastMoveUsed; equippedItem = thisEquippedItem; isInBattle = thisIsInBattle; origin = thisOrigin; isShiny = thisIsShiny; }
public static NatureDto ToDto(this Natures nature) { return(new NatureDto() { Id = nature.Id, Name = nature.Name.Capitalize(), StrongStat = nature.Strong_Stat, WeakStat = nature.Weak_Stat }); }
public override bool pbAutoFightMenu(int idxPokemon) { Pokemon thispkmn = @battlers[idxPokemon]; Natures nature = thispkmn.pokemon.Nature; int randnum = Core.Rand.Next(100); int category = 0; int atkpercent = 0; int defpercent = 0; if (!thispkmn.effects.Pinch) { atkpercent = BattlePalaceUsualTable[(int)nature * 3]; defpercent = atkpercent + BattlePalaceUsualTable[(int)nature * 3 + 1]; } else { atkpercent = BattlePalacePinchTable[(int)nature * 3]; defpercent = atkpercent + BattlePalacePinchTable[(int)nature * 3 + 1]; } if (randnum < atkpercent) { category = 0; } else if (randnum < defpercent) { category = 1; } else { category = 2; } int[] moves = new int[4]; for (int i = 0; i < thispkmn.moves.Length; i++) { if (!pbCanChooseMovePartial(idxPokemon, i)) { continue; } if (pbMoveCategory(thispkmn.moves[i]) == category) { moves[moves.Length] = i; } } if (moves.Length == 0) { // No moves of selected category pbRegisterMove(idxPokemon, -2); } else { int chosenmove = moves[Core.Rand.Next(moves.Length)]; pbRegisterMove(idxPokemon, chosenmove); } return(true); }
public async Task <IActionResult> PostNatures([FromBody] Natures natures) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Natures.Add(natures); await _context.SaveChangesAsync(); return(CreatedAtAction("GetNatures", new { id = natures.Id }, natures)); }
public static StatArray CalculateStats(StatArray base_stats, StatArray ivs, StatArray evs, uint level, Natures nature) { StatArray stats = new StatArray(); stats.HP = CalculateHPStat(base_stats.HP, ivs.HP, evs.HP, level); stats.ATK = CalculateStat(Stats.Attack, base_stats.ATK, ivs.ATK, evs.ATK, level, nature); stats.DEF = CalculateStat(Stats.Defense, base_stats.DEF, ivs.DEF, evs.DEF, level, nature); stats.SP_ATK = CalculateStat(Stats.SpecialAttack, base_stats.SP_ATK, ivs.SP_ATK, evs.SP_ATK, level, nature); stats.SP_DEF = CalculateStat(Stats.SpecialDefense, base_stats.SP_DEF, ivs.SP_DEF, evs.SP_DEF, level, nature); stats.SPD = CalculateStat(Stats.Speed, base_stats.SPD, ivs.SPD, evs.SPD, level, nature); return(stats); }
public void pbPinchChange(int idxPokemon) { Pokemon thispkmn = @battlers[idxPokemon]; if (!thispkmn.effects.Pinch && thispkmn.Status != Status.SLEEP && thispkmn.HP <= (int)Math.Floor(thispkmn.TotalHP / 2f)) { Natures nature = thispkmn.pokemon.Nature; thispkmn.effects.Pinch = true; if (nature == Natures.QUIET || nature == Natures.BASHFUL || nature == Natures.NAIVE || nature == Natures.QUIRKY || nature == Natures.HARDY || nature == Natures.DOCILE || nature == Natures.SERIOUS) { pbDisplay(Game._INTL("{1} is eager for more!", thispkmn.ToString())); } if (nature == Natures.CAREFUL || nature == Natures.RASH || nature == Natures.LAX || nature == Natures.SASSY || nature == Natures.MILD || nature == Natures.TIMID) { pbDisplay(Game._INTL("{1} began growling deeply!", thispkmn.ToString())); } if (nature == Natures.GENTLE || nature == Natures.ADAMANT || nature == Natures.HASTY || nature == Natures.LONELY || nature == Natures.RELAXED || nature == Natures.NAUGHTY) { pbDisplay(Game._INTL("A glint appears in {1}'s eyes!", thispkmn.ToString(true))); } if (nature == Natures.JOLLY || nature == Natures.BOLD || nature == Natures.BRAVE || nature == Natures.CALM || nature == Natures.IMPISH || nature == Natures.MODEST) { pbDisplay(Game._INTL("{1} is getting into position!", thispkmn.ToString())); } } }
static int CalculateStat(P_Stats_All Stat, int Base, int DV, int EV, int Level, P_Nature Nature) { float Value; if (Stat == Stats[0]) { Value = ((2 * Base + DV + (EV / 4)) * Level / 100) + Level + 10; } else { Value = (((2 * Base + DV + (EV / 4)) * Level / 100) + 5) * Natures.GetValue(Nature, Stat); } return(Mathf.FloorToInt(Value)); }
/*public Nature() * { * this.Natures = getRandomNature(); * } * public Nature(Natures nature) * { * this.Natures = natures[(int)nature].Natures; * } * public Nature(Natures name, float ATK_mod, float DEF_mod, float SPA_mod, float SPD_mod, float SPE_mod) * { * this.Natures = name; * this.Stat_mod = new float[6]; * this.Stat_mod[(int)Stats.ATTACK] = ATK_mod; * this.Stat_mod[(int)Stats.DEFENSE] = DEF_mod; * this.Stat_mod[(int)Stats.SPATK] = SPA_mod; * this.Stat_mod[(int)Stats.SPDEF] = SPD_mod; * this.Stat_mod[(int)Stats.SPEED] = SPE_mod; * } * private static Nature[] natures = new Nature[] * { * new Nature(Natures.HARDY, 1, 1, 1, 1, 1), * new Nature(Natures.LONELY, 1.1f, 0.9f, 1, 1, 1), * new Nature(Natures.BRAVE, 1.1f, 1, 1, 1, 0.9f), * new Nature(Natures.ADAMANT, 1.1f, 1, 0.9f, 1, 1), * new Nature(Natures.NAUGHTY, 1.1f, 1, 1, 0.9f, 1), * new Nature(Natures.BOLD, 0.9f, 1.1f, 1, 1, 1), * new Nature(Natures.DOCILE, 1, 1, 1, 1, 1), * new Nature(Natures.RELAXED, 1, 1.1f, 1, 1, 0.9f), * new Nature(Natures.IMPISH, 1, 1.1f, 0.9f, 1, 1), * new Nature(Natures.LAX, 1, 1.1f, 1, 0.9f, 1), * new Nature(Natures.TIMID, 0.9f, 1, 1, 1, 1.1f), * new Nature(Natures.HASTY, 1, 0.9f, 1, 1, 1.1f), * new Nature(Natures.SERIOUS, 1, 1, 1, 1, 1), * new Nature(Natures.JOLLY, 1, 1, 0.9f, 1, 1.1f), * new Nature(Natures.NAIVE, 1, 1, 1, 0.9f, 1.1f), * new Nature(Natures.MODEST, 0.9f, 1, 1.1f, 1, 1), * new Nature(Natures.MILD, 1, 0.9f, 1.1f, 1, 1), * new Nature(Natures.QUIET, 1, 1, 1.1f, 1, 0.9f), * new Nature(Natures.BASHFUL, 1, 1, 1, 1, 1), * new Nature(Natures.RASH, 1, 1, 1.1f, 0.9f, 1), * new Nature(Natures.CALM, 0.9f, 1, 1, 1.1f, 1), * new Nature(Natures.GENTLE, 1, 0.9f, 1, 1.1f, 1), * new Nature(Natures.SASSY, 1, 1, 1, 1.1f, 0.9f), * new Nature(Natures.CAREFUL, 1, 1, 0.9f, 1.1f, 1), * new Nature(Natures.QUIRKY, 1, 1, 1, 1, 1) * };*/ public Nature(Natures nature, Stats increase, Stats decrease, Flavours like, Flavours dislike) { Natures = nature; Increases = increase; Decreases = decrease; Likes = like; Dislikes = dislike; this.Stat_mod = new float[6]; this.Stat_mod[(int)Stats.ATTACK] = 1; this.Stat_mod[(int)Stats.DEFENSE] = 1; this.Stat_mod[(int)Stats.SPATK] = 1; this.Stat_mod[(int)Stats.SPDEF] = 1; this.Stat_mod[(int)Stats.SPEED] = 1; this.Stat_mod[(int)increase] += .1f; this.Stat_mod[(int)decrease] -= .1f; }
public void SetupPokemonFirstTime() { System.Array natures = System.Enum.GetValues(typeof(Natures)); nature = (Natures)natures.GetValue(UnityEngine.Random.Range(0, 24)); components.hpPP.SetupFirstTime(); components.stats.SetupFirstTime(); if (components.stats.defIV == 10 && components.stats.spdIV == 10 && components.stats.spatkIV == 10) { if (components.stats.atkIV == 2 || components.stats.atkIV == 3 || components.stats.atkIV == 6 || components.stats.atkIV == 7 || components.stats.atkIV == 10 || components.stats.atkIV == 11 || components.stats.atkIV == 14 || components.stats.atkIV == 15) { shiny = true; GetComponentInChildren <SkinnedMeshRenderer>().materials = ShinyMats; } } float rand = Random.Range(0.000f, 1f); if (rand > genderRatio) { gender = Genders.FEMALE; } else if (rand <= genderRatio) { gender = Genders.MALE; } if (genderRatio == 0.00f) { gender = Genders.NONE; } lastReqEXP = Calculations.CalculateCurrentXP(level - 1, levelRate); curEXP = Calculations.CalculateCurrentXP(level, levelRate); nextReqEXP = Calculations.CalculateRequiredXP(level, levelRate); if (trainer.networkID == DarkRiftAPI.id) { SetupMoves(); } setup = true; }
public static uint CalculateStat(Stats stat, uint base_stat, uint stat_iv, uint stat_ev, uint level, Natures nature) { double nature_mod = 1; if (Nature.GetBoostedStat(nature) == stat) { nature_mod = 1.1; } else if (Nature.GetHinderedStat(nature) == stat) { nature_mod = 0.9; } uint value = (uint)(Math.Floor((double)((2 * base_stat + stat_iv + Math.Floor((double)stat_ev / 4)) * level) / 100) + 5); value = (uint)(value * nature_mod); return(value); }
public bool Equals(SmogonResponse?other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(GenerationPrefix == other.GenerationPrefix && Generations.SetEquals(other.Generations) && Pokemons.SetEquals(other.Pokemons) && Formats.SetEquals(other.Formats) && Natures.SetEquals(other.Natures) && Abilities.SetEquals(other.Abilities) && Moves.SetEquals(other.Moves) && Types.SetEquals(other.Types) && Items.SetEquals(other.Items)); }
public async Task SeedsAsync() { using (var client = new HttpClient()) { client.BaseAddress = new Uri(_apiUrl); for (int i = 1; i <= 25; i++) { var responseTask = client.GetAsync(string.Concat("nature/", i)); responseTask.Wait(); var results = responseTask.Result; if (results.IsSuccessStatusCode) { string apiResponse = await results.Content.ReadAsStringAsync(); var json = JObject.Parse(apiResponse); var name = json["name"].ToString(); StatsEnum?increasedStats = null; StatsEnum?decreasedStats = null; try { var increasedStatsString = json["increased_stat"]["name"].ToString(); if (!increasedStatsString.IsNullOrEmpty()) { increasedStats = (StatsEnum)typeof(StatsEnum).GetEnumByDescription(increasedStatsString); } var decreasedStatsString = json["decreased_stat"]["name"].ToString(); decreasedStats = (StatsEnum)typeof(StatsEnum).GetEnumByDescription(decreasedStatsString); } catch (Exception) {} Natures nature = new Natures() { Name = name, Strong_Stat = increasedStats, Weak_Stat = decreasedStats }; _repository.CreateNature(nature); } } } }
public Pokemon(Species species, uint level, uint form_id = 0, string nickname = "", Nullable <int> ability_id = null, Nullable <Genders> gender = null, Nullable <Natures> nature = null, Nullable <bool> is_shiny = null, Items.Items ball_used = Items.Items.PokeBall, Trainer ot = null, ObtainModes obtain_mode = ObtainModes.Met) { // Trainer if (ot == null) { ot = GameObject.FindObjectOfType <PlayerTrainer>(); } this.trainer_id = ot.trainer_id; this.original_trainer = ot.name; this.original_trainer_gender = ot.gender; // Form Form alt_form = Form.GetFormData(species, form_id); if (alt_form != null) { this.form_id = alt_form.form_id; } else { this.form_id = 0; } // Personal ID Creation this.personal_id = GeneratePokemonID(); this.public_id = this.personal_id & 0x0000FFFF; // Constant among species Specie specie = Specie.species[species]; this.species = species; if (alt_form != null && alt_form.types.Length > 0) { this.types = alt_form.types; } else { this.types = specie.types; } // Level and experience this.level = level; this.exp = Experience.GetLevelTotalExp(level, specie.growth_rate); // Nickname this.nickname = nickname; // Ability (determined by personal id) if (ability_id != null) { this.force_ability = ability_id; if (ability_id == 0) { if (alt_form != null && alt_form.abilities.Length > 0) { this.ability = alt_form.abilities[0]; } else { this.ability = specie.abilities[0]; } } else if (ability_id == 1) { if (alt_form != null && alt_form.abilities.Length > 1) { this.ability = alt_form.abilities[1]; } else if (specie.abilities.Length > 1) { this.ability = specie.abilities[1]; } else { this.ability = Ability.GetAbilityFromID(this.personal_id, specie.abilities); } } else if (ability_id == 2) { if (alt_form != null && alt_form.hidden_ability.Length > 0) { this.ability = alt_form.hidden_ability[0]; } else if (specie.hidden_ability.Length > 0) { this.ability = specie.hidden_ability[0]; } else { this.ability = Ability.GetAbilityFromID(this.personal_id, specie.abilities); } } else { this.ability = Ability.GetAbilityFromID(this.personal_id, specie.abilities); } } else { if (alt_form != null && alt_form.abilities.Length > 0) { this.ability = Ability.GetAbilityFromID(this.personal_id, alt_form.abilities); } else { this.ability = Ability.GetAbilityFromID(this.personal_id, specie.abilities); } } // Gender (determined by personal id) if (gender != null) { this.force_gender = (Genders)gender; if (gender == Genders.Male && specie.gender_rate != GenderRates.Genderless && specie.gender_rate != GenderRates.AlwaysFemale) { this.gender = (Genders)gender; } else if (gender == Genders.Female && specie.gender_rate != GenderRates.Genderless && specie.gender_rate != GenderRates.AlwaysMale) { this.gender = (Genders)gender; } else { this.gender = Breeding.GetGenderFromID(this.personal_id, specie.gender_rate); } } else { this.gender = Breeding.GetGenderFromID(this.personal_id, specie.gender_rate); } // Nature (determined by personal id) if (nature != null) { this.force_nature = nature; if ((int)nature >= 0 && (int)nature < 25) { this.nature = (Natures)nature; } else { this.nature = Nature.GetNatureFromID(this.personal_id); } } else { this.nature = Nature.GetNatureFromID(this.personal_id); } // Shininess (determined by personal id and trainer id) if (is_shiny != null) { this.force_shiny = is_shiny; this.is_shiny = (bool)is_shiny; } else { this.is_shiny = GetShininessFromIDs(this.personal_id, ot.trainer_id, ot.secret_id); } // IVs and EVs StatArray ivs = Stat.GenerateRandomIVs(); this.ivs = ivs; StatArray evs = new StatArray(); this.evs = evs; // Stats if (alt_form != null && alt_form.base_stats.HP > 0) { this.stats = Stat.CalculateStats(alt_form.base_stats, ivs, evs, level, this.nature); } else { this.stats = Stat.CalculateStats(specie.base_stats, ivs, evs, level, this.nature); } // Current HP this.current_HP = this.stats.HP; // Friendship if (alt_form != null && alt_form.happiness != 0 && alt_form.happiness != specie.happiness) { // TODO: If alt form has set happiness of 0 this doesn't work... // don't think this ever comes up though this.happiness = alt_form.happiness; } else { this.happiness = specie.happiness; } // Status Condition this.status = Statuses.None; this.status_parameter = 0; // Egg Steps this.egg_steps = 0; // Set Moves if (alt_form != null && alt_form.moves.Length > 0) { this.moves = Move.GeneratePokemonMoveSlots(alt_form.moves, level); } else { this.moves = Move.GeneratePokemonMoveSlots(specie.moves, level); } // Ball Used and Held Item this.ball_used = ball_used; this.held_item = Items.Items.None; this.mail = null; // Pokerus Status this.pokerus_status = 0; // Fused Pokemon this.fused_pokemon = null; // Contest Stats this.contest_stats = new ContestStatArray(); // Markings this.markings = new bool[Constants.NUM_MARKINGS]; // Ribbons this.ribbons = new bool[Ribbons.NUM_RIBBONS]; // Obtain info this.obtain_mode = obtain_mode; this.obtain_date = DateTime.Now; this.obtain_map = null; // TODO: Implement this this.obtain_level = level; this.hatched_map = null; this.obtain_text = null; // Language this.language = Languages.English; // TODO: Implement different options }
public static void Initialize(string CacheFolder = "") { if (Connector.isInitialized) { throw new Exception("PokeAPI is initialized and can only be initialized once"); //May seems a bit over kill but this is nessecery for corrent usage. } #region "Structure" Connector.Berries = new Berries(); Connector.BerryFirmnesses = new BerryFirmnesses(); Connector.BerryFlavors = new BerryFlavors(); Connector.ContestNames = new ContestNames(); Connector.ContestEffects = new ContestEffects(); Connector.SuperContestEffects = new SuperContestEffects(); Connector.EncounterMethods = new EncounterMethods(); Connector.EncounterConditions = new EncounterConditions(); Connector.EncounterConditionValues = new EncounterConditionValues(); Connector.EvolutionChains = new EvolutionChains(); Connector.EvolutionTrigger = new EvolutionTrigger(); Connector.Generations = new Generations(); Connector.Pokedexes = new Pokedexes(); Connector.Versions = new Versions(); Connector.VersionGroups = new VersionGroups(); Connector.Items = new Items(); Connector.ItemAttributes = new ItemAttributes(); Connector.ItemCategories = new ItemCategories(); Connector.ItemFlingEffects = new ItemFlingEffects(); Connector.ItemPockets = new ItemPockets(); Connector.Locations = new Locations(); Connector.LocationAreas = new LocationAreas(); Connector.PalParkAreas = new PalParkAreas(); Connector.Regions = new Regions(); Connector.Machines = new Machines(); Connector.Moves = new Moves(); Connector.MoveAilments = new MoveAilments(); Connector.MoveBattleStyles = new MoveBattleStyles(); Connector.MoveCategories = new MoveCategories(); Connector.MoveDamageClasses = new MoveDamageClasses(); Connector.MoveLearnMethods = new MoveLearnMethods(); Connector.MoveTargets = new MoveTargets(); Connector.Abilities = new Abilities(); Connector.Characteristics = new Characteristics(); Connector.EggGroups = new EggGroups(); Connector.Genders = new Genders(); Connector.GrowthRates = new GrowthRates(); Connector.Natures = new Natures(); Connector.PokeathlonStats = new PokeathlonStats(); Connector.Pokemons = new Pokemons(); Connector.PokemonColors = new PokemonColors(); Connector.PokemonForms = new PokemonForms(); Connector.PokemonHabitats = new PokemonHabitats(); Connector.PokemonShapes = new PokemonShapes(); Connector.PokemonSpecies = new PokemonSpecies(); Connector.Stats = new Stats(); Connector.Types = new Types(); Connector.Languages = new Languages(); #endregion if (CacheFolder == "") { Connector.CacheFolder = AppDomain.CurrentDomain.BaseDirectory + "pokeAPI//"; } else { if (!System.IO.Directory.Exists(CacheFolder)) { throw new Exception("Directory : " + CacheFolder + " was not found"); } Connector.CacheFolder = CacheFolder; } Cacher.Initialize(); Connector.isInitialized = true; }
private void SetupNature() { System.Array natures = System.Enum.GetValues(typeof(Natures)); nature = (Natures)natures.GetValue(UnityEngine.Random.Range(0, 24)); }