Package org.pokenet.server.battle

Examples of org.pokenet.server.battle.PokemonEvolution


          /* Ensure poke exists */
          if (poke == null) return false;
          PokemonSpecies pokeData = PokemonSpecies.getDefaultData().getPokemonByName(
              poke.getSpeciesName());
          for (int j = 0; j < pokeData.getEvolutions().length; j++) {
            PokemonEvolution evolution = pokeData.getEvolutions()[j];
            /*
             * Check if this pokemon evolves by item
             */
            if (evolution.getType() == EvolutionTypes.Item) {
              /*
               * Check if the item is an evolution stone If so, evolve the
               * Pokemon
               */
              if (i.getName().equalsIgnoreCase("FIRE STONE")
                  && evolution.getAttribute().equalsIgnoreCase("FIRESTONE")) {
                poke.setEvolution(evolution);
                poke.evolutionResponse(true, p);
                return true;
              } else if (i.getName().equalsIgnoreCase("WATER STONE")
                  && evolution.getAttribute().equalsIgnoreCase("WATERSTONE")) {
                poke.setEvolution(evolution);
                poke.evolutionResponse(true, p);
                return true;
              } else if (i.getName().equalsIgnoreCase("THUNDERSTONE")
                  && evolution.getAttribute().equalsIgnoreCase("THUNDERSTONE")) {
                poke.setEvolution(evolution);
                poke.evolutionResponse(true, p);
                return true;
              } else if (i.getName().equalsIgnoreCase("LEAF STONE")
                  && evolution.getAttribute().equalsIgnoreCase("LEAFSTONE")) {
                poke.setEvolution(evolution);
                poke.evolutionResponse(true, p);
                return true;
              } else if (i.getName().equalsIgnoreCase("MOON STONE")
                  && evolution.getAttribute().equalsIgnoreCase("MOONSTONE")) {
                poke.setEvolution(evolution);
                poke.evolutionResponse(true, p);
                return true;
              } else if (i.getName().equalsIgnoreCase("SUN STONE")
                  && evolution.getAttribute().equalsIgnoreCase("SUNSTONE")) {
                poke.setEvolution(evolution);
                poke.evolutionResponse(true, p);
                return true;
              } else if (i.getName().equalsIgnoreCase("SHINY STONE")
                  && evolution.getAttribute().equalsIgnoreCase("SHINYSTONE")) {
                poke.setEvolution(evolution);
                poke.evolutionResponse(true, p);
                return true;
              } else if (i.getName().equalsIgnoreCase("DUSK STONE")
                  && evolution.getAttribute().equalsIgnoreCase("DUSKSTONE")) {
                poke.setEvolution(evolution);
                poke.evolutionResponse(true, p);
                return true;
              } else if (i.getName().equalsIgnoreCase("DAWN STONE")
                  && evolution.getAttribute().equalsIgnoreCase("DAWNSTONE")) {
                poke.setEvolution(evolution);
                poke.evolutionResponse(true, p);
                return true;
              } else if (i.getName().equalsIgnoreCase("OVAL STONE")
                  && evolution.getAttribute().equalsIgnoreCase("OVALSTONE")) {
                poke.setEvolution(evolution);
                poke.evolutionResponse(true, p);
                return true;
              }
            }
View Full Code Here


          PokemonSpecies pokeData = PokemonSpecies.getDefaultData().getPokemonByName(
              p.getSpeciesName());
          boolean evolve = false;
          /* Handle evolution */
          for (int i = 0; i < pokeData.getEvolutions().length; i++) {
            PokemonEvolution evolution = pokeData.getEvolutions()[i];
            if (evolution.getType() == EvolutionTypes.Level) {
              if (evolution.getLevel() <= p.getLevel() + 1) {
                p.setEvolution(evolution);
                m_player.getTcpSession().write("PE" + index);
                evolve = true;
                i = pokeData.getEvolutions().length;
              }
            } else if (evolution.getType() == EvolutionTypes.HappinessDay) {
              if (p.getHappiness() > 220 && !TimeService.isNight()) {
                p.setEvolution(evolution);
                m_player.getTcpSession().write("PE" + index);
                evolve = true;
                i = pokeData.getEvolutions().length;
              }
            } else if (evolution.getType() == EvolutionTypes.HappinessNight) {
              if (p.getHappiness() > 220 && TimeService.isNight()) {
                p.setEvolution(evolution);
                m_player.getTcpSession().write("PE" + index);
                evolve = true;
                i = pokeData.getEvolutions().length;
              }
            } else if (evolution.getType() == EvolutionTypes.Happiness) {
              if (p.getHappiness() > 220) {
                p.setEvolution(evolution);
                m_player.getTcpSession().write("PE" + index);
                evolve = true;
                i = pokeData.getEvolutions().length;
View Full Code Here

TOP

Related Classes of org.pokenet.server.battle.PokemonEvolution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.