Ejemplo n.º 1
0
  @Test
  public void testHealingItem_HighHealth_Server() {
    Statistics vals = new Statistics();
    vals = vals.copy("HP", 20);
    vals = vals.copy("Mov", 5);
    vals = vals.copy("Con", 8);
    Unit unit = new Unit("test", Class.createClass("Ike"), '-', vals, vals);
    unit.addToInventory(new HealingItem("Blarg", 15, 0, 1));
    unit.setHp(15);

    Object result = new UseCommand(0).applyServer(null, unit);

    assertEquals(20, unit.getHp());
    assertEquals(2, unit.getInventory().get(0).getUses());
    assertEquals(null, result);
  }
Ejemplo n.º 2
0
  @Test
  public void testRise_Server() {
    Statistics vals = new Statistics();
    vals = vals.copy("HP", 20);
    vals = vals.copy("Mov", 5);
    vals = vals.copy("Con", 8);
    Unit unit = new Unit("test", Class.createClass("Ike"), '-', vals, vals);
    unit.addToInventory(new RiseTome());
    unit.setHp(3);

    try {
      new UseCommand(0).applyServer(null, unit);
      fail("No exception thrown");
    } catch (IllegalStateException e) {
      // success
    }
  }
Ejemplo n.º 3
0
  @Test
  public void testHealingItem_OneUseWithWeapons_Server() {
    Statistics vals = new Statistics();
    vals = vals.copy("HP", 20);
    vals = vals.copy("Mov", 5);
    vals = vals.copy("Con", 8);
    Unit unit = new Unit("test", Class.createClass("Ike"), '-', vals, vals);
    unit.addToInventory(new HealingItem("Blarg", 15, 0, 1));
    unit.setHp(15);
    unit.getInventory().get(0).setUsesDEBUGGING(1);
    unit.addToInventory(createAxe(1));
    unit.addToInventory(createAxe(2));
    unit.addToInventory(createAxe(3));

    // assert doesn't throw anything
    Object result = new UseCommand(0).applyServer(null, unit);
    assertEquals(null, result);
  }