public static void updatePokemon(bool isPlayer, PokemonObject curPkmn) { GUIText myText; if (isPlayer) { BattleScreen.playerPokemon = curPkmn; curPkmn.fought = true; myText = GameObject.Find ("NameVal1").GetComponent<GUIText> (); myText.text = curPkmn.pkmnName; myText = GameObject.Find ("LevelVal1").GetComponent<GUIText> (); myText.text = curPkmn.level.ToString (); myText = GameObject.Find ("HPVal1").GetComponent<GUIText> (); myText.text = curPkmn.curHp.ToString () + '/' + curPkmn.totHp.ToString(); } else { BattleScreen.opponentPokemon = curPkmn; myText = GameObject.Find ("NameVal2").GetComponent<GUIText>(); myText.text = curPkmn.pkmnName; myText = GameObject.Find ("LevelVal2").GetComponent<GUIText>(); myText.text = curPkmn.level.ToString(); myText = GameObject.Find ("HPVal2").GetComponent<GUIText>(); myText.text = curPkmn.curHp.ToString () + '/' + curPkmn.totHp.ToString(); } }
public static void updateMoveView(int moveNum, PokemonObject curPkmn) { GUIText myText1; GUIText myText2; myText1 = GameObject.Find ("PPVal").GetComponent<GUIText>(); myText2 = GameObject.Find ("TypeVal").GetComponent<GUIText>(); switch (moveNum) { case 0: myText1.text = curPkmn.move1.curPp.ToString() + '/' + curPkmn.move1.totPp.ToString(); myText2.text = curPkmn.move1.type.ToString(); break; case 1: myText1.text = curPkmn.move2.curPp.ToString() + '/' + curPkmn.move2.totPp.ToString(); myText2.text = curPkmn.move2.type.ToString(); break; case 2: myText1.text = curPkmn.move3.curPp.ToString() + '/' + curPkmn.move3.totPp.ToString(); myText2.text = curPkmn.move3.type.ToString(); break; case 4: myText1.text = curPkmn.move4.curPp.ToString() + '/' + curPkmn.move4.totPp.ToString(); myText2.text = curPkmn.move4.type.ToString(); break; } }
private void LoadPokemons(ItemData item) { var pokemons = session.Inventory.GetPokemons().Result .Where(p => p != null && p.PokemonId > 0) .OrderByDescending(PokemonInfo.CalculatePokemonPerfection) .ThenByDescending(key => key.Cp) .OrderBy(key => key.PokemonId); List <PokemonId> list = new List <PokemonId>(); foreach (var pokemon in pokemons) { if (!list.Contains(pokemon.PokemonId)) { PokemonObject _pokemon = new PokemonObject(session, pokemon); if (_pokemon.Slashed) { continue; } list.Add(pokemon.PokemonId); Image img = ResourceHelper.SetImageSize(_pokemon.Icon, 48, 48); var Pok = new ItemBox(session, item, pokemon, img); flpPokeDex.Controls.Add(Pok); } } PokeDexForm.ActiveForm.Refresh(); }
void Start() { po = gameObject.GetComponent <PokemonObject>(); bh = FindObjectOfType <BattleHandler>(); foreach (Transform child in transform) { if (child.tag == "Pokemon Sprite") { sr = child.GetComponent <SpriteRenderer>(); } } /* * UI */ //Text Business displayName.text = po.species.pokemonName; displayNameShadow.text = po.species.pokemonName; displayTotalHP.text = po.statCalc[0].ToString(); displayTotalHPShadow.text = po.statCalc[0].ToString(); displayLevel.text = po.level.ToString(); displayLevelShadow.text = po.level.ToString(); transform.localPosition = new Vector3(-0.64f, -0.41f, 0); sr.sprite = Sprite.Create(po.species.backSprite, new Rect(0, 0, po.species.backSprite.width, po.species.backSprite.height), new Vector2(0.5f, 0.5f)); }
public int totalSelectableMoves; //Helps with automated move selection void Start() { eo = gameObject.GetComponent <PokemonObject>(); bh = FindObjectOfType <BattleHandler>(); foreach (Transform child in transform) { if (child.tag == "Pokemon Sprite") { sr = child.GetComponent <SpriteRenderer>(); } } //Text business displayName.text = eo.species.pokemonName; displayNameShadow.text = eo.species.pokemonName; displayLevel.text = eo.level.ToString(); displayLevelShadow.text = eo.level.ToString(); transform.localPosition = new Vector3(0.62f, 0.06f, 0); sr.sprite = Sprite.Create(eo.species.frontSprite, new Rect(0, 0, eo.species.frontSprite.width, eo.species.frontSprite.height), new Vector2(0.5f, 0.5f)); for (int i = 0; i < eo.moves.Length; i++) { if (eo.moves[i] != null) { totalSelectableMoves++; } } }
public PokemonPropertiesForm(ISession session, PokemonObject pokemon) { InitializeComponent(); pbPokemon.Image = ResourceHelper.SetImageSize(pokemon.Icon, pbPokemon.Size.Height, pbPokemon.Size.Width); var pokName = string.IsNullOrEmpty(pokemon.Nickname) ? session.Translation.GetPokemonTranslation(pokemon.PokemonId) : pokemon.Nickname; lbName.Text = $"{pokName} Level: {pokemon.GetLv}"; Text = $"Properties of {lbName.Text}"; lbTypes.Text = $"Types\n\r {pokemon.Types}"; lbSex.Text = $"Sex: {pokemon.Sex}"; lbShiny.Text = pokemon.Shiny ? "Shiny: Yes" : "Shiny: No"; lbMove1.Text = $"{session.Translation.GetTranslation(TranslationString.DisplayHighestMove1Header)}\n\r {pokemon.Move1}"; lbMove2.Text = $"{session.Translation.GetTranslation(TranslationString.DisplayHighestMove2Header)}\n\r {pokemon.Move2}"; lbHP.Text = $"HP: {pokemon.HP}/{pokemon.MaxHP}"; lbCp.Text = $"CP: {pokemon.Cp}"; lbIV.Text = $"IV: {pokemon.GetIV * 100}%"; lbCaughtloc.Text = $"Caught Location: {pokemon.CaughtLocation}"; lbCountry.Text = $"Country: {pokemon.GeoLocation}"; lbStamina.Text = $"Stamina: {pokemon.IndividualStamina}"; lbAtk.Text = $"Attack: {pokemon.IndividualAttack}"; lbDefense.Text = $"Defense: {pokemon.IndividualDefense}"; lbCandy.Text = $"{pokemon.Candy} candy {pokemon.FamilyId}\n\r{pokemon.CandyToEvolve} candy required to evolve"; lbCaughtTime.Text = $"Caught Time: {pokemon.CaughtTime}"; lbKg.Text = $"Weight {pokemon.WeightKg}kg"; lbHeight.Text = $"Height {pokemon.HeightM}m"; }
public void Start() { moveSel = 1; po = pokemonObject.GetComponent <PokemonObject>(); eo = enemyObject.GetComponent <PokemonObject>(); bh = FindObjectOfType <BattleHandler>(); dh = FindObjectOfType <DialogueHandler>(); for (int i = 0; i < moveButtons.Length; i++) { if (i == 0) { moveButtons[i].GetComponentInChildren <Text>().text = po.moves[i].moveName; moveButtons[i].GetComponent <Image>().sprite = po.moves[i].type.moveButtonDesel; } else { if (po.moves[i] != null) { moveButtons[i].GetComponentInChildren <Text>().text = po.moves[i].moveName; moveButtons[i].GetComponent <Image>().sprite = po.moves[1].type.moveButtonDesel; } else { moveButtons[i].GetComponentInChildren <Text>().text = " "; } } } dh.StartDialogue(encounterMessage, true, new string[] { eo.species.pokemonName }); }
//Move execution, atk - attacking pokemon; def - defending pokemon; selectedMove - the chosen move of the attacking pokemon public int CalculateDamage(PokemonObject atk, PokemonObject def, int selectedMove) { int damage; //total damage done float dmgModifier = 1; //damage modifier (type effectiveness, STAB, Item modifiers, etc.) /* * Calculation for Damage Modifier */ //Type Effectiveness if (def.species.type2 == null) { //if defending pokemon has one type dmgModifier *= atk.moves[selectedMove].type.offensives[def.species.type1.index]; } else { //if defending pokemon has two types dmgModifier *= atk.moves[selectedMove].type.offensives[def.species.type1.index] * atk.moves[selectedMove].type.offensives[def.species.type2.index]; } //STAB if (atk.species.type2 != null) { //if attacking pokemon has one type if (atk.species.type1 == atk.moves[selectedMove].type) { dmgModifier *= 1.5f; } } else { //if attacking pokemon has two types if (atk.species.type1 == atk.moves[selectedMove].type || atk.species.type2 == atk.moves[selectedMove]) { dmgModifier *= 1.5f; } } /* * Calculation for Damage */ if (atk.moves[selectedMove].hitType == moveType.PHYSICAL) { Debug.Log("Damage = ((((((2 * " + atk.level + ") / 5) + 2)" + " * " + atk.moves[selectedMove].damage + " * (" + atk.battleStats[1] + " / " + def.battleStats[2] + ")) / 50) + 2) * " + dmgModifier); damage = Mathf.RoundToInt(((((((2 * atk.level) / 5) + 2) * atk.moves[selectedMove].damage * (atk.battleStats[1] / def.battleStats[2])) / 50) + 2) * dmgModifier); return((int)damage); } else if (atk.moves[selectedMove].hitType == moveType.SPECIAL) { Debug.Log("Damage = ((((((2 * " + atk.level + ") / 5) + 2)" + " * " + atk.moves[selectedMove].damage + " * (" + atk.statCalc[3] + " / " + def.statCalc[4] + ")) / 50) + 2) * " + dmgModifier); damage = Mathf.RoundToInt(((((((2 * atk.level) / 5) + 2) * atk.moves[selectedMove].damage * (atk.battleStats[3] / def.battleStats[4])) / 50) + 2) * dmgModifier); return((int)damage); } else { return(0); } }
void startBattle() { playerPokemon = Player.S.pokemon_list [0]; opponentPokemon = PokemonObject.getPokemon ("Bulbasaur"); //= getOpponentPokemon (); updatePokemon (true, playerPokemon); updatePokemon (false, opponentPokemon); }
public MainViewModel() { // Get screen width. ScreenWidth = Convert.ToInt32(App.ScreenHeight); pokemonObject = new PokemonObject(); pokemonSummaryObject = new PokemonSummaryObject(); pokemonEvolutionObject = new PokemonEvolutionObject(); }
// Start is called before the first frame update void Start() { npcDialogue = GetComponent <NPCTileDialogue>(); UpdateSprite(); homePos = transform.position; frameTimer = 2; movementDelay = Random.Range(0, 128); pokemonObject = GetComponent <PokemonObject>(); pokemonObject.onDisabled.AddListener(OnDisableNPC); }
public static void updateMoves(PokemonObject curPkmn) { GUIText myText; myText = GameObject.Find ("Move1").GetComponent<GUIText>(); myText.text = curPkmn.move1.moveName; myText = GameObject.Find ("Move2").GetComponent<GUIText>(); myText.text = curPkmn.move2.moveName; myText = GameObject.Find ("Move3").GetComponent<GUIText>(); myText.text = curPkmn.move3.moveName; myText = GameObject.Find ("Move4").GetComponent<GUIText>(); myText.text = curPkmn.move4.moveName; }
private IEnumerator DecreaseHP(int damage, PokemonObject def) { int x = (int)def.battleStats[0]; while (true) { def.battleStats[0]--; yield return(new WaitForSeconds(4 / damage)); if (def.battleStats[0] == x - damage || def.battleStats[0] <= 0) { break; } } }
void Start() { turnNumber = 1; po = playerMon.GetComponent <PokemonObject>(); eo = enemyMon.GetComponent <PokemonObject>(); buih = FindObjectOfType <BattleUIHandler>(); dh = FindObjectOfType <DialogueHandler>(); po.calculateStats(); eo.calculateStats(); Debug.Log("Battle Phase: " + (int)currentPhase); Debug.Log("Turn: " + turnNumber); }
private async void CleanUpTransferPokemon(PokemonObject pokemon, string type) { var et = pokemon.EvolveTimes; var pokemonCount = olvPokemonList.Objects .Cast <PokemonObject>() .Count(p => p.PokemonId == pokemon.PokemonId); if (pokemonCount < et) { await ReloadPokemonList(); return; } if (et == 0) { et = 1; } if (type.Equals("IV")) { var pokemons = olvPokemonList.Objects.Cast <PokemonObject>() .Where(p => p.PokemonId == pokemon.PokemonId) .Select(p => p.PokemonData) .OrderBy(p => p.Cp) .ThenBy(PokemonInfo.CalculatePokemonPerfection) .Take(pokemonCount - et); TransferPokemon(pokemons); } else if (type.Equals("CP")) { var pokemons = olvPokemonList.Objects.Cast <PokemonObject>() .Where(p => p.PokemonId == pokemon.PokemonId) .Select(p => p.PokemonData) .OrderBy(PokemonInfo.CalculatePokemonPerfection) .ThenBy(p => p.Cp) .Take(pokemonCount - et); TransferPokemon(pokemons); } }
void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("interactionobject")) { currentInterObj = other.gameObject; currentInterObjScript = currentInterObj.GetComponent <PokemonObject> (); } if (other.CompareTag("HerbeHaute")) { currentInterObj = other.gameObject; Debug.Log("Haute herbe contact"); if (Random.Range(0, 15) == 5) { EnterCombat(); } } }
private async void CleanUpEvolvePokemon(PokemonObject pokemon, string type) { var et = pokemon.EvolveTimes; if (et < 1) { await ReloadPokemonList(); return; } if (type.Equals("IV")) { var pokemons = olvPokemonList.Objects.Cast <PokemonObject>() .Where(p => p.PokemonId == pokemon.PokemonId) .Select(p => p.PokemonData) .OrderByDescending(p => p.Cp) .ThenByDescending(PokemonInfo.CalculatePokemonPerfection) .Take(et); EvolvePokemon(pokemons); } else if (type.Equals("CP")) { var pokemons = olvPokemonList.Objects.Cast <PokemonObject>() .Where(p => p.PokemonId == pokemon.PokemonId) .Select(p => p.PokemonData) .OrderByDescending(PokemonInfo.CalculatePokemonPerfection) .ThenByDescending(p => p.Cp) .Take(et); EvolvePokemon(pokemons); } }
public static void updatePokemon(bool isPlayer, PokemonObject curPkmn) { GUIText myText; if (isPlayer) { myText = GameObject.Find ("NameVal1").GetComponent<GUIText> (); myText.text = curPkmn.pkmnName; myText = GameObject.Find ("LevelVal1").GetComponent<GUIText> (); myText.text = curPkmn.level.ToString (); myText = GameObject.Find ("HPVal1").GetComponent<GUIText> (); myText.text = curPkmn.curHp.ToString () + '/' + curPkmn.totHp.ToString(); AttackMoveView.updateMoves(curPkmn); } else { myText = GameObject.Find ("NameVal2").GetComponent<GUIText>(); myText.text = curPkmn.pkmnName; myText = GameObject.Find ("LevelVal2").GetComponent<GUIText>(); myText.text = curPkmn.level.ToString(); myText = GameObject.Find ("HPVal2").GetComponent<GUIText>(); myText.text = curPkmn.curHp.ToString () + '/' + curPkmn.totHp.ToString(); } }
public NicknamePokemonForm(PokemonObject pokemon) { InitializeComponent(); txtNickname.Text = pokemon.Nickname; txtNickname.KeyDown += TxtNickname_KeyDown; }
public static PokemonObject getPokemon(string inputName) { PokemonObject pkmn = new PokemonObject (); pkmn.level = 5; pkmn.exp = 5 * 5 * 5; switch (inputName) { case "Bulbasaur": pkmn.pkmnName = "Bulbasaur"; pkmn.type1 = pkmnType.grass; pkmn.type2 = pkmnType.poision; pkmn.totHp = 45; pkmn.curHp = 45; pkmn.atk = 49; pkmn.def = 49; pkmn.spAtk = 65; pkmn.spDef = 65; pkmn.speed = 45; pkmn.move1 = AttackMove.getMove("Tackle"); pkmn.move2 = AttackMove.getMove("None"); pkmn.move3 = AttackMove.getMove("None"); pkmn.move4 = AttackMove.getMove("None"); break; case "Charmander": pkmn.pkmnName = "Charmander"; pkmn.type1 = pkmnType.fire; pkmn.type2 = pkmnType.none; pkmn.totHp = 39; pkmn.curHp = 39; pkmn.atk = 52; pkmn.def = 43; pkmn.spAtk = 60; pkmn.spDef = 50; pkmn.speed = 65; pkmn.move1 = AttackMove.getMove("Scratch"); pkmn.move2 = AttackMove.getMove("None"); pkmn.move3 = AttackMove.getMove("None"); pkmn.move4 = AttackMove.getMove("None"); break; case "Squirtle": pkmn.pkmnName = "Squirtle"; pkmn.type1 = pkmnType.water; pkmn.type2 = pkmnType.none; pkmn.totHp = 44; pkmn.curHp = 44; pkmn.atk = 48; pkmn.def = 65; pkmn.spAtk = 50; pkmn.spDef = 64; pkmn.speed = 43; pkmn.move1 = AttackMove.getMove("Tackle"); pkmn.move2 = AttackMove.getMove("None"); pkmn.move3 = AttackMove.getMove("None"); pkmn.move4 = AttackMove.getMove("None"); break; case "Pikachu": pkmn.pkmnName = "Pikachu"; pkmn.type1 = pkmnType.electric; pkmn.type2 = pkmnType.none; pkmn.totHp = 35; pkmn.curHp = 35; pkmn.atk = 55; pkmn.def = 40; pkmn.spAtk = 50; pkmn.spDef = 50; pkmn.speed = 90; pkmn.move1 = AttackMove.getMove("Thunder Shock"); pkmn.move2 = AttackMove.getMove("None"); pkmn.move3 = AttackMove.getMove("None"); pkmn.move4 = AttackMove.getMove("None"); break; } return pkmn; }
public void takeHit(AttackMove atkMove, PokemonObject attacker) { double modifier1 = 1; double modifier2 = 1; /*Dictionary<pkmnType, double> result; if (modifierTable.TryGetValue (atkMove.type, out result)) { result.TryGetValue (type1, out modifier1); result.TryGetValue (type2, out modifier2); }*/ curHp -= (int)Math.Floor((((2.0 * (attacker.level + 10.0) / 250.0) * (attacker.atk / def) * atkMove.pwr) + 2.0) * modifier1 * modifier2); }
public Pokeball_Info(int x_in, int y_in, PokemonObject place_pokemon_in) { this.x = x_in; this.y = y_in; this.place_pokemon = place_pokemon_in; }
private IEnumerator ExecuteMove(Move move, int damage, PokemonObject def, PokemonObject atk) { //Accuracy probability = move.accuracy; if (Random.Range(0, 1.01f) <= probability) { //Status Effects if (atk.currentEffect != null) { switch (atk.currentEffect.index) { //PARALYSIS case 1: if (Random.Range(0, 1.01f) < 0.25f) { success = false; Debug.Log(atk.name + " is fully paralyzed!"); } break; default: success = true; break; } } else { success = true; } } else { success = false; Debug.Log(atk.name + "'s attacked missed!"); } if (success) { yield return(StartCoroutine(DecreaseHP(damage, def))); yield return(new WaitForSeconds(0.2f)); //Status Effects if (move.effects.Length != 0) { foreach (Effect effect in move.effects) { r = Random.Range(0, 1.01f); if (r <= effect.chance) { def.currentEffect = effect.givenEffect; switch (def.currentEffect.index) { case 0: break; //PARALYSIS case 1: Mathf.RoundToInt(def.battleStats[5] = def.battleStats[5] / 2); break; } } } } //Stat Changes if (move.statChanges.Length != 0) { foreach (StatChange change in move.statChanges) { r = Random.Range(0, 1.01f); if (r <= change.chance) { switch (change.increment) { case -3: n = 5; break; case -2: n = 4; break; case -1: n = 3; break; case 1: n = 0; break; case 2: n = 1; break; case 3: n = 2; break; } switch (change.statIndex) { case 1: n2 = "attack"; break; case 2: n2 = "defense"; break; case 3: n2 = "special attack"; break; case 4: n2 = "special defense"; break; case 5: n2 = "speed"; break; } dh.StartDialogue(buih.statChange[n], true, new string[] { def.species.pokemonName, n2 }); def.statBattleModif[change.statIndex] += change.increment; def.recalculateBattleStat(change.statIndex); } } } } else { } }
void FixedUpdate() { if(!moving && !Main.S.inDialog && inScene0 && allowedToMove){ if(Input.GetKeyDown(KeyCode.A)){ //min 40 CheckForAction(); } //ARROW KEYS else if(Input.GetKey(KeyCode.RightArrow)){ moveVec = Vector3.right; direction = Direction.right; sprend.sprite = rightSprite; moving = true; } else if(Input.GetKey(KeyCode.LeftArrow)){ moveVec = Vector3.left; direction = Direction.left; sprend.sprite = leftSprite; moving = true; } else if(Input.GetKey(KeyCode.UpArrow)){ moveVec = Vector3.up; direction = Direction.up; sprend.sprite = upSprite; moving = true; } else if(Input.GetKey(KeyCode.DownArrow)){ moveVec = Vector3.down; direction = Direction.down; sprend.sprite = downSprite; moving = true; } else{ moveVec = Vector3.zero; moving = false; } if ((S.pos.x == 68 && S.pos.y == 113) || (S.pos.x == 69 && S.pos.y == 114)){ allowedToMove = false; CheckForAction(); print("you win"); Opponent.S.gameObject.SetActive(false); } ////////////////////////////////////// //minute 25 //ray cast sends out a ray in any direction for however long //we want to see if there is an immovable object within 1 tile of dir we face //jump over ledges if(Physics.Raycast(GetRay(), out hitInfo, 1f, GetLayerMask(new string[] {"Ledge"})) && (direction == Direction.down && moving)){ transform.position += Vector3.down; } else if(Physics.Raycast(GetRay(), out hitInfo, 1f, GetLayerMask(new string[] {"Immovable", "NPC", "Lass", "Youngster", "Bug_Catcher", "Ledge"}))){ moveVec = Vector3.zero; moving = false; } targetPos = pos + moveVec; } else{ //battle if player runs into opponents pokemon for(int i = 0; i < Opponent.S.opponent_pokeball.Count; ++i){ if(Math.Abs(Opponent.S.opponent_pokeball[i].x - transform.position.x) < epsilon && Math.Abs(Opponent.S.opponent_pokeball[i].x - transform.position.x) < epsilon){ Main.S.playerTurn = false; engagedPokemon = Opponent.S.opponent_pokeball[i].place_pokemon; enemyNo = 7; Opponent.S.opponent_pokeball.RemoveAt(i); Application.LoadLevelAdditive ("_Scene_2"); } } if((targetPos - pos).magnitude < moveSpeed * Time.fixedDeltaTime){ pos = targetPos; //around min 17 moving = false; ++spacesMoved; } else{ pos += (targetPos - pos).normalized * moveSpeed * Time.fixedDeltaTime; } } }
public async Task GetPokemon() { try { IsBusy = true; // Var call. pokemonObject = await App.HttpWebRequest.GetPokemon(SearchFilter); // Set Pokemon name. PokemonName = MethodHelpers.FirstCharToUpper(pokemonObject.name); PokemonImage = pokemonObject.sprites.other.dream_world.front_default; //PokemonImage = result.sprites.versions.generationv.blackwhite.front_default; PokemonColor = MethodHelpers.SetColor(MethodHelpers.FirstCharToUpper(pokemonObject.types[0].type.name)); PokemonNumber = pokemonObject.id; PokemonWeight = "w: " + pokemonObject.weight; PokemonHeight = " h: " + pokemonObject.height; if (IsShiny) { PokemonImageFrontMale = pokemonObject.sprites.front_shiny; PokemonImageBackMale = pokemonObject.sprites.back_shiny; PokemonImageFrontFemale = Convert.ToString(pokemonObject.sprites.front_shiny_female); PokemonImageBackFemale = Convert.ToString(pokemonObject.sprites.back_shiny_female); } else { // Images PokemonImageFrontMale = pokemonObject.sprites.front_default; PokemonImageBackMale = pokemonObject.sprites.back_default; PokemonImageFrontFemale = Convert.ToString(pokemonObject.sprites.front_female); PokemonImageBackFemale = Convert.ToString(pokemonObject.sprites.back_female); } Type1 = MethodHelpers.SetImage(MethodHelpers.FirstCharToUpper(pokemonObject.types[0].type.name)); Type2 = pokemonObject.types.Length == 2 ? MethodHelpers.SetImage(MethodHelpers.FirstCharToUpper(pokemonObject.types[1].type.name)) : ""; Ability1 = (MethodHelpers.FirstCharToUpper(pokemonObject.abilities[0].ability.name)); Ability2 = pokemonObject.abilities.Length == 2 ? MethodHelpers.FirstCharToUpper(pokemonObject.abilities[1].ability.name) : "N/A"; Console.WriteLine(pokemonObject.id); // Call summary. pokemonSummaryObject = await App.HttpWebRequest.GetPokemonSummary(pokemonObject.id); Description = pokemonSummaryObject.flavor_text_entries[0].flavor_text; // Call Evolution. var evolutionUrl = pokemonSummaryObject.evolution_chain.url; pokemonEvolutionObject = await App.HttpWebRequest.GetPokemonEvolution(evolutionUrl); Evolution1 = App.HttpWebRequest.GetPokemonImage(pokemonEvolutionObject.chain.species.url).Result; Evolution2 = App.HttpWebRequest.GetPokemonImage(pokemonEvolutionObject.chain.evolves_to[0].species.url).Result; Evolution3 = App.HttpWebRequest.GetPokemonImage(pokemonEvolutionObject.chain.evolves_to[0].evolves_to[0].species.url).Result; if (pokemonEvolutionObject.chain.evolves_to[0].species.name != "") { Console.WriteLine("He"); } } catch (Exception ex) { throw ex; } finally { IsBusy = false; } }
void Start() { sprend = gameObject.GetComponent<SpriteRenderer>(); spacesMoved = 0; moveLim = 15; PokemonObject.start (); pokemon_list.Add(PokemonObject.getPokemon ("None")); pokemon_list.Add(PokemonObject.getPokemon ("None")); pokemon_list.Add(PokemonObject.getPokemon ("None")); pokemon_list.Add(PokemonObject.getPokemon ("None")); pokemon_list.Add(PokemonObject.getPokemon ("None")); pokemon_list.Add(PokemonObject.getPokemon ("None")); BC_pkmn = PokemonObject.getPokemon ("Caterpie"); Lass_pkmn = PokemonObject.getPokemon ("Squirtle"); Lass_pkmn.level = 3; Lass_pkmn.totHp -= 10; Lass_pkmn.curHp -= 10; Lass_pkmn.atk -= 10; Lass_pkmn.def -= 10; YS_pkmn = PokemonObject.getPokemon ("Bulbasaur"); YS_pkmn.level = 3; YS_pkmn.totHp -= 10; YS_pkmn.curHp -= 10; YS_pkmn.atk -= 10; YS_pkmn.def -= 10; wildPkmn1 = PokemonObject.getPokemon ("Caterpie"); wildPkmn2 = PokemonObject.getPokemon ("Caterpie"); itemsDictionary ["POKeBALL"] = 2; itemsDictionary["Potion"] = 2; }
private async Task ReloadPokemonList() { SetState(false); try { await _session.Inventory.RefreshCachedInventory(); var itemTemplates = await _session.Client.Download.GetItemTemplates(); var inventory = await _session.Inventory.GetCachedInventory(); var profile = await _session.Client.Player.GetPlayer(); var inventoryAppliedItems = await _session.Inventory.GetAppliedItems(); var appliedItems = inventoryAppliedItems.Where(aItems => aItems?.Item != null) .SelectMany(aItems => aItems.Item) .ToDictionary(item => item.ItemId, item => Utils.FromUnixTimeUtc(item.ExpireMs)); PokemonObject.Initilize(itemTemplates); var pokemons = inventory.InventoryDelta.InventoryItems.Select(i => i?.InventoryItemData?.PokemonData) .Where(p => p != null && p.PokemonId > 0) .OrderByDescending(PokemonInfo.CalculatePokemonPerfection) .ThenByDescending(key => key.Cp) .OrderBy(key => key.PokemonId); _families = inventory.InventoryDelta.InventoryItems .Select(i => i.InventoryItemData.Candy) .Where(p => p != null && p.FamilyId > 0) .OrderByDescending(p => p.FamilyId); var pokemonObjects = new List <PokemonObject>(); foreach (var pokemon in pokemons) { var pokemonObject = new PokemonObject(pokemon); var family = _families.First(i => (int)i.FamilyId <= (int)pokemon.PokemonId); pokemonObject.Candy = family.Candy_; pokemonObjects.Add(pokemonObject); } var prevTopItem = olvPokemonList.TopItemIndex; olvPokemonList.SetObjects(pokemonObjects); olvPokemonList.TopItemIndex = prevTopItem; var pokemoncount = inventory.InventoryDelta.InventoryItems .Select(i => i.InventoryItemData?.PokemonData) .Count(p => p != null && p.PokemonId > 0); var eggcount = inventory.InventoryDelta.InventoryItems .Select(i => i.InventoryItemData?.PokemonData) .Count(p => p != null && p.IsEgg); lblPokemonList.Text = $"{pokemoncount + eggcount} / {profile.PlayerData.MaxPokemonStorage} ({pokemoncount} pokemon, {eggcount} eggs)"; var items = inventory.InventoryDelta.InventoryItems .Select(i => i.InventoryItemData?.Item) .Where(i => i != null) .OrderBy(i => i.ItemId); var itemscount = inventory.InventoryDelta.InventoryItems .Select(i => i.InventoryItemData?.Item) .Where(i => i != null) .Sum(i => i.Count) + 1; flpItems.Controls.Clear(); foreach (var item in items) { var box = new ItemBox(item); if (appliedItems.ContainsKey(item.ItemId)) { box.expires = appliedItems[item.ItemId]; } box.ItemClick += ItemBox_ItemClick; flpItems.Controls.Add(box); } lblInventory.Text = itemscount + @" / " + profile.PlayerData.MaxItemStorage; } catch (ArgumentNullException) { Logger.Write("Please start the bot or wait until login is finished before loading Pokemon List", LogLevel.Warning); SetState(true); return; } catch (Exception ex) { Logger.Write(ex.ToString(), LogLevel.Error); } SetState(true); }
public static PokemonObject getPokemon(string inputName) { PokemonObject pkmn = new PokemonObject (); pkmn.level = 5; pkmn.exp = 5 * 5 * 5; pkmn.fought = false; pkmn.stat = pkmnStatus.OK; switch (inputName) { case "Bulbasaur": pkmn.pkmnName = "Bulbasaur"; pkmn.type1 = pkmnType.grass; pkmn.type2 = pkmnType.poision; pkmn.totHp = 45; pkmn.curHp = 45; pkmn.atk = 49; pkmn.def = 49; pkmn.spAtk = 65; pkmn.spDef = 65; pkmn.speed = 45; pkmn.move1 = AttackMove.getMove("Tackle"); pkmn.move2 = AttackMove.getMove("Scratch"); pkmn.move3 = AttackMove.getMove("None"); pkmn.move4 = AttackMove.getMove("None"); break; case "Charmander": pkmn.pkmnName = "Charmander"; pkmn.type1 = pkmnType.fire; pkmn.type2 = pkmnType.none; pkmn.totHp = 39; pkmn.curHp = 39; pkmn.atk = 52; pkmn.def = 43; pkmn.spAtk = 60; pkmn.spDef = 50; pkmn.speed = 65; pkmn.move1 = AttackMove.getMove("Scratch"); pkmn.move2 = AttackMove.getMove("Tackle"); pkmn.move3 = AttackMove.getMove("None"); pkmn.move4 = AttackMove.getMove("None"); break; case "Squirtle": pkmn.pkmnName = "Squirtle"; pkmn.type1 = pkmnType.water; pkmn.type2 = pkmnType.none; pkmn.totHp = 44; pkmn.curHp = 44; pkmn.atk = 48; pkmn.def = 65; pkmn.spAtk = 50; pkmn.spDef = 64; pkmn.speed = 43; pkmn.move1 = AttackMove.getMove("Tackle"); pkmn.move2 = AttackMove.getMove("Scratch"); pkmn.move3 = AttackMove.getMove("None"); pkmn.move4 = AttackMove.getMove("None"); break; case "Pikachu": pkmn.pkmnName = "Pikachu"; pkmn.type1 = pkmnType.electric; pkmn.type2 = pkmnType.none; pkmn.totHp = 35; pkmn.curHp = 35; pkmn.atk = 55; pkmn.def = 40; pkmn.spAtk = 50; pkmn.spDef = 50; pkmn.speed = 90; pkmn.move1 = AttackMove.getMove("Thunder Shock"); pkmn.move2 = AttackMove.getMove("Tackle"); pkmn.move3 = AttackMove.getMove("None"); pkmn.move4 = AttackMove.getMove("None"); break; case "Caterpie": pkmn.pkmnName = "Caterpie"; pkmn.type1 = pkmnType.bug; pkmn.type2 = pkmnType.none; pkmn.totHp = 30; pkmn.curHp = 30; pkmn.atk = 20; pkmn.def = 25; pkmn.spAtk = 20; pkmn.spDef = 20; pkmn.speed = 35; pkmn.move1 = AttackMove.getMove("Bug Bite"); pkmn.move2 = AttackMove.getMove("Tackle"); pkmn.move3 = AttackMove.getMove("None"); pkmn.move4 = AttackMove.getMove("None"); pkmn.level = 3; break; case "Pidgey": pkmn.pkmnName = "Pidgey"; pkmn.type1 = pkmnType.normal; pkmn.type2 = pkmnType.flying; pkmn.totHp = 35; pkmn.curHp = 35; pkmn.atk = 30; pkmn.def = 35; pkmn.spAtk = 20; pkmn.spDef = 20; pkmn.speed = 45; pkmn.move1 = AttackMove.getMove("Gust"); pkmn.move2 = AttackMove.getMove("Tackle"); pkmn.move3 = AttackMove.getMove("None"); pkmn.move4 = AttackMove.getMove("None"); pkmn.level = 3; break; default : pkmn.pkmnName = "None"; pkmn.type1 = pkmnType.none; pkmn.type2 = pkmnType.none; pkmn.totHp = 0; pkmn.curHp = 0; pkmn.atk = 0; pkmn.def = 0; pkmn.spAtk = 0; pkmn.spDef = 0; pkmn.speed = 0; pkmn.move1 = AttackMove.getMove("None"); pkmn.move2 = AttackMove.getMove("None"); pkmn.move3 = AttackMove.getMove("None"); pkmn.move4 = AttackMove.getMove("None"); break; } return pkmn; }
public void takeHit(AttackMove atkMove, PokemonObject attacker, bool isPlayer) { if (atkMove.moveName == "None") return; TurnActionViewer.S.diffmod = 1; double modifier1 = modifierTable[type1][atkMove.type]; double modifier2 = modifierTable[type2][atkMove.type]; double totmod = modifier1 * modifier2; Debug.Log ("total mod : " + totmod.ToString ()); if (totmod != 1) TurnActionViewer.S.diffmod = totmod; if (!isPlayer) TurnActionViewer.S.diffmod += 10; --atkMove.curPp; int dmg = (int)Math.Floor ((((2.0 * ((double)attacker.level+10.0)/250.0) * (double)attacker.atk/(double)def * (double)atkMove.pwr) + 2) * totmod); if ((curHp - dmg) < 0) curHp = 0; else curHp -= dmg; if (curHp <= 0 && isPlayer) { stat = pkmnStatus.FAINTED; int i; TurnActionViewer.S.activeDied = pkmnName; for (i = 0; i < 6; ++i) { if (Player.S.pokemon_list [i].curHp > 0) { BattleScreen.updatePokemon (true, Player.S.pokemon_list [i]); break; } } if (i == 6) { TurnActionViewer.S.allDied = true; Vector3 pos; pos.x = 21; pos.y = 52; pos.z = -0.01f; Player.S.inScene0 = true; Player.S.MoveThroughDoor (pos); for (int j = 0; j < 6; ++j) { Player.S.pokemon_list [j].curHp = Player.S.pokemon_list [j].totHp; Player.S.pokemon_list [j].move1.curPp = Player.S.pokemon_list [j].move1.totPp; Player.S.pokemon_list [j].move2.curPp = Player.S.pokemon_list [j].move2.totPp; Player.S.pokemon_list [j].move3.curPp = Player.S.pokemon_list [j].move3.totPp; Player.S.pokemon_list [j].move4.curPp = Player.S.pokemon_list [j].move4.totPp; Player.S.pokemon_list [j].stat = pkmnStatus.OK; } } } }
public override void OnInspectorGUI() { PokemonObject pkmn = (PokemonObject)target; GUILayout.Label("Species Info", EditorStyles.boldLabel); GUILayout.Space(5); pkmn.species = (PokemonSpecies)EditorGUILayout.ObjectField("Species: ", pkmn.species, typeof(PokemonSpecies), false); if (GUILayout.Button("Find Species")) { EditorGUIUtility.PingObject(AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GetAssetPath(pkmn.species))); } if (pkmn.species != null) { EditorGUILayout.LabelField("Species Name: ", pkmn.species.pokemonName); EditorGUILayout.LabelField("Species Dex Num: ", pkmn.species.dexnum.ToString()); EditorGUILayout.LabelField("Species Index: ", pkmn.species.index.ToString()); EditorGUILayout.LabelField("Species Height: ", pkmn.species.height.ToString()); EditorGUILayout.LabelField("Species Weight: ", pkmn.species.weight.ToString()); EditorGUILayout.LabelField("Type 1: ", pkmn.species.type1.typeName); if (pkmn.species.type2 != null) { EditorGUILayout.LabelField("Type 2: ", pkmn.species.type2.typeName); } GUILayout.BeginHorizontal(); if (GUILayout.Button("Find Type 1")) { EditorGUIUtility.PingObject(AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GetAssetPath(pkmn.species.type1))); } if (pkmn.species.type2 != null) { if (GUILayout.Button("Find Type 2")) { EditorGUIUtility.PingObject(AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GetAssetPath(pkmn.species.type2))); } } GUILayout.EndHorizontal(); GUILayout.Space(15); GUILayout.Label("Base Stats"); GUILayout.Space(5); EditorGUILayout.LabelField("HP: ", pkmn.species.statsBase[0].ToString()); EditorGUILayout.LabelField("Attack: ", pkmn.species.statsBase[1].ToString()); EditorGUILayout.LabelField("Defense: ", pkmn.species.statsBase[2].ToString()); EditorGUILayout.LabelField("Sp. Attack: ", pkmn.species.statsBase[3].ToString()); EditorGUILayout.LabelField("Sp. Defense: ", pkmn.species.statsBase[4].ToString()); EditorGUILayout.LabelField("Speed: ", pkmn.species.statsBase[5].ToString()); } /* * * POKEMON INFO * */ GUILayout.Space(15); GUILayout.Label("Pokemon Info", EditorStyles.boldLabel); GUILayout.Space(5); pkmn.level = Mathf.RoundToInt(EditorGUILayout.Slider("Level: ", pkmn.level, 1, 100)); pkmn.nat = (Nature)EditorGUILayout.ObjectField("Nature: ", pkmn.nat, typeof(Nature), false); pkmn.currentEffect = (StatusEffect)EditorGUILayout.ObjectField("Status Effect: ", pkmn.currentEffect, typeof(StatusEffect), false); for (int i = 1, y = 0; i < pkmn.nat.statModifiers.Length; i++) { switch (i) { case 1: x = "Attack"; break; case 2: x = "Defense"; break; case 3: x = "Sp. Attack"; break; case 4: x = "Sp. Defense"; break; case 5: x = "Speed"; break; } if (pkmn.nat.statModifiers[i] == 1.1f) { GUILayout.Label("Buffed Stat: " + x); } if (pkmn.nat.statModifiers[i] == 0.9f) { GUILayout.Label("Nerfed Stat: " + x); } if (pkmn.nat.statModifiers[i] == 1f) { y++; } if (y == 5) { GUILayout.Label("No Nerfed/Buffed Stats"); } } if (GUILayout.Button("Find Nature")) { EditorGUIUtility.PingObject(AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GetAssetPath(pkmn.nat))); } /* * Individual Values */ GUILayout.Space(15); GUILayout.Label("Individual Values"); GUILayout.Space(5); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("HP: ", pkmn.statsIV[0].ToString()); pkmn.statsIV[0] = EditorGUILayout.IntSlider(pkmn.statsIV[0], 0, 31); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Attack: ", pkmn.statsIV[1].ToString()); pkmn.statsIV[1] = EditorGUILayout.IntSlider(pkmn.statsIV[1], 0, 31); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Defense: ", pkmn.statsIV[2].ToString()); pkmn.statsIV[2] = EditorGUILayout.IntSlider(pkmn.statsIV[2], 0, 31); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Sp. Attack: ", pkmn.statsIV[3].ToString()); pkmn.statsIV[3] = EditorGUILayout.IntSlider(pkmn.statsIV[3], 0, 31); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Sp. Defense: ", pkmn.statsIV[4].ToString()); pkmn.statsIV[4] = EditorGUILayout.IntSlider(pkmn.statsIV[4], 0, 31); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Speed: ", pkmn.statsIV[5].ToString()); pkmn.statsIV[5] = EditorGUILayout.IntSlider(pkmn.statsIV[5], 0, 31); GUILayout.EndHorizontal(); /* * Effort Values */ GUILayout.Space(15); GUILayout.Label("Effort Values"); GUILayout.Space(5); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("HP: ", pkmn.statsEV[0].ToString()); pkmn.statsEV[0] = EditorGUILayout.IntSlider(pkmn.statsEV[0], 0, 252); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Attack: ", pkmn.statsEV[1].ToString()); pkmn.statsEV[1] = EditorGUILayout.IntSlider(pkmn.statsEV[1], 0, 252); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Defense: ", pkmn.statsEV[2].ToString()); pkmn.statsEV[2] = EditorGUILayout.IntSlider(pkmn.statsEV[2], 0, 252); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Sp. Attack: ", pkmn.statsEV[3].ToString()); pkmn.statsEV[3] = EditorGUILayout.IntSlider(pkmn.statsEV[3], 0, 252); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Sp. Defense: ", pkmn.statsEV[4].ToString()); pkmn.statsEV[4] = EditorGUILayout.IntSlider(pkmn.statsEV[4], 0, 252); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Speed: ", pkmn.statsEV[5].ToString()); pkmn.statsEV[5] = EditorGUILayout.IntSlider(pkmn.statsEV[5], 0, 252); GUILayout.EndHorizontal(); GUILayout.Label("Stat Total: " + (pkmn.statsEV[0] + pkmn.statsEV[1] + pkmn.statsEV[2] + pkmn.statsEV[3] + pkmn.statsEV[4] + pkmn.statsEV[5]).ToString()); if (pkmn.statsEV[0] + pkmn.statsEV[1] + pkmn.statsEV[2] + pkmn.statsEV[3] + pkmn.statsEV[4] + pkmn.statsEV[5] > 510) { EditorGUILayout.HelpBox("EVs exceed stat total of 510!", MessageType.Error); } /* * Calculated Stats */ GUILayout.Space(15); GUILayout.Label("Calculated Stats"); GUILayout.Space(5); if (GUILayout.Button("Calculate Stats")) { pkmn.calculateStats(); } EditorGUILayout.LabelField("HP: ", pkmn.statCalc[0].ToString()); EditorGUILayout.LabelField("Attack: ", pkmn.statCalc[1].ToString()); EditorGUILayout.LabelField("Defense: ", pkmn.statCalc[2].ToString()); EditorGUILayout.LabelField("Sp. Attack: ", pkmn.statCalc[3].ToString()); EditorGUILayout.LabelField("Sp. Defense: ", pkmn.statCalc[4].ToString()); EditorGUILayout.LabelField("Speed: ", pkmn.statCalc[5].ToString()); GUILayout.Space(15); GUILayout.Label("Moves"); GUILayout.Space(5); if (GUILayout.Button("Set PP")) { for (int i = 0; i < pkmn.moves.Length; i++) { if (pkmn.moves[i] != null) { pkmn.currentPP[i] = pkmn.moves[i].pp; } } } pkmn.moves[0] = (Move)EditorGUILayout.ObjectField("Move 1: ", pkmn.moves[0], typeof(Move), false); if (pkmn.moves[0] != null) { pkmn.currentPP[0] = EditorGUILayout.IntField("PP: ", pkmn.currentPP[0]); } pkmn.moves[1] = (Move)EditorGUILayout.ObjectField("Move 2: ", pkmn.moves[1], typeof(Move), false); if (pkmn.moves[1] != null) { pkmn.currentPP[1] = EditorGUILayout.IntField("PP: ", pkmn.currentPP[1]); } pkmn.moves[2] = (Move)EditorGUILayout.ObjectField("Move 3: ", pkmn.moves[2], typeof(Move), false); if (pkmn.moves[2] != null) { pkmn.currentPP[2] = EditorGUILayout.IntField("PP: ", pkmn.currentPP[2]); } pkmn.moves[3] = (Move)EditorGUILayout.ObjectField("Move 4: ", pkmn.moves[3], typeof(Move), false); if (pkmn.moves[3] != null) { pkmn.currentPP[3] = EditorGUILayout.IntField("PP: ", pkmn.currentPP[3]); } GUILayout.Space(15); GUILayout.Label("In-battle Values", EditorStyles.boldLabel); GUILayout.Space(5); EditorGUILayout.LabelField("HP: ", pkmn.battleStats[0].ToString()); EditorGUILayout.LabelField("Attack: ", pkmn.battleStats[1].ToString()); EditorGUILayout.LabelField("Defense: ", pkmn.battleStats[2].ToString()); EditorGUILayout.LabelField("Sp. Attack: ", pkmn.battleStats[3].ToString()); EditorGUILayout.LabelField("Sp. Defense: ", pkmn.battleStats[4].ToString()); EditorGUILayout.LabelField("Speed: ", pkmn.battleStats[5].ToString()); EditorUtility.SetDirty(pkmn); }