Examples of PathfinderCharacter


Examples of pathfinder.bean.unit.PathfinderCharacter

    Integer currentHp = 28;
    Integer ac = 15;
    Integer acFlat = 13;
    Integer acTouch = 12;
    Integer initMod = 2;
    PathfinderCharacter character = new PathfinderCharacter("test-name",
        totalHp, currentHp, ac, acTouch, acFlat, initMod, img.getId());

    BeanDocument doc = new BeanDocument(CampaignClient.getInstance()
        .getRootDirectory(), character.getName(),
        DocumentTypeConstant.CHARACTER, character);

    doc = addBean(doc);

    character = doc.getBean();

    assertEquals("Total hp should be same", totalHp, character.getTotalHp());
    assertEquals("Current hp should be same", currentHp,
        character.getCurrentHp());
    assertEquals("ac should be same", ac, character.getAc());
    assertEquals("ac flat footed should be same", acFlat,
        character.getAcFlatFooted());
    assertEquals("ac touch should be same", acTouch, character.getAcTouch());
    assertEquals("init modifier should be same", initMod,
        character.getInitMod());

    totalHp = totalHp - 4;
    currentHp = currentHp - 13;
    ac = ac - 1;
    acFlat = acFlat + 1;
    acTouch = acTouch - 2;
    initMod = initMod - 2;

    character.setTotalHp(totalHp);
    character.setCurrentHp(currentHp);
    character.setAc(ac);
    character.setAcFlatFooted(acFlat);
    character.setAcTouch(acTouch);
    character.setInitMod(initMod);

    sleep(300);

    assertEquals("Total hp should be same", totalHp, character.getTotalHp());
    assertEquals("Current hp should be same", currentHp,
        character.getCurrentHp());
    assertEquals("ac should be same", ac, character.getAc());
    assertEquals("ac flat footed should be same", acFlat,
        character.getAcFlatFooted());
    assertEquals("ac touch should be same", acTouch, character.getAcTouch());
    assertEquals("init modifier should be same", initMod,
        character.getInitMod());
  }
View Full Code Here

Examples of pathfinder.bean.unit.PathfinderCharacter

  public CharacterImageIconFactory() {
  }

  @Override
  public BufferedImage getImage(BeanDocument doc) {
    PathfinderCharacter bean = doc.getBean();
    BufferedImage img = bean.getCharacterImage();
    if (img != null) {
      img = ImageUtil.resizeImage(img, 50, 50);
    }
    return img;
  }
View Full Code Here

Examples of pathfinder.bean.unit.PathfinderCharacter

  @Override
  protected void mapElementChanged() {
    PathfinderCharacterElement characterElement = getMapElement();

    PathfinderCharacter character = characterElement.getCharacter();
    BufferedImage img = character.getCharacterImage();
    img = ImageUtil.resizeImage(img, 50, 50);
    lblImg.setIcon(new ImageIcon(img));

    lblName.setText(character.getName());

    panelWidth.setElementSizeAt(0, characterElement.getWidth());
    panelHeight.setElementSizeAt(0, characterElement.getHeight());

  }
View Full Code Here

Examples of pathfinder.bean.unit.PathfinderCharacter

  public static int HEIGHT_HEALTH_BAR = 10;

  protected void drawCharacter(Graphics2D g, BeanDocument doc) {
    Graphics2D g2 = (Graphics2D) g.create();

    PathfinderCharacter character = CampaignClient.getInstance().getBean(
        doc.getBeanId());

    BufferedImage background = character.getCharacterImage();

    if (background != null) {
      g2.drawImage(background, 0, 0, WIDTH, HEIGHT, null);
    } else {
      g2.fillRect(0, 0, 50, 50);
View Full Code Here

Examples of pathfinder.bean.unit.PathfinderCharacter

    Integer ac = panelAc.getAc();
    Integer acFlat = panelAc.getAcFlatFooted();
    Integer acTouch = panelAc.getAcTouch();

    PathfinderCharacter character = new PathfinderCharacter(name, hp, hp,
        ac, acTouch, acFlat, 0, image.getId());

    return character;
  }
View Full Code Here

Examples of pathfinder.bean.unit.PathfinderCharacter

    this.character.addPropertyChangeListener(this);
    characterChange();
  }

  protected void characterChange() {
    PathfinderCharacter character = CampaignClient.getInstance().getBean(
        this.character.getBeanId());
    this.textFieldName.setText(character.getName());
    // this.spinnerModInit.setValue(character.getInitModifier());

    this.spinnerHpTotal.setValue(character.getTotalHp());
    this.spinnerHpCurrent.setValue(character.getCurrentHp());

    // this.spinnerAc.setValue(character.getAc());
    // this.spinnerAcFlatFooted.setValue(character.getAcFlatFooted());
    // this.spinnerAcTouch.setValue(character.getAcTouch());

    BufferedImage img = ImageUtil.resizeImage(
        character.getCharacterImage(), 120, 120);
    this.btnIcon.setIcon(new ImageIcon(img));
  }
View Full Code Here

Examples of pathfinder.bean.unit.PathfinderCharacter

  }

  @Override
  protected void drawElement(Graphics2D g) {
    Graphics2D g2 = (Graphics2D) g.create();
    PathfinderCharacter character = getCharacter();
    BufferedImage background = character.getCharacterImage();

    Point position = getPosition();
    int x = (int) (position.getX());
    int y = (int) (position.getY());
    int width = getWidthPixels().intValue();
    int height = getHeightPixels().intValue();

    if (background != null) {
      g2.drawImage(background, x, y, width, height, null);
    } else {
      g2.fillRect(x, y, width, height);
    }

    // Draw life bar
    // add 0.5 because cast round to lower bound
    // int
    int squareCount = Math.min(1,
        (int) ((width / (getScale().getPixels())) + 0.5));

    // 5% of the character height
    int heightLife = Math.max(5 * squareCount, 5);
    int yLife = y + height - heightLife;
    int widthLife = width;

    Integer currentHp = character.getCurrentHp();
    Integer totalHp = character.getTotalHp();

    Float ratio = Math.min(1.0f, currentHp / (float) totalHp);

    damageBar.drawBar(g2, x, yLife, heightLife, widthLife, ratio);

View Full Code Here

Examples of pathfinder.bean.unit.PathfinderCharacter

  }

  @Override
  public List<IAction> getActions() {
    ArrayList<IAction> actions = new ArrayList<IAction>();
    PathfinderCharacter character = getCharacter();
    actions.add(new DoDamage(character));
    actions.add(new DoHeal(character));

    actions.add(new AddToCombatTracker(character));
    return actions;
View Full Code Here

Examples of pathfinder.bean.unit.PathfinderCharacter

    return CampaignClient.getInstance().getBean(
        characterDocument.getBeanId());
  }

  public void updateCharacterView() {
    PathfinderCharacter character = getCharacter();
    if (character != null) {
      this.healthBar.setCurrentHp(character.getCurrentHp());
      this.healthBar.setTotalHp(character.getTotalHp());

      this.textFieldAc.setText(character.getAc().toString());
      this.textFieldAcFlatFooted.setText(character.getAcFlatFooted()
          .toString());
      this.textFieldAcTouch.setText(character.getAcTouch().toString());

      this.revalidate();
      this.repaint();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.