Package model

Examples of model.Character


 
  @Override
  public void actionPerformed(ActionEvent e) {
    //Should display all item to screen.
    //Player will click item from screen and then return the number of item.
    Character ally = map.getSelectedAlly();
    Character tradeToAlly = map.getTradeOrHealAlly();
    Trade trading = new Trade();
    trading.execute(ally, tradeToAlly);
  }
View Full Code Here


public class ItemUseTesting {

  @Test
  public void Elixir() {
    System.out.println();
    Character Greg = new Archer("Greg");
    Greg.addItem(new Elixir());
    int initialHealth = Greg.getHealth();
    System.out.println("Before: " + Greg.inventoryToString());
    Greg.useItem(0);
    int finalHealth = Greg.getHealth();
    System.out.println("After: " + Greg.inventoryToString());
    //assertTrue(finalHealth == initialHealth + 15);
    assertTrue(finalHealth == initialHealth);
  }
View Full Code Here

 
 
  @Test
  public void PowerRing() {
    System.out.println();
    Character Greg = new Archer("Greg");
    Greg.addItem(new PowerRing());
    int initialAttack = Greg.getAttack();
    System.out.println("Before: " + Greg.inventoryToString());
    Greg.useItem(0);
    int finalAttack = Greg.getAttack();
    System.out.println("After: " + Greg.inventoryToString());
    //assertTrue(finalAttack == initialAttack + 15);
    assertTrue(finalAttack == initialAttack + 5);
  }
View Full Code Here

  }
 
  @Test
  public void Boots() {
    System.out.println();
    Character Greg = new Archer("Greg");
    Greg.addItem(new Boots());
    int initialMovement = Greg.getMove();
    System.out.println("Before: " + Greg.inventoryToString());
    Greg.useItem(0);
    int finalMovement = Greg.getMove();
    System.out.println("After: " + Greg.inventoryToString());
    //assertTrue(finalMovement == initialMovement + 15);
    assertTrue(finalMovement == initialMovement + 2);
  }
View Full Code Here

  }
 
  @Test
  public void HoldingMultipleItems() {
    System.out.println();
    Character Greg = new Archer("Greg");
    Greg.addItem(new Boots());
    Greg.addItem(new PowerRing());
    Greg.addItem(new Elixir());
    Greg.addItem(new PowerRing());
    System.out.println("Holding Four Items: " + Greg.inventoryToString());
  }
View Full Code Here

public class characterTest {
 
  @Test
  public void testConstructer(){
    Character c1 = new Lorde("lorde");
    assertTrue(c1.getAttack() == 7);
    assertTrue(c1.getHealth() == 27);
    assertTrue(c1.getMove() == 5);
  }
View Full Code Here

    assertTrue(c1.getMove() == 5);
  }
 
  @Test
  public void testAttack(){
    Character c2 = new FlyingKnight("flyingknight");
    Character c3 = new Warrior("warrior");
    c2.setTarget(c3);
    c3.setTarget(c2);
    System.out.println(c2.getCurrentHealth() + " " + c3.getCurrentHealth());
    c2.attack();
    System.out.println(c2.getCurrentHealth() + " " + c3.getCurrentHealth());
    assertTrue(c3.ifAlive() == true);
    c2.attack();
    System.out.println(c2.getCurrentHealth() + " " + c3.getCurrentHealth());
    c2.attack();
    System.out.println(c2.getCurrentHealth() + " " + c3.getCurrentHealth());
    c2.attack();
    System.out.println(c2.getCurrentHealth() + " " + c3.getCurrentHealth());
    assertTrue(c3.ifAlive() == false);
    c3.setHealth(20);
  }
View Full Code Here

    c3.setHealth(20);
  }
 
  @Test
  public void testStatus(){
    Character c4 = new Mage("mage");
    Character c3 = new Warrior("warrior");
    c4.setTarget(c3);
    c3.setTarget(c4);
    System.out.println(c4.statusToString());
    assertTrue(c4.getCurrentHealth() == 21);
    c4.addItem(new Elixir());
    c3.attack();
    System.out.println(c4.statusToString());
    assertTrue(c4.getCurrentHealth() == 15);
    c4.useItem(0);
    System.out.println(c4.statusToString());
    assertTrue(c4.getCurrentHealth() == 21);
View Full Code Here

      if(nextCommand instanceof Attack) {
        if(e.getX() < 20 || e.getX() > 660 || e.getY() < 20 || e.getY() > 660) {
          JOptionPane.showMessageDialog(null, "That point is not on the map");
        }
        else {
          Character target = null;
          for(Character j: theGame.getEnemies()) {
            if((j.getPositionX() == (selectedX+1)) && (j.getPositionY() == (selectedY+1))) {
              target = j;
            }
          }
View Full Code Here

TOP

Related Classes of model.Character

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.