Package pokemon

Examples of pokemon.Move


        {
            f = new FileReader("./src/pokemon/moves/moves.txt");
            Scanner sc = new Scanner(f);
            String line = sc.nextLine();
            String[] split;
            Move mv;
            int power = -1;
            int accuracy = -1;
            int pP = -1;
            while (sc.hasNextLine())
            {
                if (line.contains(name))
                {
                    split = line.split("\t");

                    try
                    {
                        pP = Integer.decode(split[5]);
                        accuracy = Integer.decode(split[4]);
                        power = Integer.decode(split[3]);

                    }
                    catch (NumberFormatException e)
                    {
                        //surprise we do nothing when an exception is thrown
                        //it is unnecessary because every move has PowerPoints
                        //and if they do not have an accuracy value then we know
                        //that there is no power
                        //so we start from the back and work our way to the front
                    }
                    mv = new Move(split[0], split[1], split[2], power, accuracy, pP);
                    return mv;
                }
                else
                {
                    if (sc.hasNextLine())
View Full Code Here


public class TestMoveFactory {

  @Test
  public void testCreateMoveParsing(){
    Move testMove = MoveFactory.createMove("Absorb");
    assertEquals("Absorb", testMove.getName());
    assertEquals(Types.GRASS, testMove.getAttackType());
    assertEquals("Special", testMove.getCategory());
    assertEquals(20, testMove.getDamage());
    assertEquals(100, testMove.getAccuracy());
    assertEquals(25, testMove.getPowerPointsMax());
   
    /*
     * need to make sure that it doesnt break when
     * there is a "-" in the text file for accuracy/power
     */
    testMove = MoveFactory.createMove("Agility");
    assertEquals("Agility", testMove.getName());
        assertEquals(Types.PSYCHIC, testMove.getAttackType());
        assertEquals("Status", testMove.getCategory());
        assertEquals(-1, testMove.getDamage());
        assertEquals(-1, testMove.getAccuracy());
        assertEquals(30, testMove.getPowerPointsMax());
        /*
         * Agility  Psychic Status  -   -   30
         */
   
  }
 
View Full Code Here

TOP

Related Classes of pokemon.Move

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.