Package games.stendhal.server.actions.admin

Examples of games.stendhal.server.actions.admin.AlterAction


  /**
   * Tests for onAlterActionHP.
   */
  @Test
  public final void testOnAlterActionHP() {
    final AdministrationAction aa = new AlterAction();

    final Player pl = PlayerTestHelper.createPlayer("bob");
    pl.setAdminLevel(5000);
    pl.setBaseHP(100);
    pl.setHP(100);
    MockStendhalRPRuleProcessor.get().addPlayer(pl);

    final RPAction action = new RPAction();
    action.put("type", "alter");
    action.put("target", "bob");
    action.put("stat", "hp");
    action.put("mode", "");
    action.put("value", 0);
    assertEquals(100, pl.getHP());

    aa.onAction(pl, action);
    assertEquals("may not change HP to 0 ", 100, pl.getHP());

    action.put("value", 120);
    aa.onAction(pl, action);
    assertEquals("may  not change HP over base_hp", 100, pl.getHP());

    action.put("value", 90);
    aa.onAction(pl, action);
    assertEquals("may  change HP to 90 ", 90, pl.getHP());

    action.put("value", 90);
    action.put("mode", "sub");
    assertEquals("may  change HP to 90 ", 90, pl.getHP());
View Full Code Here

TOP

Related Classes of games.stendhal.server.actions.admin.AlterAction

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.