public double GetStat(PokemonStat stat) { var modification = StatModifications[stat]; if (stat == PokemonStat.Accuracy || stat == PokemonStat.Evasion) { // reverse evasion values if (stat == PokemonStat.Evasion) { modification *= -1; } return(Math.Max(3D, 3 + modification) / Math.Max(3D, 3 - modification)); } var multiplier = Math.Max(2D, 2 + modification) / Math.Max(2D, 2 - modification); switch (stat) { case PokemonStat.Attack: return(Pokemon.Attack * multiplier); case PokemonStat.Defense: return(Pokemon.Defense * multiplier); case PokemonStat.SpecialAttack: return(Pokemon.SpecialAttack * multiplier); case PokemonStat.SpecialDefense: return(Pokemon.SpecialDefense * multiplier); case PokemonStat.Speed: return(Pokemon.Speed * multiplier); } return(0); }
public static float StatRank(PokemonStat statType, Pokemon pokemon) { int statRank = pokemon.statRank[statType]; if (statRank == 0) { return(1f); } else if (statRank > 0) { if (statRank >= 6f) { return(4f); } else { return((2 + statRank) / 2f); } } else { if (statRank <= -6) { return(1f / 4f); } else { return(2f / (2f - statRank)); } } }
public static string GetDisplayString(PokemonStat stat) { switch (stat) { case PokemonStat.Attack: return("ATTACK"); case PokemonStat.Defense: return("DEFENSE"); case PokemonStat.SpecialAttack: return("SPCL.ATK"); case PokemonStat.SpecialDefense: return("SPCL.DEF"); case PokemonStat.Speed: return("SPEED"); case PokemonStat.Accuracy: return("ACCURACY"); case PokemonStat.Evasion: return("EVASION"); } return("INVALID"); }
public async Task <PokedexViewModel> GetAdditionalPokemonInfo(int id) { var apiPokemonInfo = await _pokemonApi.GetMorePokemonInfo(id); var pokemon = new PokedexViewModel { PokemonWeight = apiPokemonInfo.weight, PokemonName = apiPokemonInfo.name, PokemonId = apiPokemonInfo.id, PokemonImageUrl = apiPokemonInfo.sprites.front_default, PokemonHeight = apiPokemonInfo.height }; //var apiModel = await _pokemonApi.DetermineIfPokemonHasEvolutionChain(id); //pokemon.HaveEvolutionChain = apiModel.evolution_chain.url; //if (pokemon.HaveEvolutionChain != null) //{ // var apiChain = await _pokemonApi.GetEvolutionChain(pokemon.HaveEvolutionChain); // var pokemonEvolutionBaby = new PokemonResponse(); // pokemonEvolutionBaby.PokemonName = apiChain.chain.species.name; // var apiImageUrlCall = await _pokemonApi.GetMorePokemonInfo(pokemonEvolutionBaby.PokemonName); // pokemonEvolutionBaby.PokemonImageUrl = apiImageUrlCall.sprites.front_default; // var pokemonEvolution2 = new PokemonResponse(); // pokemonEvolution2.PokemonName = apiChain.chain.evolves_to[0].species.name; // var apiImageUrlCall2 = await _pokemonApi.GetMorePokemonInfo(pokemonEvolution2.PokemonName); // pokemonEvolution2.PokemonImageUrl = apiImageUrlCall2.sprites.front_default; // pokemon.EvolutionChain.Add(pokemonEvolutionBaby); // pokemon.EvolutionChain.Add(pokemonEvolution2); // if (apiChain.chain.evolves_to[0].evolves_to.Length != 0) // { // var pokemonEvolution3 = new PokemonResponse(); // //pokemonEvolution3.PokemonName = apiChain.chain.evolves_to[0].evolves_to[0].species.name; // var apiImageUrlCall3 = await _pokemonApi.GetMorePokemonInfo(pokemonEvolution3.PokemonName); // pokemonEvolution3.PokemonImageUrl = apiImageUrlCall3.sprites.front_default; // pokemon.EvolutionChain.Add(pokemonEvolution3); // } //} foreach (var stat in apiPokemonInfo.stats) { var pokemonStat = new PokemonStat { StatName = stat.stat.name, PointsInStat = stat.base_stat }; pokemon.PokemonStats.Add(pokemonStat); } foreach (var type in apiPokemonInfo.types) { pokemon.PokemonTypes.Add(type.type.name); } return(pokemon); }
public void Generate_WithMinMaxValue_ShouldReturnMinMaxValueMessage(PokemonStat stat, int?valueMin, int?valueMax) { var actionResponse = MakeActionResponse(stat, valueMin, valueMax); var message = _service.Generate(actionResponse); Assert.Equal($"Dratini ({stat.ToString().ToUpper()} min: {valueMin} max: {valueMax}) aggiunto alle notifiche", message); }
private static float ItemBonus(PokemonStat statType, Pokemon pokemon) { float bonus = 1f; foreach (Item item in pokemon.GetItems()) { bonus *= item.GetStatBonus(statType, pokemon); } return(bonus); }
public static int GetActualStat(int baseStat, PokemonStat statType, Pokemon pokemon) { float actualStat = (StatRank(statType, pokemon) * GetActualStat(baseStat, pokemon) * ItemBonus(statType, pokemon)); if (statType == PokemonStat.Speed && pokemon.GetCurrentStatus() == PokemonStatus.Paralysis) { actualStat /= 2; } return((int)actualStat); }
public override float GetStatBonus(PokemonStat stat, Pokemon pokemon) { if (stat == PokemonStat.Attack || stat == PokemonStat.SpecialAttack) { if (pokemon.pokemonName == PokemonName.피츄 || pokemon.pokemonName == PokemonName.피카츄) { return(2f); } } return(1f); }
public void RankUp(PokemonStat statType, int amount) { if (statType == PokemonStat.Speed) { animator.speed /= DamageCalculator.StatRank(PokemonStat.Speed, this); statRank[statType] += amount; animator.speed *= DamageCalculator.StatRank(PokemonStat.Speed, this); } else { statRank[statType] += amount; } }
public static bool CheckStatChange(BattlePokemon target, PokemonStat stat, PokemonStatChange change) { var currentStat = target.StatModifications[stat]; var statName = PokemonStatHelper.GetDisplayString(stat); if (currentStat == 6 && (change == PokemonStatChange.Increase || change == PokemonStatChange.SharpIncrease)) { Battle.ActiveBattle.UI.ShowMessageAndWait(target.GetDisplayName() + "^'s\n" + statName + " won^'t\nrise anymore!"); return(false); } else if (currentStat == -6 && (change == PokemonStatChange.Decrease || change == PokemonStatChange.SharpDecrease)) { Battle.ActiveBattle.UI.ShowMessageAndWait(target.GetDisplayName() + "^'s\n" + statName + " won^'t\ndrop anymore!"); return(false); } return(true); }
int GetStat(PokemonStat stat) { int statVal = Stats[stat]; //Stat boosts int boost = StatBoost[stat]; var boostVal = new float[] { 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f }; if (boost >= 0) { statVal = Mathf.FloorToInt(statVal * boostVal[boost]); } else { statVal = Mathf.FloorToInt(statVal * boostVal[-boost]); } return(statVal); }
public abstract float GetStatBonus(PokemonStat stat, Pokemon pokemon);